Skip to content

Commit

Permalink
Merge pull request #445 from JJ-Cro/Update230824
Browse files Browse the repository at this point in the history
v2.13.1: feat(): added missing Exchange Link(broker) Endpoints, deprecated fns
  • Loading branch information
tiagosiebler authored Aug 26, 2024
2 parents e3d85e1 + ccbc166 commit 6afb837
Show file tree
Hide file tree
Showing 7 changed files with 369 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
151 changes: 147 additions & 4 deletions src/main-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,27 @@ import {
CollateralRecord,
DualInvestmentProduct,
UpdateIpRestrictionForSubApiKey,
GetSubAccountDepositHistoryParams,
QuerySubAccountSpotMarginAssetInfoParams,
QuerySubAccountFuturesAssetInfoParams,
BrokerUniversalTransfer,
ChangeSubAccountCommissionParams,
ChangeSubAccountCommissionResponse,
ChangeSubAccountFuturesCommissionParams,
ChangeSubAccountFuturesCommissionResponse,
QuerySubAccountFuturesCommissionParams,
BrokerSubAccountFuturesCommission,
ChangeSubAccountCoinFuturesCommissionParams,
BrokerSubAccountCoinFuturesCommission,
QuerySubAccountCoinFuturesCommissionParams,
BrokerCommissionRebate,
QueryBrokerSpotCommissionRebateParams,
QueryBrokerFuturesCommissionRebateParams,
UsdtMarginedFuturesResponse,
CoinMarginedFuturesResponse,
SubAccountDeposit,
SubaccountBrokerSpotAsset,
SubAccountBrokerMarginAsset,
} from './types/spot';

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

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

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

getSubAccountBNBBurnStatus(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 +3400,49 @@ export class MainClient extends BaseRestClient {
return this.getPrivate('sapi/v1/broker/transfer/futures', params);
}

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

getBrokerSubAccountSpotAssets(
params: QuerySubAccountSpotMarginAssetInfoParams,
): Promise<{
data: SubaccountBrokerSpotAsset[];
timestamp: number;
}> {
return this.getPrivate('sapi/v1/broker/subAccount/spotSummary', params);
}

getSubAccountMarginAssetInfo(
params: QuerySubAccountSpotMarginAssetInfoParams,
): Promise<{
data: SubAccountBrokerMarginAsset[];
timestamp: number;
}> {
return this.getPrivate('sapi/v1/broker/subAccount/marginSummary', params);
}

querySubAccountFuturesAssetInfo(
params: QuerySubAccountFuturesAssetInfoParams,
): Promise<{
data: (UsdtMarginedFuturesResponse | CoinMarginedFuturesResponse)[];
timestamp: number;
}> {
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 +3452,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 6afb837

Please sign in to comment.