Skip to content

Commit 53fca78

Browse files
authored
Merge pull request #939 from ccxt/leverage-method-fix
fix(client): v1/leverage method
2 parents 70adf5a + bea5647 commit 53fca78

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/node-binance-api.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4184,7 +4184,7 @@ export default class Binance {
41844184
async futuresLeverage(symbol: string, leverage: number, params: Dict = {}) {
41854185
params.symbol = symbol;
41864186
params.leverage = leverage;
4187-
return await this.privateFuturesRequest('v1/leverage', params);
4187+
return await this.privateFuturesRequest('v1/leverage', params, 'POST');
41884188
}
41894189

41904190
// ISOLATED, CROSSED
@@ -4198,15 +4198,15 @@ export default class Binance {
41984198
async futuresMarginType(symbol: string, marginType: string, params: Dict = {}) {
41994199
params.symbol = symbol;
42004200
params.marginType = marginType;
4201-
return await this.privateFuturesRequest('v1/marginType', params);
4201+
return await this.privateFuturesRequest('v1/marginType', params, 'POST');
42024202
}
42034203

42044204
// type: 1: Add postion margin,2: Reduce postion margin
42054205
async futuresPositionMargin(symbol: string, amount: number, type = 1, params: Dict = {}) {
42064206
params.symbol = symbol;
42074207
params.amount = amount;
42084208
params.type = type;
4209-
return await this.privateFuturesRequest('v1/positionMargin', params);
4209+
return await this.privateFuturesRequest('v1/positionMargin', params, 'POST');
42104210
}
42114211

42124212
async futuresPositionMarginHistory(symbol: string, params: Dict = {}) {

tests/binance-class-static.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,12 @@ describe( 'Static tests', async function () {
305305

306306
})
307307

308+
309+
it( 'futures ser leverage', async function ( ) {
310+
await binance.futuresLeverage( 'BTCUSDT', 5 )
311+
assert.isTrue( interceptedUrl.startsWith('https://fapi.binance.com/fapi/v1/leverage?symbol=BTCUSDT&leverage=5' ))
312+
})
313+
308314
it( 'delivery MarketBuy', async function ( ) {
309315
await binance.deliveryOrder( 'MARKET', 'BUY', 'BTCUSD_PERP', 0.1 )
310316
assert.isTrue( interceptedUrl.startsWith('https://dapi.binance.com/dapi/v1/order' ))

0 commit comments

Comments
 (0)