ccxt 4.3.4 → 4.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +299 -6
- package/dist/cjs/src/binance.js +24 -17
- package/dist/cjs/src/bingx.js +45 -0
- package/dist/cjs/src/bitmex.js +24 -0
- package/dist/cjs/src/bybit.js +86 -0
- package/dist/cjs/src/coinbase.js +5 -4
- package/dist/cjs/src/coinex.js +30 -32
- package/dist/cjs/src/cryptocom.js +32 -0
- package/dist/cjs/src/htx.js +28 -0
- package/dist/cjs/src/hyperliquid.js +40 -0
- package/dist/cjs/src/kraken.js +30 -0
- package/dist/cjs/src/krakenfutures.js +28 -0
- package/dist/cjs/src/kucoin.js +53 -3
- package/dist/cjs/src/kucoinfutures.js +2 -2
- package/dist/cjs/src/okx.js +113 -0
- package/dist/cjs/src/pro/binance.js +439 -75
- package/dist/cjs/src/pro/bitget.js +1 -1
- package/dist/cjs/src/pro/woo.js +0 -1
- package/dist/cjs/src/whitebit.js +174 -2
- package/dist/cjs/src/woo.js +29 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binance.d.ts +1 -0
- package/js/src/abstract/binancecoinm.d.ts +1 -0
- package/js/src/abstract/binanceus.d.ts +1 -0
- package/js/src/abstract/binanceusdm.d.ts +1 -0
- package/js/src/abstract/bingx.d.ts +1 -0
- package/js/src/abstract/whitebit.d.ts +21 -0
- package/js/src/abstract/woo.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +52 -3
- package/js/src/base/Exchange.js +299 -6
- package/js/src/binance.d.ts +4 -0
- package/js/src/binance.js +24 -17
- package/js/src/bingx.d.ts +1 -0
- package/js/src/bingx.js +45 -0
- package/js/src/bitmex.d.ts +1 -0
- package/js/src/bitmex.js +24 -0
- package/js/src/bybit.d.ts +2 -1
- package/js/src/bybit.js +86 -0
- package/js/src/coinbase.js +5 -4
- package/js/src/coinex.js +30 -32
- package/js/src/cryptocom.d.ts +2 -1
- package/js/src/cryptocom.js +32 -0
- package/js/src/htx.d.ts +1 -0
- package/js/src/htx.js +28 -0
- package/js/src/hyperliquid.d.ts +1 -0
- package/js/src/hyperliquid.js +40 -0
- package/js/src/kraken.d.ts +1 -0
- package/js/src/kraken.js +30 -0
- package/js/src/krakenfutures.d.ts +1 -0
- package/js/src/krakenfutures.js +28 -0
- package/js/src/kucoin.d.ts +1 -0
- package/js/src/kucoin.js +53 -3
- package/js/src/kucoinfutures.js +2 -2
- package/js/src/okx.d.ts +3 -1
- package/js/src/okx.js +113 -0
- package/js/src/pro/binance.d.ts +9 -1
- package/js/src/pro/binance.js +439 -75
- package/js/src/pro/bitget.d.ts +1 -1
- package/js/src/pro/bitget.js +1 -1
- package/js/src/pro/cex.d.ts +1 -1
- package/js/src/pro/lbank.d.ts +1 -1
- package/js/src/pro/woo.js +0 -1
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
- package/js/src/whitebit.d.ts +3 -0
- package/js/src/whitebit.js +174 -2
- package/js/src/woo.d.ts +2 -1
- package/js/src/woo.js +29 -0
- package/package.json +1 -1
package/js/src/base/Exchange.js
CHANGED
|
@@ -359,35 +359,55 @@ export default class Exchange {
|
|
|
359
359
|
'cancelAllOrders': undefined,
|
|
360
360
|
'cancelAllOrdersWs': undefined,
|
|
361
361
|
'cancelOrder': true,
|
|
362
|
+
'cancelOrderWs': undefined,
|
|
362
363
|
'cancelOrders': undefined,
|
|
363
364
|
'cancelOrdersWs': undefined,
|
|
364
|
-
'cancelOrderWs': undefined,
|
|
365
365
|
'closeAllPositions': undefined,
|
|
366
366
|
'closePosition': undefined,
|
|
367
367
|
'createDepositAddress': undefined,
|
|
368
368
|
'createLimitBuyOrder': undefined,
|
|
369
|
+
'createLimitBuyOrderWs': undefined,
|
|
369
370
|
'createLimitOrder': true,
|
|
371
|
+
'createLimitOrderWs': undefined,
|
|
370
372
|
'createLimitSellOrder': undefined,
|
|
373
|
+
'createLimitSellOrderWs': undefined,
|
|
371
374
|
'createMarketBuyOrder': undefined,
|
|
375
|
+
'createMarketBuyOrderWs': undefined,
|
|
372
376
|
'createMarketBuyOrderWithCost': undefined,
|
|
377
|
+
'createMarketBuyOrderWithCostWs': undefined,
|
|
373
378
|
'createMarketOrder': true,
|
|
379
|
+
'createMarketOrderWs': true,
|
|
374
380
|
'createMarketOrderWithCost': undefined,
|
|
381
|
+
'createMarketOrderWithCostWs': undefined,
|
|
375
382
|
'createMarketSellOrder': undefined,
|
|
383
|
+
'createMarketSellOrderWs': undefined,
|
|
376
384
|
'createMarketSellOrderWithCost': undefined,
|
|
385
|
+
'createMarketSellOrderWithCostWs': undefined,
|
|
377
386
|
'createOrder': true,
|
|
387
|
+
'createOrderWs': undefined,
|
|
378
388
|
'createOrders': undefined,
|
|
379
389
|
'createOrderWithTakeProfitAndStopLoss': undefined,
|
|
380
|
-
'
|
|
390
|
+
'createOrderWithTakeProfitAndStopLossWs': undefined,
|
|
381
391
|
'createPostOnlyOrder': undefined,
|
|
392
|
+
'createPostOnlyOrderWs': undefined,
|
|
382
393
|
'createReduceOnlyOrder': undefined,
|
|
394
|
+
'createReduceOnlyOrderWs': undefined,
|
|
383
395
|
'createStopLimitOrder': undefined,
|
|
396
|
+
'createStopLimitOrderWs': undefined,
|
|
384
397
|
'createStopLossOrder': undefined,
|
|
398
|
+
'createStopLossOrderWs': undefined,
|
|
385
399
|
'createStopMarketOrder': undefined,
|
|
400
|
+
'createStopMarketOrderWs': undefined,
|
|
386
401
|
'createStopOrder': undefined,
|
|
402
|
+
'createStopOrderWs': undefined,
|
|
387
403
|
'createTakeProfitOrder': undefined,
|
|
404
|
+
'createTakeProfitOrderWs': undefined,
|
|
388
405
|
'createTrailingAmountOrder': undefined,
|
|
406
|
+
'createTrailingAmountOrderWs': undefined,
|
|
389
407
|
'createTrailingPercentOrder': undefined,
|
|
408
|
+
'createTrailingPercentOrderWs': undefined,
|
|
390
409
|
'createTriggerOrder': undefined,
|
|
410
|
+
'createTriggerOrderWs': undefined,
|
|
391
411
|
'deposit': undefined,
|
|
392
412
|
'editOrder': 'emulated',
|
|
393
413
|
'editOrderWs': undefined,
|
|
@@ -470,16 +490,20 @@ export default class Exchange {
|
|
|
470
490
|
'fetchOrderWs': undefined,
|
|
471
491
|
'fetchPermissions': undefined,
|
|
472
492
|
'fetchPosition': undefined,
|
|
493
|
+
'fetchPositionWs': undefined,
|
|
473
494
|
'fetchPositionMode': undefined,
|
|
474
495
|
'fetchPositions': undefined,
|
|
496
|
+
'fetchPositionsWs': undefined,
|
|
475
497
|
'fetchPositionsForSymbol': undefined,
|
|
498
|
+
'fetchPositionsForSymbolWs': undefined,
|
|
476
499
|
'fetchPositionsRisk': undefined,
|
|
477
500
|
'fetchPremiumIndexOHLCV': undefined,
|
|
478
501
|
'fetchSettlementHistory': undefined,
|
|
479
502
|
'fetchStatus': undefined,
|
|
480
503
|
'fetchTicker': true,
|
|
481
|
-
'fetchTickers': undefined,
|
|
482
504
|
'fetchTickerWs': undefined,
|
|
505
|
+
'fetchTickers': undefined,
|
|
506
|
+
'fetchTickersWs': undefined,
|
|
483
507
|
'fetchTime': undefined,
|
|
484
508
|
'fetchTrades': true,
|
|
485
509
|
'fetchTradesWs': undefined,
|
|
@@ -3771,6 +3795,9 @@ export default class Exchange {
|
|
|
3771
3795
|
async fetchPosition(symbol, params = {}) {
|
|
3772
3796
|
throw new NotSupported(this.id + ' fetchPosition() is not supported yet');
|
|
3773
3797
|
}
|
|
3798
|
+
async fetchPositionWs(symbol, params = {}) {
|
|
3799
|
+
throw new NotSupported(this.id + ' fetchPositionWs() is not supported yet');
|
|
3800
|
+
}
|
|
3774
3801
|
async watchPosition(symbol = undefined, params = {}) {
|
|
3775
3802
|
throw new NotSupported(this.id + ' watchPosition() is not supported yet');
|
|
3776
3803
|
}
|
|
@@ -3791,9 +3818,23 @@ export default class Exchange {
|
|
|
3791
3818
|
*/
|
|
3792
3819
|
throw new NotSupported(this.id + ' fetchPositionsForSymbol() is not supported yet');
|
|
3793
3820
|
}
|
|
3821
|
+
async fetchPositionsForSymbolWs(symbol, params = {}) {
|
|
3822
|
+
/**
|
|
3823
|
+
* @method
|
|
3824
|
+
* @name exchange#fetchPositionsForSymbol
|
|
3825
|
+
* @description fetches all open positions for specific symbol, unlike fetchPositions (which is designed to work with multiple symbols) so this method might be preffered for one-market position, because of less rate-limit consumption and speed
|
|
3826
|
+
* @param {string} symbol unified market symbol
|
|
3827
|
+
* @param {object} params extra parameters specific to the endpoint
|
|
3828
|
+
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure} with maximum 3 items - possible one position for "one-way" mode, and possible two positions (long & short) for "two-way" (a.k.a. hedge) mode
|
|
3829
|
+
*/
|
|
3830
|
+
throw new NotSupported(this.id + ' fetchPositionsForSymbol() is not supported yet');
|
|
3831
|
+
}
|
|
3794
3832
|
async fetchPositions(symbols = undefined, params = {}) {
|
|
3795
3833
|
throw new NotSupported(this.id + ' fetchPositions() is not supported yet');
|
|
3796
3834
|
}
|
|
3835
|
+
async fetchPositionsWs(symbols = undefined, params = {}) {
|
|
3836
|
+
throw new NotSupported(this.id + ' fetchPositions() is not supported yet');
|
|
3837
|
+
}
|
|
3797
3838
|
async fetchPositionsRisk(symbols = undefined, params = {}) {
|
|
3798
3839
|
throw new NotSupported(this.id + ' fetchPositionsRisk() is not supported yet');
|
|
3799
3840
|
}
|
|
@@ -4170,12 +4211,33 @@ export default class Exchange {
|
|
|
4170
4211
|
throw new NotSupported(this.id + ' fetchTicker() is not supported yet');
|
|
4171
4212
|
}
|
|
4172
4213
|
}
|
|
4214
|
+
async fetchTickerWs(symbol, params = {}) {
|
|
4215
|
+
if (this.has['fetchTickersWs']) {
|
|
4216
|
+
await this.loadMarkets();
|
|
4217
|
+
const market = this.market(symbol);
|
|
4218
|
+
symbol = market['symbol'];
|
|
4219
|
+
const tickers = await this.fetchTickerWs(symbol, params);
|
|
4220
|
+
const ticker = this.safeDict(tickers, symbol);
|
|
4221
|
+
if (ticker === undefined) {
|
|
4222
|
+
throw new NullResponse(this.id + ' fetchTickers() could not find a ticker for ' + symbol);
|
|
4223
|
+
}
|
|
4224
|
+
else {
|
|
4225
|
+
return ticker;
|
|
4226
|
+
}
|
|
4227
|
+
}
|
|
4228
|
+
else {
|
|
4229
|
+
throw new NotSupported(this.id + ' fetchTicker() is not supported yet');
|
|
4230
|
+
}
|
|
4231
|
+
}
|
|
4173
4232
|
async watchTicker(symbol, params = {}) {
|
|
4174
4233
|
throw new NotSupported(this.id + ' watchTicker() is not supported yet');
|
|
4175
4234
|
}
|
|
4176
4235
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
4177
4236
|
throw new NotSupported(this.id + ' fetchTickers() is not supported yet');
|
|
4178
4237
|
}
|
|
4238
|
+
async fetchTickersWs(symbols = undefined, params = {}) {
|
|
4239
|
+
throw new NotSupported(this.id + ' fetchTickers() is not supported yet');
|
|
4240
|
+
}
|
|
4179
4241
|
async fetchOrderBooks(symbols = undefined, limit = undefined, params = {}) {
|
|
4180
4242
|
throw new NotSupported(this.id + ' fetchOrderBooks() is not supported yet');
|
|
4181
4243
|
}
|
|
@@ -4230,6 +4292,33 @@ export default class Exchange {
|
|
|
4230
4292
|
}
|
|
4231
4293
|
throw new NotSupported(this.id + ' createTrailingAmountOrder() is not supported yet');
|
|
4232
4294
|
}
|
|
4295
|
+
async createTrailingAmountOrderWs(symbol, type, side, amount, price = undefined, trailingAmount = undefined, trailingTriggerPrice = undefined, params = {}) {
|
|
4296
|
+
/**
|
|
4297
|
+
* @method
|
|
4298
|
+
* @name createTrailingAmountOrderWs
|
|
4299
|
+
* @description create a trailing order by providing the symbol, type, side, amount, price and trailingAmount
|
|
4300
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
4301
|
+
* @param {string} type 'market' or 'limit'
|
|
4302
|
+
* @param {string} side 'buy' or 'sell'
|
|
4303
|
+
* @param {float} amount how much you want to trade in units of the base currency, or number of contracts
|
|
4304
|
+
* @param {float} [price] the price for the order to be filled at, in units of the quote currency, ignored in market orders
|
|
4305
|
+
* @param {float} trailingAmount the quote amount to trail away from the current market price
|
|
4306
|
+
* @param {float} [trailingTriggerPrice] the price to activate a trailing order, default uses the price argument
|
|
4307
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4308
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4309
|
+
*/
|
|
4310
|
+
if (trailingAmount === undefined) {
|
|
4311
|
+
throw new ArgumentsRequired(this.id + ' createTrailingAmountOrderWs() requires a trailingAmount argument');
|
|
4312
|
+
}
|
|
4313
|
+
params['trailingAmount'] = trailingAmount;
|
|
4314
|
+
if (trailingTriggerPrice !== undefined) {
|
|
4315
|
+
params['trailingTriggerPrice'] = trailingTriggerPrice;
|
|
4316
|
+
}
|
|
4317
|
+
if (this.has['createTrailingAmountOrderWs']) {
|
|
4318
|
+
return await this.createOrderWs(symbol, type, side, amount, price, params);
|
|
4319
|
+
}
|
|
4320
|
+
throw new NotSupported(this.id + ' createTrailingAmountOrderWs() is not supported yet');
|
|
4321
|
+
}
|
|
4233
4322
|
async createTrailingPercentOrder(symbol, type, side, amount, price = undefined, trailingPercent = undefined, trailingTriggerPrice = undefined, params = {}) {
|
|
4234
4323
|
/**
|
|
4235
4324
|
* @method
|
|
@@ -4257,6 +4346,33 @@ export default class Exchange {
|
|
|
4257
4346
|
}
|
|
4258
4347
|
throw new NotSupported(this.id + ' createTrailingPercentOrder() is not supported yet');
|
|
4259
4348
|
}
|
|
4349
|
+
async createTrailingPercentOrderWs(symbol, type, side, amount, price = undefined, trailingPercent = undefined, trailingTriggerPrice = undefined, params = {}) {
|
|
4350
|
+
/**
|
|
4351
|
+
* @method
|
|
4352
|
+
* @name createTrailingPercentOrderWs
|
|
4353
|
+
* @description create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
|
|
4354
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
4355
|
+
* @param {string} type 'market' or 'limit'
|
|
4356
|
+
* @param {string} side 'buy' or 'sell'
|
|
4357
|
+
* @param {float} amount how much you want to trade in units of the base currency, or number of contracts
|
|
4358
|
+
* @param {float} [price] the price for the order to be filled at, in units of the quote currency, ignored in market orders
|
|
4359
|
+
* @param {float} trailingPercent the percent to trail away from the current market price
|
|
4360
|
+
* @param {float} [trailingTriggerPrice] the price to activate a trailing order, default uses the price argument
|
|
4361
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4362
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4363
|
+
*/
|
|
4364
|
+
if (trailingPercent === undefined) {
|
|
4365
|
+
throw new ArgumentsRequired(this.id + ' createTrailingPercentOrderWs() requires a trailingPercent argument');
|
|
4366
|
+
}
|
|
4367
|
+
params['trailingPercent'] = trailingPercent;
|
|
4368
|
+
if (trailingTriggerPrice !== undefined) {
|
|
4369
|
+
params['trailingTriggerPrice'] = trailingTriggerPrice;
|
|
4370
|
+
}
|
|
4371
|
+
if (this.has['createTrailingPercentOrderWs']) {
|
|
4372
|
+
return await this.createOrderWs(symbol, type, side, amount, price, params);
|
|
4373
|
+
}
|
|
4374
|
+
throw new NotSupported(this.id + ' createTrailingPercentOrderWs() is not supported yet');
|
|
4375
|
+
}
|
|
4260
4376
|
async createMarketOrderWithCost(symbol, side, cost, params = {}) {
|
|
4261
4377
|
/**
|
|
4262
4378
|
* @method
|
|
@@ -4303,6 +4419,22 @@ export default class Exchange {
|
|
|
4303
4419
|
}
|
|
4304
4420
|
throw new NotSupported(this.id + ' createMarketSellOrderWithCost() is not supported yet');
|
|
4305
4421
|
}
|
|
4422
|
+
async createMarketOrderWithCostWs(symbol, side, cost, params = {}) {
|
|
4423
|
+
/**
|
|
4424
|
+
* @method
|
|
4425
|
+
* @name createMarketOrderWithCostWs
|
|
4426
|
+
* @description create a market order by providing the symbol, side and cost
|
|
4427
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
4428
|
+
* @param {string} side 'buy' or 'sell'
|
|
4429
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
4430
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4431
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4432
|
+
*/
|
|
4433
|
+
if (this.has['createMarketOrderWithCostWs'] || (this.has['createMarketBuyOrderWithCostWs'] && this.has['createMarketSellOrderWithCostWs'])) {
|
|
4434
|
+
return await this.createOrderWs(symbol, 'market', side, cost, 1, params);
|
|
4435
|
+
}
|
|
4436
|
+
throw new NotSupported(this.id + ' createMarketOrderWithCostWs() is not supported yet');
|
|
4437
|
+
}
|
|
4306
4438
|
async createTriggerOrder(symbol, type, side, amount, price = undefined, triggerPrice = undefined, params = {}) {
|
|
4307
4439
|
/**
|
|
4308
4440
|
* @method
|
|
@@ -4326,6 +4458,29 @@ export default class Exchange {
|
|
|
4326
4458
|
}
|
|
4327
4459
|
throw new NotSupported(this.id + ' createTriggerOrder() is not supported yet');
|
|
4328
4460
|
}
|
|
4461
|
+
async createTriggerOrderWs(symbol, type, side, amount, price = undefined, triggerPrice = undefined, params = {}) {
|
|
4462
|
+
/**
|
|
4463
|
+
* @method
|
|
4464
|
+
* @name createTriggerOrderWs
|
|
4465
|
+
* @description create a trigger stop order (type 1)
|
|
4466
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
4467
|
+
* @param {string} type 'market' or 'limit'
|
|
4468
|
+
* @param {string} side 'buy' or 'sell'
|
|
4469
|
+
* @param {float} amount how much you want to trade in units of the base currency or the number of contracts
|
|
4470
|
+
* @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
|
|
4471
|
+
* @param {float} triggerPrice the price to trigger the stop order, in units of the quote currency
|
|
4472
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4473
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4474
|
+
*/
|
|
4475
|
+
if (triggerPrice === undefined) {
|
|
4476
|
+
throw new ArgumentsRequired(this.id + ' createTriggerOrderWs() requires a triggerPrice argument');
|
|
4477
|
+
}
|
|
4478
|
+
params['triggerPrice'] = triggerPrice;
|
|
4479
|
+
if (this.has['createTriggerOrderWs']) {
|
|
4480
|
+
return await this.createOrderWs(symbol, type, side, amount, price, params);
|
|
4481
|
+
}
|
|
4482
|
+
throw new NotSupported(this.id + ' createTriggerOrderWs() is not supported yet');
|
|
4483
|
+
}
|
|
4329
4484
|
async createStopLossOrder(symbol, type, side, amount, price = undefined, stopLossPrice = undefined, params = {}) {
|
|
4330
4485
|
/**
|
|
4331
4486
|
* @method
|
|
@@ -4349,6 +4504,29 @@ export default class Exchange {
|
|
|
4349
4504
|
}
|
|
4350
4505
|
throw new NotSupported(this.id + ' createStopLossOrder() is not supported yet');
|
|
4351
4506
|
}
|
|
4507
|
+
async createStopLossOrderWs(symbol, type, side, amount, price = undefined, stopLossPrice = undefined, params = {}) {
|
|
4508
|
+
/**
|
|
4509
|
+
* @method
|
|
4510
|
+
* @name createStopLossOrderWs
|
|
4511
|
+
* @description create a trigger stop loss order (type 2)
|
|
4512
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
4513
|
+
* @param {string} type 'market' or 'limit'
|
|
4514
|
+
* @param {string} side 'buy' or 'sell'
|
|
4515
|
+
* @param {float} amount how much you want to trade in units of the base currency or the number of contracts
|
|
4516
|
+
* @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
|
|
4517
|
+
* @param {float} stopLossPrice the price to trigger the stop loss order, in units of the quote currency
|
|
4518
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4519
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4520
|
+
*/
|
|
4521
|
+
if (stopLossPrice === undefined) {
|
|
4522
|
+
throw new ArgumentsRequired(this.id + ' createStopLossOrderWs() requires a stopLossPrice argument');
|
|
4523
|
+
}
|
|
4524
|
+
params['stopLossPrice'] = stopLossPrice;
|
|
4525
|
+
if (this.has['createStopLossOrderWs']) {
|
|
4526
|
+
return await this.createOrderWs(symbol, type, side, amount, price, params);
|
|
4527
|
+
}
|
|
4528
|
+
throw new NotSupported(this.id + ' createStopLossOrderWs() is not supported yet');
|
|
4529
|
+
}
|
|
4352
4530
|
async createTakeProfitOrder(symbol, type, side, amount, price = undefined, takeProfitPrice = undefined, params = {}) {
|
|
4353
4531
|
/**
|
|
4354
4532
|
* @method
|
|
@@ -4372,6 +4550,29 @@ export default class Exchange {
|
|
|
4372
4550
|
}
|
|
4373
4551
|
throw new NotSupported(this.id + ' createTakeProfitOrder() is not supported yet');
|
|
4374
4552
|
}
|
|
4553
|
+
async createTakeProfitOrderWs(symbol, type, side, amount, price = undefined, takeProfitPrice = undefined, params = {}) {
|
|
4554
|
+
/**
|
|
4555
|
+
* @method
|
|
4556
|
+
* @name createTakeProfitOrderWs
|
|
4557
|
+
* @description create a trigger take profit order (type 2)
|
|
4558
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
4559
|
+
* @param {string} type 'market' or 'limit'
|
|
4560
|
+
* @param {string} side 'buy' or 'sell'
|
|
4561
|
+
* @param {float} amount how much you want to trade in units of the base currency or the number of contracts
|
|
4562
|
+
* @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
|
|
4563
|
+
* @param {float} takeProfitPrice the price to trigger the take profit order, in units of the quote currency
|
|
4564
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4565
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4566
|
+
*/
|
|
4567
|
+
if (takeProfitPrice === undefined) {
|
|
4568
|
+
throw new ArgumentsRequired(this.id + ' createTakeProfitOrderWs() requires a takeProfitPrice argument');
|
|
4569
|
+
}
|
|
4570
|
+
params['takeProfitPrice'] = takeProfitPrice;
|
|
4571
|
+
if (this.has['createTakeProfitOrderWs']) {
|
|
4572
|
+
return await this.createOrderWs(symbol, type, side, amount, price, params);
|
|
4573
|
+
}
|
|
4574
|
+
throw new NotSupported(this.id + ' createTakeProfitOrderWs() is not supported yet');
|
|
4575
|
+
}
|
|
4375
4576
|
async createOrderWithTakeProfitAndStopLoss(symbol, type, side, amount, price = undefined, takeProfit = undefined, stopLoss = undefined, params = {}) {
|
|
4376
4577
|
/**
|
|
4377
4578
|
* @method
|
|
@@ -4395,6 +4596,13 @@ export default class Exchange {
|
|
|
4395
4596
|
* @param {float} [params.stopLossAmount] *not available on all exchanges* the amount for a stop loss
|
|
4396
4597
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4397
4598
|
*/
|
|
4599
|
+
params = this.setTakeProfitAndStopLossParams(symbol, type, side, amount, price, takeProfit, stopLoss, params);
|
|
4600
|
+
if (this.has['createOrderWithTakeProfitAndStopLoss']) {
|
|
4601
|
+
return await this.createOrder(symbol, type, side, amount, price, params);
|
|
4602
|
+
}
|
|
4603
|
+
throw new NotSupported(this.id + ' createOrderWithTakeProfitAndStopLoss() is not supported yet');
|
|
4604
|
+
}
|
|
4605
|
+
setTakeProfitAndStopLossParams(symbol, type, side, amount, price = undefined, takeProfit = undefined, stopLoss = undefined, params = {}) {
|
|
4398
4606
|
if ((takeProfit === undefined) && (stopLoss === undefined)) {
|
|
4399
4607
|
throw new ArgumentsRequired(this.id + ' createOrderWithTakeProfitAndStopLoss() requires either a takeProfit or stopLoss argument');
|
|
4400
4608
|
}
|
|
@@ -4441,10 +4649,36 @@ export default class Exchange {
|
|
|
4441
4649
|
params['stopLoss']['amount'] = this.parseToNumeric(stopLossAmount);
|
|
4442
4650
|
}
|
|
4443
4651
|
params = this.omit(params, ['takeProfitType', 'takeProfitPriceType', 'takeProfitLimitPrice', 'takeProfitAmount', 'stopLossType', 'stopLossPriceType', 'stopLossLimitPrice', 'stopLossAmount']);
|
|
4444
|
-
|
|
4445
|
-
|
|
4652
|
+
return params;
|
|
4653
|
+
}
|
|
4654
|
+
async createOrderWithTakeProfitAndStopLossWs(symbol, type, side, amount, price = undefined, takeProfit = undefined, stopLoss = undefined, params = {}) {
|
|
4655
|
+
/**
|
|
4656
|
+
* @method
|
|
4657
|
+
* @name createOrderWithTakeProfitAndStopLossWs
|
|
4658
|
+
* @description create an order with a stop loss or take profit attached (type 3)
|
|
4659
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
4660
|
+
* @param {string} type 'market' or 'limit'
|
|
4661
|
+
* @param {string} side 'buy' or 'sell'
|
|
4662
|
+
* @param {float} amount how much you want to trade in units of the base currency or the number of contracts
|
|
4663
|
+
* @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
|
|
4664
|
+
* @param {float} [takeProfit] the take profit price, in units of the quote currency
|
|
4665
|
+
* @param {float} [stopLoss] the stop loss price, in units of the quote currency
|
|
4666
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4667
|
+
* @param {string} [params.takeProfitType] *not available on all exchanges* 'limit' or 'market'
|
|
4668
|
+
* @param {string} [params.stopLossType] *not available on all exchanges* 'limit' or 'market'
|
|
4669
|
+
* @param {string} [params.takeProfitPriceType] *not available on all exchanges* 'last', 'mark' or 'index'
|
|
4670
|
+
* @param {string} [params.stopLossPriceType] *not available on all exchanges* 'last', 'mark' or 'index'
|
|
4671
|
+
* @param {float} [params.takeProfitLimitPrice] *not available on all exchanges* limit price for a limit take profit order
|
|
4672
|
+
* @param {float} [params.stopLossLimitPrice] *not available on all exchanges* stop loss for a limit stop loss order
|
|
4673
|
+
* @param {float} [params.takeProfitAmount] *not available on all exchanges* the amount for a take profit
|
|
4674
|
+
* @param {float} [params.stopLossAmount] *not available on all exchanges* the amount for a stop loss
|
|
4675
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4676
|
+
*/
|
|
4677
|
+
params = this.setTakeProfitAndStopLossParams(symbol, type, side, amount, price, takeProfit, stopLoss, params);
|
|
4678
|
+
if (this.has['createOrderWithTakeProfitAndStopLossWs']) {
|
|
4679
|
+
return await this.createOrderWs(symbol, type, side, amount, price, params);
|
|
4446
4680
|
}
|
|
4447
|
-
throw new NotSupported(this.id + '
|
|
4681
|
+
throw new NotSupported(this.id + ' createOrderWithTakeProfitAndStopLossWs() is not supported yet');
|
|
4448
4682
|
}
|
|
4449
4683
|
async createOrders(orders, params = {}) {
|
|
4450
4684
|
throw new NotSupported(this.id + ' createOrders() is not supported yet');
|
|
@@ -4464,6 +4698,9 @@ export default class Exchange {
|
|
|
4464
4698
|
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
4465
4699
|
throw new NotSupported(this.id + ' cancelAllOrders() is not supported yet');
|
|
4466
4700
|
}
|
|
4701
|
+
async cancelAllOrdersAfter(timeout, params = {}) {
|
|
4702
|
+
throw new NotSupported(this.id + ' cancelAllOrdersAfter() is not supported yet');
|
|
4703
|
+
}
|
|
4467
4704
|
async cancelOrdersForSymbols(orders, params = {}) {
|
|
4468
4705
|
throw new NotSupported(this.id + ' cancelOrdersForSymbols() is not supported yet');
|
|
4469
4706
|
}
|
|
@@ -4686,21 +4923,39 @@ export default class Exchange {
|
|
|
4686
4923
|
async createLimitOrder(symbol, side, amount, price, params = {}) {
|
|
4687
4924
|
return await this.createOrder(symbol, 'limit', side, amount, price, params);
|
|
4688
4925
|
}
|
|
4926
|
+
async createLimitOrderWs(symbol, side, amount, price, params = {}) {
|
|
4927
|
+
return await this.createOrderWs(symbol, 'limit', side, amount, price, params);
|
|
4928
|
+
}
|
|
4689
4929
|
async createMarketOrder(symbol, side, amount, price = undefined, params = {}) {
|
|
4690
4930
|
return await this.createOrder(symbol, 'market', side, amount, price, params);
|
|
4691
4931
|
}
|
|
4932
|
+
async createMarketOrderWs(symbol, side, amount, price = undefined, params = {}) {
|
|
4933
|
+
return await this.createOrderWs(symbol, 'market', side, amount, price, params);
|
|
4934
|
+
}
|
|
4692
4935
|
async createLimitBuyOrder(symbol, amount, price, params = {}) {
|
|
4693
4936
|
return await this.createOrder(symbol, 'limit', 'buy', amount, price, params);
|
|
4694
4937
|
}
|
|
4938
|
+
async createLimitBuyOrderWs(symbol, amount, price, params = {}) {
|
|
4939
|
+
return await this.createOrderWs(symbol, 'limit', 'buy', amount, price, params);
|
|
4940
|
+
}
|
|
4695
4941
|
async createLimitSellOrder(symbol, amount, price, params = {}) {
|
|
4696
4942
|
return await this.createOrder(symbol, 'limit', 'sell', amount, price, params);
|
|
4697
4943
|
}
|
|
4944
|
+
async createLimitSellOrderWs(symbol, amount, price, params = {}) {
|
|
4945
|
+
return await this.createOrderWs(symbol, 'limit', 'sell', amount, price, params);
|
|
4946
|
+
}
|
|
4698
4947
|
async createMarketBuyOrder(symbol, amount, params = {}) {
|
|
4699
4948
|
return await this.createOrder(symbol, 'market', 'buy', amount, undefined, params);
|
|
4700
4949
|
}
|
|
4950
|
+
async createMarketBuyOrderWs(symbol, amount, params = {}) {
|
|
4951
|
+
return await this.createOrderWs(symbol, 'market', 'buy', amount, undefined, params);
|
|
4952
|
+
}
|
|
4701
4953
|
async createMarketSellOrder(symbol, amount, params = {}) {
|
|
4702
4954
|
return await this.createOrder(symbol, 'market', 'sell', amount, undefined, params);
|
|
4703
4955
|
}
|
|
4956
|
+
async createMarketSellOrderWs(symbol, amount, params = {}) {
|
|
4957
|
+
return await this.createOrderWs(symbol, 'market', 'sell', amount, undefined, params);
|
|
4958
|
+
}
|
|
4704
4959
|
costToPrecision(symbol, cost) {
|
|
4705
4960
|
const market = this.market(symbol);
|
|
4706
4961
|
return this.decimalToPrecision(cost, TRUNCATE, market['precision']['price'], this.precisionMode, this.paddingMode);
|
|
@@ -4836,6 +5091,13 @@ export default class Exchange {
|
|
|
4836
5091
|
const query = this.extend(params, { 'postOnly': true });
|
|
4837
5092
|
return await this.createOrder(symbol, type, side, amount, price, query);
|
|
4838
5093
|
}
|
|
5094
|
+
async createPostOnlyOrderWs(symbol, type, side, amount, price = undefined, params = {}) {
|
|
5095
|
+
if (!this.has['createPostOnlyOrderWs']) {
|
|
5096
|
+
throw new NotSupported(this.id + 'createPostOnlyOrderWs() is not supported yet');
|
|
5097
|
+
}
|
|
5098
|
+
const query = this.extend(params, { 'postOnly': true });
|
|
5099
|
+
return await this.createOrderWs(symbol, type, side, amount, price, query);
|
|
5100
|
+
}
|
|
4839
5101
|
async createReduceOnlyOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
4840
5102
|
if (!this.has['createReduceOnlyOrder']) {
|
|
4841
5103
|
throw new NotSupported(this.id + 'createReduceOnlyOrder() is not supported yet');
|
|
@@ -4843,6 +5105,13 @@ export default class Exchange {
|
|
|
4843
5105
|
const query = this.extend(params, { 'reduceOnly': true });
|
|
4844
5106
|
return await this.createOrder(symbol, type, side, amount, price, query);
|
|
4845
5107
|
}
|
|
5108
|
+
async createReduceOnlyOrderWs(symbol, type, side, amount, price = undefined, params = {}) {
|
|
5109
|
+
if (!this.has['createReduceOnlyOrderWs']) {
|
|
5110
|
+
throw new NotSupported(this.id + 'createReduceOnlyOrderWs() is not supported yet');
|
|
5111
|
+
}
|
|
5112
|
+
const query = this.extend(params, { 'reduceOnly': true });
|
|
5113
|
+
return await this.createOrderWs(symbol, type, side, amount, price, query);
|
|
5114
|
+
}
|
|
4846
5115
|
async createStopOrder(symbol, type, side, amount, price = undefined, stopPrice = undefined, params = {}) {
|
|
4847
5116
|
if (!this.has['createStopOrder']) {
|
|
4848
5117
|
throw new NotSupported(this.id + ' createStopOrder() is not supported yet');
|
|
@@ -4853,6 +5122,16 @@ export default class Exchange {
|
|
|
4853
5122
|
const query = this.extend(params, { 'stopPrice': stopPrice });
|
|
4854
5123
|
return await this.createOrder(symbol, type, side, amount, price, query);
|
|
4855
5124
|
}
|
|
5125
|
+
async createStopOrderWs(symbol, type, side, amount, price = undefined, stopPrice = undefined, params = {}) {
|
|
5126
|
+
if (!this.has['createStopOrderWs']) {
|
|
5127
|
+
throw new NotSupported(this.id + ' createStopOrderWs() is not supported yet');
|
|
5128
|
+
}
|
|
5129
|
+
if (stopPrice === undefined) {
|
|
5130
|
+
throw new ArgumentsRequired(this.id + ' createStopOrderWs() requires a stopPrice argument');
|
|
5131
|
+
}
|
|
5132
|
+
const query = this.extend(params, { 'stopPrice': stopPrice });
|
|
5133
|
+
return await this.createOrderWs(symbol, type, side, amount, price, query);
|
|
5134
|
+
}
|
|
4856
5135
|
async createStopLimitOrder(symbol, side, amount, price, stopPrice, params = {}) {
|
|
4857
5136
|
if (!this.has['createStopLimitOrder']) {
|
|
4858
5137
|
throw new NotSupported(this.id + ' createStopLimitOrder() is not supported yet');
|
|
@@ -4860,6 +5139,13 @@ export default class Exchange {
|
|
|
4860
5139
|
const query = this.extend(params, { 'stopPrice': stopPrice });
|
|
4861
5140
|
return await this.createOrder(symbol, 'limit', side, amount, price, query);
|
|
4862
5141
|
}
|
|
5142
|
+
async createStopLimitOrderWs(symbol, side, amount, price, stopPrice, params = {}) {
|
|
5143
|
+
if (!this.has['createStopLimitOrderWs']) {
|
|
5144
|
+
throw new NotSupported(this.id + ' createStopLimitOrderWs() is not supported yet');
|
|
5145
|
+
}
|
|
5146
|
+
const query = this.extend(params, { 'stopPrice': stopPrice });
|
|
5147
|
+
return await this.createOrderWs(symbol, 'limit', side, amount, price, query);
|
|
5148
|
+
}
|
|
4863
5149
|
async createStopMarketOrder(symbol, side, amount, stopPrice, params = {}) {
|
|
4864
5150
|
if (!this.has['createStopMarketOrder']) {
|
|
4865
5151
|
throw new NotSupported(this.id + ' createStopMarketOrder() is not supported yet');
|
|
@@ -4867,6 +5153,13 @@ export default class Exchange {
|
|
|
4867
5153
|
const query = this.extend(params, { 'stopPrice': stopPrice });
|
|
4868
5154
|
return await this.createOrder(symbol, 'market', side, amount, undefined, query);
|
|
4869
5155
|
}
|
|
5156
|
+
async createStopMarketOrderWs(symbol, side, amount, stopPrice, params = {}) {
|
|
5157
|
+
if (!this.has['createStopMarketOrderWs']) {
|
|
5158
|
+
throw new NotSupported(this.id + ' createStopMarketOrderWs() is not supported yet');
|
|
5159
|
+
}
|
|
5160
|
+
const query = this.extend(params, { 'stopPrice': stopPrice });
|
|
5161
|
+
return await this.createOrderWs(symbol, 'market', side, amount, undefined, query);
|
|
5162
|
+
}
|
|
4870
5163
|
safeCurrencyCode(currencyId, currency = undefined) {
|
|
4871
5164
|
currency = this.safeCurrency(currencyId, currency);
|
|
4872
5165
|
return currency['code'];
|
package/js/src/binance.d.ts
CHANGED
|
@@ -49,6 +49,10 @@ export default class binance extends Exchange {
|
|
|
49
49
|
fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
50
50
|
editSpotOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
|
|
51
51
|
editSpotOrderRequest(id: string, symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): any;
|
|
52
|
+
editContractOrderRequest(id: string, symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): {
|
|
53
|
+
symbol: string;
|
|
54
|
+
side: string;
|
|
55
|
+
};
|
|
52
56
|
editContractOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
|
|
53
57
|
editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;
|
|
54
58
|
parseOrderStatus(status: any): string;
|
package/js/src/binance.js
CHANGED
|
@@ -324,6 +324,7 @@ export default class binance extends Exchange {
|
|
|
324
324
|
'capital/deposit/subAddress': 0.1,
|
|
325
325
|
'capital/deposit/subHisrec': 0.1,
|
|
326
326
|
'capital/withdraw/history': 1800,
|
|
327
|
+
'capital/withdraw/address/list': 10,
|
|
327
328
|
'capital/contract/convertible-coins': 4.0002,
|
|
328
329
|
'convert/tradeFlow': 20.001,
|
|
329
330
|
'convert/exchangeInfo': 50,
|
|
@@ -4110,6 +4111,7 @@ export default class binance extends Exchange {
|
|
|
4110
4111
|
* @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
4111
4112
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4112
4113
|
* @param {string} [params.subType] "linear" or "inverse"
|
|
4114
|
+
* @param {string} [params.type] 'spot', 'option', use params["subType"] for swap and future markets
|
|
4113
4115
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
4114
4116
|
*/
|
|
4115
4117
|
await this.loadMarkets();
|
|
@@ -4948,23 +4950,7 @@ export default class binance extends Exchange {
|
|
|
4948
4950
|
params = this.omit(params, ['quoteOrderQty', 'cost', 'stopPrice', 'newClientOrderId', 'clientOrderId', 'postOnly']);
|
|
4949
4951
|
return this.extend(request, params);
|
|
4950
4952
|
}
|
|
4951
|
-
|
|
4952
|
-
/**
|
|
4953
|
-
* @method
|
|
4954
|
-
* @name binance#editContractOrder
|
|
4955
|
-
* @description edit a trade order
|
|
4956
|
-
* @see https://binance-docs.github.io/apidocs/futures/en/#modify-order-trade
|
|
4957
|
-
* @see https://binance-docs.github.io/apidocs/delivery/en/#modify-order-trade
|
|
4958
|
-
* @param {string} id cancel order id
|
|
4959
|
-
* @param {string} symbol unified symbol of the market to create an order in
|
|
4960
|
-
* @param {string} type 'market' or 'limit'
|
|
4961
|
-
* @param {string} side 'buy' or 'sell'
|
|
4962
|
-
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
4963
|
-
* @param {float} [price] the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
|
|
4964
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4965
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4966
|
-
*/
|
|
4967
|
-
await this.loadMarkets();
|
|
4953
|
+
editContractOrderRequest(id, symbol, type, side, amount, price = undefined, params = {}) {
|
|
4968
4954
|
const market = this.market(symbol);
|
|
4969
4955
|
if (!market['contract']) {
|
|
4970
4956
|
throw new NotSupported(this.id + ' editContractOrder() does not support ' + market['type'] + ' orders');
|
|
@@ -4983,6 +4969,27 @@ export default class binance extends Exchange {
|
|
|
4983
4969
|
request['origClientOrderId'] = clientOrderId;
|
|
4984
4970
|
}
|
|
4985
4971
|
params = this.omit(params, ['clientOrderId', 'newClientOrderId']);
|
|
4972
|
+
return request;
|
|
4973
|
+
}
|
|
4974
|
+
async editContractOrder(id, symbol, type, side, amount, price = undefined, params = {}) {
|
|
4975
|
+
/**
|
|
4976
|
+
* @method
|
|
4977
|
+
* @name binance#editContractOrder
|
|
4978
|
+
* @description edit a trade order
|
|
4979
|
+
* @see https://binance-docs.github.io/apidocs/futures/en/#modify-order-trade
|
|
4980
|
+
* @see https://binance-docs.github.io/apidocs/delivery/en/#modify-order-trade
|
|
4981
|
+
* @param {string} id cancel order id
|
|
4982
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
4983
|
+
* @param {string} type 'market' or 'limit'
|
|
4984
|
+
* @param {string} side 'buy' or 'sell'
|
|
4985
|
+
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
4986
|
+
* @param {float} [price] the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
|
|
4987
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4988
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4989
|
+
*/
|
|
4990
|
+
await this.loadMarkets();
|
|
4991
|
+
const market = this.market(symbol);
|
|
4992
|
+
const request = this.editContractOrderRequest(id, symbol, type, side, amount, price, params);
|
|
4986
4993
|
let response = undefined;
|
|
4987
4994
|
if (market['linear']) {
|
|
4988
4995
|
response = await this.fapiPrivatePutOrder(this.extend(request, params));
|
package/js/src/bingx.d.ts
CHANGED
|
@@ -79,6 +79,7 @@ export default class bingx extends Exchange {
|
|
|
79
79
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
80
80
|
cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
|
|
81
81
|
cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<any>;
|
|
82
|
+
cancelAllOrdersAfter(timeout: Int, params?: {}): Promise<any>;
|
|
82
83
|
fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
83
84
|
fetchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
84
85
|
fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
package/js/src/bingx.js
CHANGED
|
@@ -35,6 +35,7 @@ export default class bingx extends Exchange {
|
|
|
35
35
|
'option': false,
|
|
36
36
|
'addMargin': true,
|
|
37
37
|
'cancelAllOrders': true,
|
|
38
|
+
'cancelAllOrdersAfter': true,
|
|
38
39
|
'cancelOrder': true,
|
|
39
40
|
'cancelOrders': true,
|
|
40
41
|
'closeAllPositions': true,
|
|
@@ -231,6 +232,7 @@ export default class bingx extends Exchange {
|
|
|
231
232
|
'trade/order': 3,
|
|
232
233
|
'trade/batchOrders': 3,
|
|
233
234
|
'trade/closeAllPositions': 3,
|
|
235
|
+
'trade/cancelAllAfter': 3,
|
|
234
236
|
'trade/marginType': 3,
|
|
235
237
|
'trade/leverage': 3,
|
|
236
238
|
'trade/positionMargin': 3,
|
|
@@ -2752,6 +2754,49 @@ export default class bingx extends Exchange {
|
|
|
2752
2754
|
//
|
|
2753
2755
|
return response;
|
|
2754
2756
|
}
|
|
2757
|
+
async cancelAllOrdersAfter(timeout, params = {}) {
|
|
2758
|
+
/**
|
|
2759
|
+
* @method
|
|
2760
|
+
* @name bingx#cancelAllOrdersAfter
|
|
2761
|
+
* @description dead man's switch, cancel all orders after the given timeout
|
|
2762
|
+
* @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel%20all%20orders%20in%20countdown
|
|
2763
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Cancel%20all%20orders%20in%20countdown
|
|
2764
|
+
* @param {number} timeout time in milliseconds, 0 represents cancel the timer
|
|
2765
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2766
|
+
* @param {string} [params.type] spot or swap market
|
|
2767
|
+
* @returns {object} the api result
|
|
2768
|
+
*/
|
|
2769
|
+
await this.loadMarkets();
|
|
2770
|
+
const isActive = (timeout > 0);
|
|
2771
|
+
const request = {
|
|
2772
|
+
'type': (isActive) ? 'ACTIVATE' : 'CLOSE',
|
|
2773
|
+
'timeOut': (isActive) ? (this.parseToInt(timeout / 1000)) : 0,
|
|
2774
|
+
};
|
|
2775
|
+
let response = undefined;
|
|
2776
|
+
let type = undefined;
|
|
2777
|
+
[type, params] = this.handleMarketTypeAndParams('cancelAllOrdersAfter', undefined, params);
|
|
2778
|
+
if (type === 'spot') {
|
|
2779
|
+
response = await this.spotV1PrivatePostTradeCancelAllAfter(this.extend(request, params));
|
|
2780
|
+
}
|
|
2781
|
+
else if (type === 'swap') {
|
|
2782
|
+
response = await this.swapV2PrivatePostTradeCancelAllAfter(this.extend(request, params));
|
|
2783
|
+
}
|
|
2784
|
+
else {
|
|
2785
|
+
throw new NotSupported(this.id + ' cancelAllOrdersAfter() is not supported for ' + type + ' markets');
|
|
2786
|
+
}
|
|
2787
|
+
//
|
|
2788
|
+
// {
|
|
2789
|
+
// code: '0',
|
|
2790
|
+
// msg: '',
|
|
2791
|
+
// data: {
|
|
2792
|
+
// triggerTime: '1712645434',
|
|
2793
|
+
// status: 'ACTIVATED',
|
|
2794
|
+
// note: 'All your perpetual pending orders will be closed automatically at 2024-04-09 06:50:34 UTC(+0),before that you can cancel the timer, or extend triggerTime time by this request'
|
|
2795
|
+
// }
|
|
2796
|
+
// }
|
|
2797
|
+
//
|
|
2798
|
+
return response;
|
|
2799
|
+
}
|
|
2755
2800
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
2756
2801
|
/**
|
|
2757
2802
|
* @method
|