ccxt 4.2.13 → 4.2.14

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.
Files changed (47) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +624 -130
  3. package/dist/ccxt.browser.min.js +7 -7
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/js/ccxt.js +1 -1
  6. package/dist/cjs/js/src/base/Exchange.js +148 -1
  7. package/dist/cjs/js/src/bigone.js +36 -32
  8. package/dist/cjs/js/src/binance.js +108 -0
  9. package/dist/cjs/js/src/binanceus.js +8 -0
  10. package/dist/cjs/js/src/bingx.js +4 -0
  11. package/dist/cjs/js/src/bitget.js +4 -0
  12. package/dist/cjs/js/src/bybit.js +4 -0
  13. package/dist/cjs/js/src/coinex.js +3 -0
  14. package/dist/cjs/js/src/delta.js +7 -1
  15. package/dist/cjs/js/src/gate.js +5 -0
  16. package/dist/cjs/js/src/htx.js +126 -1
  17. package/dist/cjs/js/src/kraken.js +19 -7
  18. package/dist/cjs/js/src/kucoin.js +5 -0
  19. package/dist/cjs/js/src/kucoinfutures.js +131 -77
  20. package/dist/cjs/js/src/okx.js +9 -8
  21. package/dist/cjs/js/src/woo.js +6 -2
  22. package/js/ccxt.d.ts +1 -1
  23. package/js/ccxt.js +1 -1
  24. package/js/src/abstract/bigone.d.ts +1 -0
  25. package/js/src/abstract/kucoin.d.ts +4 -0
  26. package/js/src/abstract/kucoinfutures.d.ts +4 -0
  27. package/js/src/base/Exchange.d.ts +8 -0
  28. package/js/src/base/Exchange.js +148 -1
  29. package/js/src/bigone.js +36 -32
  30. package/js/src/binance.d.ts +9 -0
  31. package/js/src/binance.js +108 -0
  32. package/js/src/binanceus.js +8 -0
  33. package/js/src/bingx.js +4 -0
  34. package/js/src/bitget.js +4 -0
  35. package/js/src/bybit.js +4 -0
  36. package/js/src/coinex.js +3 -0
  37. package/js/src/delta.js +7 -1
  38. package/js/src/gate.js +5 -0
  39. package/js/src/htx.d.ts +9 -0
  40. package/js/src/htx.js +126 -1
  41. package/js/src/kraken.js +19 -7
  42. package/js/src/kucoin.js +5 -0
  43. package/js/src/kucoinfutures.d.ts +4 -2
  44. package/js/src/kucoinfutures.js +131 -77
  45. package/js/src/okx.js +9 -8
  46. package/js/src/woo.js +6 -2
  47. package/package.json +1 -1
