ccxt 4.4.91 → 4.4.93

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 (64) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +2 -2
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/ascendex.js +9 -8
  5. package/dist/cjs/src/base/Exchange.js +81 -33
  6. package/dist/cjs/src/binance.js +44 -1
  7. package/dist/cjs/src/bitmart.js +7 -0
  8. package/dist/cjs/src/bitmex.js +4 -4
  9. package/dist/cjs/src/bitvavo.js +10 -1
  10. package/dist/cjs/src/bybit.js +83 -8
  11. package/dist/cjs/src/coinbaseexchange.js +53 -0
  12. package/dist/cjs/src/coincheck.js +47 -4
  13. package/dist/cjs/src/coinex.js +19 -14
  14. package/dist/cjs/src/cryptomus.js +30 -53
  15. package/dist/cjs/src/deribit.js +6 -6
  16. package/dist/cjs/src/exmo.js +72 -59
  17. package/dist/cjs/src/htx.js +1 -1
  18. package/dist/cjs/src/hyperliquid.js +3 -2
  19. package/dist/cjs/src/krakenfutures.js +1 -1
  20. package/dist/cjs/src/kucoin.js +13 -15
  21. package/dist/cjs/src/latoken.js +19 -74
  22. package/dist/cjs/src/lbank.js +118 -34
  23. package/dist/cjs/src/okx.js +158 -2
  24. package/dist/cjs/src/paradex.js +54 -0
  25. package/dist/cjs/src/phemex.js +3 -3
  26. package/dist/cjs/src/pro/bitstamp.js +55 -16
  27. package/dist/cjs/src/pro/bybit.js +6 -7
  28. package/js/ccxt.d.ts +1 -1
  29. package/js/ccxt.js +1 -1
  30. package/js/src/abstract/lbank.d.ts +1 -0
  31. package/js/src/ascendex.js +9 -8
  32. package/js/src/base/Exchange.d.ts +5 -1
  33. package/js/src/base/Exchange.js +81 -33
  34. package/js/src/binance.d.ts +10 -0
  35. package/js/src/binance.js +44 -1
  36. package/js/src/bitmart.d.ts +7 -0
  37. package/js/src/bitmart.js +7 -0
  38. package/js/src/bitmex.d.ts +1 -1
  39. package/js/src/bitmex.js +4 -4
  40. package/js/src/bitvavo.js +10 -1
  41. package/js/src/bybit.d.ts +12 -1
  42. package/js/src/bybit.js +83 -8
  43. package/js/src/coinbaseexchange.js +53 -0
  44. package/js/src/coincheck.js +48 -5
  45. package/js/src/coinex.js +16 -13
  46. package/js/src/cryptomus.js +30 -53
  47. package/js/src/deribit.js +6 -6
  48. package/js/src/exmo.js +72 -59
  49. package/js/src/htx.js +1 -1
  50. package/js/src/hyperliquid.js +3 -2
  51. package/js/src/krakenfutures.js +1 -1
  52. package/js/src/kucoin.js +13 -15
  53. package/js/src/latoken.d.ts +0 -1
  54. package/js/src/latoken.js +19 -74
  55. package/js/src/lbank.d.ts +9 -1
  56. package/js/src/lbank.js +118 -34
  57. package/js/src/okx.d.ts +13 -1
  58. package/js/src/okx.js +158 -2
  59. package/js/src/paradex.d.ts +10 -0
  60. package/js/src/paradex.js +54 -0
  61. package/js/src/phemex.js +3 -3
  62. package/js/src/pro/bitstamp.js +55 -16
  63. package/js/src/pro/bybit.js +7 -8
  64. package/package.json +1 -1
@@ -841,6 +841,12 @@ export default class Exchange {
841
841
  return hexData;
842
842
  }
843
843
  }
