ccxt 4.2.84 → 4.2.86

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 (168) hide show
  1. package/README.md +5 -5
  2. package/dist/ccxt.browser.js +1226 -1104
  3. package/dist/ccxt.browser.min.js +4 -4
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/ace.js +5 -5
  6. package/dist/cjs/src/ascendex.js +8 -8
  7. package/dist/cjs/src/base/Exchange.js +76 -14
  8. package/dist/cjs/src/bigone.js +12 -12
  9. package/dist/cjs/src/binance.js +23 -35
  10. package/dist/cjs/src/bingx.js +47 -28
  11. package/dist/cjs/src/bit2c.js +1 -1
  12. package/dist/cjs/src/bitbank.js +27 -31
  13. package/dist/cjs/src/bitbns.js +5 -5
  14. package/dist/cjs/src/bitfinex.js +1 -1
  15. package/dist/cjs/src/bitfinex2.js +1 -1
  16. package/dist/cjs/src/bitget.js +30 -24
  17. package/dist/cjs/src/bithumb.js +5 -5
  18. package/dist/cjs/src/bitmart.js +16 -16
  19. package/dist/cjs/src/bitopro.js +1 -1
  20. package/dist/cjs/src/bitrue.js +4 -4
  21. package/dist/cjs/src/bitso.js +5 -5
  22. package/dist/cjs/src/bitstamp.js +1 -1
  23. package/dist/cjs/src/bitteam.js +8 -8
  24. package/dist/cjs/src/bl3p.js +1 -1
  25. package/dist/cjs/src/btcturk.js +6 -6
  26. package/dist/cjs/src/bybit.js +31 -95
  27. package/dist/cjs/src/coincheck.js +4 -4
  28. package/dist/cjs/src/coinex.js +408 -262
  29. package/dist/cjs/src/coinlist.js +7 -7
  30. package/dist/cjs/src/coinmate.js +4 -4
  31. package/dist/cjs/src/coinmetro.js +3 -3
  32. package/dist/cjs/src/coinone.js +5 -5
  33. package/dist/cjs/src/coinspot.js +2 -2
  34. package/dist/cjs/src/cryptocom.js +17 -17
  35. package/dist/cjs/src/currencycom.js +1 -1
  36. package/dist/cjs/src/delta.js +0 -8
  37. package/dist/cjs/src/deribit.js +16 -92
  38. package/dist/cjs/src/digifinex.js +8 -8
  39. package/dist/cjs/src/exmo.js +8 -8
  40. package/dist/cjs/src/gate.js +0 -8
  41. package/dist/cjs/src/hitbtc.js +5 -4
  42. package/dist/cjs/src/hollaex.js +7 -7
  43. package/dist/cjs/src/htx.js +7 -7
  44. package/dist/cjs/src/huobijp.js +3 -3
  45. package/dist/cjs/src/idex.js +12 -13
  46. package/dist/cjs/src/independentreserve.js +2 -2
  47. package/dist/cjs/src/indodax.js +2 -2
  48. package/dist/cjs/src/kraken.js +8 -8
  49. package/dist/cjs/src/krakenfutures.js +6 -6
  50. package/dist/cjs/src/kucoin.js +5 -1
  51. package/dist/cjs/src/kucoinfutures.js +8 -8
  52. package/dist/cjs/src/kuna.js +16 -16
  53. package/dist/cjs/src/latoken.js +2 -2
  54. package/dist/cjs/src/lbank.js +10 -10
  55. package/dist/cjs/src/luno.js +4 -4
  56. package/dist/cjs/src/mercado.js +5 -5
  57. package/dist/cjs/src/mexc.js +6 -6
  58. package/dist/cjs/src/ndax.js +1 -1
  59. package/dist/cjs/src/novadax.js +9 -9
  60. package/dist/cjs/src/oceanex.js +7 -7
  61. package/dist/cjs/src/okcoin.js +16 -14
  62. package/dist/cjs/src/okx.js +23 -31
  63. package/dist/cjs/src/onetrading.js +4 -4
  64. package/dist/cjs/src/p2b.js +7 -7
  65. package/dist/cjs/src/phemex.js +12 -12
  66. package/dist/cjs/src/poloniexfutures.js +5 -5
  67. package/dist/cjs/src/pro/binance.js +167 -121
  68. package/dist/cjs/src/pro/bitget.js +1 -0
  69. package/dist/cjs/src/pro/kucoin.js +6 -7
  70. package/dist/cjs/src/pro/okx.js +19 -2
  71. package/dist/cjs/src/probit.js +11 -11
  72. package/dist/cjs/src/timex.js +7 -7
  73. package/dist/cjs/src/tokocrypto.js +9 -9
  74. package/dist/cjs/src/wavesexchange.js +3 -3
  75. package/dist/cjs/src/whitebit.js +5 -5
  76. package/dist/cjs/src/woo.js +1 -1
  77. package/dist/cjs/src/zaif.js +1 -1
  78. package/dist/cjs/src/zonda.js +7 -7
  79. package/examples/js/cli.js +0 -1
  80. package/examples/ts/cli.ts +0 -1
  81. package/js/ccxt.d.ts +1 -1
  82. package/js/ccxt.js +1 -1
  83. package/js/src/abstract/coinex.d.ts +232 -123
  84. package/js/src/ace.js +5 -5
  85. package/js/src/ascendex.js +8 -8
  86. package/js/src/base/Exchange.d.ts +13 -12
  87. package/js/src/base/Exchange.js +76 -14
  88. package/js/src/bigone.js +12 -12
  89. package/js/src/binance.d.ts +0 -1
  90. package/js/src/binance.js +23 -35
  91. package/js/src/bingx.js +47 -28
  92. package/js/src/bit2c.js +1 -1
  93. package/js/src/bitbank.js +27 -31
  94. package/js/src/bitbns.js +5 -5
  95. package/js/src/bitfinex.js +1 -1
  96. package/js/src/bitfinex2.js +1 -1
  97. package/js/src/bitget.js +30 -24
  98. package/js/src/bithumb.js +5 -5
  99. package/js/src/bitmart.js +16 -16
  100. package/js/src/bitopro.js +1 -1
  101. package/js/src/bitrue.js +4 -4
  102. package/js/src/bitso.js +5 -5
  103. package/js/src/bitstamp.js +1 -1
  104. package/js/src/bitteam.js +8 -8
  105. package/js/src/bl3p.js +1 -1
  106. package/js/src/btcturk.js +6 -6
  107. package/js/src/bybit.d.ts +0 -3
  108. package/js/src/bybit.js +31 -95
  109. package/js/src/coincheck.js +4 -4
  110. package/js/src/coinex.d.ts +1 -1
  111. package/js/src/coinex.js +408 -262
  112. package/js/src/coinlist.js +7 -7
  113. package/js/src/coinmate.js +4 -4
  114. package/js/src/coinmetro.js +3 -3
  115. package/js/src/coinone.js +5 -5
  116. package/js/src/coinspot.js +2 -2
  117. package/js/src/cryptocom.js +17 -17
  118. package/js/src/currencycom.js +1 -1
  119. package/js/src/delta.d.ts +0 -1
  120. package/js/src/delta.js +0 -8
  121. package/js/src/deribit.d.ts +0 -3
  122. package/js/src/deribit.js +16 -92
  123. package/js/src/digifinex.js +8 -8
  124. package/js/src/exmo.js +8 -8
  125. package/js/src/gate.d.ts +0 -1
  126. package/js/src/gate.js +0 -8
  127. package/js/src/hitbtc.js +5 -4
  128. package/js/src/hollaex.js +7 -7
  129. package/js/src/htx.js +7 -7
  130. package/js/src/huobijp.js +3 -3
  131. package/js/src/idex.js +12 -13
  132. package/js/src/independentreserve.js +2 -2
  133. package/js/src/indodax.js +2 -2
  134. package/js/src/kraken.js +8 -8
  135. package/js/src/krakenfutures.js +6 -6
  136. package/js/src/kucoin.js +5 -1
  137. package/js/src/kucoinfutures.js +8 -8
  138. package/js/src/kuna.js +16 -16
  139. package/js/src/latoken.js +2 -2
  140. package/js/src/lbank.js +10 -10
  141. package/js/src/luno.js +4 -4
  142. package/js/src/mercado.js +5 -5
  143. package/js/src/mexc.js +6 -6
  144. package/js/src/ndax.js +1 -1
  145. package/js/src/novadax.js +9 -9
  146. package/js/src/oceanex.js +7 -7
  147. package/js/src/okcoin.js +16 -14
  148. package/js/src/okx.d.ts +0 -1
  149. package/js/src/okx.js +23 -31
  150. package/js/src/onetrading.js +4 -4
  151. package/js/src/p2b.js +7 -7
  152. package/js/src/phemex.js +12 -12
  153. package/js/src/poloniexfutures.js +5 -5
  154. package/js/src/pro/binance.d.ts +5 -1
  155. package/js/src/pro/binance.js +168 -122
  156. package/js/src/pro/bitget.js +1 -0
  157. package/js/src/pro/kucoin.js +6 -7
  158. package/js/src/pro/okx.js +19 -2
  159. package/js/src/probit.js +11 -11
  160. package/js/src/timex.js +7 -7
  161. package/js/src/tokocrypto.js +9 -9
  162. package/js/src/wavesexchange.js +3 -3
  163. package/js/src/whitebit.js +5 -5
  164. package/js/src/woo.js +1 -1
  165. package/js/src/zaif.js +1 -1
  166. package/js/src/zonda.js +7 -7
  167. package/package.json +1 -1
  168. package/skip-tests.json +4 -0
