Skip to content

Commit

Permalink
feat(): added missing Exchange Link(broker) Endpoints, deprecated cer…
Browse files Browse the repository at this point in the history
…tain functions
  • Loading branch information
JJ-Cro committed Aug 23, 2024
1 parent e3d85e1 commit f91f212
Show file tree
Hide file tree
Showing 7 changed files with 367 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ node_modules/
util/config.js
coverage/
yarn-error.log
lib/*
lib/*
privaterepotracker
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "binance",
"version": "2.13.0",
"version": "2.13.1",
"description": "Node.js & JavaScript SDK for Binance REST APIs & WebSockets, with TypeScript & end-to-end tests.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
3 changes: 1 addition & 2 deletions src/coinm-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,7 @@ export class CoinMClient extends BaseRestClient {
}

/**
* possibly @deprecated
* Only in old documentation, not in new one
* @deprecated at 6th August, 2024
**/
getClassicPortfolioMarginNotionalLimits(
params?: GetClassicPortfolioMarginNotionalLimitParams,
Expand Down
141 changes: 137 additions & 4 deletions src/main-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,26 @@ import {
CollateralRecord,
DualInvestmentProduct,
UpdateIpRestrictionForSubApiKey,
GetSubAccountDepositHistoryParams,
SubAccountDepositHistory,
SubaccountBrokerSpotAssets,
QuerySubAccountSpotMarginAssetInfoParams,
SubAccountBrokerMarginAssets,
BrokerFuturesSubAccountAssets,
QuerySubAccountFuturesAssetInfoParams,
BrokerUniversalTransfer,
ChangeSubAccountCommissionParams,
ChangeSubAccountCommissionResponse,
ChangeSubAccountFuturesCommissionParams,
ChangeSubAccountFuturesCommissionResponse,
QuerySubAccountFuturesCommissionParams,
BrokerSubAccountFuturesCommission,
ChangeSubAccountCoinFuturesCommissionParams,
BrokerSubAccountCoinFuturesCommission,
QuerySubAccountCoinFuturesCommissionParams,
BrokerCommissionRebate,
QueryBrokerSpotCommissionRebateParams,
QueryBrokerFuturesCommissionRebateParams,
} from './types/spot';

import {
Expand Down Expand Up @@ -3303,6 +3323,37 @@ export class MainClient extends BaseRestClient {
return this.getPrivate('sapi/v1/broker/info');
}

updateBNBBurnSubAccount(params: {
subAccountId: string;
spotBNBBurn: 'true' | 'false';
}): Promise<{
subAccountId: string;
spotBNBBurn: boolean;
}> {
return this.postPrivate('sapi/v1/broker/subAccount/bnbBurn/spot', params);
}

updateBNBBurnSubAccountMarginInterest(params: {
subAccountId: string;
interestBNBBurn: 'true' | 'false';
}): Promise<{
subAccountId: string;
interestBNBBurn: boolean;
}> {
return this.postPrivate(
'sapi/v1/broker/subAccount/bnbBurn/marginInterest',
params,
);
}

getBNBBurnStatusSubAccount(params: { subAccountId: string }): Promise<{
subAccountId: string;
spotBNBBurn: boolean;
interestBNBBurn: boolean;
}> {
return this.getPrivate('sapi/v1/broker/subAccount/bnbBurn/status', params);
}

/**
*
* EXCHANGE LINK - Account Endpoints
Expand Down Expand Up @@ -3348,15 +3399,40 @@ export class MainClient extends BaseRestClient {
return this.getPrivate('sapi/v1/broker/transfer/futures', params);
}

universalTransferBroker(
params: UniversalTransferBrokerParams,
): Promise<BrokerSubAccount> {
getBrokerSubDepositHistory(
params: GetSubAccountDepositHistoryParams,
): Promise<SubAccountDepositHistory[]> {
return this.getPrivate('sapi/v1/broker/subAccount/depositHist', params);
}

getBrokerSubAccountSpotAssets(
params: QuerySubAccountSpotMarginAssetInfoParams,
): Promise<SubaccountBrokerSpotAssets> {
return this.getPrivate('sapi/v1/broker/subAccount/spotSummary', params);
}

getSubAccountMarginAssetInfo(
params: QuerySubAccountSpotMarginAssetInfoParams,
): Promise<SubAccountBrokerMarginAssets> {
return this.getPrivate('sapi/v1/broker/subAccount/marginSummary', params);
}

querySubAccountFuturesAssetInfo(
params: QuerySubAccountFuturesAssetInfoParams,
): Promise<BrokerFuturesSubAccountAssets> {
return this.getPrivate('sapi/v3/broker/subAccount/futuresSummary', params);
}

universalTransferBroker(params: UniversalTransferBrokerParams): Promise<{
txnId: number;
clientTranId: string;
}> {
return this.postPrivate('sapi/v1/broker/universalTransfer', params);
}

getUniversalTransferBroker(
params: GetUniversalTransferBrokerParams,
): Promise<BrokerSubAccount> {
): Promise<BrokerUniversalTransfer[]> {
return this.getPrivate('sapi/v1/broker/universalTransfer', params);
}

Expand All @@ -3366,6 +3442,63 @@ export class MainClient extends BaseRestClient {
* https://developers.binance.com/docs/binance_link
*/

updateBrokerSubAccountCommission(
params: ChangeSubAccountCommissionParams,
): Promise<ChangeSubAccountCommissionResponse> {
return this.postPrivate('sapi/v1/broker/subAccountApi/commission', params);
}

updateBrokerSubAccountFuturesCommission(
params: ChangeSubAccountFuturesCommissionParams,
): Promise<ChangeSubAccountFuturesCommissionResponse> {
return this.postPrivate(
'sapi/v1/broker/subAccountApi/commission/futures',
params,
);
}

getBrokerSubAccountFuturesCommission(
params: QuerySubAccountFuturesCommissionParams,
): Promise<BrokerSubAccountFuturesCommission[]> {
return this.getPrivate(
'sapi/v1/broker/subAccountApi/commission/futures',
params,
);
}

updateBrokerSubAccountCoinFuturesCommission(
params: ChangeSubAccountCoinFuturesCommissionParams,
): Promise<ChangeSubAccountFuturesCommissionResponse> {
return this.postPrivate(
'sapi/v1/broker/subAccountApi/commission/coinFutures',
params,
);
}

getBrokerSubAccountCoinFuturesCommission(
params: QuerySubAccountCoinFuturesCommissionParams,
): Promise<BrokerSubAccountCoinFuturesCommission[]> {
return this.getPrivate(
'sapi/v1/broker/subAccountApi/commission/coinFutures',
params,
);
}

getBrokerSpotCommissionRebate(
params: QueryBrokerSpotCommissionRebateParams,
): Promise<BrokerCommissionRebate[]> {
return this.getPrivate('sapi/v1/broker/rebate/recentRecord', params);
}

getBrokerFuturesCommissionRebate(
params: QueryBrokerFuturesCommissionRebateParams,
): Promise<BrokerCommissionRebate[]> {
return this.getPrivate(
'sapi/v1/broker/rebate/futures/recentRecord',
params,
);
}

/**
*
* @deprecated
Expand Down
Loading

0 comments on commit f91f212

Please sign in to comment.