844
+ mapToSafeMap(dict) {
845
+ return dict; // wrapper for go
846
+ }
847
+ safeMapToMap(dict) {
848
+ return dict; // wrapper for go
849
+ }
844
850
  spawn(method, ...args) {
845
851
  const future = Future();
846
852
  // using setTimeout 0 to force the execution to run after the future is returned
@@ -2801,14 +2807,14 @@ export default class Exchange {
2801
2807
  }
2802
2808
  values.push(market);
2803
2809
  }
2804
- this.markets = this.indexBy(values, 'symbol');
2810
+ this.markets = this.mapToSafeMap(this.indexBy(values, 'symbol'));
2805
2811
  const marketsSortedBySymbol = this.keysort(this.markets);
2806
2812
  const marketsSortedById = this.keysort(this.markets_by_id);
2807
2813
  this.symbols = Object.keys(marketsSortedBySymbol);
2808
2814
  this.ids = Object.keys(marketsSortedById);
2809
2815
  if (currencies !== undefined) {
2810
2816
  // currencies is always undefined when called in constructor but not when called from loadMarkets
2811
- this.currencies = this.deepExtend(this.currencies, currencies);
2817
+ this.currencies = this.mapToSafeMap(this.deepExtend(this.currencies, currencies));
2812
2818
  }
2813
2819
  else {
2814
2820
  let baseCurrencies = [];
@@ -2838,8 +2844,8 @@ export default class Exchange {
2838
2844
  }
2839
2845
  baseCurrencies = this.sortBy(baseCurrencies, 'code', false, '');
2840
2846
  quoteCurrencies = this.sortBy(quoteCurrencies, 'code', false, '');
2841
- this.baseCurrencies = this.indexBy(baseCurrencies, 'code');
2842
- this.quoteCurrencies = this.indexBy(quoteCurrencies, 'code');
2847
+ this.baseCurrencies = this.mapToSafeMap(this.indexBy(baseCurrencies, 'code'));
2848
+ this.quoteCurrencies = this.mapToSafeMap(this.indexBy(quoteCurrencies, 'code'));
2843
2849
  const allCurrencies = this.arrayConcat(baseCurrencies, quoteCurrencies);
2844
2850
  const groupedCurrencies = this.groupBy(allCurrencies, 'code');
2845
2851
  const codes = Object.keys(groupedCurrencies);
@@ -2860,7 +2866,7 @@ export default class Exchange {
2860
2866
  resultingCurrencies.push(highestPrecisionCurrency);
2861
2867
  }
2862
2868
  const sortedCurrencies = this.sortBy(resultingCurrencies, 'code');
2863
- this.currencies = this.deepExtend(this.currencies, this.indexBy(sortedCurrencies, 'code'));
2869
+ this.currencies = this.mapToSafeMap(this.deepExtend(this.currencies, this.indexBy(sortedCurrencies, 'code')));
2864
2870
  }
2865
2871
  this.currencies_by_id = this.indexBySafe(this.currencies, 'id');
2866
2872
  const currenciesSortedByCode = this.keysort(this.currencies);
@@ -4000,7 +4006,7 @@ export default class Exchange {
4000
4006
  return this.filterBySinceLimit(sorted, since, limit, 0, tail);
4001
4007
  }
