Skip to content

Commit 9f49f41

Browse files
authored
Merge pull request #921 from ccxt/positionRiskV2
fix(client): add positionRisk v2 as an option
2 parents 2d9ba89 + cd9ee1b commit 9f49f41

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

node-binance-api.d.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -905,9 +905,12 @@ declare module "node-binance-api" {
905905
futuresLiquidationOrders(symbol?: _symbol, params?: any): Promise<any>;
906906
futuresLiquidationOrders(...args: any): any;
907907

908-
futuresPositionRisk(params?: any): Promise<any>;
908+
futuresPositionRisk(params?: any, useV2 = false): Promise<any>;
909909
futuresPositionRisk(...args: any): any;
910910

911+
futuresPositionRiskV2(params?: any): Promise<any>;
912+
futuresPositionRiskV2(...args: any): any;
913+
911914
futuresFundingRate(symbol: _symbol, params?: any): Promise<any>;
912915
futuresFundingRate(...args: any): any;
913916

node-binance-api.js

+15-2
Original file line numberDiff line numberDiff line change
@@ -4107,8 +4107,21 @@ let api = function Binance( options = {} ) {
41074107
return promiseRequest( 'v1/allForceOrders', params, { base:fapi } );
41084108
},
41094109

4110-
futuresPositionRisk: async ( params = {} ) => {
4111-
return promiseRequest( 'v3/positionRisk', params, { base:fapi, type:'SIGNED' } );
4110+
/**
4111+
* Get the account binance lending information
4112+
* @param {function} callback - the callback function
4113+
* @param {string} symbol - position symbol, optional
4114+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Position-Information-V3
4115+
* @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Position-Information-V2
4116+
* @return {promise or undefined} - omitting the callback returns a promise
4117+
*/
4118+
futuresPositionRisk: async ( params = {}, useV2 = false ) => {
4119+
const endpoint = useV2 ? 'v2/positionRisk' : 'v3/positionRisk'
4120+
return promiseRequest( endpoint, params, { base:fapi, type:'SIGNED' } );
4121+
},
4122+
4123+
futuresPositionRiskV2: async ( params = {} ) => {
4124+
return futuresPositionRisk( params, true )
41124125
},
41134126

41144127
futuresFundingRate: async ( symbol, params = {} ) => {

0 commit comments

Comments
 (0)