Skip to content

Commit

Permalink
feat(): moved futures transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ-Cro committed Aug 11, 2024
1 parent a4a0f5d commit bdca599
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 85 deletions.
98 changes: 98 additions & 0 deletions src/main-client-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,104 @@ export class MainClient extends BaseRestClient {
return this.getPrivate('sapi/v1/asset/custody/transfer-history', params);
}

/**
*
* Futures Management Endpoints:
* https://binance-docs.github.io/apidocs/spot/en/#futures
*
* Note: to trade futures use the usdm-client or coinm-client.
* MainClient only has the futures endpoints listed in the "spot" docs category, primarily used for transfers.
*
**/

/**
* Execute transfer between spot account and futures account.
*
* Type:
* - 1: transfer from spot account to USDT-Ⓜ futures account.
* - 2: transfer from USDT-Ⓜ futures account to spot account.
* - 3: transfer from spot account to COIN-Ⓜ futures account.
* - 4: transfer from COIN-Ⓜ futures account to spot account.
*/

/**
* Old docs only
* Use sapi/v1/asset/transfer instead
*/
submitNewFutureAccountTransfer(
params: NewFutureAccountTransferParams,
): Promise<{ tranId: number }> {
return this.postPrivate(`sapi/v1/futures/transfer`, params);
}

/**
* Old docs only
* Use sapi/v1/asset/transfer instead
*/
getFutureAccountTransferHistory(
params: GetFutureAccountTransferHistoryParams,
): Promise<RowsWithTotal<FutureAccountTransfer>> {
return this.getPrivate(`sapi/v1/futures/transfer`, params);
}

/**
* Old docs only
* Use sapi/v1/asset/transfer instead
*/
getFuturesTickLevelOrderbookDataLink(
params: GetFutureTickLevelOrderbookDataLinkParams,
): Promise<{
data: HistoricalDataLink[];
}> {
return this.getPrivate('sapi/v1/futures/histDataLink', params);
}

/**
* @deprecated as of 2023-09-25
*/
getCrossCollateralBorrowHistory(params?: CoinStartEndLimit): Promise<any> {
return this.getPrivate(`sapi/v1/futures/loan/borrow/history`, params);
}
/**
* @deprecated as of 2023-09-25
*/
getCrossCollateralRepaymentHistory(params?: CoinStartEndLimit): Promise<any> {
return this.getPrivate(`sapi/v1/futures/loan/repay/history`, params);
}
/**
* @deprecated as of 2023-09-25
*/
getCrossCollateralWalletV2(): Promise<any> {
return this.getPrivate(`sapi/v2/futures/loan/wallet`);
}
/**
* @deprecated as of 2023-09-25
*/
getAdjustCrossCollateralLTVHistory(
params?: GetLoanCoinPaginatedHistoryParams,
): Promise<any> {
return this.getPrivate(
`sapi/v1/futures/loan/adjustCollateral/history`,
params,
);
}
/**
* @deprecated as of 2023-09-25
*/
getCrossCollateralLiquidationHistory(
params?: GetLoanCoinPaginatedHistoryParams,
): Promise<any> {
return this.getPrivate(`sapi/v1/futures/loan/liquidationHistory`, params);
}
/**
* @deprecated as of 2023-09-25
*/
getCrossCollateralInterestHistory(
params?: GetLoanCoinPaginatedHistoryParams,
): Promise<any> {
return this.getPrivate(`sapi/v1/futures/loan/interestHistory`, params);
}

/**
*
* WALLET Endpoints - Account endpoints
Expand Down
86 changes: 1 addition & 85 deletions src/main-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -714,91 +714,7 @@ export class MainClient extends BaseRestClient {
);
}

/**
*
* Futures Management Endpoints:
* https://binance-docs.github.io/apidocs/spot/en/#futures
*
* Note: to trade futures use the usdm-client or coinm-client.
* MainClient only has the futures endpoints listed in the "spot" docs category, primarily used for transfers.
*
**/

/**
* Execute transfer between spot account and futures account.
*
* Type:
* - 1: transfer from spot account to USDT-Ⓜ futures account.
* - 2: transfer from USDT-Ⓜ futures account to spot account.
* - 3: transfer from spot account to COIN-Ⓜ futures account.
* - 4: transfer from COIN-Ⓜ futures account to spot account.
*/
submitNewFutureAccountTransfer(
params: NewFutureAccountTransferParams,
): Promise<{ tranId: number }> {
return this.postPrivate(`sapi/v1/futures/transfer`, params);
}

getFutureAccountTransferHistory(
params: GetFutureAccountTransferHistoryParams,
): Promise<RowsWithTotal<FutureAccountTransfer>> {
return this.getPrivate(`sapi/v1/futures/transfer`, params);
}

getFuturesTickLevelOrderbookDataLink(
params: GetFutureTickLevelOrderbookDataLinkParams,
): Promise<{
data: HistoricalDataLink[];
}> {
return this.getPrivate('sapi/v1/futures/histDataLink', params);
}

/**
* @deprecated as of 2023-09-25
*/
getCrossCollateralBorrowHistory(params?: CoinStartEndLimit): Promise<any> {
return this.getPrivate(`sapi/v1/futures/loan/borrow/history`, params);
}
/**
* @deprecated as of 2023-09-25
*/
getCrossCollateralRepaymentHistory(params?: CoinStartEndLimit): Promise<any> {
return this.getPrivate(`sapi/v1/futures/loan/repay/history`, params);
}
/**
* @deprecated as of 2023-09-25
*/
getCrossCollateralWalletV2(): Promise<any> {
return this.getPrivate(`sapi/v2/futures/loan/wallet`);
}
/**
* @deprecated as of 2023-09-25
*/
getAdjustCrossCollateralLTVHistory(
params?: GetLoanCoinPaginatedHistoryParams,
): Promise<any> {
return this.getPrivate(
`sapi/v1/futures/loan/adjustCollateral/history`,
params,
);
}
/**
* @deprecated as of 2023-09-25
*/
getCrossCollateralLiquidationHistory(
params?: GetLoanCoinPaginatedHistoryParams,
): Promise<any> {
return this.getPrivate(`sapi/v1/futures/loan/liquidationHistory`, params);
}
/**
* @deprecated as of 2023-09-25
*/
getCrossCollateralInterestHistory(
params?: GetLoanCoinPaginatedHistoryParams,
): Promise<any> {
return this.getPrivate(`sapi/v1/futures/loan/interestHistory`, params);
}


/**
*
* Portfolio Margin Pro
Expand Down

0 comments on commit bdca599

Please sign in to comment.