ccxt 4.5.55 → 4.5.57

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 (321) hide show
  1. package/README.md +215 -10
  2. package/dist/ccxt.browser.min.js +10 -10
  3. package/dist/cjs/ccxt.js +6 -11
  4. package/dist/cjs/src/aftermath.js +10 -5
  5. package/dist/cjs/src/alpaca.js +2 -2
  6. package/dist/cjs/src/apex.js +26 -17
  7. package/dist/cjs/src/arkham.js +10 -7
  8. package/dist/cjs/src/ascendex.js +8 -5
  9. package/dist/cjs/src/aster.js +7 -4
  10. package/dist/cjs/src/backpack.js +4 -4
  11. package/dist/cjs/src/base/Exchange.js +72 -35
  12. package/dist/cjs/src/base/functions/io.js +25 -0
  13. package/dist/cjs/src/base/functions.js +1 -0
  14. package/dist/cjs/src/bigone.js +10 -7
  15. package/dist/cjs/src/binance.js +196 -198
  16. package/dist/cjs/src/bingx.js +7 -7
  17. package/dist/cjs/src/bitfinex.js +71 -58
  18. package/dist/cjs/src/bitflyer.js +2 -1
  19. package/dist/cjs/src/bitget.js +16 -5
  20. package/dist/cjs/src/bitmart.js +18 -10
  21. package/dist/cjs/src/bitmex.js +8 -5
  22. package/dist/cjs/src/bitopro.js +2 -2
  23. package/dist/cjs/src/bitrue.js +4 -3
  24. package/dist/cjs/src/bitso.js +7 -4
  25. package/dist/cjs/src/bitstamp.js +7 -4
  26. package/dist/cjs/src/bitteam.js +1 -1
  27. package/dist/cjs/src/bittrade.js +2 -2
  28. package/dist/cjs/src/bitvavo.js +457 -34
  29. package/dist/cjs/src/blofin.js +28 -4
  30. package/dist/cjs/src/bullish.js +6 -5
  31. package/dist/cjs/src/bybit.js +19 -17
  32. package/dist/cjs/src/bybiteu.js +1 -0
  33. package/dist/cjs/src/bydfi.js +1 -1
  34. package/dist/cjs/src/cex.js +3 -3
  35. package/dist/cjs/src/coinbase.js +75 -65
  36. package/dist/cjs/src/coinbaseexchange.js +4 -3
  37. package/dist/cjs/src/coinbaseinternational.js +17 -10
  38. package/dist/cjs/src/coinex.js +79 -77
  39. package/dist/cjs/src/coinmetro.js +1 -1
  40. package/dist/cjs/src/coinsph.js +5 -5
  41. package/dist/cjs/src/cryptocom.js +52 -54
  42. package/dist/cjs/src/cryptomus.js +43 -39
  43. package/dist/cjs/src/deepcoin.js +9 -5
  44. package/dist/cjs/src/delta.js +53 -53
  45. package/dist/cjs/src/deribit.js +35 -35
  46. package/dist/cjs/src/derive.js +31 -31
  47. package/dist/cjs/src/digifinex.js +45 -45
  48. package/dist/cjs/src/exmo.js +104 -122
  49. package/dist/cjs/src/extended.js +3497 -0
  50. package/dist/cjs/src/foxbit.js +72 -76
  51. package/dist/cjs/src/gate.js +53 -53
  52. package/dist/cjs/src/gemini.js +45 -45
  53. package/dist/cjs/src/grvt.js +17 -11
  54. package/dist/cjs/src/hashkey.js +56 -58
  55. package/dist/cjs/src/hibachi.js +1 -1
  56. package/dist/cjs/src/hitbtc.js +5 -14
  57. package/dist/cjs/src/hollaex.js +51 -54
  58. package/dist/cjs/src/htx.js +84 -72
  59. package/dist/cjs/src/hyperliquid.js +60 -55
  60. package/dist/cjs/src/indodax.js +4 -3
  61. package/dist/cjs/src/kraken.js +71 -71
  62. package/dist/cjs/src/krakenfutures.js +2 -1
  63. package/dist/cjs/src/kucoin.js +3 -2
  64. package/dist/cjs/src/latoken.js +30 -32
  65. package/dist/cjs/src/lbank.js +64 -60
  66. package/dist/cjs/src/lighter.js +36 -38
  67. package/dist/cjs/src/luno.js +36 -44
  68. package/dist/cjs/src/mercado.js +2 -1
  69. package/dist/cjs/src/mexc.js +72 -63
  70. package/dist/cjs/src/modetrade.js +51 -53
  71. package/dist/cjs/src/ndax.js +35 -37
  72. package/dist/cjs/src/okx.js +23 -5
  73. package/dist/cjs/src/onetrading.js +21 -23
  74. package/dist/cjs/src/p2b.js +8 -4
  75. package/dist/cjs/src/paradex.js +3 -2
  76. package/dist/cjs/src/phemex.js +47 -47
  77. package/dist/cjs/src/poloniex.js +19 -13
  78. package/dist/cjs/src/pro/alpaca.js +1 -1
  79. package/dist/cjs/src/pro/apex.js +11 -2
  80. package/dist/cjs/src/pro/arkham.js +1 -1
  81. package/dist/cjs/src/pro/aster.js +10 -9
  82. package/dist/cjs/src/pro/backpack.js +1 -1
  83. package/dist/cjs/src/pro/binance.js +6 -6
  84. package/dist/cjs/src/pro/bingx.js +7 -2
  85. package/dist/cjs/src/pro/bitget.js +1 -1
  86. package/dist/cjs/src/pro/bithumb.js +1 -1
  87. package/dist/cjs/src/pro/bitmart.js +10 -0
  88. package/dist/cjs/src/pro/bitmex.js +1 -1
  89. package/dist/cjs/src/pro/bitstamp.js +1 -1
  90. package/dist/cjs/src/pro/blockchaincom.js +1 -1
  91. package/dist/cjs/src/pro/bybit.js +1 -1
  92. package/dist/cjs/src/pro/cex.js +1 -1
  93. package/dist/cjs/src/pro/coinex.js +1 -1
  94. package/dist/cjs/src/pro/coinone.js +1 -1
  95. package/dist/cjs/src/pro/cryptocom.js +3 -1
  96. package/dist/cjs/src/pro/dydx.js +1 -1
  97. package/dist/cjs/src/pro/exmo.js +1 -1
  98. package/dist/cjs/src/pro/extended.js +865 -0
  99. package/dist/cjs/src/pro/gate.js +1 -1
  100. package/dist/cjs/src/pro/grvt.js +8 -0
  101. package/dist/cjs/src/pro/htx.js +4 -4
  102. package/dist/cjs/src/pro/independentreserve.js +1 -1
  103. package/dist/cjs/src/pro/krakenfutures.js +16 -4
  104. package/dist/cjs/src/pro/kucoin.js +1 -1
  105. package/dist/cjs/src/pro/luno.js +3 -3
  106. package/dist/cjs/src/pro/modetrade.js +3 -3
  107. package/dist/cjs/src/pro/okx.js +4 -4
  108. package/dist/cjs/src/pro/onetrading.js +1 -1
  109. package/dist/cjs/src/pro/toobit.js +1 -1
  110. package/dist/cjs/src/pro/weex.js +1 -1
  111. package/dist/cjs/src/pro/woo.js +4 -4
  112. package/dist/cjs/src/pro/woofipro.js +3 -3
  113. package/dist/cjs/src/pro/xt.js +1 -1
  114. package/dist/cjs/src/static_dependencies/starknet/utils/hash/classHash.js +7 -7
  115. package/dist/cjs/src/tokocrypto.js +1 -1
  116. package/dist/cjs/src/toobit.js +3 -3
  117. package/dist/cjs/src/upbit.js +3 -3
  118. package/dist/cjs/src/weex.js +57 -62
  119. package/dist/cjs/src/whitebit.js +61 -63
  120. package/dist/cjs/src/woo.js +66 -55
  121. package/dist/cjs/src/woofipro.js +54 -48
  122. package/dist/cjs/src/xt.js +3 -2
  123. package/dist/cjs/src/yobit.js +4 -2
  124. package/dist/cjs/src/zebpay.js +73 -75
  125. package/js/ccxt.d.ts +8 -14
  126. package/js/ccxt.js +6 -10
  127. package/js/src/abstract/bitvavo.d.ts +15 -7
  128. package/js/src/abstract/extended.d.ts +58 -0
  129. package/js/src/abstract/mexc.d.ts +1 -0
  130. package/js/src/aftermath.js +10 -5
  131. package/js/src/alpaca.js +2 -2
  132. package/js/src/apex.d.ts +1 -1
  133. package/js/src/apex.js +26 -17
  134. package/js/src/arkham.js +10 -7
  135. package/js/src/ascendex.js +8 -5
  136. package/js/src/aster.js +7 -4
  137. package/js/src/backpack.js +4 -4
  138. package/js/src/base/Exchange.d.ts +10 -6
  139. package/js/src/base/Exchange.js +72 -35
  140. package/js/src/base/functions/io.d.ts +7 -0
  141. package/js/src/base/functions/io.js +24 -0
  142. package/js/src/bigone.js +10 -7
  143. package/js/src/binance.d.ts +2 -0
  144. package/js/src/binance.js +200 -202
  145. package/js/src/bingx.js +7 -7
  146. package/js/src/bitfinex.d.ts +2 -0
  147. package/js/src/bitfinex.js +71 -58
  148. package/js/src/bitflyer.js +2 -1
  149. package/js/src/bitget.js +16 -5
  150. package/js/src/bitmart.js +18 -10
  151. package/js/src/bitmex.js +8 -5
  152. package/js/src/bitopro.js +2 -2
  153. package/js/src/bitrue.js +4 -3
  154. package/js/src/bitso.js +7 -4
  155. package/js/src/bitstamp.js +7 -4
  156. package/js/src/bitteam.js +1 -1
  157. package/js/src/bittrade.js +2 -2
  158. package/js/src/bitvavo.d.ts +114 -21
  159. package/js/src/bitvavo.js +457 -34
  160. package/js/src/blofin.d.ts +1 -0
  161. package/js/src/blofin.js +28 -4
  162. package/js/src/bullish.js +6 -5
  163. package/js/src/bybit.d.ts +1 -1
  164. package/js/src/bybit.js +19 -17
  165. package/js/src/bybiteu.js +1 -0
  166. package/js/src/bydfi.js +1 -1
  167. package/js/src/cex.js +3 -3
  168. package/js/src/coinbase.d.ts +63 -56
  169. package/js/src/coinbase.js +75 -65
  170. package/js/src/coinbaseexchange.js +4 -3
  171. package/js/src/coinbaseinternational.d.ts +1 -1
  172. package/js/src/coinbaseinternational.js +17 -10
  173. package/js/src/coinex.d.ts +2 -1
  174. package/js/src/coinex.js +79 -77
  175. package/js/src/coinmetro.d.ts +1 -1
  176. package/js/src/coinmetro.js +1 -1
  177. package/js/src/coinsph.js +5 -5
  178. package/js/src/cryptocom.d.ts +1 -0
  179. package/js/src/cryptocom.js +52 -54
  180. package/js/src/cryptomus.d.ts +2 -1
  181. package/js/src/cryptomus.js +43 -39
  182. package/js/src/deepcoin.js +9 -5
  183. package/js/src/delta.d.ts +1 -0
  184. package/js/src/delta.js +53 -53
  185. package/js/src/deribit.d.ts +1 -0
  186. package/js/src/deribit.js +35 -35
  187. package/js/src/derive.d.ts +1 -0
  188. package/js/src/derive.js +31 -31
  189. package/js/src/digifinex.d.ts +1 -0
  190. package/js/src/digifinex.js +45 -45
  191. package/js/src/exmo.d.ts +1 -0
  192. package/js/src/exmo.js +104 -122
  193. package/js/src/extended.d.ts +554 -0
  194. package/js/src/extended.js +3490 -0
  195. package/js/src/foxbit.d.ts +1 -0
  196. package/js/src/foxbit.js +72 -76
  197. package/js/src/gate.d.ts +1 -0
  198. package/js/src/gate.js +53 -53
  199. package/js/src/gemini.d.ts +2 -1
  200. package/js/src/gemini.js +45 -45
  201. package/js/src/grvt.d.ts +1 -1
  202. package/js/src/grvt.js +17 -11
  203. package/js/src/hashkey.d.ts +1 -0
  204. package/js/src/hashkey.js +56 -58
  205. package/js/src/hibachi.d.ts +1 -1
  206. package/js/src/hibachi.js +1 -1
  207. package/js/src/hitbtc.d.ts +0 -1
  208. package/js/src/hitbtc.js +5 -14
  209. package/js/src/hollaex.d.ts +1 -0
  210. package/js/src/hollaex.js +51 -54
  211. package/js/src/htx.d.ts +1 -0
  212. package/js/src/htx.js +84 -72
  213. package/js/src/hyperliquid.d.ts +5 -4
  214. package/js/src/hyperliquid.js +60 -55
  215. package/js/src/indodax.js +4 -3
  216. package/js/src/kraken.d.ts +2 -1
  217. package/js/src/kraken.js +71 -71
  218. package/js/src/krakenfutures.js +2 -1
  219. package/js/src/kucoin.js +3 -2
  220. package/js/src/latoken.d.ts +1 -0
  221. package/js/src/latoken.js +30 -32
  222. package/js/src/lbank.d.ts +1 -0
  223. package/js/src/lbank.js +64 -60
  224. package/js/src/lighter.d.ts +2 -1
  225. package/js/src/lighter.js +36 -38
  226. package/js/src/luno.d.ts +1 -0
  227. package/js/src/luno.js +36 -44
  228. package/js/src/mercado.js +2 -1
  229. package/js/src/mexc.d.ts +4 -3
  230. package/js/src/mexc.js +72 -63
  231. package/js/src/modetrade.d.ts +1 -0
  232. package/js/src/modetrade.js +51 -53
  233. package/js/src/ndax.d.ts +1 -0
  234. package/js/src/ndax.js +35 -37
  235. package/js/src/okx.js +23 -5
  236. package/js/src/onetrading.d.ts +2 -1
  237. package/js/src/onetrading.js +21 -23
  238. package/js/src/p2b.js +8 -4
  239. package/js/src/paradex.js +3 -2
  240. package/js/src/phemex.d.ts +1 -0
  241. package/js/src/phemex.js +47 -47
  242. package/js/src/poloniex.js +19 -13
  243. package/js/src/pro/alpaca.js +1 -1
  244. package/js/src/pro/apex.js +11 -2
  245. package/js/src/pro/arkham.js +1 -1
  246. package/js/src/pro/aster.js +10 -9
  247. package/js/src/pro/backpack.js +1 -1
  248. package/js/src/pro/binance.d.ts +1 -1
  249. package/js/src/pro/binance.js +6 -6
  250. package/js/src/pro/bingx.js +7 -2
  251. package/js/src/pro/bitget.js +1 -1
  252. package/js/src/pro/bithumb.js +1 -1
  253. package/js/src/pro/bitmart.js +10 -0
  254. package/js/src/pro/bitmex.js +1 -1
  255. package/js/src/pro/bitstamp.js +1 -1
  256. package/js/src/pro/blockchaincom.js +1 -1
  257. package/js/src/pro/bybit.js +1 -1
  258. package/js/src/pro/cex.js +1 -1
  259. package/js/src/pro/coinex.js +1 -1
  260. package/js/src/pro/coinone.js +1 -1
  261. package/js/src/pro/cryptocom.js +3 -1
  262. package/js/src/pro/dydx.js +1 -1
  263. package/js/src/pro/exmo.js +1 -1
  264. package/js/src/pro/extended.d.ts +126 -0
  265. package/js/src/pro/extended.js +858 -0
  266. package/js/src/pro/gate.js +1 -1
  267. package/js/src/pro/grvt.js +8 -0
  268. package/js/src/pro/htx.d.ts +4 -4
  269. package/js/src/pro/htx.js +4 -4
  270. package/js/src/pro/independentreserve.js +1 -1
  271. package/js/src/pro/krakenfutures.d.ts +4 -4
  272. package/js/src/pro/krakenfutures.js +16 -4
  273. package/js/src/pro/kucoin.js +1 -1
  274. package/js/src/pro/luno.d.ts +1 -1
  275. package/js/src/pro/luno.js +3 -3
  276. package/js/src/pro/modetrade.d.ts +3 -3
  277. package/js/src/pro/modetrade.js +3 -3
  278. package/js/src/pro/okx.d.ts +4 -4
  279. package/js/src/pro/okx.js +4 -4
  280. package/js/src/pro/onetrading.js +1 -1
  281. package/js/src/pro/toobit.js +1 -1
  282. package/js/src/pro/weex.js +1 -1
  283. package/js/src/pro/woo.d.ts +4 -4
  284. package/js/src/pro/woo.js +4 -4
  285. package/js/src/pro/woofipro.d.ts +3 -3
  286. package/js/src/pro/woofipro.js +3 -3
  287. package/js/src/pro/xt.js +1 -1
  288. package/js/src/tokocrypto.js +1 -1
  289. package/js/src/toobit.d.ts +1 -1
  290. package/js/src/toobit.js +3 -3
  291. package/js/src/upbit.js +3 -3
  292. package/js/src/weex.d.ts +1 -0
  293. package/js/src/weex.js +57 -62
  294. package/js/src/whitebit.d.ts +1 -0
  295. package/js/src/whitebit.js +61 -63
  296. package/js/src/woo.d.ts +1 -0
  297. package/js/src/woo.js +66 -55
  298. package/js/src/woofipro.d.ts +1 -0
  299. package/js/src/woofipro.js +54 -48
  300. package/js/src/xt.js +3 -2
  301. package/js/src/yobit.js +4 -2
  302. package/js/src/zebpay.d.ts +2 -1
  303. package/js/src/zebpay.js +73 -75
  304. package/package.json +25 -11
  305. package/dist/cjs/src/gateio.js +0 -18
  306. package/dist/cjs/src/oxfun.js +0 -2931
  307. package/dist/cjs/src/pro/gateio.js +0 -18
  308. package/dist/cjs/src/pro/oxfun.js +0 -1113
  309. package/js/src/abstract/gateio.d.ts +0 -346
  310. package/js/src/abstract/gateio.js +0 -5
  311. package/js/src/abstract/oxfun.d.ts +0 -37
  312. package/js/src/gateio.d.ts +0 -4
  313. package/js/src/gateio.js +0 -11
  314. package/js/src/oxfun.d.ts +0 -442
  315. package/js/src/oxfun.js +0 -2924
  316. package/js/src/pro/gateio.d.ts +0 -4
  317. package/js/src/pro/gateio.js +0 -11
  318. package/js/src/pro/oxfun.d.ts +0 -234
  319. package/js/src/pro/oxfun.js +0 -1106
  320. /package/dist/cjs/src/abstract/{oxfun.js → extended.js} +0 -0
  321. /package/js/src/abstract/{oxfun.js → extended.js} +0 -0