4002
4008
  parseLeverageTiers(response, symbols = undefined, marketIdKey = undefined) {
4003
- // marketIdKey should only be undefined when response is a dictionary
4009
+ // marketIdKey should only be undefined when response is a dictionary.
4004
4010
  symbols = this.marketSymbols(symbols);
4005
4011
  const tiers = {};
4006
4012
  let symbolsLength = 0;
@@ -5438,6 +5444,9 @@ export default class Exchange {
5438
5444
  async fetchGreeks(symbol, params = {}) {
5439
5445
  throw new NotSupported(this.id + ' fetchGreeks() is not supported yet');
5440
5446
  }
5447
+ async fetchAllGreeks(symbols = undefined, params = {}) {
5448
+ throw new NotSupported(this.id + ' fetchAllGreeks() is not supported yet');
5449
+ }
5441
5450
  async fetchOptionChain(code, params = {}) {
5442
5451
  throw new NotSupported(this.id + ' fetchOptionChain() is not supported yet');
5443
5452
  }
@@ -5732,11 +5741,20 @@ export default class Exchange {
5732
5741
  if (precisionNumber === 0) {
5733
5742
  return '1';
5734
5743
  }
5735
- let parsedPrecision = '0.';
5736
- for (let i = 0; i < precisionNumber - 1; i++) {
5737
- parsedPrecision = parsedPrecision + '0';
5744
+ if (precisionNumber > 0) {
5745
+ let parsedPrecision = '0.';
5746
+ for (let i = 0; i < precisionNumber - 1; i++) {
5747
+ parsedPrecision = parsedPrecision + '0';
5748
+ }
5749
+ return parsedPrecision + '1';
5750
+ }
5751
+ else {
5752
+ let parsedPrecision = '1';
5753
+ for (let i = 0; i < precisionNumber * -1 - 1; i++) {
5754
+ parsedPrecision = parsedPrecision + '0';
5755
+ }
5756
+ return parsedPrecision + '0';
5738
5757
  }
5739
- return parsedPrecision + '1';
5740
5758
  }
5741
5759
  integerPrecisionToAmount(precision) {
5742
5760
  /**
@@ -6893,6 +6911,31 @@ export default class Exchange {
6893
6911
  parseGreeks(greeks, market = undefined) {
6894
6912
  throw new NotSupported(this.id + ' parseGreeks () is not supported yet');
6895
6913
  }
6914
+ parseAllGreeks(greeks, symbols = undefined, params = {}) {
6915
+ //
6916
+ // the value of greeks is either a dict or a list
6917
+ //
6918
+ const results = [];
6919
+ if (Array.isArray(greeks)) {
6920
+ for (let i = 0; i < greeks.length; i++) {
6921
+ const parsedTicker = this.parseGreeks(greeks[i]);
6922
+ const greek = this.extend(parsedTicker, params);
6923
+ results.push(greek);
6924
+ }
6925
+ }
6926
+ else {
6927
+ const marketIds = Object.keys(greeks);
6928
+ for (let i = 0; i < marketIds.length; i++) {
6929
+ const marketId = marketIds[i];
6930
+ const market = this.safeMarket(marketId);
6931
+ const parsed = this.parseGreeks(greeks[marketId], market);
6932
+ const greek = this.extend(parsed, params);
6933
+ results.push(greek);
6934
+ }
6935
+ }
6936
+ symbols = this.marketSymbols(symbols);
6937
+ return this.filterByArray(results, 'symbol', symbols);
6938
+ }
6896
6939
  parseOption(chain, currency = undefined, market = undefined) {
6897
6940
  throw new NotSupported(this.id + ' parseOption () is not supported yet');
6898
6941
  }
@@ -7033,7 +7076,7 @@ export default class Exchange {
7033
7076
  return reconstructedDate;
7034
7077
  }
7035
7078
  convertMarketIdExpireDate(date) {
7036
- // parse 03JAN24 to 240103
7079
+ // parse 03JAN24 to 240103.
7037
7080
  const monthMappping = {
7038
7081
  'JAN': '01',
7039
7082
  'FEB': '02',
@@ -7131,16 +7174,35 @@ export default class Exchange {
7131
7174
  */
7132
7175
  throw new NotSupported(this.id + ' fetchTransfers () is not supported yet');
7133
7176
  }
7134
- cleanUnsubscription(client, subHash, unsubHash) {
7177
+ cleanUnsubscription(client, subHash, unsubHash, subHashIsPrefix = false) {
7135
7178
  if (unsubHash in client.subscriptions) {
7136
7179
  delete client.subscriptions[unsubHash];
7137
7180
  }
7138
- if (subHash in client.subscriptions) {
7139
- delete client.subscriptions[subHash];
7181
+ if (!subHashIsPrefix) {
7182
+ if (subHash in client.subscriptions) {
7183
+ delete client.subscriptions[subHash];
7184
+ }
7185
+ if (subHash in client.futures) {
7186
+ const error = new UnsubscribeError(this.id + ' ' + subHash);
7187
+ client.reject(error, subHash);
7188
+ }
7140
7189
  }
7141
- if (subHash in client.futures) {
7142
- const error = new UnsubscribeError(this.id + ' ' + subHash);
7143
- client.reject(error, subHash);
7190
+ else {
7191
+ const clientSubscriptions = Object.keys(client.subscriptions);
7192
+ for (let i = 0; i < clientSubscriptions.length; i++) {
7193
+ const sub = clientSubscriptions[i];
7194
+ if (sub.startsWith(subHash)) {
7195
+ delete client.subscriptions[sub];
7196
+ }
7197
+ }
7198
+ const clientFutures = Object.keys(client.futures);
7199
+ for (let i = 0; i < clientFutures.length; i++) {
7200
+ const future = clientFutures[i];
7201
+ if (future.startsWith(subHash)) {
7202
+ const error = new UnsubscribeError(this.id + ' ' + future);
7203
+ client.reject(error, future);
7204
+ }
7205
+ }
7144
7206
  }
7145
7207
  client.resolve(true, unsubHash);
7146
7208
  }
@@ -7183,24 +7245,10 @@ export default class Exchange {
7183
7245
  }
7184
7246
  else {
7185
7247
  if (topic === 'myTrades' && (this.myTrades !== undefined)) {
7186
- // don't reset this.myTrades directly here
7187
- // because in c# we need to use a different object (thread-safe dict)
7188
- const keys = Object.keys(this.myTrades);
7189
- for (let i = 0; i < keys.length; i++) {
7190
- const key = keys[i];
7191
- if (key in this.myTrades) {
7192
- delete this.myTrades[key];
7193
- }
7194
- }
7248
+ this.myTrades = undefined;
7195
7249
  }
7196
7250
  else if (topic === 'orders' && (this.orders !== undefined)) {
7197
- const orderSymbols = Object.keys(this.orders);
7198
- for (let i = 0; i < orderSymbols.length; i++) {
7199
- const orderSymbol = orderSymbols[i];
7200
- if (orderSymbol in this.orders) {
7201
- delete this.orders[orderSymbol];
7202
- }
7203
- }
7251
+ this.orders = undefined;
7204
7252
  }
7205
7253
  else if (topic === 'ticker' && (this.tickers !== undefined)) {
7206
7254
  const tickerSymbols = Object.keys(this.tickers);
@@ -1496,6 +1496,16 @@ export default class binance extends Exchange {
1496
1496
  * @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
1497
1497
  */
1498
1498
  fetchGreeks(symbol: string, params?: {}): Promise<Greeks>;
1499
+ /**
1500
+ * @method
1501
+ * @name binance#fetchAllGreeks
1502
+ * @description fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
1503
+ * @see https://developers.binance.com/docs/derivatives/option/market-data/Option-Mark-Price
1504
+ * @param {string[]} [symbols] unified symbols of the markets to fetch greeks for, all markets are returned if not assigned
1505
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1506
+ * @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
1507
+ */
1508
+ fetchAllGreeks(symbols?: Strings, params?: {}): Promise<Greeks[]>;
1499
1509
  parseGreeks(greeks: Dict, market?: Market): Greeks;
1500
1510
  fetchTradingLimits(symbols?: Strings, params?: {}): Promise<Dict>;
1501
1511
  /**
package/js/src/binance.js CHANGED
@@ -67,6 +67,7 @@ export default class binance extends Exchange {
67
67
  'editOrder': true,
68
68
  'editOrders': true,
69
69
  'fetchAccounts': undefined,
70
+ 'fetchAllGreeks': true,
70
71
  'fetchBalance': true,
71
72
  'fetchBidsAsks': true,
72
73
  'fetchBorrowInterest': true,
@@ -11540,6 +11541,7 @@ export default class binance extends Exchange {
11540
11541
  const request = {};
11541
11542
  if (symbol !== undefined) {
11542
11543
  request['symbol'] = market['id'];
11544
+ symbol = market['symbol'];
11543
11545
  }
11544
11546
  if (since !== undefined) {
11545
11547
  request['startTime'] = since;
@@ -11570,7 +11572,7 @@ export default class binance extends Exchange {
11570
11572
  //
11571
11573
  const settlements = this.parseSettlements(response, market);
11572
11574
  const sorted = this.sortBy(settlements, 'timestamp');
11573
- return this.filterBySymbolSinceLimit(sorted, market['symbol'], since, limit);
11575
+ return this.filterBySymbolSinceLimit(sorted, symbol, since, limit);
11574
11576
  }
11575
11577
  parseSettlement(settlement, market) {
11576
11578
  //
@@ -13335,6 +13337,47 @@ export default class binance extends Exchange {
13335
13337
  //
13336
13338
  return this.parseGreeks(response[0], market);
13337
13339
  }
13340
+ /**
13341
+ * @method
13342
+ * @name binance#fetchAllGreeks
13343
+ * @description fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
13344
+ * @see https://developers.binance.com/docs/derivatives/option/market-data/Option-Mark-Price
13345
+ * @param {string[]} [symbols] unified symbols of the markets to fetch greeks for, all markets are returned if not assigned
13346
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
13347
+ * @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
13348
+ */
13349
+ async fetchAllGreeks(symbols = undefined, params = {}) {
13350
+ await this.loadMarkets();
13351
+ symbols = this.marketSymbols(symbols, undefined, true, true, true);
13352
+ const request = {};
13353
+ let market = undefined;
13354
+ if (symbols !== undefined) {
13355
+ const symbolsLength = symbols.length;
13356
+ if (symbolsLength === 1) {
13357
+ market = this.market(symbols[0]);
13358
+ request['symbol'] = market['id'];
13359
+ }
13360
+ }
13361
+ const response = await this.eapiPublicGetMark(this.extend(request, params));
13362
+ //
13363
+ // [
13364
+ // {
13365
+ // "symbol": "BTC-231229-40000-C",
13366
+ // "markPrice": "2012",
13367
+ // "bidIV": "0.60236275",
13368
+ // "askIV": "0.62267244",
13369
+ // "markIV": "0.6125176",
13370
+ // "delta": "0.39111646",
13371
+ // "theta": "-32.13948531",
13372
+ // "gamma": "0.00004656",
13373
+ // "vega": "51.70062218",
13374
+ // "highPriceLimit": "6474",
13375
+ // "lowPriceLimit": "5"
13376
+ // }
13377
+ // ]
13378
+ //
13379
+ return this.parseAllGreeks(response, symbols);
13380
+ }
13338
13381
  parseGreeks(greeks, market = undefined) {
13339
13382
  //
13340
13383
  // {
@@ -167,6 +167,7 @@ export default class bitmart extends Exchange {
167
167
  * @param {object} [params] extra parameters specific to the exchange API endpoint
168
168
  * @param {int} [params.until] the latest time in ms to fetch trades for
169
169
  * @param {boolean} [params.marginMode] *spot* whether to fetch trades for margin orders or spot orders, defaults to spot orders (only isolated margin orders are supported)
170
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
170
171
  * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
171
172
  */
172
173
  fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
@@ -180,6 +181,7 @@ export default class bitmart extends Exchange {
180
181
  * @param {int} [since] the earliest time in ms to fetch trades for
181
182
  * @param {int} [limit] the maximum number of trades to retrieve
182
183
  * @param {object} [params] extra parameters specific to the exchange API endpoint
184
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
183
185
  * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
184
186
  */
185
187
  fetchOrderTrades(id: string, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
@@ -252,6 +254,7 @@ export default class bitmart extends Exchange {
252
254
  * @param {string} [params.stopLossPrice] *swap only* the price to trigger a stop-loss order
253
255
  * @param {string} [params.takeProfitPrice] *swap only* the price to trigger a take-profit order
254
256
  * @param {int} [params.plan_category] *swap tp/sl only* 1: tp/sl, 2: position tp/sl, default is 1
257
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
255
258
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
256
259
  */
257
260
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
@@ -262,6 +265,7 @@ export default class bitmart extends Exchange {
262
265
  * @see https://developer-pro.bitmart.com/en/spot/#new-batch-order-v4-signed
263
266
  * @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
264
267
  * @param {object} [params] extra parameters specific to the exchange API endpoint
268
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
265
269
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
266
270
  */
267
271
  createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
@@ -328,6 +332,7 @@ export default class bitmart extends Exchange {
328
332
  * @param {string} [params.orderType] *swap only* 'limit', 'market', or 'trailing'
329
333
  * @param {boolean} [params.trailing] *swap only* set to true if you want to fetch trailing orders
330
334
  * @param {boolean} [params.trigger] *swap only* set to true if you want to fetch trigger orders
335
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
331
336
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
332
337
  */
333
338
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
@@ -343,6 +348,7 @@ export default class bitmart extends Exchange {
343
348
  * @param {object} [params] extra parameters specific to the exchange API endpoint
344
349
  * @param {int} [params.until] timestamp in ms of the latest entry
345
350
  * @param {string} [params.marginMode] *spot only* 'cross' or 'isolated', for margin trading
351
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
346
352
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
347
353
  */
348
354
  fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
@@ -370,6 +376,7 @@ export default class bitmart extends Exchange {
370
376
  * @param {string} [params.clientOrderId] *spot* fetch the order by client order id instead of order id
371
377
  * @param {string} [params.orderType] *swap only* 'limit', 'market', 'liquidate', 'bankruptcy', 'adl' or 'trailing'
372
378
  * @param {boolean} [params.trailing] *swap only* set to true if you want to fetch a trailing order
379
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
373
380
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
374
381
  */
375
382
  fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
package/js/src/bitmart.js CHANGED
@@ -2211,6 +2211,7 @@ export default class bitmart extends Exchange {
2211
2211
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2212
2212
  * @param {int} [params.until] the latest time in ms to fetch trades for
2213
2213
  * @param {boolean} [params.marginMode] *spot* whether to fetch trades for margin orders or spot orders, defaults to spot orders (only isolated margin orders are supported)
2214
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
2214
2215
  * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
2215
2216
  */
2216
2217
  async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -2326,6 +2327,7 @@ export default class bitmart extends Exchange {
2326
2327
  * @param {int} [since] the earliest time in ms to fetch trades for
2327
2328
  * @param {int} [limit] the maximum number of trades to retrieve
2328
2329
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2330
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
2329
2331
  * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
2330
2332
  */
2331
2333
  async fetchOrderTrades(id, symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -2787,6 +2789,7 @@ export default class bitmart extends Exchange {
2787
2789
  * @param {string} [params.stopLossPrice] *swap only* the price to trigger a stop-loss order
2788
2790
  * @param {string} [params.takeProfitPrice] *swap only* the price to trigger a take-profit order
2789
2791
  * @param {int} [params.plan_category] *swap tp/sl only* 1: tp/sl, 2: position tp/sl, default is 1
2792
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
2790
2793
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2791
2794
  */
2792
2795
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
@@ -2857,6 +2860,7 @@ export default class bitmart extends Exchange {
2857
2860
  * @see https://developer-pro.bitmart.com/en/spot/#new-batch-order-v4-signed
2858
2861
  * @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
2859
2862
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2863
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
2860
2864
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2861
2865
  */
2862
2866
  async createOrders(orders, params = {}) {
@@ -3441,6 +3445,7 @@ export default class bitmart extends Exchange {
3441
3445
  * @param {string} [params.orderType] *swap only* 'limit', 'market', or 'trailing'
3442
3446
  * @param {boolean} [params.trailing] *swap only* set to true if you want to fetch trailing orders
3443
3447
  * @param {boolean} [params.trigger] *swap only* set to true if you want to fetch trigger orders
3448
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
3444
3449
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
3445
3450
  */
3446
3451
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -3567,6 +3572,7 @@ export default class bitmart extends Exchange {
3567
3572
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3568
3573
  * @param {int} [params.until] timestamp in ms of the latest entry
3569
3574
  * @param {string} [params.marginMode] *spot only* 'cross' or 'isolated', for margin trading
3575
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
3570
3576
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
3571
3577
  */
3572
3578
  async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -3635,6 +3641,7 @@ export default class bitmart extends Exchange {
3635
3641
  * @param {string} [params.clientOrderId] *spot* fetch the order by client order id instead of order id
3636
3642
  * @param {string} [params.orderType] *swap only* 'limit', 'market', 'liquidate', 'bankruptcy', 'adl' or 'trailing'
3637
3643
  * @param {boolean} [params.trailing] *swap only* set to true if you want to fetch a trailing order
3644
+ * @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
3638
3645
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3639
3646
  */
3640
3647
  async fetchOrder(id, symbol = undefined, params = {}) {
@@ -206,7 +206,7 @@ export default class bitmex extends Exchange {
206
206
  * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
207
207
  * @param {object} [params] extra parameters specific to the exchange API endpoint
208
208
  * @param {object} [params.triggerPrice] the price at which a trigger order is triggered at
209
- * @param {object} [params.triggerDirection] the direction whenever the trigger happens with relation to price - 'above' or 'below'
209
+ * @param {object} [params.triggerDirection] the direction whenever the trigger happens with relation to price - 'ascending' or 'descending'
210
210
  * @param {float} [params.trailingAmount] the quote amount to trail away from the current market price
211
211
  * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
212
212
  */
package/js/src/bitmex.js CHANGED
@@ -38,7 +38,6 @@ export default class bitmex extends Exchange {
38
38
  'swap': true,
39
39
  'future': true,
40
40
  'option': false,
41
- 'index': true,
42
41
  'addMargin': undefined,
43
42
  'cancelAllOrders': true,
44
43
  'cancelAllOrdersAfter': true,
@@ -94,6 +93,7 @@ export default class bitmex extends Exchange {
94
93
  'fetchTransactions': 'emulated',
95
94
  'fetchTransfer': false,
96
95
  'fetchTransfers': false,
96
+ 'index': true,
97
97
  'reduceMargin': undefined,
98
98
  'sandbox': true,
99
99
  'setLeverage': true,
@@ -1990,7 +1990,7 @@ export default class bitmex extends Exchange {
1990
1990
  * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1991
1991
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1992
1992
  * @param {object} [params.triggerPrice] the price at which a trigger order is triggered at
1993
- * @param {object} [params.triggerDirection] the direction whenever the trigger happens with relation to price - 'above' or 'below'
1993
+ * @param {object} [params.triggerDirection] the direction whenever the trigger happens with relation to price - 'ascending' or 'descending'
1994
1994
  * @param {float} [params.trailingAmount] the quote amount to trail away from the current market price
1995
1995
  * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1996
1996
  */
@@ -2020,7 +2020,7 @@ export default class bitmex extends Exchange {
2020
2020
  const isTrailingAmountOrder = trailingAmount !== undefined;
2021
2021
  if (isTriggerOrder || isTrailingAmountOrder) {
2022
2022
  const triggerDirection = this.safeString(params, 'triggerDirection');
2023
- const triggerAbove = (triggerDirection === 'above');
2023
+ const triggerAbove = ((triggerDirection === 'ascending') || (triggerDirection === 'above'));
2024
2024
  if ((type === 'limit') || (type === 'market')) {
2025
2025
  this.checkRequiredArgument('createOrder', triggerDirection, 'triggerDirection', ['above', 'below']);
2026
2026
  }
@@ -2077,7 +2077,7 @@ export default class bitmex extends Exchange {
2077
2077
  const isTrailingAmountOrder = trailingAmount !== undefined;
2078
2078
  if (isTrailingAmountOrder) {
2079
2079
  const triggerDirection = this.safeString(params, 'triggerDirection');
2080
- const triggerAbove = (triggerDirection === 'above');
2080
+ const triggerAbove = ((triggerDirection === 'ascending') || (triggerDirection === 'above'));
2081
2081
  if ((type === 'limit') || (type === 'market')) {
2082
2082
  this.checkRequiredArgument('createOrder', triggerDirection, 'triggerDirection', ['above', 'below']);
2083
2083
  }
package/js/src/bitvavo.js CHANGED
@@ -656,7 +656,7 @@ export default class bitvavo extends Exchange {
656
656
  });
657
657
  }
658
658
  // set currencies here to avoid calling publicGetAssets twice
659
- this.currencies = this.deepExtend(this.currencies, result);
659
+ this.currencies = this.mapToSafeMap(this.deepExtend(this.currencies, result));
660
660
  return result;
661
661
  }
662
662
  /**
@@ -1228,6 +1228,9 @@ export default class bitvavo extends Exchange {
1228
1228
  if (operatorId !== undefined) {
1229
1229
  request['operatorId'] = this.parseToInt(operatorId);
1230
1230
  }
1231
+ else {
1232
+ throw new ArgumentsRequired(this.id + ' createOrder() requires an operatorId in params or options, eg: exchange.options[\'operatorId\'] = 1234567890');
1233
+ }
1231
1234
  return this.extend(request, params);
1232
1235
  }
1233
1236
  /**
@@ -1332,6 +1335,9 @@ export default class bitvavo extends Exchange {
1332
1335
  if (operatorId !== undefined) {
1333
1336
  request['operatorId'] = this.parseToInt(operatorId);
1334
1337
  }
1338
+ else {
1339
+ throw new ArgumentsRequired(this.id + ' editOrder() requires an operatorId in params or options, eg: exchange.options[\'operatorId\'] = 1234567890');
1340
+ }
1335
1341
  request['market'] = market['id'];
1336
1342
  return request;
1337
1343
  }
@@ -1373,6 +1379,9 @@ export default class bitvavo extends Exchange {
1373
1379
  if (operatorId !== undefined) {
1374
1380
  request['operatorId'] = this.parseToInt(operatorId);
1375
1381
  }
1382
+ else {
1383
+ throw new ArgumentsRequired(this.id + ' cancelOrder() requires an operatorId in params or options, eg: exchange.options[\'operatorId\'] = 1234567890');
1384
+ }
1376
1385
  return this.extend(request, params);
1377
1386
  }
1378
1387
  /**
package/js/src/bybit.d.ts CHANGED
@@ -227,7 +227,7 @@ export default class bybit extends Exchange {
227
227
  * @param {int} [params.isLeverage] *unified spot only* false then spot trading true then margin trading
228
228
  * @param {string} [params.tpslMode] *contract only* 'full' or 'partial'
229
229
  * @param {string} [params.mmp] *option only* market maker protection
230
- * @param {string} [params.triggerDirection] *contract only* the direction for trigger orders, 'above' or 'below'
230
+ * @param {string} [params.triggerDirection] *contract only* the direction for trigger orders, 'ascending' or 'descending'
231
231
  * @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
232
232
  * @param {float} [params.stopLossPrice] The price at which a stop loss order is triggered at
233
233
  * @param {float} [params.takeProfitPrice] The price at which a take profit order is triggered at
@@ -919,6 +919,17 @@ export default class bybit extends Exchange {
919
919
  * @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
920
920
  */
921
921
  fetchGreeks(symbol: string, params?: {}): Promise<Greeks>;
922
+ /**
923
+ * @method
924
+ * @name bybit#fetchAllGreeks
925
+ * @description fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
926
+ * @see https://bybit-exchange.github.io/docs/api-explorer/v5/market/tickers
927
+ * @param {string[]} [symbols] unified symbols of the markets to fetch greeks for, all markets are returned if not assigned
928
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
929
+ * @param {string} [params.baseCoin] the baseCoin of the symbol, default is BTC
930
+ * @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
931
+ */
932
+ fetchAllGreeks(symbols?: Strings, params?: {}): Promise<Greeks[]>;
922
933
  parseGreeks(greeks: Dict, market?: Market): Greeks;
923
934
  /**
924
935
  * @method