@@ -687,7 +687,7 @@ class bitso extends bitso$1 {
687
687
  // ]
688
688
  // }
689
689
  //
690
- const payload = this.safeValue(response, 'payload', []);
690
+ const payload = this.safeList(response, 'payload', []);
691
691
  return this.parseOHLCVs(payload, market, timeframe, since, limit);
692
692
  }
693
693
  parseOHLCV(ohlcv, market = undefined) {
@@ -1246,7 +1246,7 @@ class bitso extends bitso$1 {
1246
1246
  // }
1247
1247
  //
1248
1248
  const transactions = this.safeValue(response, 'payload', []);
1249
- const first = this.safeValue(transactions, 0, {});
1249
+ const first = this.safeDict(transactions, 0, {});
1250
1250
  return this.parseTransaction(first);
1251
1251
  }
1252
1252
  async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
@@ -1290,7 +1290,7 @@ class bitso extends bitso$1 {
1290
1290
  // }]
1291
1291
  // }
1292
1292
  //
1293
- const transactions = this.safeValue(response, 'payload', []);
1293
+ const transactions = this.safeList(response, 'payload', []);
1294
1294
  return this.parseTransactions(transactions, currency, since, limit, params);
1295
1295
  }
1296
1296
  async fetchDepositAddress(code, params = {}) {
@@ -1473,7 +1473,7 @@ class bitso extends bitso$1 {
1473
1473
  // }
1474
1474
  // }
1475
1475
  //
1476
- const payload = this.safeValue(response, 'payload', {});
1476
+ const payload = this.safeList(response, 'payload', []);
1477
1477
  return this.parseDepositWithdrawFees(payload, codes);
1478
1478
  }
1479
1479
  parseDepositWithdrawFees(response, codes = undefined, currencyIdKey = undefined) {
@@ -1609,7 +1609,7 @@ class bitso extends bitso$1 {
1609
1609
  // }
1610
1610
  //
1611
1611
  const payload = this.safeValue(response, 'payload', []);
1612
- const first = this.safeValue(payload, 0);
1612
+ const first = this.safeDict(payload, 0);
1613
1613
  return this.parseTransaction(first, currency);
1614
1614
  }
1615
1615
  safeNetwork(networkId) {
@@ -1110,7 +1110,7 @@ class bitstamp extends bitstamp$1 {
1110
1110
  // }
1111
1111
  //
1112
1112
  const data = this.safeValue(response, 'data', {});
1113
- const ohlc = this.safeValue(data, 'ohlc', []);
1113
+ const ohlc = this.safeList(data, 'ohlc', []);
1114
1114
  return this.parseOHLCVs(ohlc, market, timeframe, since, limit);
1115
1115
  }
1116
1116
  parseBalance(response) {
@@ -671,7 +671,7 @@ class bitteam extends bitteam$1 {
671
671
  // }
672
672
  //
673
673
  const result = this.safeValue(response, 'result', {});
674
- const data = this.safeValue(result, 'data', []);
674
+ const data = this.safeList(result, 'data', []);
675
675
  return this.parseOHLCVs(data, market, timeframe, since, limit);
676
676
  }
677
677
  parseOHLCV(ohlcv, market = undefined) {
@@ -852,7 +852,7 @@ class bitteam extends bitteam$1 {
852
852
  // }
853
853
  //
854
854
  const result = this.safeValue(response, 'result', {});
855
- const orders = this.safeValue(result, 'orders', []);
855
+ const orders = this.safeList(result, 'orders', []);
856
856
  return this.parseOrders(orders, market, since, limit);
857
857
  }
858
858
  async fetchOrder(id, symbol = undefined, params = {}) {
@@ -912,7 +912,7 @@ class bitteam extends bitteam$1 {
912
912
  // }
913
913
  // }
914
914
  //
915
- const result = this.safeValue(response, 'result');
915
+ const result = this.safeDict(response, 'result');
916
916
  return this.parseOrder(result, market);
917
917
  }
918
918
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -1023,7 +1023,7 @@ class bitteam extends bitteam$1 {
1023
1023
  // }
1024
1024
  // }
1025
1025
  //
1026
- const order = this.safeValue(response, 'result', {});
1026
+ const order = this.safeDict(response, 'result', {});
1027
1027
  return this.parseOrder(order, market);
1028
1028
  }
1029
1029
  async cancelOrder(id, symbol = undefined, params = {}) {
@@ -1050,7 +1050,7 @@ class bitteam extends bitteam$1 {
1050
1050
  // }
1051
1051
  // }
1052
1052
  //
1053
- const result = this.safeValue(response, 'result', {});
1053
+ const result = this.safeDict(response, 'result', {});
1054
1054
  return this.parseOrder(result);
1055
1055
  }
1056
1056
  async cancelAllOrders(symbol = undefined, params = {}) {
@@ -1513,7 +1513,7 @@ class bitteam extends bitteam$1 {
1513
1513
  // }
1514
1514
  //
1515
1515
  const result = this.safeValue(response, 'result', {});
1516
- const pair = this.safeValue(result, 'pair', {});
1516
+ const pair = this.safeDict(result, 'pair', {});
1517
1517
  return this.parseTicker(pair, market);
1518
1518
  }
1519
1519
  parseTicker(ticker, market = undefined) {
@@ -1842,7 +1842,7 @@ class bitteam extends bitteam$1 {
1842
1842
  // }
1843
1843
  //
1844
1844
  const result = this.safeValue(response, 'result', {});
1845
- const trades = this.safeValue(result, 'trades', []);
1845
+ const trades = this.safeList(result, 'trades', []);
1846
1846
  return this.parseTrades(trades, market, since, limit);
1847
1847
  }
1848
1848
  parseTrade(trade, market = undefined) {
@@ -2145,7 +2145,7 @@ class bitteam extends bitteam$1 {
2145
2145
  // }
2146
2146
  //
2147
2147
  const result = this.safeValue(response, 'result', {});
2148
- const transactions = this.safeValue(result, 'transactions', []);
2148
+ const transactions = this.safeList(result, 'transactions', []);
2149
2149
  return this.parseTransactions(transactions, currency, since, limit);
2150
2150
  }
2151
2151
  parseTransaction(transaction, currency = undefined) {
@@ -175,7 +175,7 @@ class bl3p extends bl3p$1 {
175
175
  'market': market['id'],
176
176
  };
177
177
  const response = await this.publicGetMarketOrderbook(this.extend(request, params));
178
- const orderbook = this.safeValue(response, 'data');
178
+ const orderbook = this.safeDict(response, 'data');
179
179
  return this.parseOrderBook(orderbook, market['symbol'], undefined, 'bids', 'asks', 'price_int', 'amount_int');
180
180
  }
181
181
  parseTicker(ticker, market = undefined) {
@@ -415,7 +415,7 @@ class btcturk extends btcturk$1 {
415
415
  */
416
416
  await this.loadMarkets();
417
417
  const response = await this.publicGetTicker(params);
418
- const tickers = this.safeValue(response, 'data');
418
+ const tickers = this.safeList(response, 'data');
419
419
  return this.parseTickers(tickers, symbols);
420
420
  }
421
421
  async fetchTicker(symbol, params = {}) {
@@ -533,7 +533,7 @@ class btcturk extends btcturk$1 {
533
533
  // ]
534
534
  // }
535
535
  //
536
- const data = this.safeValue(response, 'data');
536
+ const data = this.safeList(response, 'data');
537
537
  return this.parseTrades(data, market, since, limit);
538
538
  }
539
539
  parseOHLCV(ohlcv, market = undefined) {
@@ -690,7 +690,7 @@ class btcturk extends btcturk$1 {
690
690
  request['newClientOrderId'] = this.uuid();
691
691
  }
692
692
  const response = await this.privatePostOrder(this.extend(request, params));
693
- const data = this.safeValue(response, 'data');
693
+ const data = this.safeDict(response, 'data');
694
694
  return this.parseOrder(data, market);
695
695
  }
696
696
  async cancelOrder(id, symbol = undefined, params = {}) {
@@ -731,7 +731,7 @@ class btcturk extends btcturk$1 {
731
731
  const response = await this.privateGetOpenOrders(this.extend(request, params));
732
732
  const data = this.safeValue(response, 'data');
733
733
  const bids = this.safeValue(data, 'bids', []);
734
- const asks = this.safeValue(data, 'asks', []);
734
+ const asks = this.safeList(data, 'asks', []);
735
735
  return this.parseOrders(this.arrayConcat(bids, asks), market, since, limit);
736
736
  }
737
737
  async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -779,7 +779,7 @@ class btcturk extends btcturk$1 {
779
779
  // }
780
780
  // ]
781
781
  // }
782
- const data = this.safeValue(response, 'data');
782
+ const data = this.safeList(response, 'data');
783
783
  return this.parseOrders(data, market, since, limit);
784
784
  }
785
785
  parseOrderStatus(status) {
@@ -896,7 +896,7 @@ class btcturk extends btcturk$1 {
896
896
  // "code": "0"
897
897
  // }
898
898
  //
899
- const data = this.safeValue(response, 'data');
899
+ const data = this.safeList(response, 'data');
900
900
  return this.parseTrades(data, market, since, limit);
901
901
  }
902
902
  nonce() {
@@ -1120,82 +1120,6 @@ class bybit extends bybit$1 {
1120
1120
  async upgradeUnifiedTradeAccount(params = {}) {
1121
1121
  return await this.privatePostV5AccountUpgradeToUta(params);
1122
1122
  }
1123
- convertExpireDate(date) {
1124
- // parse YYMMDD to timestamp
1125
- const year = date.slice(0, 2);
1126
- const month = date.slice(2, 4);
1127
- const day = date.slice(4, 6);
1128
- const reconstructedDate = '20' + year + '-' + month + '-' + day + 'T00:00:00Z';
1129
- return reconstructedDate;
1130
- }
1131
- convertExpireDateToMarketIdDate(date) {
1132
- // parse 231229 to 29DEC23
1133
- const year = date.slice(0, 2);
1134
- const monthRaw = date.slice(2, 4);
1135
- let month = undefined;
1136
- const day = date.slice(4, 6);
1137
- if (monthRaw === '01') {
1138
- month = 'JAN';
1139
- }
1140
- else if (monthRaw === '02') {
1141
- month = 'FEB';
1142
- }
1143
- else if (monthRaw === '03') {
1144
- month = 'MAR';
1145
- }
1146
- else if (monthRaw === '04') {
1147
- month = 'APR';
1148
- }
1149
- else if (monthRaw === '05') {
1150
- month = 'MAY';
1151
- }
1152
- else if (monthRaw === '06') {
1153
- month = 'JUN';
1154
- }
1155
- else if (monthRaw === '07') {
1156
- month = 'JUL';
1157
- }
1158
- else if (monthRaw === '08') {
1159
- month = 'AUG';
1160
- }
1161
- else if (monthRaw === '09') {
1162
- month = 'SEP';
1163
- }
1164
- else if (monthRaw === '10') {
1165
- month = 'OCT';
1166
- }
1167
- else if (monthRaw === '11') {
1168
- month = 'NOV';
1169
- }
1170
- else if (monthRaw === '12') {
1171
- month = 'DEC';
1172
- }
1173
- const reconstructedDate = day + month + year;
1174
- return reconstructedDate;
1175
- }
1176
- convertMarketIdExpireDate(date) {
1177
- // parse 22JAN23 to 230122
1178
- const monthMappping = {
1179
- 'JAN': '01',
1180
- 'FEB': '02',
1181
- 'MAR': '03',
1182
- 'APR': '04',
1183
- 'MAY': '05',
1184
- 'JUN': '06',
1185
- 'JUL': '07',
1186
- 'AUG': '08',
1187
- 'SEP': '09',
1188
- 'OCT': '10',
1189
- 'NOV': '11',
1190
- 'DEC': '12',
1191
- };
1192
- const year = date.slice(0, 2);
1193
- const monthName = date.slice(2, 5);
1194
- const month = this.safeString(monthMappping, monthName);
1195
- const day = date.slice(5, 7);
1196
- const reconstructedDate = day + month + year;
1197
- return reconstructedDate;
1198
- }
1199
1123
  createExpiredOptionMarket(symbol) {
1200
1124
  // support expired option contracts
1201
1125
  const quote = 'USD';
@@ -2090,7 +2014,7 @@ class bybit extends bybit$1 {
2090
2014
  //
2091
2015
  const result = this.safeValue(response, 'result', []);
2092
2016
  const tickers = this.safeValue(result, 'list', []);
2093
- const rawTicker = this.safeValue(tickers, 0);
2017
+ const rawTicker = this.safeDict(tickers, 0);
2094
2018
  return this.parseTicker(rawTicker, market);
2095
2019
  }
2096
2020
  async fetchTickers(symbols = undefined, params = {}) {
@@ -2101,6 +2025,7 @@ class bybit extends bybit$1 {
2101
2025
  * @see https://bybit-exchange.github.io/docs/v5/market/tickers
2102
2026
  * @param {string[]} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
2103
2027
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2028
+ * @param {string} [params.subType] *contract only* 'linear', 'inverse'
2104
2029
  * @returns {object} an array of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
2105
2030
  */
2106
2031
  await this.loadMarkets();
@@ -2139,12 +2064,17 @@ class bybit extends bybit$1 {
2139
2064
  };
2140
2065
  let type = undefined;
2141
2066
  [type, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
2142
- if (type === 'spot') {
2067
+ // Calls like `.fetchTickers (undefined, {subType:'inverse'})` should be supported for this exchange, so
2068
+ // as "options.defaultSubType" is also set in exchange options, we should consider `params.subType`
2069
+ // with higher priority and only default to spot, if `subType` is not set in params
2070
+ const passedSubType = this.safeString(params, 'subType');
2071
+ let subType = undefined;
2072
+ [subType, params] = this.handleSubTypeAndParams('fetchTickers', market, params, 'linear');
2073
+ // only if passedSubType is undefined, then use spot
2074
+ if (type === 'spot' && passedSubType === undefined) {
2143
2075
  request['category'] = 'spot';
2144
2076
  }
2145
- else if (type === 'swap' || type === 'future') {
2146
- let subType = undefined;
2147
- [subType, params] = this.handleSubTypeAndParams('fetchTickers', market, params, 'linear');
2077
+ else if (type === 'swap' || type === 'future' || subType !== undefined) {
2148
2078
  request['category'] = subType;
2149
2079
  }
2150
2080
  else if (type === 'option') {
@@ -2190,7 +2120,7 @@ class bybit extends bybit$1 {
2190
2120
  // }
2191
2121
  //
2192
2122
  const result = this.safeValue(response, 'result', {});
2193
- const tickerList = this.safeValue(result, 'list', []);
2123
+ const tickerList = this.safeList(result, 'list', []);
2194
2124
  return this.parseTickers(tickerList, parsedSymbols);
2195
2125
  }
2196
2126
  parseOHLCV(ohlcv, market = undefined) {
@@ -2329,7 +2259,7 @@ class bybit extends bybit$1 {
2329
2259
  // }
2330
2260
  //
2331
2261
  const result = this.safeValue(response, 'result', {});
2332
- const ohlcvs = this.safeValue(result, 'list', []);
2262
+ const ohlcvs = this.safeList(result, 'list', []);
2333
2263
  return this.parseOHLCVs(ohlcvs, market, timeframe, since, limit);
2334
2264
  }
2335
2265
  parseFundingRate(ticker, market = undefined) {
@@ -2806,7 +2736,7 @@ class bybit extends bybit$1 {
2806
2736
  // }
2807
2737
  //
2808
2738
  const result = this.safeValue(response, 'result', {});
2809
- const trades = this.safeValue(result, 'list', []);
2739
+ const trades = this.safeList(result, 'list', []);
2810
2740
  return this.parseTrades(trades, market, since, limit);
2811
2741
  }
2812
2742
  async fetchOrderBook(symbol, limit = undefined, params = {}) {
@@ -3558,7 +3488,7 @@ class bybit extends bybit$1 {
3558
3488
  // "time": 1672211918471
3559
3489
  // }
3560
3490
  //
3561
- const order = this.safeValue(response, 'result', {});
3491
+ const order = this.safeDict(response, 'result', {});
3562
3492
  return this.parseOrder(order, market);
3563
3493
  }
3564
3494
  createOrderRequest(symbol, type, side, amount, price = undefined, params = {}, isUTA = true) {
@@ -4012,7 +3942,7 @@ class bybit extends bybit$1 {
4012
3942
  // "tpTriggerBy":"UNKNOWN"
4013
3943
  // }
4014
3944
  //
4015
- const order = this.safeValue(response, 'result', {});
3945
+ const order = this.safeDict(response, 'result', {});
4016
3946
  return this.parseOrder(order, market);
4017
3947
  }
4018
3948
  async editUsdcOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
@@ -4068,7 +3998,7 @@ class bybit extends bybit$1 {
4068
3998
  // "retExtMap": {}
4069
3999
  // }
4070
4000
  //
4071
- const result = this.safeValue(response, 'result', {});
4001
+ const result = this.safeDict(response, 'result', {});
4072
4002
  return this.parseOrder(result, market);
4073
4003
  }
4074
4004
  async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
@@ -4238,7 +4168,7 @@ class bybit extends bybit$1 {
4238
4168
  // "retExtMap": {}
4239
4169
  // }
4240
4170
  //
4241
- const result = this.safeValue(response, 'result', {});
4171
+ const result = this.safeDict(response, 'result', {});
4242
4172
  return this.parseOrder(result, market);
4243
4173
  }
4244
4174
  async cancelOrder(id, symbol = undefined, params = {}) {
@@ -4306,7 +4236,7 @@ class bybit extends bybit$1 {
4306
4236
  // "time": 1672217377164
4307
4237
  // }
4308
4238
  //
4309
- const result = this.safeValue(response, 'result', {});
4239
+ const result = this.safeDict(response, 'result', {});
4310
4240
  return this.parseOrder(result, market);
4311
4241
  }
4312
4242
  async cancelOrders(ids, symbol = undefined, params = {}) {
@@ -4603,7 +4533,7 @@ class bybit extends bybit$1 {
4603
4533
  // }
4604
4534
  //
4605
4535
  const result = this.safeValue(response, 'result', {});
4606
- const data = this.safeValue(result, 'dataList', []);
4536
+ const data = this.safeList(result, 'dataList', []);
4607
4537
  return this.parseOrders(data, market, since, limit);
4608
4538
  }
4609
4539
  async fetchOrderClassic(id, symbol = undefined, params = {}) {
@@ -5231,7 +5161,7 @@ class bybit extends bybit$1 {
5231
5161
  // }
5232
5162
  //
5233
5163
  const result = this.safeValue(response, 'result', {});
5234
- const dataList = this.safeValue(result, 'dataList', []);
5164
+ const dataList = this.safeList(result, 'dataList', []);
5235
5165
  return this.parseTrades(dataList, market, since, limit);
5236
5166
  }
5237
5167
  async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -5434,7 +5364,7 @@ class bybit extends bybit$1 {
5434
5364
  const chains = this.safeValue(result, 'chains', []);
5435
5365
  const chainsIndexedById = this.indexBy(chains, 'chain');
5436
5366
  const selectedNetworkId = this.selectNetworkIdFromRawNetworks(code, networkCode, chainsIndexedById);
5437
- const addressObject = this.safeValue(chainsIndexedById, selectedNetworkId, {});
5367
+ const addressObject = this.safeDict(chainsIndexedById, selectedNetworkId, {});
5438
5368
  return this.parseDepositAddress(addressObject, currency);
5439
5369
  }
5440
5370
  async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
@@ -5993,7 +5923,7 @@ class bybit extends bybit$1 {
5993
5923
  // "time": "1666892894902"
5994
5924
  // }
5995
5925
  //
5996
- const result = this.safeValue(response, 'result', {});
5926
+ const result = this.safeDict(response, 'result', {});
5997
5927
  return this.parseTransaction(result, currency);
5998
5928
  }
5999
5929
  async fetchPosition(symbol, params = {}) {
@@ -6402,6 +6332,12 @@ class bybit extends bybit$1 {
6402
6332
  if (timestamp === undefined) {
6403
6333
  timestamp = this.safeIntegerN(position, ['updatedTime', 'updatedAt']);
6404
6334
  }
6335
+ const tradeMode = this.safeInteger(position, 'tradeMode', 0);
6336
+ let marginMode = undefined;
6337
+ if ((!this.options['enableUnifiedAccount']) || (this.options['enableUnifiedAccount'] && market['inverse'])) {
6338
+ // tradeMode would work for classic and UTA(inverse)
6339
+ marginMode = (tradeMode === 1) ? 'isolated' : 'cross';
6340
+ }
6405
6341
  let collateralString = this.safeString(position, 'positionBalance');
6406
6342
  const entryPrice = this.omitZero(this.safeString2(position, 'entryPrice', 'avgPrice'));
6407
6343
  const liquidationPrice = this.omitZero(this.safeString(position, 'liqPrice'));
@@ -6465,7 +6401,7 @@ class bybit extends bybit$1 {
6465
6401
  'markPrice': this.safeNumber(position, 'markPrice'),
6466
6402
  'lastPrice': undefined,
6467
6403
  'collateral': this.parseNumber(collateralString),
6468
- 'marginMode': undefined,
6404
+ 'marginMode': marginMode,
6469
6405
  'side': side,
6470
6406
  'percentage': undefined,
6471
6407
  'stopLossPrice': this.safeNumber2(position, 'stop_loss', 'stopLoss'),
@@ -7523,7 +7459,7 @@ class bybit extends bybit$1 {
7523
7459
  // }
7524
7460
  //
7525
7461
  const data = this.safeValue(response, 'result', {});
7526
- const rows = this.safeValue(data, 'rows', []);
7462
+ const rows = this.safeList(data, 'rows', []);
7527
7463
  return this.parseDepositWithdrawFees(rows, codes, 'coin');
7528
7464
  }
7529
7465
  async fetchSettlementHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -485,7 +485,7 @@ class coincheck extends coincheck$1 {
485
485
  // ]
486
486
  // }
487
487
  //
488
- const transactions = this.safeValue(response, 'data', []);
488
+ const transactions = this.safeList(response, 'data', []);
489
489
  return this.parseTrades(transactions, market, since, limit);
490
490
  }
491
491
  async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
@@ -519,7 +519,7 @@ class coincheck extends coincheck$1 {
519
519
  // "created_at": "2021-12-08T14:10:33.000Z"
520
520
  // }
521
521
  //
522
- const data = this.safeValue(response, 'data', []);
522
+ const data = this.safeList(response, 'data', []);
523
523
  return this.parseTrades(data, market, since, limit);
524
524
  }
525
525
  async fetchTradingFees(params = {}) {
@@ -668,7 +668,7 @@ class coincheck extends coincheck$1 {
668
668
  // }
669
669
  // ]
670
670
  // }
671
- const data = this.safeValue(response, 'deposits', []);
671
+ const data = this.safeList(response, 'deposits', []);
672
672
  return this.parseTransactions(data, currency, since, limit, { 'type': 'deposit' });
673
673
  }
674
674
  async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
@@ -714,7 +714,7 @@ class coincheck extends coincheck$1 {
714
714
  // }
715
715
  // ]
716
716
  // }
717
- const data = this.safeValue(response, 'data', []);
717
+ const data = this.safeList(response, 'data', []);
718
718
  return this.parseTransactions(data, currency, since, limit, { 'type': 'withdrawal' });
719
719
  }
720
720
  parseTransactionStatus(status) {