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
@@ -55,6 +55,7 @@ class okx extends okx$1 {
55
55
  'createTriggerOrder': true,
56
56
  'editOrder': true,
57
57
  'fetchAccounts': true,
58
+ 'fetchAllGreeks': true,
58
59
  'fetchBalance': true,
59
60
  'fetchBidsAsks': undefined,
60
61
  'fetchBorrowInterest': true,
@@ -3789,6 +3790,84 @@ class okx extends okx$1 {
3789
3790
  // "uTime": "1621910749815"
3790
3791
  // }
3791
3792
  //
3793
+ // watchOrders & fetchClosedOrders
3794
+ //
3795
+ // {
3796
+ // "algoClOrdId": "",
3797
+ // "algoId": "",
3798
+ // "attachAlgoClOrdId": "",
3799
+ // "attachAlgoOrds": [],
3800
+ // "cancelSource": "",
3801
+ // "cancelSourceReason": "", // not present in WS, but present in fetchClosedOrders
3802
+ // "category": "normal",
3803
+ // "ccy": "", // empty in WS, but eg. `USDT` in fetchClosedOrders
3804
+ // "clOrdId": "",
3805
+ // "cTime": "1751705801423",
3806
+ // "feeCcy": "USDT",
3807
+ // "instId": "LINK-USDT-SWAP",
3808
+ // "instType": "SWAP",
3809
+ // "isTpLimit": "false",
3810
+ // "lever": "3",
3811
+ // "linkedAlgoOrd": { "algoId": "" },
3812
+ // "ordId": "2657625147249614848",
3813
+ // "ordType": "limit",
3814
+ // "posSide": "net",
3815
+ // "px": "13.142",
3816
+ // "pxType": "",
3817
+ // "pxUsd": "",
3818
+ // "pxVol": "",
3819
+ // "quickMgnType": "",
3820
+ // "rebate": "0",
3821
+ // "rebateCcy": "USDT",
3822
+ // "reduceOnly": "true",
3823
+ // "side": "sell",
3824
+ // "slOrdPx": "",
3825
+ // "slTriggerPx": "",
3826
+ // "slTriggerPxType": "",
3827
+ // "source": "",
3828
+ // "stpId": "",
3829
+ // "stpMode": "cancel_maker",
3830
+ // "sz": "0.1",
3831
+ // "tag": "",
3832
+ // "tdMode": "isolated",
3833
+ // "tgtCcy": "",
3834
+ // "tpOrdPx": "",
3835
+ // "tpTriggerPx": "",
3836
+ // "tpTriggerPxType": "",
3837
+ // "uTime": "1751705807467",
3838
+ // "reqId": "", // field present only in WS
3839
+ // "msg": "", // field present only in WS
3840
+ // "amendResult": "", // field present only in WS
3841
+ // "amendSource": "", // field present only in WS
3842
+ // "code": "0", // field present only in WS
3843
+ // "fillFwdPx": "", // field present only in WS
3844
+ // "fillMarkVol": "", // field present only in WS
3845
+ // "fillPxUsd": "", // field present only in WS
3846
+ // "fillPxVol": "", // field present only in WS
3847
+ // "lastPx": "13.142", // field present only in WS
3848
+ // "notionalUsd": "1.314515408", // field present only in WS
3849
+ //
3850
+ // #### these below fields are empty on first omit from websocket, because of "creation" event. however, if order is executed, it also immediately sends another update with these fields filled ###
3851
+ //
3852
+ // "pnl": "-0.0001",
3853
+ // "accFillSz": "0.1",
3854
+ // "avgPx": "13.142",
3855
+ // "state": "filled",
3856
+ // "fee": "-0.00026284",
3857
+ // "fillPx": "13.142",
3858
+ // "tradeId": "293429690",
3859
+ // "fillSz": "0.1",
3860
+ // "fillTime": "1751705807467",
3861
+ // "fillNotionalUsd": "1.314515408", // field present only in WS
3862
+ // "fillPnl": "-0.0001", // field present only in WS
3863
+ // "fillFee": "-0.00026284", // field present only in WS
3864
+ // "fillFeeCcy": "USDT", // field present only in WS
3865
+ // "execType": "M", // field present only in WS
3866
+ // "fillMarkPx": "13.141", // field present only in WS
3867
+ // "fillIdxPx": "13.147" // field present only in WS
3868
+ // }
3869
+ //
3870
+ //
3792
3871
  // Algo Order fetchOpenOrders, fetchCanceledOrders, fetchClosedOrders
3793
3872
  //
3794
3873
  // {
@@ -5142,7 +5221,7 @@ class okx extends okx$1 {
5142
5221
  let fee = this.safeString(params, 'fee');
5143
5222
  if (fee === undefined) {
5144
5223
  const currencies = await this.fetchCurrencies();
5145
- this.currencies = this.deepExtend(this.currencies, currencies);
5224
+ this.currencies = this.mapToSafeMap(this.deepExtend(this.currencies, currencies));
5146
5225
  const targetNetwork = this.safeDict(currency['networks'], this.networkIdToCode(network), {});
5147
5226
  fee = this.safeString(targetNetwork, 'fee');
5148
5227
  if (fee === undefined) {
@@ -7197,7 +7276,7 @@ class okx extends okx$1 {
7197
7276
  /**
7198
7277
  * @method
7199
7278
  * @name okx#fetchBorrowInterest
7200
- * @description fetch the interest owed by the user for borrowing currency for margin trading
7279
+ * @description fetch the interest owed b the user for borrowing currency for margin trading
7201
7280
  * @see https://www.okx.com/docs-v5/en/#rest-api-account-get-interest-accrued-data
7202
7281
  * @param {string} code the unified currency code for the currency of the interest
7203
7282
  * @param {string} symbol the market symbol of an isolated margin market, if undefined, the interest for cross margin markets is returned
@@ -7943,6 +8022,83 @@ class okx extends okx$1 {
7943
8022
  }
7944
8023
  return undefined;
7945
8024
  }
8025
+ /**
8026
+ * @method
8027
+ * @name okx#fetchAllGreeks
8028
+ * @description fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
8029
+ * @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-option-market-data
8030
+ * @param {string[]} [symbols] unified symbols of the markets to fetch greeks for, all markets are returned if not assigned
8031
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
8032
+ * @param {string} params.uly Underlying, either uly or instFamily is required
8033
+ * @param {string} params.instFamily Instrument family, either uly or instFamily is required
8034
+ * @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
8035
+ */
8036
+ async fetchAllGreeks(symbols = undefined, params = {}) {
8037
+ await this.loadMarkets();
8038
+ const request = {};
8039
+ symbols = this.marketSymbols(symbols, undefined, true, true, true);
8040
+ let symbolsLength = undefined;
8041
+ if (symbols !== undefined) {
8042
+ symbolsLength = symbols.length;
8043
+ }
8044
+ if ((symbols === undefined) || (symbolsLength !== 1)) {
8045
+ const uly = this.safeString(params, 'uly');
8046
+ if (uly !== undefined) {
8047
+ request['uly'] = uly;
8048
+ }
8049
+ const instFamily = this.safeString(params, 'instFamily');
8050
+ if (instFamily !== undefined) {
8051
+ request['instFamily'] = instFamily;
8052
+ }
8053
+ if ((uly === undefined) && (instFamily === undefined)) {
8054
+ throw new errors.BadRequest(this.id + ' fetchAllGreeks() requires either a uly or instFamily parameter');
8055
+ }
8056
+ }
8057
+ let market = undefined;
8058
+ if (symbols !== undefined) {
8059
+ if (symbolsLength === 1) {
8060
+ market = this.market(symbols[0]);
8061
+ const marketId = market['id'];
8062
+ const optionParts = marketId.split('-');
8063
+ request['uly'] = market['info']['uly'];
8064
+ request['instFamily'] = market['info']['instFamily'];
8065
+ request['expTime'] = this.safeString(optionParts, 2);
8066
+ }
8067
+ }
8068
+ params = this.omit(params, ['uly', 'instFamily']);
8069
+ const response = await this.publicGetPublicOptSummary(this.extend(request, params));
8070
+ //
8071
+ // {
8072
+ // "code": "0",
8073
+ // "data": [
8074
+ // {
8075
+ // "askVol": "0",
8076
+ // "bidVol": "0",
8077
+ // "delta": "0.5105464486882039",
8078
+ // "deltaBS": "0.7325502184143025",
8079
+ // "fwdPx": "37675.80158694987186",
8080
+ // "gamma": "-0.13183515090501083",
8081
+ // "gammaBS": "0.000024139685826358558",
8082
+ // "instId": "BTC-USD-240329-32000-C",
8083
+ // "instType": "OPTION",
8084
+ // "lever": "4.504428015946619",
8085
+ // "markVol": "0.5916253554539876",
8086
+ // "realVol": "0",
8087
+ // "theta": "-0.0004202992014012855",
8088
+ // "thetaBS": "-18.52354631567909",
8089
+ // "ts": "1699586421976",
8090
+ // "uly": "BTC-USD",
8091
+ // "vega": "0.0020207455080045846",
8092
+ // "vegaBS": "74.44022302387287",
8093
+ // "volLv": "0.5948549730405797"
8094
+ // },
8095
+ // ],
8096
+ // "msg": ""
8097
+ // }
8098
+ //
8099
+ const data = this.safeList(response, 'data', []);
8100
+ return this.parseAllGreeks(data, symbols);
8101
+ }
7946
8102
  parseGreeks(greeks, market = undefined) {
7947
8103
  //
7948
8104
  // {
@@ -73,6 +73,7 @@ class paradex extends paradex$1 {
73
73
  'fetchFundingRateHistory': false,
74
74
  'fetchFundingRates': false,
75
75
  'fetchGreeks': true,
76
+ 'fetchAllGreeks': true,
76
77
  'fetchIndexOHLCV': false,
77
78
  'fetchIsolatedBorrowRate': false,
78
79
  'fetchIsolatedBorrowRates': false,
@@ -2410,6 +2411,59 @@ class paradex extends paradex$1 {
2410
2411
  const greeks = this.safeDict(data, 0, {});
2411
2412
  return this.parseGreeks(greeks, market);
2412
2413
  }
2414
+ /**
2415
+ * @method
2416
+ * @name paradex#fetchAllGreeks
2417
+ * @description fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
2418
+ * @see https://docs.api.testnet.paradex.trade/#list-available-markets-summary
2419
+ * @param {string[]} [symbols] unified symbols of the markets to fetch greeks for, all markets are returned if not assigned
2420
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2421
+ * @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
2422
+ */
2423
+ async fetchAllGreeks(symbols = undefined, params = {}) {
2424
+ await this.loadMarkets();
2425
+ symbols = this.marketSymbols(symbols, undefined, true, true, true);
2426
+ const request = {
2427
+ 'market': 'ALL',
2428
+ };
2429
+ const response = await this.publicGetMarketsSummary(this.extend(request, params));
2430
+ //
2431
+ // {
2432
+ // "results": [
2433
+ // {
2434
+ // "symbol": "BTC-USD-114000-P",
2435
+ // "mark_price": "10835.66892602",
2436
+ // "mark_iv": "0.71781855",
2437
+ // "delta": "-0.98726024",
2438
+ // "greeks": {
2439
+ // "delta": "-0.9872602390817709",
2440
+ // "gamma": "0.000004560958862297231",
2441
+ // "vega": "227.11344863639806",
2442
+ // "rho": "-302.0617972461581",
2443
+ // "vanna": "0.06609830491614832",
2444
+ // "volga": "925.9501532805552"
2445
+ // },
2446
+ // "last_traded_price": "10551.5",
2447
+ // "bid": "10794.9",
2448
+ // "bid_iv": "0.05",
2449
+ // "ask": "10887.3",
2450
+ // "ask_iv": "0.8783283",
2451
+ // "last_iv": "0.05",
2452
+ // "volume_24h": "0",
2453
+ // "total_volume": "195240.72672261014",
2454
+ // "created_at": 1747644009995,
2455
+ // "underlying_price": "103164.79162649",
2456
+ // "open_interest": "0",
2457
+ // "funding_rate": "0.000004464241170536191",
2458
+ // "price_change_rate_24h": "0.074915",
2459
+ // "future_funding_rate": "0.0001"
2460
+ // }
2461
+ // ]
2462
+ // }
2463
+ //
2464
+ const results = this.safeList(response, 'results', []);
2465
+ return this.parseAllGreeks(results, symbols);
2466
+ }
2413
2467
  parseGreeks(greeks, market = undefined) {
2414
2468
  //
2415
2469
  // {
@@ -2760,10 +2760,10 @@ class phemex extends phemex$1 {
2760
2760
  let triggerDirection = undefined;
2761
2761
  [triggerDirection, params] = this.handleParamString(params, 'triggerDirection');
2762
2762
  if (triggerDirection === undefined) {
2763
- throw new errors.ArgumentsRequired(this.id + " createOrder() also requires a 'triggerDirection' parameter with either 'up' or 'down' value");
2763
+ throw new errors.ArgumentsRequired(this.id + " createOrder() also requires a 'triggerDirection' parameter with either 'ascending' or 'descending' value");
2764
2764
  }
2765
2765
  // the flow defined per https://phemex-docs.github.io/#more-order-type-examples
2766
- if (triggerDirection === 'up') {
2766
+ if (triggerDirection === 'ascending' || triggerDirection === 'up') {
2767
2767
  if (side === 'sell') {
2768
2768
  request['ordType'] = (type === 'Market') ? 'MarketIfTouched' : 'LimitIfTouched';
2769
2769
  }
@@ -2771,7 +2771,7 @@ class phemex extends phemex$1 {
2771
2771
  request['ordType'] = (type === 'Market') ? 'Stop' : 'StopLimit';
2772
2772
  }
2773
2773
  }
2774
- else if (triggerDirection === 'down') {
2774
+ else if (triggerDirection === 'descending' || triggerDirection === 'down') {
2775
2775
  if (side === 'sell') {
2776
2776
  request['ordType'] = (type === 'Market') ? 'Stop' : 'StopLimit';
2777
2777
  }
@@ -3,6 +3,7 @@
3
3
  var bitstamp$1 = require('../bitstamp.js');
4
4
  var errors = require('../base/errors.js');
5
5
  var Cache = require('../base/ws/Cache.js');
6
+ var Precise = require('../base/Precise.js');
6
7
 
7
8
  // ----------------------------------------------------------------------------
8
9
  // ---------------------------------------------------------------------------
@@ -306,6 +307,7 @@ class bitstamp extends bitstamp$1 {
306
307
  // "price_str":"1000.00"
307
308
  // },
308
309
  // "channel":"private-my_orders_ltcusd-4848701",
310
+ // "event": "order_deleted" // field only present for cancelOrder
309
311
  // }
310
312
  //
311
313
  const channel = this.safeString(message, 'channel');
@@ -318,29 +320,65 @@ class bitstamp extends bitstamp$1 {
318
320
  const subscription = this.safeValue(client.subscriptions, channel);
319
321
  const symbol = this.safeString(subscription, 'symbol');
320
322
  const market = this.market(symbol);
323
+ order['event'] = this.safeString(message, 'event');
321
324
  const parsed = this.parseWsOrder(order, market);
322
325
  stored.append(parsed);
323
326
  client.resolve(this.orders, channel);
324
327
  }
325
328
  parseWsOrder(order, market = undefined) {
326
329
  //
327
- // {
328
- // "id":"1463471322288128",
329
- // "id_str":"1463471322288128",
330
- // "order_type":1,
331
- // "datetime":"1646127778",
332
- // "microtimestamp":"1646127777950000",
333
- // "amount":0.05,
334
- // "amount_str":"0.05000000",
335
- // "price":1000,
336
- // "price_str":"1000.00"
330
+ // {
331
+ // "id": "1894876776091648",
332
+ // "id_str": "1894876776091648",
333
+ // "order_type": 0,
334
+ // "order_subtype": 0,
335
+ // "datetime": "1751451375",
336
+ // "microtimestamp": "1751451375070000",
337
+ // "amount": 1.1,
338
+ // "amount_str": "1.10000000",
339
+ // "amount_traded": "0",
340
+ // "amount_at_create": "1.10000000",
341
+ // "price": 10.23,
342
+ // "price_str": "10.23",
343
+ // "is_liquidation": false,
344
+ // "trade_account_id": 0
337
345
  // }
338
346
  //
339
347
  const id = this.safeString(order, 'id_str');
340
- const orderType = this.safeStringLower(order, 'order_type');
348
+ const orderTypeRaw = this.safeStringLower(order, 'order_type');
349
+ const side = (orderTypeRaw === '1') ? 'sell' : 'buy';
350
+ const orderSubTypeRaw = this.safeStringLower(order, 'order_subtype'); // https://www.bitstamp.net/websocket/v2/#:~:text=order_subtype
351
+ let orderType = undefined;
352
+ let timeInForce = undefined;
353
+ if (orderSubTypeRaw === '0') {
354
+ orderType = 'limit';
355
+ }
356
+ else if (orderSubTypeRaw === '2') {
357
+ orderType = 'market';
358
+ }
359
+ else if (orderSubTypeRaw === '4') {
360
+ orderType = 'limit';
361
+ timeInForce = 'IOC';
362
+ }
363
+ else if (orderSubTypeRaw === '6') {
364
+ orderType = 'limit';
365
+ timeInForce = 'FOK';
366
+ }
367
+ else if (orderSubTypeRaw === '8') {
368
+ orderType = 'limit';
369
+ timeInForce = 'GTD';
370
+ }
341
371
  const price = this.safeString(order, 'price_str');
342
372
  const amount = this.safeString(order, 'amount_str');
343
- const side = (orderType === '1') ? 'sell' : 'buy';
373
+ const filled = this.safeString(order, 'amount_traded');
374
+ const event = this.safeString(order, 'event');
375
+ let status = undefined;
376
+ if (Precise["default"].stringEq(filled, amount)) {
377
+ status = 'closed';
378
+ }
379
+ else if (event === 'order_deleted') {
380
+ status = 'canceled';
381
+ }
344
382
  const timestamp = this.safeTimestamp(order, 'datetime');
345
383
  market = this.safeMarket(undefined, market);
346
384
  const symbol = market['symbol'];
@@ -352,8 +390,8 @@ class bitstamp extends bitstamp$1 {
352
390
  'timestamp': timestamp,
353
391
  'datetime': this.iso8601(timestamp),
354
392
  'lastTradeTimestamp': undefined,
355
- 'type': undefined,
356
- 'timeInForce': undefined,
393
+ 'type': orderType,
394
+ 'timeInForce': timeInForce,
357
395
  'postOnly': undefined,
358
396
  'side': side,
359
397
  'price': price,
@@ -362,9 +400,9 @@ class bitstamp extends bitstamp$1 {
362
400
  'amount': amount,
363
401
  'cost': undefined,
364
402
  'average': undefined,
365
- 'filled': undefined,
403
+ 'filled': filled,
366
404
  'remaining': undefined,
367
- 'status': undefined,
405
+ 'status': status,
368
406
  'fee': undefined,
369
407
  'trades': undefined,
370
408
  }, market);
@@ -429,6 +467,7 @@ class bitstamp extends bitstamp$1 {
429
467
  // "price_str":"1000.00"
430
468
  // },
431
469
  // "channel":"private-my_orders_ltcusd-4848701",
470
+ // "event": "order_deleted" // field only present for cancelOrder
432
471
  // }
433
472
  //
434
473
  const channel = this.safeString(message, 'channel');
@@ -1279,11 +1279,10 @@ class bybit extends bybit$1 {
1279
1279
  async unWatchMyTrades(symbol = undefined, params = {}) {
1280
1280
  const method = 'watchMyTrades';
1281
1281
  const messageHash = 'unsubscribe:myTrades';
1282
- let subHash = 'myTrades';
1282
+ const subHash = 'myTrades';
1283
1283
  await this.loadMarkets();
1284
1284
  if (symbol !== undefined) {
1285
- symbol = this.symbol(symbol);
1286
- subHash += ':' + symbol;
1285
+ throw new errors.NotSupported(this.id + ' unWatchMyTrades() does not support a symbol parameter, you must unwatch all my trades');
1287
1286
  }
1288
1287
  const url = await this.getUrlByMarketType(symbol, true, method, params);
1289
1288
  await this.authenticate(url);
@@ -1728,10 +1727,9 @@ class bybit extends bybit$1 {
1728
1727
  await this.loadMarkets();
1729
1728
  const method = 'watchOrders';
1730
1729
  const messageHash = 'unsubscribe:orders';
1731
- let subHash = 'orders';
1730
+ const subHash = 'orders';
1732
1731
  if (symbol !== undefined) {
1733
- symbol = this.symbol(symbol);
1734
- subHash += ':' + symbol;
1732
+ throw new errors.NotSupported(this.id + ' unWatchOrders() does not support a symbol parameter, you must unwatch all orders');
1735
1733
  }
1736
1734
  const url = await this.getUrlByMarketType(symbol, true, method, params);
1737
1735
  await this.authenticate(url);
@@ -2480,7 +2478,8 @@ class bybit extends bybit$1 {
2480
2478
  for (let j = 0; j < messageHashes.length; j++) {
2481
2479
  const unsubHash = messageHashes[j];
2482
2480
  const subHash = subMessageHashes[j];
2483
- this.cleanUnsubscription(client, subHash, unsubHash);
2481
+ const usePrefix = (subHash === 'orders') || (subHash === 'myTrades');
2482
+ this.cleanUnsubscription(client, subHash, unsubHash, usePrefix);
2484
2483
  }
2485
2484
  this.cleanCache(subscription);
2486
2485
  }
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, 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, OrderBooks, OpenInterests, ConstructorArgs } 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.90";
7
+ declare const version = "4.4.92";
8
8
  import alpaca from './src/alpaca.js';
9
9
  import apex from './src/apex.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.90';
41
+ const version = '4.4.92';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import alpaca from './src/alpaca.js';
@@ -4,6 +4,7 @@ interface Exchange {
4
4
  spotPublicGetCurrencyPairs(params?: {}): Promise<implicitReturnType>;
5
5
  spotPublicGetAccuracy(params?: {}): Promise<implicitReturnType>;
6
6
  spotPublicGetUsdToCny(params?: {}): Promise<implicitReturnType>;
7
+ spotPublicGetAssetConfigs(params?: {}): Promise<implicitReturnType>;
7
8
  spotPublicGetWithdrawConfigs(params?: {}): Promise<implicitReturnType>;
8
9
  spotPublicGetTimestamp(params?: {}): Promise<implicitReturnType>;
9
10
  spotPublicGetTicker24hr(params?: {}): Promise<implicitReturnType>;
@@ -1441,6 +1441,8 @@ export default class ascendex extends Exchange {
1441
1441
  // "timestamp": 1573576916201
1442
1442
  // }
1443
1443
  //
1444
+ // & linear (fetchClosedOrders)
1445
+ //
1444
1446
  // {
1445
1447
  // "ac": "FUTURES",
1446
1448
  // "accountId": "fut2ODPhGiY71Pl4vtXnOZ00ssgD7QGn",
@@ -1448,7 +1450,7 @@ export default class ascendex extends Exchange {
1448
1450
  // "orderId": "a17e0874ecbdU0711043490bbtcpDU5X",
1449
1451
  // "seqNum": -1,
1450
1452
  // "orderType": "Limit",
1451
- // "execInst": "NULL_VAL",
1453
+ // "execInst": "NULL_VAL", // NULL_VAL, ReduceOnly , ...
1452
1454
  // "side": "Buy",
1453
1455
  // "symbol": "BTC-PERP",
1454
1456
  // "price": "30000",
@@ -1537,14 +1539,14 @@ export default class ascendex extends Exchange {
1537
1539
  const status = this.parseOrderStatus(this.safeString(order, 'status'));
1538
1540
  const marketId = this.safeString(order, 'symbol');
1539
1541
  const symbol = this.safeSymbol(marketId, market, '/');
1540
- let timestamp = this.safeInteger2(order, 'timestamp', 'sendingTime');
1542
+ let timestamp = this.safeIntegerN(order, ['timestamp', 'sendingTime', 'time']);
1541
1543
  const lastTradeTimestamp = this.safeInteger(order, 'lastExecTime');
1542
1544
  if (timestamp === undefined) {
1543
1545
  timestamp = lastTradeTimestamp;
1544
1546
  }
1545
1547
  const price = this.safeString(order, 'price');
1546
1548
  const amount = this.safeString(order, 'orderQty');
1547
- const average = this.safeString(order, 'avgPx');
1549
+ const average = this.safeString2(order, 'avgPx', 'avgFilledPx');
1548
1550
  const filled = this.safeStringN(order, ['cumFilledQty', 'cumQty', 'fillQty']);
1549
1551
  const id = this.safeString(order, 'orderId');
1550
1552
  let clientOrderId = this.safeString(order, 'id');
@@ -1576,12 +1578,12 @@ export default class ascendex extends Exchange {
1576
1578
  }
1577
1579
  const triggerPrice = this.omitZero(this.safeString(order, 'stopPrice'));
1578
1580
  let reduceOnly = undefined;
1579
- const execInst = this.safeString(order, 'execInst');
1580
- if (execInst === 'reduceOnly') {
1581
+ const execInst = this.safeStringLower(order, 'execInst');
1582
+ if (execInst === 'reduceonly') {
1581
1583
  reduceOnly = true;
1582
1584
  }
1583
1585
  let postOnly = undefined;
1584
- if (execInst === 'Post') {
1586
+ if (execInst === 'post') {
1585
1587
  postOnly = true;
1586
1588
  }
1587
1589
  return this.safeOrder({
@@ -2345,8 +2347,7 @@ export default class ascendex extends Exchange {
2345
2347
  // }
2346
2348
  //
2347
2349
  let data = this.safeList(response, 'data', []);
2348
- const isArray = Array.isArray(data);
2349
- if (!isArray) {
2350
+ if (!Array.isArray(data)) {
2350
2351
  data = this.safeList(data, 'data', []);
2351
2352
  }
2352
2353
  return this.parseOrders(data, market, since, limit);
@@ -362,6 +362,8 @@ export default class Exchange {
362
362
  checkOrderArguments(market: any, type: any, side: any, amount: any, price: any, params: any): void;
363
363
  handleHttpStatusCode(code: any, reason: any, url: any, method: any, body: any): void;
364
364
  remove0xPrefix(hexData: any): any;
365
+ mapToSafeMap(dict: any): any;
366
+ safeMapToMap(dict: any): any;
365
367
  spawn(method: any, ...args: any[]): import("./ws/Future.js").FutureInterface;
366
368
  delay(timeout: any, method: any, ...args: any[]): void;
367
369
  orderBook(snapshot?: {}, depth?: number): WsOrderBook;
@@ -762,6 +764,7 @@ export default class Exchange {
762
764
  fetchMyTradesWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
763
765
  watchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
764
766
  fetchGreeks(symbol: string, params?: {}): Promise<Greeks>;
767
+ fetchAllGreeks(symbols?: Strings, params?: {}): Promise<Greeks[]>;
765
768
  fetchOptionChain(code: string, params?: {}): Promise<OptionChain>;
766
769
  fetchOption(symbol: string, params?: {}): Promise<Option>;
767
770
  fetchConvertQuote(fromCode: string, toCode: string, amount?: Num, params?: {}): Promise<Conversion>;
@@ -887,6 +890,7 @@ export default class Exchange {
887
890
  parseLiquidation(liquidation: any, market?: Market): Liquidation;
888
891
  parseLiquidations(liquidations: Dict[], market?: Market, since?: Int, limit?: Int): Liquidation[];
889
892
  parseGreeks(greeks: Dict, market?: Market): Greeks;
893
+ parseAllGreeks(greeks: any, symbols?: Strings, params?: {}): Greeks[];
890
894
  parseOption(chain: Dict, currency?: Currency, market?: Market): Option;
891
895
  parseOptionChain(response: object[], currencyKey?: Str, symbolKey?: Str): OptionChain;
892
896
  parseMarginModes(response: object[], symbols?: string[], symbolKey?: Str, marketType?: MarketType): MarginModes;
@@ -904,7 +908,7 @@ export default class Exchange {
904
908
  parseMarginModifications(response: object[], symbols?: Strings, symbolKey?: Str, marketType?: MarketType): MarginModification[];
905
909
  fetchTransfer(id: string, code?: Str, params?: {}): Promise<TransferEntry>;
906
910
  fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<TransferEntry[]>;
907
- cleanUnsubscription(client: any, subHash: string, unsubHash: string): void;
911
+ cleanUnsubscription(client: any, subHash: string, unsubHash: string, subHashIsPrefix?: boolean): void;
908
912
  cleanCache(subscription: Dict): void;
909
913
  }
910
914
  export { Exchange, };