ccxt 4.4.48 → 4.4.49

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 (75) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +12 -12
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/bingx.js +88 -30
  5. package/dist/cjs/src/bitget.js +12 -10
  6. package/dist/cjs/src/coinsph.js +18 -9
  7. package/dist/cjs/src/deribit.js +82 -0
  8. package/dist/cjs/src/digifinex.js +131 -11
  9. package/dist/cjs/src/ellipx.js +61 -0
  10. package/dist/cjs/src/exmo.js +58 -0
  11. package/dist/cjs/src/hitbtc.js +99 -0
  12. package/dist/cjs/src/hollaex.js +73 -0
  13. package/dist/cjs/src/huobijp.js +73 -0
  14. package/dist/cjs/src/hyperliquid.js +22 -1
  15. package/dist/cjs/src/idex.js +71 -0
  16. package/dist/cjs/src/independentreserve.js +64 -0
  17. package/dist/cjs/src/indodax.js +61 -0
  18. package/dist/cjs/src/kuna.js +60 -1
  19. package/dist/cjs/src/latoken.js +64 -0
  20. package/dist/cjs/src/lbank.js +70 -0
  21. package/dist/cjs/src/luno.js +73 -0
  22. package/dist/cjs/src/lykke.js +64 -0
  23. package/dist/cjs/src/mercado.js +65 -0
  24. package/dist/cjs/src/mexc.js +1 -1
  25. package/dist/cjs/src/myokx.js +10 -0
  26. package/dist/cjs/src/ndax.js +71 -0
  27. package/dist/cjs/src/novadax.js +74 -0
  28. package/dist/cjs/src/oceanex.js +69 -0
  29. package/dist/cjs/src/okcoin.js +79 -2
  30. package/dist/cjs/src/onetrading.js +66 -0
  31. package/dist/cjs/src/oxfun.js +66 -0
  32. package/dist/cjs/src/p2b.js +63 -1
  33. package/dist/cjs/src/paradex.js +68 -0
  34. package/dist/cjs/src/pro/bitmart.js +6 -0
  35. package/js/ccxt.d.ts +1 -1
  36. package/js/ccxt.js +1 -1
  37. package/js/src/bingx.d.ts +8 -0
  38. package/js/src/bingx.js +88 -30
  39. package/js/src/bitget.d.ts +1 -0
  40. package/js/src/bitget.js +12 -10
  41. package/js/src/coinsph.d.ts +1 -0
  42. package/js/src/coinsph.js +18 -9
  43. package/js/src/deribit.js +82 -0
  44. package/js/src/digifinex.d.ts +1 -0
  45. package/js/src/digifinex.js +131 -11
  46. package/js/src/ellipx.d.ts +1 -0
  47. package/js/src/ellipx.js +61 -0
  48. package/js/src/exmo.js +58 -0
  49. package/js/src/hitbtc.js +99 -0
  50. package/js/src/hollaex.js +73 -0
  51. package/js/src/huobijp.js +73 -0
  52. package/js/src/hyperliquid.d.ts +1 -0
  53. package/js/src/hyperliquid.js +22 -1
  54. package/js/src/idex.js +71 -0
  55. package/js/src/independentreserve.js +64 -0
  56. package/js/src/indodax.js +61 -0
  57. package/js/src/kuna.js +60 -1
  58. package/js/src/latoken.js +64 -0
  59. package/js/src/lbank.js +70 -0
  60. package/js/src/luno.js +73 -0
  61. package/js/src/lykke.js +64 -0
  62. package/js/src/mercado.js +65 -0
  63. package/js/src/mexc.js +1 -1
  64. package/js/src/myokx.js +10 -0
  65. package/js/src/ndax.js +71 -0
  66. package/js/src/novadax.js +74 -0
  67. package/js/src/oceanex.js +69 -0
  68. package/js/src/okcoin.js +79 -2
  69. package/js/src/onetrading.js +66 -0
  70. package/js/src/oxfun.js +66 -0
  71. package/js/src/p2b.js +63 -1
  72. package/js/src/paradex.js +68 -0
  73. package/js/src/pro/bitmart.d.ts +1 -0
  74. package/js/src/pro/bitmart.js +6 -0
  75. package/package.json +2 -2
@@ -201,6 +201,83 @@ class okcoin extends okcoin$1 {
201
201
  },