@@ -149,6 +149,7 @@ interface kucoin {
149
149
  futuresPublicGetPremiumQuery(params?: {}): Promise<implicitReturnType>;
150
150
  futuresPublicGetTradeStatistics(params?: {}): Promise<implicitReturnType>;
151
151
  futuresPublicGetFundingRateSymbolCurrent(params?: {}): Promise<implicitReturnType>;
152
+ futuresPublicGetContractFundingRates(params?: {}): Promise<implicitReturnType>;
152
153
  futuresPublicGetTimestamp(params?: {}): Promise<implicitReturnType>;
153
154
  futuresPublicGetStatus(params?: {}): Promise<implicitReturnType>;
154
155
  futuresPublicGetLevel2MessageQuery(params?: {}): Promise<implicitReturnType>;
@@ -171,6 +172,7 @@ interface kucoin {
171
172
  futuresPrivateGetOpenOrderStatistics(params?: {}): Promise<implicitReturnType>;
172
173
  futuresPrivateGetPosition(params?: {}): Promise<implicitReturnType>;
173
174
  futuresPrivateGetPositions(params?: {}): Promise<implicitReturnType>;
175
+ futuresPrivateGetMarginMaxWithdrawMargin(params?: {}): Promise<implicitReturnType>;
174
176
  futuresPrivateGetContractsRiskLimitSymbol(params?: {}): Promise<implicitReturnType>;
175
177
  futuresPrivateGetFundingHistory(params?: {}): Promise<implicitReturnType>;
176
178
  futuresPrivateGetDepositAddress(params?: {}): Promise<implicitReturnType>;
@@ -183,7 +185,9 @@ interface kucoin {
183
185
  futuresPrivatePostTransferIn(params?: {}): Promise<implicitReturnType>;
184
186
  futuresPrivatePostOrders(params?: {}): Promise<implicitReturnType>;
185
187
  futuresPrivatePostOrdersTest(params?: {}): Promise<implicitReturnType>;
188
+ futuresPrivatePostOrdersMulti(params?: {}): Promise<implicitReturnType>;
186
189
  futuresPrivatePostPositionMarginAutoDepositStatus(params?: {}): Promise<implicitReturnType>;
190
+ futuresPrivatePostMarginWithdrawMargin(params?: {}): Promise<implicitReturnType>;
187
191
  futuresPrivatePostPositionMarginDepositMargin(params?: {}): Promise<implicitReturnType>;
188
192
  futuresPrivatePostPositionRiskLimitLevelChange(params?: {}): Promise<implicitReturnType>;
189
193
  futuresPrivatePostBulletPrivate(params?: {}): Promise<implicitReturnType>;
@@ -303,13 +303,17 @@ export default class Exchange {
303
303
  createMarketOrderWithCost: any;
304
304
  createMarketSellOrderWithCost: any;
305
305
  createOrders: any;
306
+ createOrderWithTakeProfitAndStopLoss: any;
306
307
  createPostOnlyOrder: any;
307
308
  createReduceOnlyOrder: any;
309
+ createStopLossOrder: any;
308
310
  createStopOrder: any;
309
311
  createStopLimitOrder: any;
310
312
  createStopMarketOrder: any;
313
+ createTakeProfitOrder: any;
311
314
  createTrailingAmountOrder: any;
312
315
  createTrailingPercentOrder: any;
316
+ createTriggerOrder: any;
313
317
  createOrderWs: any;
314
318
  editOrderWs: any;
315
319
  fetchOpenOrdersWs: any;
@@ -778,6 +782,10 @@ export default class Exchange {
778
782
  createMarketOrderWithCost(symbol: string, side: OrderSide, cost: any, params?: {}): Promise<Order>;
779
783
  createMarketBuyOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
780
784
  createMarketSellOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
785
+ createTriggerOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, triggerPrice?: any, params?: {}): Promise<Order>;
786
+ createStopLossOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, stopLossPrice?: any, params?: {}): Promise<Order>;
787
+ createTakeProfitOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, takeProfitPrice?: any, params?: {}): Promise<Order>;
788
+ createOrderWithTakeProfitAndStopLoss(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, takeProfit?: any, stopLoss?: any, params?: {}): Promise<Order>;
781
789
  createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
782
790
  createOrderWs(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
783
791
  cancelOrder(id: string, symbol?: string, params?: {}): Promise<any>;
@@ -359,13 +359,17 @@ export default class Exchange {
359
359
  'createMarketOrderWithCost': undefined,
360
360
  'createMarketSellOrderWithCost': undefined,
361
361
  'createOrders': undefined,
362
+ 'createOrderWithTakeProfitAndStopLoss': undefined,
362
363
  'createPostOnlyOrder': undefined,
363
364
  'createReduceOnlyOrder': undefined,
365
+ 'createStopLossOrder': undefined,
364
366
  'createStopOrder': undefined,
365
367
  'createStopLimitOrder': undefined,
366
368
  'createStopMarketOrder': undefined,
369
+ 'createTakeProfitOrder': undefined,
367
370
  'createTrailingAmountOrder': undefined,
368
371
  'createTrailingPercentOrder': undefined,
372
+ 'createTriggerOrder': undefined,
369
373
  'createOrderWs': undefined,
370
374
  'editOrderWs': undefined,
371
375
  'fetchOpenOrdersWs': undefined,
@@ -3868,11 +3872,154 @@ export default class Exchange {
3868
3872
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3869
3873
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3870
3874
  */
3871
- if (this.options['createMarketSellOrderRequiresPrice'] || this.options['createMarketSellOrderWithCost']) {
3875
+ if (this.options['createMarketSellOrderRequiresPrice'] || this.has['createMarketSellOrderWithCost']) {
3872
3876
  return await this.createOrder(symbol, 'market', 'sell', cost, 1, params);
3873
3877
  }
3874
3878
  throw new NotSupported(this.id + ' createMarketSellOrderWithCost() is not supported yet');
3875
3879
  }
3880
+ async createTriggerOrder(symbol, type, side, amount, price = undefined, triggerPrice = undefined, params = {}) {
3881
+ /**
3882
+ * @method
3883
+ * @name createTriggerOrder
3884
+ * @description create a trigger stop order (type 1)
3885
+ * @param {string} symbol unified symbol of the market to create an order in
3886
+ * @param {string} type 'market' or 'limit'
3887
+ * @param {string} side 'buy' or 'sell'
3888
+ * @param {float} amount how much you want to trade in units of the base currency or the number of contracts
3889
+ * @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
3890
+ * @param {float} triggerPrice the price to trigger the stop order, in units of the quote currency
3891
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3892
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3893
+ */
3894
+ if (triggerPrice === undefined) {
3895
+ throw new ArgumentsRequired(this.id + ' createTriggerOrder() requires a triggerPrice argument');
3896
+ }
3897
+ params['triggerPrice'] = triggerPrice;
3898
+ if (this.has['createTriggerOrder']) {
3899
+ return await this.createOrder(symbol, type, side, amount, price, params);
3900
+ }
3901
+ throw new NotSupported(this.id + ' createTriggerOrder() is not supported yet');
3902
+ }
3903
+ async createStopLossOrder(symbol, type, side, amount, price = undefined, stopLossPrice = undefined, params = {}) {
3904
+ /**
3905
+ * @method
3906
+ * @name createStopLossOrder
3907
+ * @description create a trigger stop loss order (type 2)
3908
+ * @param {string} symbol unified symbol of the market to create an order in
3909
+ * @param {string} type 'market' or 'limit'
3910
+ * @param {string} side 'buy' or 'sell'
3911
+ * @param {float} amount how much you want to trade in units of the base currency or the number of contracts
3912
+ * @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
3913
+ * @param {float} stopLossPrice the price to trigger the stop loss order, in units of the quote currency
3914
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3915
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3916
+ */
3917
+ if (stopLossPrice === undefined) {
3918
+ throw new ArgumentsRequired(this.id + ' createStopLossOrder() requires a stopLossPrice argument');
3919
+ }
3920
+ params['stopLossPrice'] = stopLossPrice;
3921
+ if (this.has['createStopLossOrder']) {
3922
+ return await this.createOrder(symbol, type, side, amount, price, params);
3923
+ }
3924
+ throw new NotSupported(this.id + ' createStopLossOrder() is not supported yet');
3925
+ }
3926
+ async createTakeProfitOrder(symbol, type, side, amount, price = undefined, takeProfitPrice = undefined, params = {}) {
3927
+ /**
3928
+ * @method
3929
+ * @name createTakeProfitOrder
3930
+ * @description create a trigger take profit order (type 2)
3931
+ * @param {string} symbol unified symbol of the market to create an order in
3932
+ * @param {string} type 'market' or 'limit'
3933
+ * @param {string} side 'buy' or 'sell'
3934
+ * @param {float} amount how much you want to trade in units of the base currency or the number of contracts
3935
+ * @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
3936
+ * @param {float} takeProfitPrice the price to trigger the take profit order, in units of the quote currency
3937
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3938
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3939
+ */
3940
+ if (takeProfitPrice === undefined) {
3941
+ throw new ArgumentsRequired(this.id + ' createTakeProfitOrder() requires a takeProfitPrice argument');
3942
+ }
3943
+ params['takeProfitPrice'] = takeProfitPrice;
3944
+ if (this.has['createTakeProfitOrder']) {
3945
+ return await this.createOrder(symbol, type, side, amount, price, params);
3946
+ }
3947
+ throw new NotSupported(this.id + ' createTakeProfitOrder() is not supported yet');
3948
+ }
3949
+ async createOrderWithTakeProfitAndStopLoss(symbol, type, side, amount, price = undefined, takeProfit = undefined, stopLoss = undefined, params = {}) {
3950
+ /**
3951
+ * @method
3952
+ * @name createOrderWithTakeProfitAndStopLoss
3953
+ * @description create an order with a stop loss or take profit attached (type 3)
3954
+ * @param {string} symbol unified symbol of the market to create an order in
3955
+ * @param {string} type 'market' or 'limit'
3956
+ * @param {string} side 'buy' or 'sell'
3957
+ * @param {float} amount how much you want to trade in units of the base currency or the number of contracts
3958
+ * @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
3959
+ * @param {float} [takeProfit] the take profit price, in units of the quote currency
3960
+ * @param {float} [stopLoss] the stop loss price, in units of the quote currency
3961
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3962
+ * @param {string} [params.takeProfitType] *not available on all exchanges* 'limit' or 'market'
3963
+ * @param {string} [params.stopLossType] *not available on all exchanges* 'limit' or 'market'
3964
+ * @param {string} [params.takeProfitPriceType] *not available on all exchanges* 'last', 'mark' or 'index'
3965
+ * @param {string} [params.stopLossPriceType] *not available on all exchanges* 'last', 'mark' or 'index'
3966
+ * @param {float} [params.takeProfitLimitPrice] *not available on all exchanges* limit price for a limit take profit order
3967
+ * @param {float} [params.stopLossLimitPrice] *not available on all exchanges* stop loss for a limit stop loss order
3968
+ * @param {float} [params.takeProfitAmount] *not available on all exchanges* the amount for a take profit
3969
+ * @param {float} [params.stopLossAmount] *not available on all exchanges* the amount for a stop loss
3970
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3971
+ */
3972
+ if ((takeProfit === undefined) && (stopLoss === undefined)) {
3973
+ throw new ArgumentsRequired(this.id + ' createOrderWithTakeProfitAndStopLoss() requires either a takeProfit or stopLoss argument');
3974
+ }
3975
+ if (takeProfit !== undefined) {
3976
+ params['takeProfit'] = {
3977
+ 'triggerPrice': takeProfit,
3978
+ };
3979
+ }
3980
+ if (stopLoss !== undefined) {
3981
+ params['stopLoss'] = {
3982
+ 'triggerPrice': stopLoss,
3983
+ };
3984
+ }
3985
+ const takeProfitType = this.safeString(params, 'takeProfitType');
3986
+ const takeProfitPriceType = this.safeString(params, 'takeProfitPriceType');
3987
+ const takeProfitLimitPrice = this.safeString(params, 'takeProfitLimitPrice');
3988
+ const takeProfitAmount = this.safeString(params, 'takeProfitAmount');
3989
+ const stopLossType = this.safeString(params, 'stopLossType');
3990
+ const stopLossPriceType = this.safeString(params, 'stopLossPriceType');
3991
+ const stopLossLimitPrice = this.safeString(params, 'stopLossLimitPrice');
3992
+ const stopLossAmount = this.safeString(params, 'stopLossAmount');
3993
+ if (takeProfitType !== undefined) {
3994
+ params['takeProfit']['type'] = takeProfitType;
3995
+ }
3996
+ if (takeProfitPriceType !== undefined) {
3997
+ params['takeProfit']['priceType'] = takeProfitPriceType;
3998
+ }
3999
+ if (takeProfitLimitPrice !== undefined) {
4000
+ params['takeProfit']['price'] = this.parseToNumeric(takeProfitLimitPrice);
4001
+ }
4002
+ if (takeProfitAmount !== undefined) {
4003
+ params['takeProfit']['amount'] = this.parseToNumeric(takeProfitAmount);
4004
+ }
4005
+ if (stopLossType !== undefined) {
4006
+ params['stopLoss']['type'] = stopLossType;
4007
+ }
4008
+ if (stopLossPriceType !== undefined) {
4009
+ params['stopLoss']['priceType'] = stopLossPriceType;
4010
+ }
4011
+ if (stopLossLimitPrice !== undefined) {
4012
+ params['stopLoss']['price'] = this.parseToNumeric(stopLossLimitPrice);
4013
+ }
4014
+ if (stopLossAmount !== undefined) {
4015
+ params['stopLoss']['amount'] = this.parseToNumeric(stopLossAmount);
4016
+ }
4017
+ params = this.omit(params, ['takeProfitType', 'takeProfitPriceType', 'takeProfitLimitPrice', 'takeProfitAmount', 'stopLossType', 'stopLossPriceType', 'stopLossLimitPrice', 'stopLossAmount']);
4018
+ if (this.has['createOrderWithTakeProfitAndStopLoss']) {
4019
+ return await this.createOrder(symbol, type, side, amount, price, params);
4020
+ }
4021
+ throw new NotSupported(this.id + ' createOrderWithTakeProfitAndStopLoss() is not supported yet');
4022
+ }
3876
4023
  async createOrders(orders, params = {}) {
3877
4024
  throw new NotSupported(this.id + ' createOrders() is not supported yet');
3878
4025
  }
package/js/src/bigone.js CHANGED
@@ -127,6 +127,7 @@ export default class bigone extends Exchange {
127
127
  },
128
128
  'contractPublic': {
129
129
  'get': [
130
+ 'symbols',
130
131
  'instruments',
131
132
  'depth@{symbol}/snapshot',
132
133
  'instruments/difference',
@@ -522,7 +523,10 @@ export default class bigone extends Exchange {
522
523
  * @param {object} [params] extra parameters specific to the exchange API endpoint
523
524
  * @returns {object[]} an array of objects representing market data
524
525
  */
525
- const response = await this.publicGetAssetPairs(params);
526
+ const promises = [this.publicGetAssetPairs(params), this.contractPublicGetSymbols(params)];
527
+ const promisesResult = await Promise.all(promises);
528
+ const response = promisesResult[0];
529
+ const contractResponse = promisesResult[1];
526
530
  //
527
531
  // {
528
532
  // "code":0,
@@ -548,29 +552,30 @@ export default class bigone extends Exchange {
548
552
  // ]
549
553
  // }
550
554
  //
551
- const contractResponse = await this.contractPublicGetInstruments(params);
552
555
  //
553
556
  // [
554
557
  // {
555
- // "usdtPrice": 1.00031998,
558
+ // "baseCurrency": "BTC",
559
+ // "multiplier": 1,
560
+ // "enable": true,
561
+ // "priceStep": 0.5,
562
+ // "maxRiskLimit": 1000,
563
+ // "pricePrecision": 1,
564
+ // "maintenanceMargin": 0.00500,
556
565
  // "symbol": "BTCUSD",
557
- // "btcPrice": 34700.4,
558
- // "ethPrice": 1787.83,
559
- // "nextFundingRate": 0.00010,
560
- // "fundingRate": 0.00010,
561
- // "latestPrice": 34708.5,
562
- // "last24hPriceChange": 0.0321,
563
- // "indexPrice": 34700.4,
564
- // "volume24h": 261319063,
565
- // "turnover24h": 8204.129380685496,
566
- // "nextFundingTime": 1698285600000,
567
- // "markPrice": 34702.4646738,
568
- // "last24hMaxPrice": 35127.5,
569
- // "volume24hInUsd": 0.0,
570
- // "openValue": 32.88054722085945,
571
- // "last24hMinPrice": 33552.0,
572
- // "openInterest": 1141372.0
573
- // }
566
+ // "valuePrecision": 4,
567
+ // "minRiskLimit": 100,
568
+ // "riskLimit": 100,
569
+ // "isInverse": true,
570
+ // "riskStep": 1,
571
+ // "settleCurrency": "BTC",
572
+ // "baseName": "Bitcoin",
573
+ // "feePrecision": 8,
574
+ // "priceMin": 0.5,
575
+ // "priceMax": 1E+6,
576
+ // "initialMargin": 0.01000,
577
+ // "quoteCurrency": "USD"
578
+ // },
574
579
  // ...
575
580
  // ]
576
581
  //
@@ -637,15 +642,14 @@ export default class bigone extends Exchange {
637
642
  }
638
643
  for (let i = 0; i < contractResponse.length; i++) {
639
644
  const market = contractResponse[i];
645
+ const baseId = this.safeString(market, 'baseCurrency');
646
+ const quoteId = this.safeString(market, 'quoteCurrency');
647
+ const settleId = this.safeString(market, 'settleCurrency');
640
648
  const marketId = this.safeString(market, 'symbol');
641
- const index = marketId.indexOf('USD');
642
- const baseId = marketId.slice(0, index);
643
- const quoteId = marketId.slice(index);
644
- const inverse = (quoteId === 'USD');
645
- const settleId = inverse ? baseId : quoteId;
646
649
  const base = this.safeCurrencyCode(baseId);
647
650
  const quote = this.safeCurrencyCode(quoteId);
648
651
  const settle = this.safeCurrencyCode(settleId);
652
+ const inverse = this.safeValue(market, 'isInverse');
649
653
  result.push(this.safeMarketStructure({
650
654
  'id': marketId,
651
655
  'symbol': base + '/' + quote + ':' + settle,
@@ -661,18 +665,18 @@ export default class bigone extends Exchange {
661
665
  'swap': true,
662
666
  'future': false,
663
667
  'option': false,
664
- 'active': true,
668
+ 'active': this.safeValue(market, 'enable'),
665
669
  'contract': true,
666
670
  'linear': !inverse,
667
671
  'inverse': inverse,
668
- 'contractSize': 1,
672
+ 'contractSize': this.safeNumber(market, 'multiplier'),
669
673
  'expiry': undefined,
670
674
  'expiryDatetime': undefined,
671
675
  'strike': undefined,
672
676
  'optionType': undefined,
673
677
  'precision': {
674
- 'amount': undefined,
675
- 'price': undefined,
678
+ 'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'valuePrecision'))),
679
+ 'price': this.parseNumber(this.parsePrecision(this.safeString(market, 'pricePrecision'))),
676
680
  },
677
681
  'limits': {
678
682
  'leverage': {
@@ -684,11 +688,11 @@ export default class bigone extends Exchange {
684
688
  'max': undefined,
685
689
  },
686
690
  'price': {
687
- 'min': undefined,
688
- 'max': undefined,
691
+ 'min': this.safeNumber(market, 'priceMin'),
692
+ 'max': this.safeNumber(market, 'priceMax'),
689
693
  },
690
694
  'cost': {
691
- 'min': undefined,
695
+ 'min': this.safeNumber(market, 'initialMargin'),
692
696
  'max': undefined,
693
697
  },
694
698
  },
@@ -34,6 +34,15 @@ export default class binance extends Exchange {
34
34
  }>;
35
35
  fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
36
36
  fetchBidsAsks(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Dictionary<Ticker>>;
37
+ fetchLastPrices(symbols?: Strings, params?: {}): Promise<any>;
38
+ parseLastPrice(entry: any, market?: Market): {
39
+ symbol: string;
40
+ timestamp: number;
41
+ datetime: string;
42
+ price: number;
43
+ side: any;
44
+ info: any;
45
+ };
37
46
  fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
38
47
  parseOHLCV(ohlcv: any, market?: Market): OHLCV;
39
48
  fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
package/js/src/binance.js CHANGED
@@ -55,6 +55,9 @@ export default class binance extends Exchange {
55
55
  'createStopMarketOrder': false,
56
56
  'createStopOrder': true,
57
57
  'createTrailingPercentOrder': true,
58
+ 'createTriggerOrder': true,
59
+ 'createTakeProfitOrder': true,
60
+ 'createStopLossOrder': true,
58
61
  'editOrder': true,
59
62
  'fetchAccounts': undefined,
60
63
  'fetchBalance': true,
@@ -85,6 +88,7 @@ export default class binance extends Exchange {
85
88
  'fetchIsolatedBorrowRate': false,
86
89
  'fetchIsolatedBorrowRates': false,
87
90
  'fetchL3OrderBook': false,
91
+ 'fetchLastPrices': true,
88
92
  'fetchLedger': true,
89
93
  'fetchLeverage': false,
90
94
  'fetchLeverageTiers': true,
@@ -3160,6 +3164,110 @@ export default class binance extends Exchange {
3160
3164
  }
3161
3165
  return this.parseTickers(response, symbols);
3162
3166
  }
3167
+ async fetchLastPrices(symbols = undefined, params = {}) {
3168
+ /**
3169
+ * @method
3170
+ * @name binance#fetchLastPrices
3171
+ * @description fetches the last price for multiple markets
3172
+ * @see https://binance-docs.github.io/apidocs/spot/en/#symbol-price-ticker // spot
3173
+ * @see https://binance-docs.github.io/apidocs/future/en/#symbol-price-ticker // swap
3174
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#symbol-price-ticker // future
3175
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the last prices
3176
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3177
+ * @returns {object} a dictionary of lastprices structures
3178
+ */
3179
+ await this.loadMarkets();
3180
+ symbols = this.marketSymbols(symbols);
3181
+ const market = this.getMarketFromSymbols(symbols);
3182
+ let type = undefined;
3183
+ let subType = undefined;
3184
+ [subType, params] = this.handleSubTypeAndParams('fetchLastPrices', market, params);
3185
+ [type, params] = this.handleMarketTypeAndParams('fetchLastPrices', market, params);
3186
+ let response = undefined;
3187
+ if (this.isLinear(type, subType)) {
3188
+ response = await this.fapiPublicV2GetTickerPrice(params);
3189
+ //
3190
+ // [
3191
+ // {
3192
+ // "symbol": "LTCBTC",
3193
+ // "price": "4.00000200"
3194
+ // "time": 1589437530011
3195
+ // },
3196
+ // ...
3197
+ // ]
3198
+ //
3199
+ }
3200
+ else if (this.isInverse(type, subType)) {
3201
+ response = await this.dapiPublicGetTickerPrice(params);
3202
+ //
3203
+ // [
3204
+ // {
3205
+ // "symbol": "BTCUSD_200626",
3206
+ // "ps": "9647.8",
3207
+ // "price": "9647.8",
3208
+ // "time": 1591257246176
3209
+ // }
3210
+ // ]
3211
+ //
3212
+ }
3213
+ else if (type === 'spot') {
3214
+ response = await this.publicGetTickerPrice(params);
3215
+ //
3216
+ // [
3217
+ // {
3218
+ // "symbol": "LTCBTC",
3219
+ // "price": "4.00000200"
3220
+ // },
3221
+ // ...
3222
+ // ]
3223
+ //
3224
+ }
3225
+ else {
3226
+ throw new NotSupported(this.id + ' fetchLastPrices() does not support ' + type + ' markets yet');
3227
+ }
3228
+ return this.parseLastPrices(response, symbols);
3229
+ }
3230
+ parseLastPrice(entry, market = undefined) {
3231
+ //
3232
+ // spot
3233
+ //
3234
+ // {
3235
+ // "symbol": "LTCBTC",
3236
+ // "price": "4.00000200"
3237
+ // }
3238
+ //
3239
+ // usdm (swap/future)
3240
+ //
3241
+ // {
3242
+ // "symbol": "BTCUSDT",
3243
+ // "price": "6000.01",
3244
+ // "time": 1589437530011 // Transaction time
3245
+ // }
3246
+ //
3247
+ //
3248
+ // coinm (swap/future)
3249
+ //
3250
+ // {
3251
+ // "symbol": "BTCUSD_200626", // symbol ("BTCUSD_200626", "BTCUSD_PERP", etc..)
3252
+ // "ps": "BTCUSD", // pair
3253
+ // "price": "9647.8",
3254
+ // "time": 1591257246176
3255
+ // }
3256
+ //
3257
+ const timestamp = this.safeInteger(entry, 'time');
3258
+ const type = (timestamp === undefined) ? 'spot' : 'swap';
3259
+ const marketId = this.safeString(entry, 'symbol');
3260
+ market = this.safeMarket(marketId, market, undefined, type);
3261
+ const price = this.safeNumber(entry, 'price');
3262
+ return {
3263
+ 'symbol': market['symbol'],
3264
+ 'timestamp': timestamp,
3265
+ 'datetime': this.iso8601(timestamp),
3266
+ 'price': price,
3267
+ 'side': undefined,
3268
+ 'info': entry,
3269
+ };
3270
+ }
3163
3271
  async fetchTickers(symbols = undefined, params = {}) {
3164
3272
  /**
3165
3273
  * @method
@@ -13,6 +13,7 @@ export default class binanceus extends binance {
13
13
  'id': 'binanceus',
14
14
  'name': 'Binance US',
15
15
  'countries': ['US'],
16
+ 'rateLimit': 50,
16
17
  'certified': false,
17
18
  'pro': true,
18
19
  'urls': {
@@ -80,6 +81,13 @@ export default class binanceus extends binance {
80
81
  'setMarginMode': false,
81
82
  'setPositionMode': false,
82
83
  },
84
+ 'api': {
85
+ 'public': {
86
+ 'get': {
87
+ 'ticker/price': { 'cost': 1, 'noSymbol': 2 },
88
+ },
89
+ },
90
+ },
83
91
  });
84
92
  }
85
93
  }
package/js/src/bingx.js CHANGED
@@ -41,6 +41,10 @@ export default class bingx extends Exchange {
41
41
  'createOrders': true,
42
42
  'createTrailingAmountOrder': true,
43
43
  'createTrailingPercentOrder': true,
44
+ 'createTriggerOrder': true,
45
+ 'createTakeProfitOrder': true,
46
+ 'createStopLossOrder': true,
47
+ 'createOrderWithTakeProfitAndStopLoss': true,
44
48
  'fetchBalance': true,
45
49
  'fetchClosedOrders': true,
46
50
  'fetchCurrencies': true,
package/js/src/bitget.js CHANGED
@@ -47,6 +47,10 @@ export default class bitget extends Exchange {
47
47
  'createOrders': true,
48
48
  'createReduceOnlyOrder': false,
49
49
  'createTrailingPercentOrder': true,
50
+ 'createTriggerOrder': true,
51
+ 'createTakeProfitOrder': true,
52
+ 'createStopLossOrder': true,
53
+ 'createOrderWithTakeProfitAndStopLoss': true,
50
54
  'editOrder': true,
51
55
  'fetchAccounts': false,
52
56
  'fetchBalance': true,
package/js/src/bybit.js CHANGED
@@ -50,6 +50,10 @@ export default class bybit extends Exchange {
50
50
  'createStopMarketOrder': true,
51
51
  'createStopOrder': true,
52
52
  'createTrailingAmountOrder': true,
53
+ 'createTriggerOrder': true,
54
+ 'createTakeProfitOrder': true,
55
+ 'createStopLossOrder': true,
56
+ 'createOrderWithTakeProfitAndStopLoss': true,
53
57
  'editOrder': true,
54
58
  'fetchBalance': true,
55
59
  'fetchBorrowInterest': false,
package/js/src/coinex.js CHANGED
@@ -51,6 +51,9 @@ export default class coinex extends Exchange {
51
51
  'createMarketBuyOrderWithCost': true,
52
52
  'createMarketOrderWithCost': false,
53
53
  'createMarketSellOrderWithCost': false,
54
+ 'createTriggerOrder': true,
55
+ 'createTakeProfitOrder': true,
56
+ 'createStopLossOrder': true,
54
57
  'createOrder': true,
55
58
  'createOrders': true,
56
59
  'createReduceOnlyOrder': true,
package/js/src/delta.js CHANGED
@@ -2074,7 +2074,13 @@ export default class delta extends Exchange {
2074
2074
  if (limit !== undefined) {
2075
2075
  request['page_size'] = limit;
2076
2076
  }
2077
- const response = await this[method](this.extend(request, params));
2077
+ let response = undefined;
2078
+ if (method === 'privateGetOrders') {
2079
+ response = await this.privateGetOrders(this.extend(request, params));
2080
+ }
2081
+ else if (method === 'privateGetOrdersHistory') {
2082
+ response = await this.privateGetOrdersHistory(this.extend(request, params));
2083
+ }
2078
2084
  //
2079
2085
  // {
2080
2086
  // "success": true,
package/js/src/gate.js CHANGED
@@ -93,6 +93,9 @@ export default class gate extends Exchange {
93
93
  'createReduceOnlyOrder': true,
94
94
  'createStopLimitOrder': true,
95
95
  'createStopMarketOrder': false,
96
+ 'createTriggerOrder': true,
97
+ 'createTakeProfitOrder': true,
98
+ 'createStopLossOrder': true,
96
99
  'createStopOrder': true,
97
100
  'editOrder': true,
98
101
  'fetchBalance': true,
@@ -3769,6 +3772,8 @@ export default class gate extends Exchange {
3769
3772
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3770
3773
  * @param {float} [params.stopPrice] The price at which a trigger order is triggered at
3771
3774
  * @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
3775
+ * @param {float} [params.stopLossPrice] The price at which a stop loss order is triggered at
3776
+ * @param {float} [params.takeProfitPrice] The price at which a take profit order is triggered at
3772
3777
  * @param {string} [params.marginMode] 'cross' or 'isolated' - marginMode for margin trading if not provided this.options['defaultMarginMode'] is used
3773
3778
  * @param {int} [params.iceberg] Amount to display for the iceberg order, Null or 0 for normal orders, Set to -1 to hide the order completely
3774
3779
  * @param {string} [params.text] User defined information
package/js/src/htx.d.ts CHANGED
@@ -51,6 +51,15 @@ export default class htx extends Exchange {
51
51
  parseTicker(ticker: any, market?: Market): Ticker;
52
52
  fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
53
53
  fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
54
+ fetchLastPrices(symbols?: Strings, params?: {}): Promise<any>;
55
+ parseLastPrice(entry: any, market?: Market): {
56
+ symbol: string;
57
+ timestamp: any;
58
+ datetime: any;
59
+ price: number;
60
+ side: string;
61
+ info: any;
62
+ };
54
63
  fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
55
64
  parseTrade(trade: any, market?: Market): Trade;
56
65
  fetchOrderTrades(id: string, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;