diff --git a/.gitignore b/.gitignore index 22a7692..8a7fcd8 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ node_modules/ util/config.js coverage/ yarn-error.log -lib/* \ No newline at end of file +lib/* +privaterepotracker \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 5344f7c..7388970 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "binance", - "version": "2.13.0", + "version": "2.13.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "binance", - "version": "2.13.0", + "version": "2.13.1", "license": "MIT", "dependencies": { "axios": "^1.6.2", diff --git a/package.json b/package.json index 80d9386..e123043 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/coinm-client.ts b/src/coinm-client.ts index 06edb59..6482584 100644 --- a/src/coinm-client.ts +++ b/src/coinm-client.ts @@ -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, diff --git a/src/main-client.ts b/src/main-client.ts index b183602..ccbc03d 100644 --- a/src/main-client.ts +++ b/src/main-client.ts @@ -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 { @@ -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 @@ -3348,15 +3400,49 @@ export class MainClient extends BaseRestClient { return this.getPrivate('sapi/v1/broker/transfer/futures', params); } - universalTransferBroker( - params: UniversalTransferBrokerParams, - ): Promise { + getBrokerSubDepositHistory( + params: GetSubAccountDepositHistoryParams, + ): Promise { + 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 { + ): Promise { return this.getPrivate('sapi/v1/broker/universalTransfer', params); } @@ -3366,6 +3452,63 @@ export class MainClient extends BaseRestClient { * https://developers.binance.com/docs/binance_link */ + updateBrokerSubAccountCommission( + params: ChangeSubAccountCommissionParams, + ): Promise { + return this.postPrivate('sapi/v1/broker/subAccountApi/commission', params); + } + + updateBrokerSubAccountFuturesCommission( + params: ChangeSubAccountFuturesCommissionParams, + ): Promise { + return this.postPrivate( + 'sapi/v1/broker/subAccountApi/commission/futures', + params, + ); + } + + getBrokerSubAccountFuturesCommission( + params: QuerySubAccountFuturesCommissionParams, + ): Promise { + return this.getPrivate( + 'sapi/v1/broker/subAccountApi/commission/futures', + params, + ); + } + + updateBrokerSubAccountCoinFuturesCommission( + params: ChangeSubAccountCoinFuturesCommissionParams, + ): Promise { + return this.postPrivate( + 'sapi/v1/broker/subAccountApi/commission/coinFutures', + params, + ); + } + + getBrokerSubAccountCoinFuturesCommission( + params: QuerySubAccountCoinFuturesCommissionParams, + ): Promise { + return this.getPrivate( + 'sapi/v1/broker/subAccountApi/commission/coinFutures', + params, + ); + } + + getBrokerSpotCommissionRebate( + params: QueryBrokerSpotCommissionRebateParams, + ): Promise { + return this.getPrivate('sapi/v1/broker/rebate/recentRecord', params); + } + + getBrokerFuturesCommissionRebate( + params: QueryBrokerFuturesCommissionRebateParams, + ): Promise { + return this.getPrivate( + 'sapi/v1/broker/rebate/futures/recentRecord', + params, + ); + } + /** * * @deprecated diff --git a/src/types/spot.ts b/src/types/spot.ts index c40bee1..a258ca9 100644 --- a/src/types/spot.ts +++ b/src/types/spot.ts @@ -4916,3 +4916,206 @@ export interface SimpleEarnAccountResponse { totalLockedinBTC: string; totalLockedinUSDT: string; } + +export interface GetSubAccountDepositHistoryParams { + subAccountId?: string; + coin?: string; + status?: number; + startTime?: number; + endTime?: number; + limit?: number; + offset?: number; +} + +export interface SubAccountDeposit { + depositId: number; + subAccountId: string; + address: string; + addressTag: string; + amount: string; + coin: string; + insertTime: number; + transferType: number; + network: string; + status: number; + txId: string; + sourceAddress: string; + confirmTimes: string; + selfReturnStatus: number; +} + +// Request interface for querying sub account spot asset info +export interface QuerySubAccountSpotMarginAssetInfoParams { + subAccountId?: string; + page?: number; + size?: number; +} + +export interface SubaccountBrokerSpotAsset { + subAccountId: string; + totalBalanceOfBtc: string; +} + +export interface SubAccountBrokerMarginAsset { + marginEnable: boolean; + subAccountId: string; + totalAssetOfBtc?: string; + totalLiabilityOfBtc?: string; + totalNetAssetOfBtc?: string; + marginLevel?: string; +} + +// Request interface for querying sub account futures asset info +export interface QuerySubAccountFuturesAssetInfoParams { + subAccountId?: string; + futuresType: number; // 1: USD Margined Futures, 2: COIN Margined Futures + page?: number; + size?: number; +} + +// Response interface for querying sub account futures asset info (USD Margined Futures) +export interface UsdtMarginedFuturesResponse { + subAccountId: string; + totalInitialMargin: string; + totalMaintenanceMargin: string; + totalWalletBalance: string; + totalUnrealizedProfit: string; + totalMarginBalance: string; + totalPositionInitialMargin: string; + totalOpenOrderInitialMargin: string; + futuresEnable: boolean; + asset: string; +} + +// Response interface for querying sub account futures asset info (COIN Margined Futures) +export interface CoinMarginedFuturesResponse { + subAccountId: string; + totalWalletBalanceOfUsdt: string; + totalUnrealizedProfitOfUsdt: string; + totalMarginBalanceOfUsdt: string; + futuresEnable: boolean; +} + +// Combined response interface for querying sub account futures asset info +export interface BrokerFuturesSubAccountAssets { + data: (UsdtMarginedFuturesResponse | CoinMarginedFuturesResponse)[]; + timestamp: number; +} + +export interface BrokerUniversalTransfer { + toId: string; + asset: string; + qty: string; + time: number; + status: string; + txnId: string; + clientTranId: string; + fromAccountType: string; + toAccountType: string; +} + +// Request interface for changing sub account commission +export interface ChangeSubAccountCommissionParams { + subAccountId: string; + makerCommission: number; + takerCommission: number; + marginMakerCommission?: number; + marginTakerCommission?: number; +} + +// Response interface for changing sub account commission +export interface ChangeSubAccountCommissionResponse { + subAccountId: string; + makerCommission: number; + takerCommission: number; + marginMakerCommission: number; + marginTakerCommission: number; +} + +// Request interface for changing sub account USDT-Ⓜ futures commission adjustment +export interface ChangeSubAccountFuturesCommissionParams { + subAccountId: string; + symbol: string; + makerAdjustment: number; + takerAdjustment: number; +} + +// Response interface for changing sub account USDT-Ⓜ futures commission adjustment +export interface ChangeSubAccountFuturesCommissionResponse { + subAccountId: string; + symbol: string; + makerAdjustment: number; + takerAdjustment: number; + makerCommission: number; + takerCommission: number; +} + +// Request interface for querying sub account USDT-Ⓜ futures commission adjustment +export interface QuerySubAccountFuturesCommissionParams { + subAccountId: string; + symbol?: string; +} + +// Response interface for querying sub account USDT-Ⓜ futures commission adjustment +export interface BrokerSubAccountFuturesCommission { + subAccountId: string; + symbol: string; + makerCommission: number; + takerCommission: number; +} + +export interface ChangeSubAccountCoinFuturesCommissionParams { + subAccountId: string; + pair: string; + makerAdjustment: number; + takerAdjustment: number; + recvWindow?: number; + timestamp: number; +} + +export interface QuerySubAccountCoinFuturesCommissionParams { + subAccountId: string; + pair?: string; + recvWindow?: number; + timestamp: number; +} + +// Response interface for querying sub account COIN-Ⓜ futures commission adjustment +export interface BrokerSubAccountCoinFuturesCommission { + subAccountId: string; + pair: string; + makerCommission: number; + takerCommission: number; +} + +export interface QueryBrokerSpotCommissionRebateParams { + subAccountId?: string; + startTime?: number; + endTime?: number; + page?: number; + size?: number; + recvWindow?: number; + timestamp: number; +} + +// Response interface for querying spot commission rebate recent record +export interface BrokerCommissionRebate { + subaccountId: string; + income: string; + asset: string; + symbol: string; + tradeId: number; + time: number; + status: number; +} + +export interface QueryBrokerFuturesCommissionRebateParams { + futuresType: number; // 1: USDT Futures, 2: Coin Futures + startTime: number; + endTime: number; + page?: number; + size?: number; + filterResult?: boolean; + recvWindow?: number; + timestamp: number; +} diff --git a/src/usdm-client.ts b/src/usdm-client.ts index 3594a43..36e1027 100644 --- a/src/usdm-client.ts +++ b/src/usdm-client.ts @@ -441,6 +441,10 @@ export class USDMClient extends BaseRestClient { return this.postPrivate('fapi/v1/positionMargin', params); } + /** + * @deprecated + * Use getPositionsV3() instead + **/ getPositions(params?: Partial): Promise { return this.getPrivate('fapi/v2/positionRisk', params); } @@ -469,6 +473,10 @@ export class USDMClient extends BaseRestClient { return this.getPrivate('fapi/v3/balance'); } + /** + * @deprecated + * Use getBalanceV3() instead + **/ getBalance(): Promise { return this.getPrivate('fapi/v2/balance'); } @@ -477,6 +485,10 @@ export class USDMClient extends BaseRestClient { return this.getPrivate('fapi/v3/account'); } + /** + * @deprecated + * Use getAccountInformationV3() instead + **/ getAccountInformation(): Promise { return this.getPrivate('fapi/v2/account'); } @@ -599,7 +611,7 @@ export class USDMClient extends BaseRestClient { * Broker Futures Endpoints * Possibly @deprecated, found only in old docs * All broker endpoints start with /sapi/v1/broker or sapi/v2/broker or sapi/v3/broker - * + * **/ /**