@@ -159,6 +159,7 @@ export default class blofin extends Exchange {
159
159
  * @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
160
160
  * @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
161
161
  * @param {float} [params.stopLoss.price] stop loss order price (if not provided the order will be a market order)
162
+ * @param {float} [params.tpsl] whether to force to send the order to the combined TPSL oco order endpoint
162
163
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
163
164
  */
164
165
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
package/js/src/blofin.js CHANGED
@@ -546,6 +546,7 @@ export default class blofin extends Exchange {
546
546
  let maxLeverage = this.safeString(market, 'maxLeverage', '100');
547
547
  maxLeverage = Precise.stringMax(maxLeverage, '1');
548
548
  const isActive = (this.safeString(market, 'state') === 'live');
549
+ const isMargin = spot && (Precise.stringGt(maxLeverage, '1'));
549
550
  return this.safeMarketStructure({
550
551
  'id': id,
551
552
  'symbol': symbol,
@@ -558,7 +559,7 @@ export default class blofin extends Exchange {
558
559
  'type': type,
559
560
  'spot': spot,
560
561
  'option': option,
561
- 'margin': spot && (Precise.stringGt(maxLeverage, '1')),
562
+ 'margin': isMargin,
562
563
  'swap': swap,
563
564
  'future': future,
564
565
  'active': isActive,
@@ -1458,6 +1459,7 @@ export default class blofin extends Exchange {
1458
1459
  * @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
1459
1460
  * @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
1460
1461
  * @param {float} [params.stopLoss.price] stop loss order price (if not provided the order will be a market order)
1462
+ * @param {float} [params.tpsl] whether to force to send the order to the combined TPSL oco order endpoint
1461
1463
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
1462
1464
  */
1463
1465
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
@@ -1466,7 +1468,9 @@ export default class blofin extends Exchange {
1466
1468
  const isStopLossPriceDefined = this.safeString(params, 'stopLossPrice') !== undefined;
1467
1469
  const isTakeProfitPriceDefined = this.safeString(params, 'takeProfitPrice') !== undefined;
1468
1470
  const isTriggerOrder = this.safeString(params, 'triggerPrice') !== undefined;
1469
- const isCombinedSlTp = (isStopLossPriceDefined && isTakeProfitPriceDefined);
1471
+ let isTpslEndpoint = false;
1472
+ [isTpslEndpoint, params] = this.handleOptionAndParams(params, 'createOrder', 'tpsl', false);
1473
+ const isCombinedSlTp = (isStopLossPriceDefined && isTakeProfitPriceDefined) || isTpslEndpoint;
1470
1474
  const isSlOrTp = isStopLossPriceDefined || isTakeProfitPriceDefined;
1471
1475
  let response = undefined;
1472
1476
  const reduceOnly = this.safeBool(params, 'reduceOnly');
@@ -1521,11 +1525,31 @@ export default class blofin extends Exchange {
1521
1525
  const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
1522
1526
  if (stopLossPrice !== undefined) {
1523
1527
  request['slTriggerPrice'] = this.priceToPrecision(symbol, stopLossPrice);
1524
- request['slOrderPrice'] = (type === 'market') ? '-1' : this.priceToPrecision(symbol, price);
1528
+ if (type === 'market') {
1529
+ request['slOrderPrice'] = '-1';
1530
+ }
1531
+ else {
1532
+ const slLimitPrice = this.safeString(params, 'stopLossLimitPrice');
1533
+ if (slLimitPrice === undefined) {
1534
+ throw new ArgumentsRequired(this.id + ' createTpslOrder() requires a "stopLossLimitPrice" parameter (instead of "price" argument) for stop loss orders when the order type is not market');
1535
+ }
1536
+ request['slOrderPrice'] = this.priceToPrecision(symbol, slLimitPrice);
1537
+ params = this.omit(params, 'stopLossLimitPrice');
1538
+ }
1525
1539
  }
1526
1540
  if (takeProfitPrice !== undefined) {
1527
1541
  request['tpTriggerPrice'] = this.priceToPrecision(symbol, takeProfitPrice);
1528
- request['tpOrderPrice'] = (type === 'market') ? '-1' : this.priceToPrecision(symbol, price);
1542
+ if (type === 'market') {
1543
+ request['tpOrderPrice'] = '-1';
1544
+ }
1545
+ else {
1546
+ const tpLimitPrice = this.safeString(params, 'takeProfitLimitPrice');
1547
+ if (tpLimitPrice === undefined) {
1548
+ throw new ArgumentsRequired(this.id + ' createTpslOrder() requires a "takeProfitLimitPrice" parameter (instead of "price" argument) for take profit orders when the order type is not market');
1549
+ }
1550
+ request['tpOrderPrice'] = this.priceToPrecision(symbol, tpLimitPrice);
1551
+ params = this.omit(params, 'takeProfitLimitPrice');
1552
+ }
1529
1553
  }
1530
1554
  request['marginMode'] = marginMode;
1531
1555
  params = this.omit(params, ['stopLossPrice', 'takeProfitPrice', 'reduceOnly', 'hedged']);
package/js/src/bullish.js CHANGED
@@ -2094,7 +2094,7 @@ export default class bullish extends Exchange {
2094
2094
  let networkCode = undefined;
2095
2095
  [networkCode, params] = this.handleNetworkCodeAndParams(params);
2096
2096
  if (networkCode !== undefined) {
2097
- request['network'] = this.networkCodeToId(networkCode);
2097
+ request['network'] = this.networkCodeToId(networkCode, code);
2098
2098
  }
2099
2099
  else {
2100
2100
  throw new ArgumentsRequired(this.id + ' withdraw() requires a network parameter');
@@ -2168,7 +2168,7 @@ export default class bullish extends Exchange {
2168
2168
  'txid': txid,
2169
2169
  'timestamp': timestamp,
2170
2170
  'datetime': this.iso8601(timestamp),
2171
- 'network': this.networkIdToCode(network),
2171
+ 'network': this.networkIdToCode(network, code),
2172
2172
  'addressFrom': sourceAddress,
2173
2173
  'address': address,
2174
2174
  'addressTo': address,
@@ -2365,7 +2365,7 @@ export default class bullish extends Exchange {
2365
2365
  for (let i = 0; i < safeResponse.length; i++) {
2366
2366
  const entry = this.safeDict(safeResponse, i, {});
2367
2367
  const networkId = this.safeString(entry, 'network');
2368
- const networkCode = this.networkIdToCode(networkId);
2368
+ const networkCode = this.networkIdToCode(networkId, code);
2369
2369
  if (network === networkCode) {
2370
2370
  data = entry;
2371
2371
  break;
@@ -2381,10 +2381,11 @@ export default class bullish extends Exchange {
2381
2381
  parseDepositAddress(depositAddress, currency = undefined) {
2382
2382
  const id = this.safeString(depositAddress, 'symbol');
2383
2383
  const network = this.safeString(depositAddress, 'network');
2384
+ const code = this.safeCurrencyCode(id, currency);
2384
2385
  return {
2385
2386
  'info': depositAddress,
2386
- 'currency': this.safeCurrencyCode(id, currency),
2387
- 'network': this.networkIdToCode(network),
2387
+ 'currency': code,
2388
+ 'network': this.networkIdToCode(network, code),
2388
2389
  'address': this.safeString(depositAddress, 'address'),
2389
2390
  'tag': undefined,
2390
2391
  };
package/js/src/bybit.d.ts CHANGED
@@ -70,7 +70,7 @@ export default class bybit extends Exchange {
70
70
  */
71
71
  fetchMarkets(params?: {}): Promise<Market[]>;
72
72
  fetchSpotMarkets(params: any): Promise<Market[]>;
73
- fetchFutureMarkets(params: any): Promise<Market[]>;
73
+ fetchFutureMarkets(params?: {}): Promise<Market[]>;
74
74
  fetchOptionMarkets(params: any): Promise<Market[]>;
75
75
  parseTicker(ticker: Dict, market?: Market): Ticker;
76
76
  /**
package/js/src/bybit.js CHANGED
@@ -1541,8 +1541,9 @@ export default class bybit extends Exchange {
1541
1541
  amountPrecision = this.parseNumber('1');
1542
1542
  pricePrecision = this.parseNumber('0.01');
1543
1543
  }
1544
+ const convertedExpireDate = this.convertExpireDateToMarketIdDate(expiry);
1544
1545
  return {
1545
- 'id': base + '-' + this.convertExpireDateToMarketIdDate(expiry) + '-' + strike + '-' + optionType,
1546
+ 'id': base + '-' + convertedExpireDate + '-' + strike + '-' + optionType,
1546
1547
  'symbol': base + '/' + quote + ':' + settle + '-' + expiry + '-' + strike + '-' + optionType,
1547
1548
  'base': base,
1548
1549
  'quote': quote,
@@ -1949,8 +1950,8 @@ export default class bybit extends Exchange {
1949
1950
  }
1950
1951
  return result;
1951
1952
  }
1952
- async fetchFutureMarkets(params) {
1953
- params = this.extend(params);
1953
+ async fetchFutureMarkets(params = {}) {
1954
+ params = this.extend(params, {});
1954
1955
  params['limit'] = 1000; // minimize number of requests
1955
1956
  let preLaunchMarkets = [];
1956
1957
  const usePrivateInstrumentsInfo = this.safeBool(this.options, 'usePrivateInstrumentsInfo', false);
@@ -2093,7 +2094,7 @@ export default class bybit extends Exchange {
2093
2094
  symbol = symbol + '-' + this.yymmdd(expiry);
2094
2095
  }
2095
2096
  const contractSize = inverse ? this.safeNumber2(lotSizeFilter, 'minTradingQty', 'minOrderQty') : this.parseNumber('1');
2096
- result.push(this.safeMarketStructure({
2097
+ const parsedMarket = this.safeMarketStructure({
2097
2098
  'id': id,
2098
2099
  'symbol': symbol,
2099
2100
  'base': base,
@@ -2143,7 +2144,8 @@ export default class bybit extends Exchange {
2143
2144
  },
2144
2145
  'created': this.safeInteger(market, 'launchTime'),
2145
2146
  'info': market,
2146
- }));
2147
+ });
2148
+ result.push(parsedMarket);
2147
2149
  }
2148
2150
  return result;
2149
2151
  }
@@ -4949,7 +4951,7 @@ export default class bybit extends Exchange {
4949
4951
  //
4950
4952
  const result = this.safeDict(response, 'result', {});
4951
4953
  const row = this.safeList(result, 'list', []);
4952
- return this.parseOrders(row, undefined);
4954
+ return this.parseOrders(row);
4953
4955
  }
4954
4956
  /**
4955
4957
  * @method
@@ -5786,7 +5788,7 @@ export default class bybit extends Exchange {
5786
5788
  */
5787
5789
  async fetchDepositAddressesByNetwork(code, params = {}) {
5788
5790
  await this.loadMarkets();
5789
- let currency = this.currency(code);
5791
+ const currency = this.currency(code);
5790
5792
  const request = {
5791
5793
  'coin': currency['id'],
5792
5794
  };
@@ -5818,9 +5820,9 @@ export default class bybit extends Exchange {
5818
5820
  const result = this.safeDict(response, 'result', {});
5819
5821
  const chains = this.safeList(result, 'chains', []);
5820
5822
  const coin = this.safeString(result, 'coin');
5821
- currency = this.currency(coin);
5822
- const parsed = this.parseDepositAddresses(chains, [currency['code']], false, {
5823
- 'currency': currency['code'],
5823
+ const currencyFromResponse = this.currency(coin);
5824
+ const parsed = this.parseDepositAddresses(chains, [currencyFromResponse['code']], false, {
5825
+ 'currency': currencyFromResponse['code'],
5824
5826
  });
5825
5827
  return this.indexBy(parsed, 'network');
5826
5828
  }
@@ -7094,7 +7096,7 @@ export default class bybit extends Exchange {
7094
7096
  }
7095
7097
  async fetchDerivativesOpenInterestHistory(symbol, timeframe = '1h', since = undefined, limit = undefined, params = {}) {
7096
7098
  await this.loadMarkets();
7097
- let market = this.market(symbol);
7099
+ const market = this.market(symbol);
7098
7100
  const subType = market['linear'] ? 'linear' : 'inverse';
7099
7101
  const category = this.safeString(params, 'category', subType);
7100
7102
  const intervals = this.safeDict(this.options, 'intervals');
@@ -7145,8 +7147,8 @@ export default class bybit extends Exchange {
7145
7147
  const result = this.safeDict(response, 'result', {});
7146
7148
  const data = this.addPaginationCursorToResult(response);
7147
7149
  const id = this.safeString(result, 'symbol');
7148
- market = this.safeMarket(id, market, undefined, 'contract');
7149
- return this.parseOpenInterestsHistory(data, market, since, limit);
7150
+ const safeMarketObj = this.safeMarket(id, market, undefined, 'contract');
7151
+ return this.parseOpenInterestsHistory(data, safeMarketObj, since, limit);
7150
7152
  }
7151
7153
  /**
7152
7154
  * @method
@@ -7161,7 +7163,7 @@ export default class bybit extends Exchange {
7161
7163
  */
7162
7164
  async fetchOpenInterest(symbol, params = {}) {
7163
7165
  await this.loadMarkets();
7164
- let market = this.market(symbol);
7166
+ const market = this.market(symbol);
7165
7167
  if (!market['contract']) {
7166
7168
  throw new BadRequest(this.id + ' fetchOpenInterest() supports contract markets only');
7167
7169
  }
@@ -7204,9 +7206,9 @@ export default class bybit extends Exchange {
7204
7206
  //
7205
7207
  const result = this.safeDict(response, 'result', {});
7206
7208
  const id = this.safeString(result, 'symbol');
7207
- market = this.safeMarket(id, market, undefined, 'contract');
7209
+ const safeMarketObj = this.safeMarket(id, market, undefined, 'contract');
7208
7210
  const data = this.addPaginationCursorToResult(response);
7209
- return this.parseOpenInterest(data[0], market);
7211
+ return this.parseOpenInterest(data[0], safeMarketObj);
7210
7212
  }
7211
7213
  /**
7212
7214
  * @method
@@ -7374,7 +7376,7 @@ export default class bybit extends Exchange {
7374
7376
  //
7375
7377
  const data = this.safeDict(response, 'result', {});
7376
7378
  const rows = this.safeList(data, 'loanAccountList', []);
7377
- const interest = this.parseBorrowInterests(rows, undefined);
7379
+ const interest = this.parseBorrowInterests(rows);
7378
7380
  return this.filterByCurrencySinceLimit(interest, code, since, limit);
7379
7381
  }
7380
7382
  /**
package/js/src/bybiteu.js CHANGED
@@ -50,6 +50,7 @@ export default class bybiteu extends bybit {
50
50
  'margin': true,
51
51
  'swap': false,
52
52
  'future': false,
53
+ 'option': undefined,
53
54
  },
54
55
  });
55
56
  }
package/js/src/bydfi.js CHANGED
@@ -2814,7 +2814,7 @@ export default class bydfi extends Exchange {
2814
2814
  'txid': this.safeString(transaction, 'txId'),
2815
2815
  'type': undefined,
2816
2816
  'currency': code,
2817
- 'network': this.networkIdToCode(this.safeString(transaction, 'network')),
2817
+ 'network': this.networkIdToCode(this.safeString(transaction, 'network'), code),
2818
2818
  'amount': this.safeNumber(transaction, 'amount'),
2819
2819
  'status': this.parseTransactionStatus(rawStatus),
2820
2820
  'timestamp': timestamp,
package/js/src/cex.js CHANGED
@@ -368,7 +368,7 @@ export default class cex extends Exchange {
368
368
  for (let j = 0; j < keys.length; j++) {
369
369
  const networkId = keys[j];
370
370
  const rawNetwork = rawNetworks[networkId];
371
- const networkCode = this.networkIdToCode(networkId);
371
+ const networkCode = this.networkIdToCode(networkId, code);
372
372
  const deposit = this.safeString(rawNetwork, 'deposit') === 'enabled';
373
373
  const withdraw = this.safeString(rawNetwork, 'withdrawal') === 'enabled';
374
374
  networks[networkCode] = {
@@ -1696,7 +1696,7 @@ export default class cex extends Exchange {
1696
1696
  const request = {
1697
1697
  'accountId': accountId,
1698
1698
  'currency': currency['id'],
1699
- 'blockchain': this.networkCodeToId(networkCode),
1699
+ 'blockchain': this.networkCodeToId(networkCode, currency['code']),
1700
1700
  };
1701
1701
  const response = await this.privatePostGetDepositAddress(this.extend(request, params));
1702
1702
  //
@@ -1721,7 +1721,7 @@ export default class cex extends Exchange {
1721
1721
  return {
1722
1722
  'info': depositAddress,
1723
1723
  'currency': currency['code'],
1724
- 'network': this.networkIdToCode(this.safeString(depositAddress, 'blockchain')),
1724
+ 'network': this.networkIdToCode(this.safeString(depositAddress, 'blockchain'), currency['code']),
1725
1725
  'address': address,
1726
1726
  'tag': undefined,
1727
1727
  };