202
202
  },
203
203
  },
204
+ 'features': {
205
+ 'spot': {
206
+ 'sandbox': false,
207
+ 'createOrder': {
208
+ 'marginMode': true,
209
+ 'triggerPrice': true,
210
+ 'triggerDirection': true,
211
+ 'triggerPriceType': {
212
+ 'last': true,
213
+ 'mark': false,
214
+ 'index': false,
215
+ },
216
+ 'stopLossPrice': true,
217
+ 'takeProfitPrice': true,
218
+ 'attachedStopLossTakeProfit': {
219
+ 'triggerPriceType': {
220
+ 'last': true,
221
+ 'mark': false,
222
+ 'index': false,
223
+ },
224
+ 'price': true,
225
+ },
226
+ 'timeInForce': {
227
+ 'IOC': true,
228
+ 'FOK': true,
229
+ 'PO': true,
230
+ 'GTD': false,
231
+ },
232
+ 'hedged': false,
233
+ 'trailing': true,
234
+ 'leverage': false,
235
+ 'marketBuyByCost': true,
236
+ 'marketBuyRequiresPrice': true,
237
+ 'selfTradePrevention': false,
238
+ 'iceberg': true, // todo
239
+ },
240
+ 'createOrders': undefined,
241
+ 'fetchMyTrades': {
242
+ 'marginMode': false,
243
+ 'limit': 100,
244
+ 'daysBack': 90,
245
+ 'untilDays': 90, // todo
246
+ },
247
+ 'fetchOrder': {
248
+ 'marginMode': false,
249
+ 'trigger': true,
250
+ 'trailing': true, // todo
251
+ },
252
+ 'fetchOpenOrders': {
253
+ 'marginMode': false,
254
+ 'limit': 100,
255
+ 'trigger': true,
256
+ 'trailing': true,
257
+ },
258
+ 'fetchOrders': undefined,
259
+ 'fetchClosedOrders': {
260
+ 'marginMode': false,
261
+ 'limit': 100,
262
+ 'daysBack': 90,
263
+ 'daysBackCanceled': 1 / 12,
264
+ 'untilDays': 90,
265
+ 'trigger': true,
266
+ 'trailing': true,
267
+ },
268
+ 'fetchOHLCV': {
269
+ 'limit': 100, // 300 is only possible for 'recent' 1440 candles, which does not make much sense
270
+ },
271
+ },
272
+ 'swap': {
273
+ 'linear': undefined,
274
+ 'inverse': undefined,
275
+ },
276
+ 'future': {
277
+ 'linear': undefined,
278
+ 'inverse': undefined,
279
+ },
280
+ },
204
281
  'fees': {
205
282
  'trading': {
206
283
  'taker': 0.002,
@@ -1510,7 +1587,7 @@ class okcoin extends okcoin$1 {
1510
1587
  if (stopLossDefined) {
1511
1588
  const stopLossTriggerPrice = this.safeValueN(stopLoss, ['triggerPrice', 'stopPrice', 'slTriggerPx']);
1512
1589
  if (stopLossTriggerPrice === undefined) {
1513
- throw new errors.InvalidOrder(this.id + ' createOrder() requires a trigger price in params["stopLoss"]["triggerPrice"], or params["stopLoss"]["stopPrice"], or params["stopLoss"]["slTriggerPx"] for a stop loss order');
1590
+ throw new errors.InvalidOrder(this.id + ' createOrder() requires a trigger price in params["stopLoss"]["triggerPrice"] for a stop loss order');
1514
1591
  }
1515
1592
  request['slTriggerPx'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
1516
1593
  const stopLossLimitPrice = this.safeValueN(stopLoss, ['price', 'stopLossPrice', 'slOrdPx']);
@@ -1523,7 +1600,7 @@ class okcoin extends okcoin$1 {
1523
1600
  }
1524
1601
  else if (stopLossLimitOrderType) {
1525
1602
  if (stopLossLimitPrice === undefined) {
1526
- throw new errors.InvalidOrder(this.id + ' createOrder() requires a limit price in params["stopLoss"]["price"] or params["stopLoss"]["slOrdPx"] for a stop loss limit order');
1603
+ throw new errors.InvalidOrder(this.id + ' createOrder() requires a limit price in params["stopLoss"]["price"] for a stop loss limit order');
1527
1604
  }
1528
1605
  else {
1529
1606
  request['slOrdPx'] = this.priceToPrecision(symbol, stopLossLimitPrice);
@@ -289,6 +289,72 @@ class onetrading extends onetrading$1 {
289
289
  },
290
290
  'fiat': ['EUR', 'CHF'],
291
291
  },
292
+ 'features': {
293
+ 'spot': {
294
+ 'sandbox': false,
295
+ 'createOrder': {
296
+ 'marginMode': false,
297
+ 'triggerPrice': false,
298
+ 'triggerDirection': false,
299
+ 'triggerPriceType': undefined,
300
+ 'stopLossPrice': false,
301
+ 'takeProfitPrice': false,
302
+ 'attachedStopLossTakeProfit': undefined,
303
+ 'timeInForce': {
304
+ 'IOC': true,
305
+ 'FOK': true,
306
+ 'PO': true,
307
+ 'GTD': false,
308
+ },
309
+ 'hedged': false,
310
+ 'trailing': false,
311
+ 'leverage': false,
312
+ 'marketBuyByCost': false,
313
+ 'marketBuyRequiresPrice': false,
314
+ 'selfTradePrevention': false,
315
+ 'iceberg': false,
316
+ },
317
+ 'createOrders': undefined,
318
+ 'fetchMyTrades': {
319
+ 'marginMode': false,
320
+ 'limit': 100,
321
+ 'daysBack': 100000,
322
+ 'untilDays': 100000, // todo
323
+ },
324
+ 'fetchOrder': {
325
+ 'marginMode': false,
326
+ 'trigger': false,
327
+ 'trailing': false,
328
+ },
329
+ 'fetchOpenOrders': {
330
+ 'marginMode': false,
331
+ 'limit': 100,
332
+ 'trigger': false,
333
+ 'trailing': false,
334
+ },
335
+ 'fetchOrders': undefined,
336
+ 'fetchClosedOrders': {
337
+ 'marginMode': false,
338
+ 'limit': 100,
339
+ 'daysBack': 100000,
340
+ 'daysBackCanceled': 1 / 12,
341
+ 'untilDays': 100000,
342
+ 'trigger': false,
343
+ 'trailing': false,
344
+ },
345
+ 'fetchOHLCV': {
346
+ 'limit': 5000,
347
+ },
348
+ },
349
+ 'swap': {
350
+ 'linear': undefined,
351
+ 'inverse': undefined,
352
+ },
353
+ 'future': {
354
+ 'linear': undefined,
355
+ 'inverse': undefined,
356
+ },
357
+ },
292
358
  });
293
359
  }
294
360
  /**
@@ -116,6 +116,7 @@ class oxfun extends oxfun$1 {
116
116
  'reduceMargin': false,
117
117
  'repayCrossMargin': false,
118
118
  'repayIsolatedMargin': false,
119
+ 'sandbox': true,
119
120
  'setLeverage': false,
120
121
  'setMargin': false,
121
122
  'setMarginMode': false,
@@ -242,6 +243,71 @@ class oxfun extends oxfun$1 {
242
243
  'Optimism': 'OPTIMISM',
243
244
  },
244
245
  },
246
+ 'features': {
247
+ 'default': {
248
+ 'sandbox': true,
249
+ 'createOrder': {
250
+ 'marginMode': false,
251
+ 'triggerPrice': true,
252
+ 'triggerDirection': false,
253
+ 'triggerPriceType': undefined,
254
+ 'stopLossPrice': false,
255
+ 'takeProfitPrice': false,
256
+ 'attachedStopLossTakeProfit': undefined,
257
+ 'timeInForce': {
258
+ 'IOC': true,
259
+ 'FOK': true,
260
+ 'PO': true,
261
+ 'GTD': false,
262
+ },
263
+ 'hedged': false,
264
+ 'trailing': false,
265
+ 'leverage': false,
266
+ 'marketBuyByCost': true,
267
+ 'marketBuyRequiresPrice': false,
268
+ 'selfTradePrevention': true,
269
+ 'iceberg': true, // todo
270
+ },
271
+ 'createOrders': {
272
+ 'max': 10, // todo
273
+ },
274
+ 'fetchMyTrades': {
275
+ 'marginMode': false,
276
+ 'limit': 500,
277
+ 'daysBack': 100000,
278
+ 'untilDays': 7,
279
+ },
280
+ 'fetchOrder': {
281
+ 'marginMode': false,
282
+ 'trigger': false,
283
+ 'trailing': false,
284
+ },
285
+ 'fetchOpenOrders': {
286
+ 'marginMode': false,
287
+ 'limit': undefined,
288
+ 'trigger': false,
289
+ 'trailing': false,
290
+ },
291
+ 'fetchOrders': undefined,
292
+ 'fetchClosedOrders': undefined,
293
+ 'fetchOHLCV': {
294
+ 'limit': 500,
295
+ },
296
+ },
297
+ 'spot': {
298
+ 'extends': 'default',
299
+ },
300
+ 'swap': {
301
+ 'linear': {
302
+ 'extends': 'default',
303
+ },
304
+ 'inverse': undefined,
305
+ },
306
+ 'future': {
307
+ 'linear': undefined,
308
+ 'inverse': undefined,
309
+ },
310
+ },
245
311
  'exceptions': {
246
312
  'exact': {
247
313
  '-0010': errors.OperationFailed,
@@ -75,7 +75,7 @@ class p2b extends p2b$1 {
75
75
  'fetchOpenOrders': true,
76
76
  'fetchOrderBook': true,
77
77
  'fetchOrderBooks': false,
78
- 'fetchOrders': true,
78
+ 'fetchOrders': false,
79
79
  'fetchOrderTrades': true,
80
80
  'fetchPosition': false,
81
81
  'fetchPositionHistory': false,
@@ -182,6 +182,68 @@ class p2b extends p2b$1 {
182
182
  ],
183
183
  },
184
184
  },
185
+ 'features': {
186
+ 'spot': {
187
+ 'sandbox': false,
188
+ 'createOrder': {
189
+ 'marginMode': false,
190
+ 'triggerPrice': false,
191
+ 'triggerDirection': false,
192
+ 'triggerPriceType': undefined,
193
+ 'stopLossPrice': false,
194
+ 'takeProfitPrice': false,
195
+ 'attachedStopLossTakeProfit': undefined,
196
+ 'timeInForce': {
197
+ 'IOC': true,
198
+ 'FOK': true,
199
+ 'PO': true,
200
+ 'GTD': false,
201
+ },
202
+ 'hedged': false,
203
+ 'trailing': false,
204
+ 'leverage': false,
205
+ 'marketBuyByCost': false,
206
+ 'marketBuyRequiresPrice': false,
207
+ 'selfTradePrevention': false,
208
+ 'iceberg': false,
209
+ },
210
+ 'createOrders': undefined,
211
+ 'fetchMyTrades': {
212
+ 'marginMode': false,
213
+ 'limit': 100,
214
+ 'daysBack': 100000,
215
+ 'untilDays': 1,
216
+ },
217
+ 'fetchOrder': undefined,
218
+ 'fetchOpenOrders': {
219
+ 'marginMode': false,
220
+ 'limit': 100,
221
+ 'trigger': false,
222
+ 'trailing': false,
223
+ },
224
+ 'fetchOrders': undefined,
225
+ 'fetchClosedOrders': {
226
+ 'marginMode': false,
227
+ 'limit': 100,
228
+ 'daysBack': 100000,
229
+ 'daysBackCanceled': 1 / 12,
230
+ 'untilDays': 1,
231
+ 'trigger': false,
232
+ 'trailing': false,
233
+ },
234
+ 'fetchOHLCV': {
235
+ 'limit': 500,
236
+ },
237
+ },
238
+ 'swap': {
239
+ 'linear': undefined,
240
+ 'inverse': undefined,
241
+ },
242
+ 'future': {
243
+ 'linear': undefined,
244
+ 'inverse': undefined,
245
+ },
246
+ },
185
247
  'commonCurrencies': {},
186
248
  'precisionMode': number.TICK_SIZE,
187
249
  'exceptions': {
@@ -276,6 +276,74 @@ class paradex extends paradex$1 {
276
276
  'paradexAccount': undefined,
277
277
  'broker': 'CCXT',
278
278
  },
279
+ 'features': {
280
+ 'spot': undefined,
281
+ 'forSwap': {
282
+ 'sandbox': true,
283
+ 'createOrder': {
284
+ 'marginMode': false,
285
+ 'triggerPrice': true,
286
+ 'triggerDirection': true,
287
+ 'triggerPriceType': undefined,
288
+ 'stopLossPrice': false,
289
+ 'takeProfitPrice': false,
290
+ 'attachedStopLossTakeProfit': undefined,
291
+ 'timeInForce': {
292
+ 'IOC': true,
293
+ 'FOK': false,
294
+ 'PO': true,
295
+ 'GTD': false,
296
+ },
297
+ 'hedged': false,
298
+ 'trailing': false,
299
+ 'leverage': false,
300
+ 'marketBuyByCost': false,
301
+ 'marketBuyRequiresPrice': false,
302
+ 'selfTradePrevention': true,
303
+ 'iceberg': false,
304
+ },
305
+ 'createOrders': undefined,
306
+ 'fetchMyTrades': {
307
+ 'marginMode': false,
308
+ 'limit': 100,
309
+ 'daysBack': 100000,
310
+ 'untilDays': 100000, // todo
311
+ },
312
+ 'fetchOrder': {
313
+ 'marginMode': false,
314
+ 'trigger': false,
315
+ 'trailing': false,
316
+ },
317
+ 'fetchOpenOrders': {
318
+ 'marginMode': false,
319
+ 'limit': 100,
320
+ 'trigger': false,
321
+ 'trailing': false,
322
+ },
323
+ 'fetchOrders': {
324
+ 'marginMode': false,
325
+ 'limit': 100,
326
+ 'daysBack': 100000,
327
+ 'untilDays': 100000,
328
+ 'trigger': false,
329
+ 'trailing': false,
330
+ },
331
+ 'fetchClosedOrders': undefined,
332
+ 'fetchOHLCV': {
333
+ 'limit': undefined, // todo by from/to
334
+ },
335
+ },
336
+ 'swap': {
337
+ 'linear': {
338
+ 'extends': 'forSwap',
339
+ },
340
+ 'inverse': undefined,
341
+ },
342
+ 'future': {
343
+ 'linear': undefined,
344
+ 'inverse': undefined,
345
+ },
346
+ },
279
347
  });
280
348
  }
281
349
  /**
@@ -101,6 +101,11 @@ class bitmart extends bitmart$1 {
101
101
  }
102
102
  else {
103
103
  messageHash = 'futures/' + channel + ':' + market['id'];
104
+ const speed = this.safeString(params, 'speed');
105
+ if (speed !== undefined) {
106
+ params = this.omit(params, 'speed');
107
+ messageHash += ':' + speed;
108
+ }
104
109
  request = {
105
110
  'action': 'subscribe',
106
111
  'args': [messageHash],
@@ -1208,6 +1213,7 @@ class bitmart extends bitmart$1 {
1208
1213
  * @param {string} symbol unified symbol of the market to fetch the order book for
1209
1214
  * @param {int} [limit] the maximum amount of order book entries to return
1210
1215
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1216
+ * @param {string} [params.speed] *futures only* '100ms' or '200ms'
1211
1217
  * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
1212
1218
  */
1213
1219
  async watchOrderBook(symbol, limit = undefined, params = {}) {
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarketMarginModes, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers, LongShortRatio, OpenInterests } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
7
- declare const version = "4.4.47";
7
+ declare const version = "4.4.48";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.4.48';
41
+ const version = '4.4.49';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
package/js/src/bingx.d.ts CHANGED
@@ -122,6 +122,13 @@ export default class bingx extends Exchange {
122
122
  * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
123
123
  */
124
124
  fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
125
+ parseFundingRateHistory(contract: any, market?: Market): {
126
+ info: any;
127
+ symbol: string;
128
+ fundingRate: number;
129
+ timestamp: number;
130
+ datetime: string;
131
+ };
125
132
  /**
126
133
  * @method
127
134
  * @name bingx#fetchOpenInterest
@@ -753,6 +760,7 @@ export default class bingx extends Exchange {
753
760
  */
754
761
  fetchTradingFee(symbol: string, params?: {}): Promise<TradingFeeInterface>;
755
762
  parseTradingFee(fee: Dict, market?: Market): TradingFeeInterface;
763
+ customEncode(params: any): any;
756
764
  sign(path: any, section?: string, method?: string, params?: {}, headers?: any, body?: any): {
757
765
  url: string;
758
766
  method: string;
package/js/src/bingx.js CHANGED
@@ -824,8 +824,8 @@ export default class bingx extends Exchange {
824
824
  // "symbols": [
825
825
  // {
826
826
  // "symbol": "GEAR-USDT",
827
- // "minQty": 735,
828
- // "maxQty": 2941177,
827
+ // "minQty": 735, // deprecated
828
+ // "maxQty": 2941177, // deprecated
829
829
  // "minNotional": 5,
830
830
  // "maxNotional": 20000,
831
831
  // "status": 1,
@@ -949,6 +949,10 @@ export default class bingx extends Exchange {
949
949
  }
950
950
  const isInverse = (spot) ? undefined : checkIsInverse;
951
951
  const isLinear = (spot) ? undefined : checkIsLinear;
952
+ let minAmount = undefined;
953
+ if (!spot) {
954
+ minAmount = this.safeNumber2(market, 'minQty', 'tradeMinQuantity');
955
+ }
952
956
  let timeOnline = this.safeInteger(market, 'timeOnline');
953
957
  if (timeOnline === 0) {
954
958
  timeOnline = undefined;
@@ -990,8 +994,8 @@ export default class bingx extends Exchange {
990
994
  'max': undefined,
991
995
  },
992
996
  'amount': {
993
- 'min': this.safeNumber2(market, 'minQty', 'tradeMinQuantity'),
994
- 'max': this.safeNumber(market, 'maxQty'),
997
+ 'min': minAmount,
998
+ 'max': undefined,
995
999
  },
996
1000
  'price': {
997
1001
  'min': minTickSize,
@@ -1659,22 +1663,24 @@ export default class bingx extends Exchange {
1659
1663
  // }
1660
1664
  //
1661
1665
  const data = this.safeList(response, 'data', []);
1662
- const rates = [];
1663
- for (let i = 0; i < data.length; i++) {
1664
- const entry = data[i];
1665
- const marketId = this.safeString(entry, 'symbol');
1666
- const symbolInner = this.safeSymbol(marketId, market, '-', 'swap');
1667
- const timestamp = this.safeInteger(entry, 'fundingTime');
1668
- rates.push({
1669
- 'info': entry,
1670
- 'symbol': symbolInner,
1671
- 'fundingRate': this.safeNumber(entry, 'fundingRate'),
1672
- 'timestamp': timestamp,
1673
- 'datetime': this.iso8601(timestamp),
1674
- });
1675
- }
1676
- const sorted = this.sortBy(rates, 'timestamp');
1677
- return this.filterBySymbolSinceLimit(sorted, market['symbol'], since, limit);
1666
+ return this.parseFundingRateHistories(data, market, since, limit);
1667
+ }
1668
+ parseFundingRateHistory(contract, market = undefined) {
1669
+ //
1670
+ // {
1671
+ // "symbol": "BTC-USDT",
1672
+ // "fundingRate": "0.0001",
1673
+ // "fundingTime": 1585684800000
1674
+ // }
1675
+ //
1676
+ const timestamp = this.safeInteger(contract, 'fundingTime');
1677
+ return {
1678
+ 'info': contract,
1679
+ 'symbol': this.safeSymbol(this.safeString(contract, 'symbol'), market, '-', 'swap'),
1680
+ 'fundingRate': this.safeNumber(contract, 'fundingRate'),
1681
+ 'timestamp': timestamp,
1682
+ 'datetime': this.iso8601(timestamp),
1683
+ };
1678
1684
  }
1679
1685
  /**
1680
1686
  * @method
@@ -2346,12 +2352,14 @@ export default class bingx extends Exchange {
2346
2352
  else {
2347
2353
  const linearSwapData = this.safeDict(response, 'data', {});
2348
2354
  const linearSwapBalance = this.safeDict(linearSwapData, 'balance');
2349
- const currencyId = this.safeString(linearSwapBalance, 'asset');
2350
- const code = this.safeCurrencyCode(currencyId);
2351
- const account = this.account();
2352
- account['free'] = this.safeString(linearSwapBalance, 'availableMargin');
2353
- account['used'] = this.safeString(linearSwapBalance, 'usedMargin');
2354
- result[code] = account;
2355
+ if (linearSwapBalance) {
2356
+ const currencyId = this.safeString(linearSwapBalance, 'asset');
2357
+ const code = this.safeCurrencyCode(currencyId);
2358
+ const account = this.account();
2359
+ account['free'] = this.safeString(linearSwapBalance, 'availableMargin');
2360
+ account['used'] = this.safeString(linearSwapBalance, 'usedMargin');
2361
+ result[code] = account;
2362
+ }
2355
2363
  }
2356
2364
  return this.safeBalance(result);
2357
2365
  }
@@ -6455,6 +6463,48 @@ export default class bingx extends Exchange {
6455
6463
  'tierBased': false,
6456
6464
  };
6457
6465
  }
6466
+ customEncode(params) {
6467
+ const sortedParams = this.keysort(params);
6468
+ const keys = Object.keys(sortedParams);
6469
+ let adjustedValue = undefined;
6470
+ let result = undefined;
6471
+ for (let i = 0; i < keys.length; i++) {
6472
+ const key = keys[i];
6473
+ let value = sortedParams[key];
6474
+ if (Array.isArray(value)) {
6475
+ let arrStr = undefined;
6476
+ for (let j = 0; j < value.length; j++) {
6477
+ const arrayElement = value[j];
6478
+ const isString = (typeof arrayElement === 'string');
6479
+ if (isString) {
6480
+ if (j > 0) {
6481
+ arrStr += ',' + '"' + arrayElement.toString() + '"';
6482
+ }
6483
+ else {
6484
+ arrStr = '"' + arrayElement.toString() + '"';
6485
+ }
6486
+ }
6487
+ else {
6488
+ if (j > 0) {
6489
+ arrStr += ',' + arrayElement.toString();
6490
+ }
6491
+ else {
6492
+ arrStr = arrayElement.toString();
6493
+ }
6494
+ }
6495
+ }
6496
+ adjustedValue = '[' + arrStr + ']';
6497
+ value = adjustedValue;
6498
+ }
6499
+ if (i === 0) {
6500
+ result = key + '=' + value;
6501
+ }
6502
+ else {
6503
+ result += '&' + key + '=' + value;
6504
+ }
6505
+ }
6506
+ return result;
6507
+ }
6458
6508
  sign(path, section = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
6459
6509
  let type = section[0];
6460
6510
  let version = section[1];
@@ -6490,16 +6540,24 @@ export default class bingx extends Exchange {
6490
6540
  else if (access === 'private') {
6491
6541
  this.checkRequiredCredentials();
6492
6542
  const isJsonContentType = (((type === 'subAccount') || (type === 'account/transfer')) && (method === 'POST'));
6493
- const parsedParams = this.parseParams(params);
6494
- const signature = this.hmac(this.encode(this.rawencode(parsedParams)), this.encode(this.secret), sha256);
6543
+ let parsedParams = undefined;
6544
+ let encodeRequest = undefined;
6545
+ if (isJsonContentType) {
6546
+ encodeRequest = this.customEncode(params);
6547
+ }
6548
+ else {
6549
+ parsedParams = this.parseParams(params);
6550
+ encodeRequest = this.rawencode(parsedParams);
6551
+ }
6552
+ const signature = this.hmac(this.encode(encodeRequest), this.encode(this.secret), sha256);
6495
6553
  headers = {
6496
6554
  'X-BX-APIKEY': this.apiKey,
6497
6555
  'X-SOURCE-KEY': this.safeString(this.options, 'broker', 'CCXT'),
6498
6556
  };
6499
6557
  if (isJsonContentType) {
6500
6558
  headers['Content-Type'] = 'application/json';
6501
- parsedParams['signature'] = signature;
6502
- body = this.json(parsedParams);
6559
+ params['signature'] = signature;
6560
+ body = this.json(params);
6503
6561
  }
6504
6562
  else {
6505
6563
  const query = this.urlencode(parsedParams);
@@ -226,6 +226,7 @@ export default class bitget extends Exchange {
226
226
  * @param {int} [limit] the maximum amount of candles to fetch
227
227
  * @param {object} [params] extra parameters specific to the exchange API endpoint
228
228
  * @param {int} [params.until] timestamp in ms of the latest candle to fetch
229
+ * @param {boolean} [params.useHistoryEndpoint] whether to force to use historical endpoint (it has max limit of 200)
229
230
  * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
230
231
  * @param {string} [params.price] *swap only* "mark" (to fetch mark price candles) or "index" (to fetch index price candles)
231
232
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume