ccxt 4.4.75 → 4.4.78

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 (114) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +7 -7
  3. package/dist/cjs/ccxt.js +8 -4
  4. package/dist/cjs/src/abstract/apex.js +9 -0
  5. package/dist/cjs/src/apex.js +1949 -0
  6. package/dist/cjs/src/base/Exchange.js +49 -3
  7. package/dist/cjs/src/binance.js +44 -220
  8. package/dist/cjs/src/bitget.js +139 -71
  9. package/dist/cjs/src/bitmex.js +4 -4
  10. package/dist/cjs/src/bitrue.js +48 -0
  11. package/dist/cjs/src/cex.js +1 -1
  12. package/dist/cjs/src/coinbase.js +32 -3
  13. package/dist/cjs/src/coincatch.js +68 -0
  14. package/dist/cjs/src/coinex.js +3 -0
  15. package/dist/cjs/src/coinlist.js +85 -1
  16. package/dist/cjs/src/hitbtc.js +3 -0
  17. package/dist/cjs/src/hyperliquid.js +13 -4
  18. package/dist/cjs/src/mexc.js +50 -57
  19. package/dist/cjs/src/okx.js +23 -8
  20. package/dist/cjs/src/paradex.js +3 -12
  21. package/dist/cjs/src/phemex.js +2 -1
  22. package/dist/cjs/src/poloniex.js +1 -1
  23. package/dist/cjs/src/pro/apex.js +1043 -0
  24. package/dist/cjs/src/pro/coinbase.js +4 -8
  25. package/dist/cjs/src/pro/gate.js +27 -2
  26. package/dist/cjs/src/pro/hollaex.js +2 -2
  27. package/dist/cjs/src/pro/hyperliquid.js +1 -1
  28. package/dist/cjs/src/pro/p2b.js +2 -2
  29. package/dist/cjs/src/pro/tradeogre.js +283 -0
  30. package/dist/cjs/src/probit.js +1 -0
  31. package/dist/cjs/src/static_dependencies/zklink/zklink-sdk-web.js +2645 -0
  32. package/dist/cjs/src/tradeogre.js +2 -1
  33. package/dist/cjs/src/upbit.js +299 -93
  34. package/dist/cjs/src/whitebit.js +1 -0
  35. package/dist/cjs/src/woo.js +3 -1
  36. package/dist/cjs/src/xt.js +131 -4
  37. package/js/ccxt.d.ts +11 -5
  38. package/js/ccxt.js +8 -4
  39. package/js/src/abstract/apex.d.ts +34 -0
  40. package/js/src/abstract/myokx.d.ts +4 -0
  41. package/js/src/abstract/okx.d.ts +4 -0
  42. package/js/src/abstract/upbit.d.ts +15 -1
  43. package/js/src/abstract/xt.d.ts +3 -0
  44. package/js/src/apex.d.ts +333 -0
  45. package/js/src/apex.js +1951 -0
  46. package/js/src/ascendex.d.ts +3 -3
  47. package/js/src/base/Exchange.d.ts +3 -0
  48. package/js/src/base/Exchange.js +49 -2
  49. package/js/src/binance.d.ts +9 -7
  50. package/js/src/binance.js +44 -220
  51. package/js/src/bitfinex.d.ts +3 -3
  52. package/js/src/bitflyer.d.ts +2 -2
  53. package/js/src/bitget.d.ts +2 -0
  54. package/js/src/bitget.js +139 -71
  55. package/js/src/bitmart.d.ts +4 -4
  56. package/js/src/bitmex.d.ts +3 -3
  57. package/js/src/bitmex.js +4 -4
  58. package/js/src/bitrue.js +48 -0
  59. package/js/src/cex.js +1 -1
  60. package/js/src/coinbase.d.ts +6 -4
  61. package/js/src/coinbase.js +32 -3
  62. package/js/src/coinbaseexchange.d.ts +1 -1
  63. package/js/src/coincatch.d.ts +11 -0
  64. package/js/src/coincatch.js +68 -0
  65. package/js/src/coinex.js +3 -0
  66. package/js/src/coinlist.d.ts +12 -1
  67. package/js/src/coinlist.js +85 -1
  68. package/js/src/cryptocom.d.ts +4 -4
  69. package/js/src/deribit.d.ts +4 -4
  70. package/js/src/derive.d.ts +3 -3
  71. package/js/src/digifinex.d.ts +4 -4
  72. package/js/src/hitbtc.js +3 -0
  73. package/js/src/htx.d.ts +4 -4
  74. package/js/src/hyperliquid.d.ts +1 -0
  75. package/js/src/hyperliquid.js +13 -4
  76. package/js/src/kraken.d.ts +3 -3
  77. package/js/src/krakenfutures.d.ts +2 -2
  78. package/js/src/kucoinfutures.d.ts +5 -5
  79. package/js/src/mexc.d.ts +1 -0
  80. package/js/src/mexc.js +50 -57
  81. package/js/src/okx.js +23 -8
  82. package/js/src/oxfun.d.ts +3 -3
  83. package/js/src/paradex.js +3 -12
  84. package/js/src/phemex.d.ts +3 -3
  85. package/js/src/phemex.js +2 -1
  86. package/js/src/poloniex.d.ts +3 -3
  87. package/js/src/poloniex.js +1 -1
  88. package/js/src/pro/apex.d.ts +160 -0
  89. package/js/src/pro/apex.js +1044 -0
  90. package/js/src/pro/coinbase.js +4 -8
  91. package/js/src/pro/gate.js +27 -2
  92. package/js/src/pro/hollaex.js +2 -2
  93. package/js/src/pro/hyperliquid.js +1 -1
  94. package/js/src/pro/p2b.js +2 -2
  95. package/js/src/pro/tradeogre.d.ts +49 -0
  96. package/js/src/pro/tradeogre.js +284 -0
  97. package/js/src/probit.js +1 -0
  98. package/js/src/static_dependencies/zklink/zklink-sdk-web.d.ts +1279 -0
  99. package/js/src/static_dependencies/zklink/zklink-sdk-web.js +4282 -0
  100. package/js/src/tradeogre.js +2 -1
  101. package/js/src/upbit.d.ts +34 -4
  102. package/js/src/upbit.js +299 -93
  103. package/js/src/vertex.d.ts +3 -3
  104. package/js/src/whitebit.js +1 -0
  105. package/js/src/woo.d.ts +4 -4
  106. package/js/src/woo.js +3 -1
  107. package/js/src/woofipro.d.ts +4 -4
  108. package/js/src/xt.d.ts +23 -4
  109. package/js/src/xt.js +131 -4
  110. package/package.json +2 -2
  111. package/js/src/abstract/ace.d.ts +0 -18
  112. package/js/src/ace.d.ts +0 -158
  113. package/js/src/ace.js +0 -1181
  114. /package/js/src/abstract/{ace.js → apex.js} +0 -0
@@ -64,7 +64,7 @@ class coinlist extends coinlist$1 {
64
64
  'fetchDepositWithdrawFee': false,
65
65
  'fetchDepositWithdrawFees': false,
66
66
  'fetchFundingHistory': false,
67
- 'fetchFundingRate': false,
67
+ 'fetchFundingRate': true,
68
68
  'fetchFundingRateHistory': false,
69
69
  'fetchFundingRates': false,
70
70
  'fetchIndexOHLCV': false,
@@ -2460,6 +2460,90 @@ class coinlist extends coinlist$1 {
2460
2460
  };
2461
2461
  return this.safeString(types, type, type);
2462
2462
  }
2463
+ /**
2464
+ * @method
2465
+ * @name coinlist#fetchFundingRate
2466
+ * @description fetch the current funding rate
2467
+ * @see https://trade-docs.coinlist.co/#coinlist-pro-api-Funding-Rates
2468
+ * @param {string} symbol unified market symbol
2469
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2470
+ * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
2471
+ */
2472
+ async fetchFundingRate(symbol, params = {}) {
2473
+ await this.loadMarkets();
2474
+ const market = this.market(symbol);
2475
+ if (!market['swap']) {
2476
+ throw new errors.BadSymbol(this.id + ' fetchFundingRate() supports swap contracts only');
2477
+ }
2478
+ const request = {
2479
+ 'symbol': market['id'],
2480
+ };
2481
+ const response = await this.publicGetV1SymbolsSymbolFunding(this.extend(request, params));
2482
+ //
2483
+ // {
2484
+ // "last": {
2485
+ // "funding_rate": "-0.00043841",
2486
+ // "funding_time": "2025-04-15T04:00:00.000Z"
2487
+ // },
2488
+ // "next": {
2489
+ // "funding_rate": "-0.00046952",
2490
+ // "funding_time": "2025-04-15T12:00:00.000Z"
2491
+ // },
2492
+ // "indicative": {
2493
+ // "funding_rate": "-0.00042517",
2494
+ // "funding_time": "2025-04-15T20:00:00.000Z"
2495
+ // },
2496
+ // "timestamp": "2025-04-15T07:01:15.219Z"
2497
+ // }
2498
+ //
2499
+ return this.parseFundingRate(response, market);
2500
+ }
2501
+ parseFundingRate(contract, market = undefined) {
2502
+ //
2503
+ // {
2504
+ // "last": {
2505
+ // "funding_rate": "-0.00043841",
2506
+ // "funding_time": "2025-04-15T04:00:00.000Z"
2507
+ // },
2508
+ // "next": {
2509
+ // "funding_rate": "-0.00046952",
2510
+ // "funding_time": "2025-04-15T12:00:00.000Z"
2511
+ // },
2512
+ // "indicative": {
2513
+ // "funding_rate": "-0.00042517",
2514
+ // "funding_time": "2025-04-15T20:00:00.000Z"
2515
+ // },
2516
+ // "timestamp": "2025-04-15T07:01:15.219Z"
2517
+ // }
2518
+ //
2519
+ const previous = this.safeDict(contract, 'last', {});
2520
+ const current = this.safeDict(contract, 'next', {});
2521
+ const next = this.safeDict(contract, 'indicative', {});
2522
+ const previousDatetime = this.safeString(previous, 'funding_time');
2523
+ const currentDatetime = this.safeString(current, 'funding_time');
2524
+ const nextDatetime = this.safeString(next, 'funding_time');
2525
+ const datetime = this.safeString(contract, 'timestamp');
2526
+ return {
2527
+ 'info': contract,
2528
+ 'symbol': this.safeSymbol(undefined, market),
2529
+ 'markPrice': undefined,
2530
+ 'indexPrice': undefined,
2531
+ 'interestRate': undefined,
2532
+ 'estimatedSettlePrice': undefined,
2533
+ 'timestamp': this.parse8601(datetime),
2534
+ 'datetime': datetime,
2535
+ 'fundingRate': this.safeNumber(current, 'funding_rate'),
2536
+ 'fundingTimestamp': this.parse8601(currentDatetime),
2537
+ 'fundingDatetime': currentDatetime,
2538
+ 'nextFundingRate': this.safeNumber(next, 'funding_rate'),
2539
+ 'nextFundingTimestamp': this.parse8601(nextDatetime),
2540
+ 'nextFundingDatetime': nextDatetime,
2541
+ 'previousFundingRate': this.safeNumber(previous, 'funding_rate'),
2542
+ 'previousFundingTimestamp': this.parse8601(previousDatetime),
2543
+ 'previousFundingDatetime': previousDatetime,
2544
+ 'interval': '8h',
2545
+ };
2546
+ }
2463
2547
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
2464
2548
  const request = this.omit(params, this.extractParams(path));
2465
2549
  const endpoint = '/' + this.implodeParams(path, params);
@@ -955,6 +955,8 @@ class hitbtc extends hitbtc$1 {
955
955
  const transferEnabled = this.safeBool(entry, 'transfer_enabled', false);
956
956
  const active = payinEnabled && payoutEnabled && transferEnabled;
957
957
  const rawNetworks = this.safeValue(entry, 'networks', []);
958
+ const isCrypto = this.safeBool(entry, 'crypto');
959
+ const type = isCrypto ? 'crypto' : 'fiat';
958
960
  const networks = {};
959
961
  let fee = undefined;
960
962
  let depositEnabled = undefined;
@@ -1017,6 +1019,7 @@ class hitbtc extends hitbtc$1 {
1017
1019
  'max': undefined,
1018
1020
  },
1019
1021
  },
1022
+ 'type': type,
1020
1023
  };
1021
1024
  }
1022
1025
  return result;
@@ -771,6 +771,7 @@ class hyperliquid extends hyperliquid$1 {
771
771
  * @param {object} [params] extra parameters specific to the exchange API endpoint
772
772
  * @param {string} [params.user] user address, will default to this.walletAddress if not provided
773
773
  * @param {string} [params.type] wallet type, ['spot', 'swap'], defaults to swap
774
+ * @param {string} [params.marginMode] 'cross' or 'isolated', for margin trading, uses this.options.defaultMarginMode if not passed, defaults to undefined/None/null
774
775
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
775
776
  */
776
777
  async fetchBalance(params = {}) {
@@ -778,6 +779,8 @@ class hyperliquid extends hyperliquid$1 {
778
779
  [userAddress, params] = this.handlePublicAddress('fetchBalance', params);
779
780
  let type = undefined;
780
781
  [type, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
782
+ let marginMode = undefined;
783
+ [marginMode, params] = this.handleMarginModeAndParams('fetchBalance', params);
781
784
  const isSpot = (type === 'spot');
782
785
  const reqType = (isSpot) ? 'spotClearinghouseState' : 'clearinghouseState';
783
786
  const request = {
@@ -836,12 +839,18 @@ class hyperliquid extends hyperliquid$1 {
836
839
  return this.safeBalance(spotBalances);
837
840
  }
838
841
  const data = this.safeDict(response, 'marginSummary', {});
842
+ const usdcBalance = {
843
+ 'total': this.safeNumber(data, 'accountValue'),
844
+ };
845
+ if ((marginMode !== undefined) && (marginMode === 'isolated')) {
846
+ usdcBalance['free'] = this.safeNumber(response, 'withdrawable');
847
+ }
848
+ else {
849
+ usdcBalance['used'] = this.safeNumber(data, 'totalMarginUsed');
850
+ }
839
851
  const result = {
840
852
  'info': response,
841
- 'USDC': {
842
- 'total': this.safeNumber(data, 'accountValue'),
843
- 'used': this.safeNumber(data, 'totalMarginUsed'),
844
- },
853
+ 'USDC': usdcBalance,
845
854
  };
846
855
  const timestamp = this.safeInteger(response, 'time');
847
856
  result['timestamp'] = timestamp;
@@ -1088,87 +1088,48 @@ class mexc extends mexc$1 {
1088
1088
  const id = this.safeString(currency, 'coin');
1089
1089
  const code = this.safeCurrencyCode(id);
1090
1090
  const name = this.safeString(currency, 'name');
1091
- let currencyActive = false;
1092
- let currencyFee = undefined;
1093
- let currencyWithdrawMin = undefined;
1094
- let currencyWithdrawMax = undefined;
1095
- let depositEnabled = false;
1096
- let withdrawEnabled = false;
1097
1091
  const networks = {};
1098
1092
  const chains = this.safeValue(currency, 'networkList', []);
1099
1093
  for (let j = 0; j < chains.length; j++) {
1100
1094
  const chain = chains[j];
1101
1095
  const networkId = this.safeString2(chain, 'netWork', 'network');
1102
1096
  const network = this.networkIdToCode(networkId);
1103
- const isDepositEnabled = this.safeBool(chain, 'depositEnable', false);
1104
- const isWithdrawEnabled = this.safeBool(chain, 'withdrawEnable', false);
1105
- const active = (isDepositEnabled && isWithdrawEnabled);
1106
- currencyActive = active || currencyActive;
1107
- const withdrawMin = this.safeString(chain, 'withdrawMin');
1108
- const withdrawMax = this.safeString(chain, 'withdrawMax');
1109
- currencyWithdrawMin = (currencyWithdrawMin === undefined) ? withdrawMin : currencyWithdrawMin;
1110
- currencyWithdrawMax = (currencyWithdrawMax === undefined) ? withdrawMax : currencyWithdrawMax;
1111
- const fee = this.safeNumber(chain, 'withdrawFee');
1112
- currencyFee = (currencyFee === undefined) ? fee : currencyFee;
1113
- if (Precise["default"].stringGt(currencyWithdrawMin, withdrawMin)) {
1114
- currencyWithdrawMin = withdrawMin;
1115
- }
1116
- if (Precise["default"].stringLt(currencyWithdrawMax, withdrawMax)) {
1117
- currencyWithdrawMax = withdrawMax;
1118
- }
1119
- if (isDepositEnabled) {
1120
- depositEnabled = true;
1121
- }
1122
- if (isWithdrawEnabled) {
1123
- withdrawEnabled = true;
1124
- }
1125
1097
  networks[network] = {
1126
1098
  'info': chain,
1127
1099
  'id': networkId,
1128
1100
  'network': network,
1129
- 'active': active,
1130
- 'deposit': isDepositEnabled,
1131
- 'withdraw': isWithdrawEnabled,
1132
- 'fee': fee,
1101
+ 'active': undefined,
1102
+ 'deposit': this.safeBool(chain, 'depositEnable', false),
1103
+ 'withdraw': this.safeBool(chain, 'withdrawEnable', false),
1104
+ 'fee': this.safeNumber(chain, 'withdrawFee'),
1133
1105
  'precision': undefined,
1134
1106
  'limits': {
1135
1107
  'withdraw': {
1136
- 'min': withdrawMin,
1137
- 'max': withdrawMax,
1108
+ 'min': this.safeString(chain, 'withdrawMin'),
1109
+ 'max': this.safeString(chain, 'withdrawMax'),
1138
1110
  },
1139
1111
  },
1140
1112
  };
1141
1113
  }
1142
- const networkKeys = Object.keys(networks);
1143
- const networkKeysLength = networkKeys.length;
1144
- if ((networkKeysLength === 1) || ('NONE' in networks)) {
1145
- const defaultNetwork = this.safeValue2(networks, 'NONE', networkKeysLength - 1);
1146
- if (defaultNetwork !== undefined) {
1147
- currencyFee = defaultNetwork['fee'];
1148
- }
1149
- }
1150
- result[code] = {
1114
+ result[code] = this.safeCurrencyStructure({
1151
1115
  'info': currency,
1152
1116
  'id': id,
1153
1117
  'code': code,
1154
1118
  'name': name,
1155
- 'active': currencyActive,
1156
- 'deposit': depositEnabled,
1157
- 'withdraw': withdrawEnabled,
1158
- 'fee': currencyFee,
1119
+ 'active': undefined,
1120
+ 'deposit': undefined,
1121
+ 'withdraw': undefined,
1122
+ 'fee': undefined,
1159
1123
  'precision': undefined,
1160
1124
  'limits': {
1161
1125
  'amount': {
1162
1126
  'min': undefined,
1163
1127
  'max': undefined,
1164
1128
  },
1165
- 'withdraw': {
1166
- 'min': currencyWithdrawMin,
1167
- 'max': currencyWithdrawMax,
1168
- },
1169
1129
  },
1130
+ 'type': 'crypto',
1170
1131
  'networks': networks,
1171
- };
1132
+ });
1172
1133
  }
1173
1134
  return result;
1174
1135
  }
@@ -3425,13 +3386,27 @@ class mexc extends mexc$1 {
3425
3386
  }
3426
3387
  parseOrder(order, market = undefined) {
3427
3388
  //
3428
- // spot: createOrder
3389
+ // spot
3390
+ // createOrder
3429
3391
  //
3430
- // {
3392
+ // {
3393
+ // "symbol": "FARTCOINUSDT",
3394
+ // "orderId": "C02__342252993005723644225",
3395
+ // "orderListId": "-1",
3396
+ // "price": "1.1",
3397
+ // "origQty": "6.3",
3398
+ // "type": "IMMEDIATE_OR_CANCEL",
3399
+ // "side": "SELL",
3400
+ // "transactTime": "1745852205223"
3401
+ // }
3402
+ //
3403
+ // unknown endpoint on spot
3404
+ //
3405
+ // {
3431
3406
  // "symbol": "BTCUSDT",
3432
3407
  // "orderId": "123738410679123456",
3433
3408
  // "orderListId": -1
3434
- // }
3409
+ // }
3435
3410
  //
3436
3411
  // margin: createOrder
3437
3412
  //
@@ -3596,6 +3571,11 @@ class mexc extends mexc$1 {
3596
3571
  else {
3597
3572
  id = this.safeString2(order, 'orderId', 'id');
3598
3573
  }
3574
+ let timeInForce = this.parseOrderTimeInForce(this.safeString(order, 'timeInForce'));
3575
+ const typeRaw = this.safeString(order, 'type');
3576
+ if (timeInForce === undefined) {
3577
+ timeInForce = this.getTifFromRawOrderType(typeRaw);
3578
+ }
3599
3579
  const marketId = this.safeString(order, 'symbol');
3600
3580
  market = this.safeMarket(marketId, market);
3601
3581
  const timestamp = this.safeIntegerN(order, ['time', 'createTime', 'transactTime']);
@@ -3618,8 +3598,8 @@ class mexc extends mexc$1 {
3618
3598
  'lastTradeTimestamp': undefined,
3619
3599
  'status': this.parseOrderStatus(this.safeString2(order, 'status', 'state')),
3620
3600
  'symbol': market['symbol'],
3621
- 'type': this.parseOrderType(this.safeString(order, 'type')),
3622
- 'timeInForce': this.parseOrderTimeInForce(this.safeString(order, 'timeInForce')),
3601
+ 'type': this.parseOrderType(typeRaw),
3602
+ 'timeInForce': timeInForce,
3623
3603
  'side': this.parseOrderSide(this.safeString(order, 'side')),
3624
3604
  'price': this.safeNumber(order, 'price'),
3625
3605
  'triggerPrice': this.safeNumber2(order, 'stopPrice', 'triggerPrice'),
@@ -3648,6 +3628,9 @@ class mexc extends mexc$1 {
3648
3628
  'MARKET': 'market',
3649
3629
  'LIMIT': 'limit',
3650
3630
  'LIMIT_MAKER': 'limit',
3631
+ // on spot, during submission below types are used only accepted as limit order
3632
+ 'IMMEDIATE_OR_CANCEL': 'limit',
3633
+ 'FILL_OR_KILL': 'limit',
3651
3634
  };
3652
3635
  return this.safeString(statuses, status, status);
3653
3636
  }
@@ -3675,6 +3658,16 @@ class mexc extends mexc$1 {
3675
3658
  };
3676
3659
  return this.safeString(statuses, status, status);
3677
3660
  }
3661
+ getTifFromRawOrderType(orderType = undefined) {
3662
+ const statuses = {
3663
+ 'LIMIT': 'GTC',
3664
+ 'LIMIT_MAKER': 'POST_ONLY',
3665
+ 'IMMEDIATE_OR_CANCEL': 'IOC',
3666
+ 'FILL_OR_KILL': 'FOK',
3667
+ 'MARKET': 'IOC',
3668
+ };
3669
+ return this.safeString(statuses, orderType, orderType);
3670
+ }
3678
3671
  async fetchAccountHelper(type, params) {
3679
3672
  if (type === 'spot') {
3680
3673
  return await this.spotPrivateGetAccount(params);
@@ -372,6 +372,7 @@ class okx extends okx$1 {
372
372
  'asset/subaccount/managed-subaccount-bills': 5 / 3,
373
373
  'users/entrust-subaccount-list': 10,
374
374
  'account/subaccount/interest-limits': 4,
375
+ 'users/subaccount/apikey': 10,
375
376
  // grid trading
376
377
  'tradingBot/grid/orders-algo-pending': 1,
377
378
  'tradingBot/grid/orders-algo-history': 1,
@@ -504,6 +505,9 @@ class okx extends okx$1 {
504
505
  'asset/subaccount/transfer': 10,
505
506
  'users/subaccount/set-transfer-out': 10,
506
507
  'account/subaccount/set-loan-allocation': 4,
508
+ 'users/subaccount/create-subaccount': 10,
509
+ 'users/subaccount/subaccount-apikey': 10,
510
+ 'users/subaccount/delete-apikey': 10,
507
511
  // grid trading
508
512
  'tradingBot/grid/order-algo': 1,
509
513
  'tradingBot/grid/amend-order-algo': 1,
@@ -914,6 +918,11 @@ class okx extends okx$1 {
914
918
  '59506': errors.ExchangeError,
915
919
  '59507': errors.ExchangeError,
916
920
  '59508': errors.AccountSuspended,
921
+ '59515': errors.ExchangeError,
922
+ '59516': errors.ExchangeError,
923
+ '59517': errors.ExchangeError,
924
+ '59518': errors.ExchangeError,
925
+ '59519': errors.ExchangeError,
917
926
  '59642': errors.BadRequest,
918
927
  '59643': errors.ExchangeError,
919
928
  // WebSocket error Codes from 60000-63999
@@ -1596,8 +1605,8 @@ class okx extends okx$1 {
1596
1605
  const swap = (type === 'swap');
1597
1606
  const option = (type === 'option');
1598
1607
  const contract = swap || future || option;
1599
- let baseId = this.safeString(market, 'baseCcy');
1600
- let quoteId = this.safeString(market, 'quoteCcy');
1608
+ let baseId = this.safeString(market, 'baseCcy', ''); // defaulting to '' because some weird preopen markets have empty baseId
1609
+ let quoteId = this.safeString(market, 'quoteCcy', '');
1601
1610
  const settleId = this.safeString(market, 'settleCcy');
1602
1611
  const settle = this.safeCurrencyCode(settleId);
1603
1612
  const underlying = this.safeString(market, 'uly');
@@ -1613,19 +1622,25 @@ class okx extends okx$1 {
1613
1622
  let strikePrice = undefined;
1614
1623
  let optionType = undefined;
1615
1624
  if (contract) {
1616
- symbol = symbol + ':' + settle;
1625
+ if (settle !== undefined) {
1626
+ symbol = symbol + ':' + settle;
1627
+ }
1617
1628
  if (future) {
1618
1629
  expiry = this.safeInteger(market, 'expTime');
1619
- const ymd = this.yymmdd(expiry);
1620
- symbol = symbol + '-' + ymd;
1630
+ if (expiry !== undefined) {
1631
+ const ymd = this.yymmdd(expiry);
1632
+ symbol = symbol + '-' + ymd;
1633
+ }
1621
1634
  }
1622
1635
  else if (option) {
1623
1636
  expiry = this.safeInteger(market, 'expTime');
1624
1637
  strikePrice = this.safeString(market, 'stk');
1625
1638
  optionType = this.safeString(market, 'optType');
1626
- const ymd = this.yymmdd(expiry);
1627
- symbol = symbol + '-' + ymd + '-' + strikePrice + '-' + optionType;
1628
- optionType = (optionType === 'P') ? 'put' : 'call';
1639
+ if (expiry !== undefined) {
1640
+ const ymd = this.yymmdd(expiry);
1641
+ symbol = symbol + '-' + ymd + '-' + strikePrice + '-' + optionType;
1642
+ optionType = (optionType === 'P') ? 'put' : 'call';
1643
+ }
1629
1644
  }
1630
1645
  }
1631
1646
  const tickSize = this.safeString(market, 'tickSz');
@@ -707,18 +707,9 @@ class paradex extends paradex$1 {
707
707
  async fetchTickers(symbols = undefined, params = {}) {
708
708
  await this.loadMarkets();
709
709
  symbols = this.marketSymbols(symbols);
710
- const request = {};
711
- if (symbols !== undefined) {
712
- if (Array.isArray(symbols)) {
713
- request['market'] = this.marketId(symbols[0]);
714
- }
715
- else {
716
- request['market'] = this.marketId(symbols);
717
- }
718
- }
719
- else {
720
- request['market'] = 'ALL';
721
- }
710
+ const request = {
711
+ 'market': 'ALL',
712
+ };
722
713
  const response = await this.publicGetMarketsSummary(this.extend(request, params));
723
714
  //
724
715
  // {
@@ -1162,7 +1162,8 @@ class phemex extends phemex$1 {
1162
1162
  },
1163
1163
  },
1164
1164
  'valueScale': valueScale,
1165
- 'networks': {},
1165
+ 'networks': undefined,
1166
+ 'type': 'crypto',
1166
1167
  };
1167
1168
  }
1168
1169
  return result;
@@ -1852,7 +1852,7 @@ class poloniex extends poloniex$1 {
1852
1852
  const isTrigger = this.safeValue2(params, 'trigger', 'stop');
1853
1853
  params = this.omit(params, ['trigger', 'stop']);
1854
1854
  let response = undefined;
1855
- if (!market['spot']) {
1855
+ if (marketType !== 'spot') {
1856
1856
  const raw = await this.swapPrivateGetV3TradeOrderOpens(this.extend(request, params));
1857
1857
  //
1858
1858
  // {