ccxt 4.5.28 → 4.5.29

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 (513) hide show
  1. package/README.md +21 -5
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/alpaca.js +21 -21
  5. package/dist/cjs/src/apex.js +20 -20
  6. package/dist/cjs/src/arkham.js +22 -22
  7. package/dist/cjs/src/ascendex.js +28 -28
  8. package/dist/cjs/src/backpack.js +22 -22
  9. package/dist/cjs/src/base/Exchange.js +48 -38
  10. package/dist/cjs/src/base/functions/throttle.js +54 -5
  11. package/dist/cjs/src/bigone.js +19 -19
  12. package/dist/cjs/src/binance.js +83 -82
  13. package/dist/cjs/src/bingx.js +46 -46
  14. package/dist/cjs/src/bit2c.js +11 -11
  15. package/dist/cjs/src/bitbank.js +49 -48
  16. package/dist/cjs/src/bitbns.js +13 -13
  17. package/dist/cjs/src/bitfinex.js +33 -33
  18. package/dist/cjs/src/bitflyer.js +17 -17
  19. package/dist/cjs/src/bitget.js +58 -57
  20. package/dist/cjs/src/bithumb.js +10 -10
  21. package/dist/cjs/src/bitmart.js +44 -44
  22. package/dist/cjs/src/bitmex.js +24 -24
  23. package/dist/cjs/src/bitopro.js +20 -20
  24. package/dist/cjs/src/bitrue.js +18 -18
  25. package/dist/cjs/src/bitso.js +20 -20
  26. package/dist/cjs/src/bitstamp.js +21 -21
  27. package/dist/cjs/src/bittrade.js +20 -20
  28. package/dist/cjs/src/bitvavo.js +19 -19
  29. package/dist/cjs/src/blockchaincom.js +20 -20
  30. package/dist/cjs/src/blofin.js +26 -26
  31. package/dist/cjs/src/btcalpha.js +35 -34
  32. package/dist/cjs/src/btcbox.js +10 -10
  33. package/dist/cjs/src/btcmarkets.js +16 -16
  34. package/dist/cjs/src/btcturk.js +10 -10
  35. package/dist/cjs/src/bullish.js +26 -26
  36. package/dist/cjs/src/bybit.js +67 -67
  37. package/dist/cjs/src/cex.js +18 -18
  38. package/dist/cjs/src/coinbase.js +40 -40
  39. package/dist/cjs/src/coinbaseexchange.js +22 -22
  40. package/dist/cjs/src/coinbaseinternational.js +22 -22
  41. package/dist/cjs/src/coincatch.js +39 -39
  42. package/dist/cjs/src/coincheck.js +11 -11
  43. package/dist/cjs/src/coinex.js +48 -48
  44. package/dist/cjs/src/coinmate.js +14 -14
  45. package/dist/cjs/src/coinmetro.js +14 -14
  46. package/dist/cjs/src/coinone.js +11 -11
  47. package/dist/cjs/src/coinsph.js +20 -20
  48. package/dist/cjs/src/coinspot.js +8 -8
  49. package/dist/cjs/src/cryptocom.js +32 -32
  50. package/dist/cjs/src/cryptomus.js +9 -9
  51. package/dist/cjs/src/deepcoin.js +33 -33
  52. package/dist/cjs/src/defx.js +23 -23
  53. package/dist/cjs/src/delta.js +29 -29
  54. package/dist/cjs/src/deribit.js +36 -36
  55. package/dist/cjs/src/derive.js +19 -19
  56. package/dist/cjs/src/digifinex.js +36 -36
  57. package/dist/cjs/src/dydx.js +22 -22
  58. package/dist/cjs/src/exmo.js +29 -29
  59. package/dist/cjs/src/foxbit.js +23 -23
  60. package/dist/cjs/src/gate.js +57 -57
  61. package/dist/cjs/src/gemini.js +16 -16
  62. package/dist/cjs/src/hashkey.js +35 -35
  63. package/dist/cjs/src/hibachi.js +24 -24
  64. package/dist/cjs/src/hitbtc.js +38 -38
  65. package/dist/cjs/src/hollaex.js +22 -22
  66. package/dist/cjs/src/htx.js +50 -50
  67. package/dist/cjs/src/hyperliquid.js +76 -42
  68. package/dist/cjs/src/independentreserve.js +13 -13
  69. package/dist/cjs/src/indodax.js +14 -14
  70. package/dist/cjs/src/kraken.js +30 -30
  71. package/dist/cjs/src/krakenfutures.js +21 -21
  72. package/dist/cjs/src/kucoin.js +44 -44
  73. package/dist/cjs/src/kucoinfutures.js +42 -40
  74. package/dist/cjs/src/latoken.js +16 -16
  75. package/dist/cjs/src/lbank.js +23 -23
  76. package/dist/cjs/src/luno.js +17 -17
  77. package/dist/cjs/src/mercado.js +11 -11
  78. package/dist/cjs/src/mexc.js +47 -47
  79. package/dist/cjs/src/modetrade.js +37 -35
  80. package/dist/cjs/src/ndax.js +19 -19
  81. package/dist/cjs/src/novadax.js +19 -19
  82. package/dist/cjs/src/oceanex.js +16 -16
  83. package/dist/cjs/src/okx.js +83 -83
  84. package/dist/cjs/src/onetrading.js +34 -33
  85. package/dist/cjs/src/oxfun.js +25 -25
  86. package/dist/cjs/src/p2b.js +11 -11
  87. package/dist/cjs/src/paradex.js +54 -54
  88. package/dist/cjs/src/paymium.js +20 -21
  89. package/dist/cjs/src/phemex.js +35 -35
  90. package/dist/cjs/src/poloniex.js +27 -27
  91. package/dist/cjs/src/pro/alpaca.js +5 -5
  92. package/dist/cjs/src/pro/apex.js +8 -8
  93. package/dist/cjs/src/pro/arkham.js +5 -5
  94. package/dist/cjs/src/pro/ascendex.js +5 -5
  95. package/dist/cjs/src/pro/backpack.js +16 -16
  96. package/dist/cjs/src/pro/binance.js +35 -35
  97. package/dist/cjs/src/pro/bingx.js +9 -9
  98. package/dist/cjs/src/pro/bitfinex.js +8 -8
  99. package/dist/cjs/src/pro/bitget.js +12 -12
  100. package/dist/cjs/src/pro/bithumb.js +3 -3
  101. package/dist/cjs/src/pro/bitmart.js +388 -31
  102. package/dist/cjs/src/pro/bitmex.js +9 -9
  103. package/dist/cjs/src/pro/bitopro.js +5 -5
  104. package/dist/cjs/src/pro/bitrue.js +2 -2
  105. package/dist/cjs/src/pro/bitstamp.js +3 -3
  106. package/dist/cjs/src/pro/bittrade.js +3 -3
  107. package/dist/cjs/src/pro/bitvavo.js +19 -19
  108. package/dist/cjs/src/pro/blockchaincom.js +5 -5
  109. package/dist/cjs/src/pro/blofin.js +10 -10
  110. package/dist/cjs/src/pro/bullish.js +6 -6
  111. package/dist/cjs/src/pro/bybit.js +19 -19
  112. package/dist/cjs/src/pro/cex.js +13 -13
  113. package/dist/cjs/src/pro/coinbase.js +13 -13
  114. package/dist/cjs/src/pro/coinbaseexchange.js +10 -10
  115. package/dist/cjs/src/pro/coinbaseinternational.js +8 -8
  116. package/dist/cjs/src/pro/coincatch.js +10 -10
  117. package/dist/cjs/src/pro/coincheck.js +2 -2
  118. package/dist/cjs/src/pro/coinex.js +10 -10
  119. package/dist/cjs/src/pro/coinone.js +3 -3
  120. package/dist/cjs/src/pro/cryptocom.js +20 -20
  121. package/dist/cjs/src/pro/deepcoin.js +8 -8
  122. package/dist/cjs/src/pro/defx.js +15 -15
  123. package/dist/cjs/src/pro/deribit.js +10 -10
  124. package/dist/cjs/src/pro/derive.js +6 -6
  125. package/dist/cjs/src/pro/dydx.js +3 -3
  126. package/dist/cjs/src/pro/exmo.js +7 -7
  127. package/dist/cjs/src/pro/gate.js +21 -59
  128. package/dist/cjs/src/pro/gemini.js +6 -6
  129. package/dist/cjs/src/pro/hashkey.js +6 -6
  130. package/dist/cjs/src/pro/hitbtc.js +8 -8
  131. package/dist/cjs/src/pro/hollaex.js +5 -5
  132. package/dist/cjs/src/pro/htx.js +9 -9
  133. package/dist/cjs/src/pro/hyperliquid.js +103 -14
  134. package/dist/cjs/src/pro/independentreserve.js +2 -2
  135. package/dist/cjs/src/pro/kraken.js +15 -15
  136. package/dist/cjs/src/pro/krakenfutures.js +10 -10
  137. package/dist/cjs/src/pro/kucoin.js +15 -15
  138. package/dist/cjs/src/pro/kucoinfutures.js +13 -13
  139. package/dist/cjs/src/pro/lbank.js +5 -5
  140. package/dist/cjs/src/pro/luno.js +2 -2
  141. package/dist/cjs/src/pro/mexc.js +13 -13
  142. package/dist/cjs/src/pro/modetrade.js +8 -8
  143. package/dist/cjs/src/pro/ndax.js +3 -3
  144. package/dist/cjs/src/pro/okx.js +25 -25
  145. package/dist/cjs/src/pro/onetrading.js +6 -6
  146. package/dist/cjs/src/pro/oxfun.js +13 -13
  147. package/dist/cjs/src/pro/p2b.js +5 -5
  148. package/dist/cjs/src/pro/paradex.js +8 -8
  149. package/dist/cjs/src/pro/phemex.js +7 -7
  150. package/dist/cjs/src/pro/poloniex.js +8 -8
  151. package/dist/cjs/src/pro/probit.js +6 -6
  152. package/dist/cjs/src/pro/toobit.js +9 -9
  153. package/dist/cjs/src/pro/upbit.js +9 -9
  154. package/dist/cjs/src/pro/whitebit.js +7 -7
  155. package/dist/cjs/src/pro/woo.js +13 -13
  156. package/dist/cjs/src/pro/woofipro.js +20 -20
  157. package/dist/cjs/src/pro/xt.js +2 -2
  158. package/dist/cjs/src/probit.js +18 -18
  159. package/dist/cjs/src/static_dependencies/ethers/utils/index.js +11 -0
  160. package/dist/cjs/src/timex.js +16 -16
  161. package/dist/cjs/src/tokocrypto.js +17 -17
  162. package/dist/cjs/src/toobit.js +31 -29
  163. package/dist/cjs/src/upbit.js +23 -23
  164. package/dist/cjs/src/wavesexchange.js +86 -85
  165. package/dist/cjs/src/whitebit.js +44 -44
  166. package/dist/cjs/src/woo.js +51 -49
  167. package/dist/cjs/src/woofipro.js +104 -82
  168. package/dist/cjs/src/xt.js +17 -12
  169. package/dist/cjs/src/yobit.js +15 -15
  170. package/dist/cjs/src/zaif.js +38 -9
  171. package/dist/cjs/src/zebpay.js +35 -20
  172. package/dist/cjs/src/zonda.js +14 -14
  173. package/js/ccxt.d.ts +1 -1
  174. package/js/ccxt.js +1 -1
  175. package/js/src/alpaca.d.ts +21 -21
  176. package/js/src/alpaca.js +21 -21
  177. package/js/src/apex.d.ts +20 -20
  178. package/js/src/apex.js +20 -20
  179. package/js/src/arkham.d.ts +22 -22
  180. package/js/src/arkham.js +22 -22
  181. package/js/src/ascendex.d.ts +28 -28
  182. package/js/src/ascendex.js +28 -28
  183. package/js/src/backpack.d.ts +21 -21
  184. package/js/src/backpack.js +22 -22
  185. package/js/src/base/Exchange.d.ts +6 -3
  186. package/js/src/base/Exchange.js +48 -38
  187. package/js/src/base/functions/throttle.d.ts +22 -0
  188. package/js/src/base/functions/throttle.js +54 -5
  189. package/js/src/bigone.d.ts +19 -19
  190. package/js/src/bigone.js +19 -19
  191. package/js/src/binance.d.ts +82 -82
  192. package/js/src/binance.js +83 -82
  193. package/js/src/bingx.d.ts +46 -46
  194. package/js/src/bingx.js +46 -46
  195. package/js/src/bit2c.d.ts +11 -11
  196. package/js/src/bit2c.js +11 -11
  197. package/js/src/bitbank.d.ts +12 -12
  198. package/js/src/bitbank.js +49 -48
  199. package/js/src/bitbns.d.ts +13 -13
  200. package/js/src/bitbns.js +13 -13
  201. package/js/src/bitfinex.d.ts +33 -33
  202. package/js/src/bitfinex.js +33 -33
  203. package/js/src/bitflyer.d.ts +17 -17
  204. package/js/src/bitflyer.js +17 -17
  205. package/js/src/bitget.d.ts +57 -57
  206. package/js/src/bitget.js +58 -57
  207. package/js/src/bithumb.d.ts +10 -10
  208. package/js/src/bithumb.js +10 -10
  209. package/js/src/bitmart.d.ts +42 -42
  210. package/js/src/bitmart.js +44 -44
  211. package/js/src/bitmex.d.ts +24 -24
  212. package/js/src/bitmex.js +24 -24
  213. package/js/src/bitopro.d.ts +20 -20
  214. package/js/src/bitopro.js +20 -20
  215. package/js/src/bitrue.d.ts +18 -18
  216. package/js/src/bitrue.js +18 -18
  217. package/js/src/bitso.d.ts +20 -20
  218. package/js/src/bitso.js +20 -20
  219. package/js/src/bitstamp.d.ts +21 -21
  220. package/js/src/bitstamp.js +21 -21
  221. package/js/src/bittrade.d.ts +20 -20
  222. package/js/src/bittrade.js +20 -20
  223. package/js/src/bitvavo.d.ts +19 -19
  224. package/js/src/bitvavo.js +19 -19
  225. package/js/src/blockchaincom.d.ts +20 -20
  226. package/js/src/blockchaincom.js +20 -20
  227. package/js/src/blofin.d.ts +26 -26
  228. package/js/src/blofin.js +26 -26
  229. package/js/src/btcalpha.d.ts +14 -14
  230. package/js/src/btcalpha.js +35 -34
  231. package/js/src/btcbox.d.ts +10 -10
  232. package/js/src/btcbox.js +10 -10
  233. package/js/src/btcmarkets.d.ts +16 -16
  234. package/js/src/btcmarkets.js +16 -16
  235. package/js/src/btcturk.d.ts +10 -10
  236. package/js/src/btcturk.js +10 -10
  237. package/js/src/bullish.d.ts +26 -26
  238. package/js/src/bullish.js +26 -26
  239. package/js/src/bybit.d.ts +66 -66
  240. package/js/src/bybit.js +67 -67
  241. package/js/src/cex.d.ts +18 -18
  242. package/js/src/cex.js +18 -18
  243. package/js/src/coinbase.d.ts +40 -40
  244. package/js/src/coinbase.js +40 -40
  245. package/js/src/coinbaseexchange.d.ts +22 -22
  246. package/js/src/coinbaseexchange.js +22 -22
  247. package/js/src/coinbaseinternational.d.ts +22 -22
  248. package/js/src/coinbaseinternational.js +22 -22
  249. package/js/src/coincatch.d.ts +39 -39
  250. package/js/src/coincatch.js +39 -39
  251. package/js/src/coincheck.d.ts +11 -11
  252. package/js/src/coincheck.js +11 -11
  253. package/js/src/coinex.d.ts +48 -48
  254. package/js/src/coinex.js +48 -48
  255. package/js/src/coinmate.d.ts +14 -14
  256. package/js/src/coinmate.js +14 -14
  257. package/js/src/coinmetro.d.ts +14 -14
  258. package/js/src/coinmetro.js +14 -14
  259. package/js/src/coinone.d.ts +11 -11
  260. package/js/src/coinone.js +11 -11
  261. package/js/src/coinsph.d.ts +20 -20
  262. package/js/src/coinsph.js +20 -20
  263. package/js/src/coinspot.d.ts +8 -8
  264. package/js/src/coinspot.js +8 -8
  265. package/js/src/cryptocom.d.ts +32 -32
  266. package/js/src/cryptocom.js +32 -32
  267. package/js/src/cryptomus.d.ts +9 -9
  268. package/js/src/cryptomus.js +9 -9
  269. package/js/src/deepcoin.d.ts +33 -33
  270. package/js/src/deepcoin.js +33 -33
  271. package/js/src/defx.d.ts +23 -23
  272. package/js/src/defx.js +23 -23
  273. package/js/src/delta.d.ts +29 -29
  274. package/js/src/delta.js +29 -29
  275. package/js/src/deribit.d.ts +36 -36
  276. package/js/src/deribit.js +36 -36
  277. package/js/src/derive.d.ts +19 -19
  278. package/js/src/derive.js +19 -19
  279. package/js/src/digifinex.d.ts +36 -36
  280. package/js/src/digifinex.js +36 -36
  281. package/js/src/dydx.d.ts +22 -22
  282. package/js/src/dydx.js +22 -22
  283. package/js/src/exmo.d.ts +29 -29
  284. package/js/src/exmo.js +29 -29
  285. package/js/src/foxbit.d.ts +23 -23
  286. package/js/src/foxbit.js +23 -23
  287. package/js/src/gate.d.ts +57 -57
  288. package/js/src/gate.js +57 -57
  289. package/js/src/gemini.d.ts +16 -16
  290. package/js/src/gemini.js +16 -16
  291. package/js/src/hashkey.d.ts +35 -35
  292. package/js/src/hashkey.js +35 -35
  293. package/js/src/hibachi.d.ts +24 -24
  294. package/js/src/hibachi.js +24 -24
  295. package/js/src/hitbtc.d.ts +38 -38
  296. package/js/src/hitbtc.js +38 -38
  297. package/js/src/hollaex.d.ts +22 -22
  298. package/js/src/hollaex.js +22 -22
  299. package/js/src/htx.d.ts +50 -50
  300. package/js/src/htx.js +50 -50
  301. package/js/src/hyperliquid.d.ts +46 -36
  302. package/js/src/hyperliquid.js +76 -42
  303. package/js/src/independentreserve.d.ts +13 -13
  304. package/js/src/independentreserve.js +13 -13
  305. package/js/src/indodax.d.ts +14 -14
  306. package/js/src/indodax.js +14 -14
  307. package/js/src/kraken.d.ts +30 -30
  308. package/js/src/kraken.js +30 -30
  309. package/js/src/krakenfutures.d.ts +21 -21
  310. package/js/src/krakenfutures.js +21 -21
  311. package/js/src/kucoin.d.ts +44 -44
  312. package/js/src/kucoin.js +44 -44
  313. package/js/src/kucoinfutures.d.ts +35 -35
  314. package/js/src/kucoinfutures.js +42 -40
  315. package/js/src/latoken.d.ts +16 -16
  316. package/js/src/latoken.js +16 -16
  317. package/js/src/lbank.d.ts +23 -23
  318. package/js/src/lbank.js +23 -23
  319. package/js/src/luno.d.ts +17 -17
  320. package/js/src/luno.js +17 -17
  321. package/js/src/mercado.d.ts +11 -11
  322. package/js/src/mercado.js +11 -11
  323. package/js/src/mexc.d.ts +47 -47
  324. package/js/src/mexc.js +47 -47
  325. package/js/src/modetrade.d.ts +31 -31
  326. package/js/src/modetrade.js +37 -35
  327. package/js/src/ndax.d.ts +19 -19
  328. package/js/src/ndax.js +19 -19
  329. package/js/src/novadax.d.ts +19 -19
  330. package/js/src/novadax.js +19 -19
  331. package/js/src/oceanex.d.ts +16 -16
  332. package/js/src/oceanex.js +16 -16
  333. package/js/src/okx.d.ts +74 -74
  334. package/js/src/okx.js +83 -83
  335. package/js/src/onetrading.d.ts +34 -33
  336. package/js/src/onetrading.js +34 -33
  337. package/js/src/oxfun.d.ts +25 -25
  338. package/js/src/oxfun.js +25 -25
  339. package/js/src/p2b.d.ts +11 -11
  340. package/js/src/p2b.js +11 -11
  341. package/js/src/paradex.d.ts +54 -54
  342. package/js/src/paradex.js +54 -54
  343. package/js/src/paymium.d.ts +20 -21
  344. package/js/src/paymium.js +20 -21
  345. package/js/src/phemex.d.ts +30 -30
  346. package/js/src/phemex.js +35 -35
  347. package/js/src/poloniex.d.ts +26 -26
  348. package/js/src/poloniex.js +27 -27
  349. package/js/src/pro/alpaca.d.ts +5 -5
  350. package/js/src/pro/alpaca.js +5 -5
  351. package/js/src/pro/apex.d.ts +8 -8
  352. package/js/src/pro/apex.js +8 -8
  353. package/js/src/pro/arkham.d.ts +5 -5
  354. package/js/src/pro/arkham.js +5 -5
  355. package/js/src/pro/ascendex.d.ts +5 -5
  356. package/js/src/pro/ascendex.js +5 -5
  357. package/js/src/pro/backpack.d.ts +16 -16
  358. package/js/src/pro/backpack.js +16 -16
  359. package/js/src/pro/binance.d.ts +35 -35
  360. package/js/src/pro/binance.js +35 -35
  361. package/js/src/pro/bingx.d.ts +9 -9
  362. package/js/src/pro/bingx.js +9 -9
  363. package/js/src/pro/bitfinex.d.ts +8 -8
  364. package/js/src/pro/bitfinex.js +8 -8
  365. package/js/src/pro/bitget.d.ts +12 -12
  366. package/js/src/pro/bitget.js +12 -12
  367. package/js/src/pro/bithumb.d.ts +3 -3
  368. package/js/src/pro/bithumb.js +3 -3
  369. package/js/src/pro/bitmart.d.ts +120 -9
  370. package/js/src/pro/bitmart.js +388 -31
  371. package/js/src/pro/bitmex.d.ts +9 -9
  372. package/js/src/pro/bitmex.js +9 -9
  373. package/js/src/pro/bitopro.d.ts +5 -5
  374. package/js/src/pro/bitopro.js +5 -5
  375. package/js/src/pro/bitrue.d.ts +2 -2
  376. package/js/src/pro/bitrue.js +2 -2
  377. package/js/src/pro/bitstamp.d.ts +3 -3
  378. package/js/src/pro/bitstamp.js +3 -3
  379. package/js/src/pro/bittrade.d.ts +3 -3
  380. package/js/src/pro/bittrade.js +3 -3
  381. package/js/src/pro/bitvavo.d.ts +19 -19
  382. package/js/src/pro/bitvavo.js +19 -19
  383. package/js/src/pro/blockchaincom.d.ts +5 -5
  384. package/js/src/pro/blockchaincom.js +5 -5
  385. package/js/src/pro/blofin.d.ts +10 -10
  386. package/js/src/pro/blofin.js +10 -10
  387. package/js/src/pro/bullish.d.ts +6 -6
  388. package/js/src/pro/bullish.js +6 -6
  389. package/js/src/pro/bybit.d.ts +19 -19
  390. package/js/src/pro/bybit.js +19 -19
  391. package/js/src/pro/cex.d.ts +13 -13
  392. package/js/src/pro/cex.js +13 -13
  393. package/js/src/pro/coinbase.d.ts +13 -13
  394. package/js/src/pro/coinbase.js +13 -13
  395. package/js/src/pro/coinbaseexchange.d.ts +10 -10
  396. package/js/src/pro/coinbaseexchange.js +10 -10
  397. package/js/src/pro/coinbaseinternational.d.ts +8 -8
  398. package/js/src/pro/coinbaseinternational.js +8 -8
  399. package/js/src/pro/coincatch.d.ts +10 -10
  400. package/js/src/pro/coincatch.js +10 -10
  401. package/js/src/pro/coincheck.d.ts +2 -2
  402. package/js/src/pro/coincheck.js +2 -2
  403. package/js/src/pro/coinex.d.ts +10 -10
  404. package/js/src/pro/coinex.js +10 -10
  405. package/js/src/pro/coinone.d.ts +3 -3
  406. package/js/src/pro/coinone.js +3 -3
  407. package/js/src/pro/cryptocom.d.ts +20 -20
  408. package/js/src/pro/cryptocom.js +20 -20
  409. package/js/src/pro/deepcoin.d.ts +8 -8
  410. package/js/src/pro/deepcoin.js +8 -8
  411. package/js/src/pro/defx.d.ts +15 -15
  412. package/js/src/pro/defx.js +15 -15
  413. package/js/src/pro/deribit.d.ts +10 -10
  414. package/js/src/pro/deribit.js +10 -10
  415. package/js/src/pro/derive.d.ts +6 -6
  416. package/js/src/pro/derive.js +6 -6
  417. package/js/src/pro/dydx.d.ts +3 -3
  418. package/js/src/pro/dydx.js +3 -3
  419. package/js/src/pro/exmo.d.ts +7 -7
  420. package/js/src/pro/exmo.js +7 -7
  421. package/js/src/pro/gate.d.ts +22 -23
  422. package/js/src/pro/gate.js +21 -59
  423. package/js/src/pro/gemini.d.ts +6 -6
  424. package/js/src/pro/gemini.js +6 -6
  425. package/js/src/pro/hashkey.d.ts +6 -6
  426. package/js/src/pro/hashkey.js +6 -6
  427. package/js/src/pro/hitbtc.d.ts +8 -8
  428. package/js/src/pro/hitbtc.js +8 -8
  429. package/js/src/pro/hollaex.d.ts +5 -5
  430. package/js/src/pro/hollaex.js +5 -5
  431. package/js/src/pro/htx.d.ts +9 -9
  432. package/js/src/pro/htx.js +9 -9
  433. package/js/src/pro/hyperliquid.d.ts +38 -14
  434. package/js/src/pro/hyperliquid.js +103 -14
  435. package/js/src/pro/independentreserve.d.ts +2 -2
  436. package/js/src/pro/independentreserve.js +2 -2
  437. package/js/src/pro/kraken.d.ts +15 -15
  438. package/js/src/pro/kraken.js +15 -15
  439. package/js/src/pro/krakenfutures.d.ts +10 -10
  440. package/js/src/pro/krakenfutures.js +10 -10
  441. package/js/src/pro/kucoin.d.ts +15 -15
  442. package/js/src/pro/kucoin.js +15 -15
  443. package/js/src/pro/kucoinfutures.d.ts +13 -13
  444. package/js/src/pro/kucoinfutures.js +13 -13
  445. package/js/src/pro/lbank.d.ts +5 -5
  446. package/js/src/pro/lbank.js +5 -5
  447. package/js/src/pro/luno.d.ts +2 -2
  448. package/js/src/pro/luno.js +2 -2
  449. package/js/src/pro/mexc.d.ts +13 -13
  450. package/js/src/pro/mexc.js +13 -13
  451. package/js/src/pro/modetrade.d.ts +8 -8
  452. package/js/src/pro/modetrade.js +8 -8
  453. package/js/src/pro/ndax.d.ts +3 -3
  454. package/js/src/pro/ndax.js +3 -3
  455. package/js/src/pro/okx.d.ts +25 -25
  456. package/js/src/pro/okx.js +25 -25
  457. package/js/src/pro/onetrading.d.ts +6 -6
  458. package/js/src/pro/onetrading.js +6 -6
  459. package/js/src/pro/oxfun.d.ts +13 -13
  460. package/js/src/pro/oxfun.js +13 -13
  461. package/js/src/pro/p2b.d.ts +5 -5
  462. package/js/src/pro/p2b.js +5 -5
  463. package/js/src/pro/paradex.d.ts +8 -8
  464. package/js/src/pro/paradex.js +8 -8
  465. package/js/src/pro/phemex.d.ts +7 -7
  466. package/js/src/pro/phemex.js +7 -7
  467. package/js/src/pro/poloniex.d.ts +8 -8
  468. package/js/src/pro/poloniex.js +8 -8
  469. package/js/src/pro/probit.d.ts +6 -6
  470. package/js/src/pro/probit.js +6 -6
  471. package/js/src/pro/toobit.d.ts +9 -9
  472. package/js/src/pro/toobit.js +9 -9
  473. package/js/src/pro/upbit.d.ts +9 -9
  474. package/js/src/pro/upbit.js +9 -9
  475. package/js/src/pro/whitebit.d.ts +7 -7
  476. package/js/src/pro/whitebit.js +7 -7
  477. package/js/src/pro/woo.d.ts +13 -13
  478. package/js/src/pro/woo.js +13 -13
  479. package/js/src/pro/woofipro.d.ts +20 -20
  480. package/js/src/pro/woofipro.js +20 -20
  481. package/js/src/pro/xt.d.ts +2 -2
  482. package/js/src/pro/xt.js +2 -2
  483. package/js/src/probit.d.ts +18 -18
  484. package/js/src/probit.js +18 -18
  485. package/js/src/static_dependencies/ethers/utils/index.d.ts +2 -1
  486. package/js/src/static_dependencies/ethers/utils/index.js +8 -1
  487. package/js/src/timex.d.ts +16 -16
  488. package/js/src/timex.js +16 -16
  489. package/js/src/tokocrypto.d.ts +17 -17
  490. package/js/src/tokocrypto.js +17 -17
  491. package/js/src/toobit.d.ts +27 -27
  492. package/js/src/toobit.js +31 -29
  493. package/js/src/upbit.d.ts +23 -23
  494. package/js/src/upbit.js +23 -23
  495. package/js/src/wavesexchange.d.ts +15 -15
  496. package/js/src/wavesexchange.js +86 -85
  497. package/js/src/whitebit.d.ts +44 -44
  498. package/js/src/whitebit.js +44 -44
  499. package/js/src/woo.d.ts +45 -45
  500. package/js/src/woo.js +51 -49
  501. package/js/src/woofipro.d.ts +77 -77
  502. package/js/src/woofipro.js +104 -82
  503. package/js/src/xt.d.ts +12 -12
  504. package/js/src/xt.js +17 -12
  505. package/js/src/yobit.d.ts +15 -15
  506. package/js/src/yobit.js +15 -15
  507. package/js/src/zaif.d.ts +9 -9
  508. package/js/src/zaif.js +38 -9
  509. package/js/src/zebpay.d.ts +20 -20
  510. package/js/src/zebpay.js +35 -20
  511. package/js/src/zonda.d.ts +14 -14
  512. package/js/src/zonda.js +14 -14
  513. package/package.json +1 -1
@@ -34,6 +34,16 @@ class bitmart extends bitmart$1["default"] {
34
34
  'watchOHLCV': true,
35
35
  'watchPosition': 'emulated',
36
36
  'watchPositions': true,
37
+ 'unWatchBidsAsks': false,
38
+ 'unWatchOHLCV': true,
39
+ 'unWatchOrderBook': true,
40
+ 'unWatchOrderBookForSymbols': true,
41
+ 'unWatchOrders': true,
42
+ 'unWatchPositions': true,
43
+ 'unWatchTicker': true,
44
+ 'unWatchTickers': true,
45
+ 'unWatchTrades': true,
46
+ 'unWatchTradesForSymbols': true,
37
47
  },
38
48
  'urls': {
39
49
  'api': {
@@ -97,10 +107,18 @@ class bitmart extends bitmart$1["default"] {
97
107
  const url = this.implodeHostname(this.urls['api']['ws'][type]['public']);
98
108
  let request = {};
99
109
  let messageHash = undefined;
110
+ const unsubscribe = this.safeBool(params, 'unsubscribe', false);
111
+ let prefix = '';
112
+ let requestOp = 'subscribe';
113
+ if (unsubscribe) {
114
+ params = this.omit(params, 'unsubscribe');
115
+ prefix = 'unsubscribe::';
116
+ requestOp = 'unsubscribe';
117
+ }
100
118
  if (type === 'spot') {
101
119
  messageHash = 'spot/' + channel + ':' + market['id'];
102
120
  request = {
103
- 'op': 'subscribe',
121
+ 'op': requestOp,
104
122
  'args': [messageHash],
105
123
  };
106
124
  }
@@ -112,10 +130,11 @@ class bitmart extends bitmart$1["default"] {
112
130
  messageHash += ':' + speed;
113
131
  }
114
132
  request = {
115
- 'action': 'subscribe',
133
+ 'action': requestOp,
116
134
  'args': [messageHash],
117
135
  };
118
136
  }
137
+ messageHash = prefix + messageHash;
119
138
  return await this.watch(url, messageHash, this.deepExtend(request, params), messageHash);
120
139
  }
121
140
  async subscribeMultiple(channel, type, symbols = undefined, params = {}) {
@@ -125,11 +144,23 @@ class bitmart extends bitmart$1["default"] {
125
144
  const actionType = (type === 'spot') ? 'op' : 'action';
126
145
  const rawSubscriptions = [];
127
146
  const messageHashes = [];
147
+ const subHashes = [];
148
+ const unsubscribe = this.safeBool(params, 'unsubscribe', false);
149
+ let prefix = '';
150
+ let requestOp = 'subscribe';
151
+ if (unsubscribe) {
152
+ params = this.omit(params, 'unsubscribe');
153
+ prefix = 'unsubscribe::';
154
+ requestOp = 'unsubscribe';
155
+ }
128
156
  for (let i = 0; i < symbols.length; i++) {
129
157
  const market = this.market(symbols[i]);
130
158
  const message = channelType + '/' + channel + ':' + market['id'];
159
+ const subHash = prefix + message;
160
+ const messageHash = prefix + channel + ':' + market['symbol'];
131
161
  rawSubscriptions.push(message);
132
- messageHashes.push(channel + ':' + market['symbol']);
162
+ subHashes.push(subHash);
163
+ messageHashes.push(messageHash);
133
164
  }
134
165
  // as an exclusion, futures "tickers" need one generic request for all symbols
135
166
  // if ((type !== 'spot') && (channel === 'ticker')) {
@@ -139,8 +170,8 @@ class bitmart extends bitmart$1["default"] {
139
170
  const request = {
140
171
  'args': rawSubscriptions,
141
172
  };
142
- request[actionType] = 'subscribe';
143
- return await this.watchMultiple(url, messageHashes, this.deepExtend(request, params), rawSubscriptions);
173
+ request[actionType] = requestOp;
174
+ return await this.watchMultiple(url, messageHashes, this.deepExtend(request, params), subHashes);
144
175
  }
145
176
  /**
146
177
  * @method
@@ -149,7 +180,7 @@ class bitmart extends bitmart$1["default"] {
149
180
  * @see https://developer-pro.bitmart.com/en/futuresv2/#private-assets-channel
150
181
  * @description watch balance and get the amount of funds available for trading or funds locked in orders
151
182
  * @param {object} [params] extra parameters specific to the exchange API endpoint
152
- * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
183
+ * @returns {object} a [balance structure]{@link https://docs.ccxt.com/?id=balance-structure}
153
184
  */
154
185
  async watchBalance(params = {}) {
155
186
  await this.loadMarkets();
@@ -175,8 +206,8 @@ class bitmart extends bitmart$1["default"] {
175
206
  this.setBalanceCache(client, type, messageHash);
176
207
  let fetchBalanceSnapshot = undefined;
177
208
  let awaitBalanceSnapshot = undefined;
178
- [fetchBalanceSnapshot, params] = this.handleOptionAndParams(this.options, 'watchBalance', 'fetchBalanceSnapshot', true);
179
- [awaitBalanceSnapshot, params] = this.handleOptionAndParams(this.options, 'watchBalance', 'awaitBalanceSnapshot', false);
209
+ [fetchBalanceSnapshot, params] = this.handleOptionAndParams(params, 'watchBalance', 'fetchBalanceSnapshot', true);
210
+ [awaitBalanceSnapshot, params] = this.handleOptionAndParams(params, 'watchBalance', 'awaitBalanceSnapshot', false);
180
211
  if (fetchBalanceSnapshot && awaitBalanceSnapshot) {
181
212
  await client.future(type + ':fetchBalanceSnapshot');
182
213
  }
@@ -186,7 +217,7 @@ class bitmart extends bitmart$1["default"] {
186
217
  if (subscribeHash in client.subscriptions) {
187
218
  return;
188
219
  }
189
- const options = this.safeValue(this.options, 'watchBalance');
220
+ const options = this.safeDict(this.options, 'watchBalance');
190
221
  const snapshot = this.safeBool(options, 'fetchBalanceSnapshot', true);
191
222
  if (snapshot) {
192
223
  const messageHash = type + ':' + 'fetchBalanceSnapshot';
@@ -252,7 +283,7 @@ class bitmart extends bitmart$1["default"] {
252
283
  const timestamp = this.safeInteger(message, 'event_time');
253
284
  this.balance[type]['timestamp'] = timestamp;
254
285
  this.balance[type]['datetime'] = this.iso8601(timestamp);
255
- const balanceDetails = this.safeValue(data[i], 'balance_details', []);
286
+ const balanceDetails = this.safeList(data[i], 'balance_details', []);
256
287
  for (let ii = 0; ii < balanceDetails.length; ii++) {
257
288
  const rawBalance = balanceDetails[i];
258
289
  const account = this.account();
@@ -286,7 +317,7 @@ class bitmart extends bitmart$1["default"] {
286
317
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
287
318
  * @param {int} [limit] the maximum amount of trades to fetch
288
319
  * @param {object} [params] extra parameters specific to the exchange API endpoint
289
- * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
320
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/?id=public-trades}
290
321
  */
291
322
  async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
292
323
  return await this.watchTradesForSymbols([symbol], since, limit, params);
@@ -295,12 +326,13 @@ class bitmart extends bitmart$1["default"] {
295
326
  * @method
296
327
  * @name bitmart#watchTradesForSymbols
297
328
  * @see https://developer-pro.bitmart.com/en/spot/#public-trade-channel
329
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#public-trade-channel
298
330
  * @description get the list of most recent trades for a list of symbols
299
331
  * @param {string[]} symbols unified symbol of the market to fetch trades for
300
332
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
301
333
  * @param {int} [limit] the maximum amount of trades to fetch
302
334
  * @param {object} [params] extra parameters specific to the exchange API endpoint
303
- * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
335
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/?id=public-trades}
304
336
  */
305
337
  async watchTradesForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
306
338
  await this.loadMarkets();
@@ -321,6 +353,37 @@ class bitmart extends bitmart$1["default"] {
321
353
  }
322
354
  return result;
323
355
  }
356
+ /**
357
+ * @method
358
+ * @name bitmart#unWatchTrades
359
+ * @description unWatches from the stream channel
360
+ * @see https://developer-pro.bitmart.com/en/spot/#public-trade-channel
361
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#public-trade-channel
362
+ * @param {string} symbol unified symbol of the market to fetch trades for
363
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
364
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
365
+ */
366
+ async unWatchTrades(symbol, params = {}) {
367
+ return await this.unWatchTradesForSymbols([symbol], params);
368
+ }
369
+ /**
370
+ * @method
371
+ * @name bitmart#unWatchTradesForSymbols
372
+ * @description unsubscribes from the trades channel
373
+ * @see https://developer-pro.bitmart.com/en/spot/#public-trade-channel
374
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#public-trade-channel
375
+ * @param {string[]} symbols unified symbol of the market to fetch trades for
376
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
377
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
378
+ */
379
+ async unWatchTradesForSymbols(symbols, params = {}) {
380
+ await this.loadMarkets();
381
+ let marketType = undefined;
382
+ [symbols, marketType, params] = this.getParamsForMultipleSub('unWatchTradesForSymbols', symbols, undefined, params);
383
+ const channelName = 'trade';
384
+ params = this.extend(params, { 'unsubscribe': true });
385
+ return await this.subscribeMultiple(channelName, marketType, symbols, params);
386
+ }
324
387
  getParamsForMultipleSub(methodName, symbols, limit = undefined, params = {}) {
325
388
  symbols = this.marketSymbols(symbols, undefined, false, true);
326
389
  const length = symbols.length;
@@ -340,7 +403,7 @@ class bitmart extends bitmart$1["default"] {
340
403
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
341
404
  * @param {string} symbol unified symbol of the market to fetch the ticker for
342
405
  * @param {object} [params] extra parameters specific to the exchange API endpoint
343
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
406
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/?id=ticker-structure}
344
407
  */
345
408
  async watchTicker(symbol, params = {}) {
346
409
  await this.loadMarkets();
@@ -356,7 +419,7 @@ class bitmart extends bitmart$1["default"] {
356
419
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
357
420
  * @param {string[]} symbols unified symbol of the market to fetch the ticker for
358
421
  * @param {object} [params] extra parameters specific to the exchange API endpoint
359
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
422
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/?id=ticker-structure}
360
423
  */
361
424
  async watchTickers(symbols = undefined, params = {}) {
362
425
  await this.loadMarkets();
@@ -371,6 +434,37 @@ class bitmart extends bitmart$1["default"] {
371
434
  }
372
435
  return this.filterByArray(this.tickers, 'symbol', symbols);
373
436
  }
437
+ /**
438
+ * @method
439
+ * @name bitmart#unWatchTicker
440
+ * @description unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
441
+ * @see https://developer-pro.bitmart.com/en/spot/#public-ticker-channel
442
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#public-ticker-channel
443
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
444
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
445
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
446
+ */
447
+ async unWatchTicker(symbol, params = {}) {
448
+ return await this.unWatchTickers([symbol], params);
449
+ }
450
+ /**
451
+ * @method
452
+ * @name bitmart#unWatchTickers
453
+ * @description unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
454
+ * @see https://developer-pro.bitmart.com/en/spot/#public-ticker-channel
455
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#public-ticker-channel
456
+ * @param {string[]} symbols unified symbol of the market to fetch the ticker for
457
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
458
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
459
+ */
460
+ async unWatchTickers(symbols = undefined, params = {}) {
461
+ await this.loadMarkets();
462
+ const market = this.getMarketFromSymbols(symbols);
463
+ let marketType = undefined;
464
+ [marketType, params] = this.handleMarketTypeAndParams('watchTickers', market, params);
465
+ params = this.extend(params, { 'unsubscribe': true });
466
+ return await this.subscribeMultiple('ticker', marketType, symbols, params);
467
+ }
374
468
  /**
375
469
  * @method
376
470
  * @name bitmart#watchBidsAsks
@@ -379,7 +473,7 @@ class bitmart extends bitmart$1["default"] {
379
473
  * @description watches best bid & ask for symbols
380
474
  * @param {string[]} symbols unified symbol of the market to fetch the ticker for
381
475
  * @param {object} [params] extra parameters specific to the exchange API endpoint
382
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
476
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/?id=ticker-structure}
383
477
  */
384
478
  async watchBidsAsks(symbols = undefined, params = {}) {
385
479
  await this.loadMarkets();
@@ -420,7 +514,7 @@ class bitmart extends bitmart$1["default"] {
420
514
  rawTickers = this.safeList(message, 'data', []);
421
515
  }
422
516
  else {
423
- rawTickers = [this.safeValue(message, 'data', {})];
517
+ rawTickers = [this.safeDict(message, 'data', {})];
424
518
  }
425
519
  if (!rawTickers.length) {
426
520
  return;
@@ -459,7 +553,7 @@ class bitmart extends bitmart$1["default"] {
459
553
  * @param {int} [since] the earliest time in ms to fetch orders for
460
554
  * @param {int} [limit] the maximum number of order structures to retrieve
461
555
  * @param {object} [params] extra parameters specific to the exchange API endpoint
462
- * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
556
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/?id=order-structure}
463
557
  */
464
558
  async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
465
559
  await this.loadMarkets();
@@ -500,6 +594,54 @@ class bitmart extends bitmart$1["default"] {
500
594
  }
501
595
  return this.filterBySymbolSinceLimit(this.orders, symbol, since, limit, true);
502
596
  }
597
+ /**
598
+ * @method
599
+ * @name bitmart#unWatchOrders
600
+ * @description unWatches information on multiple orders made by the user
601
+ * @see https://developer-pro.bitmart.com/en/spot/#private-order-progress
602
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#private-order-channel
603
+ * @param {string} symbol unified market symbol of the market orders were made in
604
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
605
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
606
+ */
607
+ async unWatchOrders(symbol = undefined, params = {}) {
608
+ await this.loadMarkets();
609
+ let market = undefined;
610
+ let messageHash = 'unsubscribe::orders';
611
+ if (symbol !== undefined) {
612
+ symbol = this.symbol(symbol);
613
+ market = this.market(symbol);
614
+ if (market['swap']) {
615
+ throw new errors.NotSupported(this.id + ' unWatchOrders() does not support a symbol for swap markets, unWatch from all markets only');
616
+ }
617
+ messageHash += '::' + symbol;
618
+ }
619
+ let type = 'spot';
620
+ [type, params] = this.handleMarketTypeAndParams('watchOrders', market, params);
621
+ await this.authenticate(type, params);
622
+ let request = undefined;
623
+ if (type === 'spot') {
624
+ let argsRequest = 'spot/user/order:';
625
+ if (symbol !== undefined) {
626
+ argsRequest += market['id'];
627
+ }
628
+ else {
629
+ argsRequest = 'spot/user/orders:ALL_SYMBOLS';
630
+ }
631
+ request = {
632
+ 'op': 'unsubscribe',
633
+ 'args': [argsRequest],
634
+ };
635
+ }
636
+ else {
637
+ request = {
638
+ 'action': 'unsubscribe',
639
+ 'args': ['futures/order'],
640
+ };
641
+ }
642
+ const url = this.implodeHostname(this.urls['api']['ws'][type]['private']);
643
+ return await this.watch(url, messageHash, this.deepExtend(request, params), messageHash);
644
+ }
503
645
  handleOrders(client, message) {
504
646
  //
505
647
  // spot
@@ -554,7 +696,7 @@ class bitmart extends bitmart$1["default"] {
554
696
  // ]
555
697
  // }
556
698
  //
557
- const orders = this.safeValue(message, 'data');
699
+ const orders = this.safeList(message, 'data');
558
700
  if (orders === undefined) {
559
701
  return;
560
702
  }
@@ -670,13 +812,13 @@ class bitmart extends bitmart$1["default"] {
670
812
  }, market);
671
813
  }
672
814
  else {
673
- const orderInfo = this.safeValue(order, 'order');
815
+ const orderInfo = this.safeDict(order, 'order');
674
816
  const marketId = this.safeString(orderInfo, 'symbol');
675
817
  const symbol = this.safeSymbol(marketId, market, '', 'swap');
676
818
  const orderId = this.safeString(orderInfo, 'order_id');
677
819
  const timestamp = this.safeInteger(orderInfo, 'create_time');
678
820
  const updatedTimestamp = this.safeInteger(orderInfo, 'update_time');
679
- const lastTrade = this.safeValue(orderInfo, 'last_trade');
821
+ const lastTrade = this.safeDict(orderInfo, 'last_trade');
680
822
  const cachedOrders = this.orders;
681
823
  const orders = this.safeValue(cachedOrders.hashmap, symbol, {});
682
824
  const cachedOrder = this.safeValue(orders, orderId);
@@ -771,6 +913,31 @@ class bitmart extends bitmart$1["default"] {
771
913
  }
772
914
  return this.filterBySymbolsSinceLimit(this.positions, symbols, since, limit);
773
915
  }
916
+ /**
917
+ * @method
918
+ * @name bitmart#unWatchPositions
919
+ * @description unWatches all open positions
920
+ * @see https://developer-pro.bitmart.com/en/futures/#private-position-channel
921
+ * @param {string[]} [symbols] list of unified market symbols
922
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
923
+ * @returns {object} status of the unwatch request
924
+ */
925
+ async unWatchPositions(symbols = undefined, params = {}) {
926
+ if (symbols !== undefined) {
927
+ const length = symbols.length;
928
+ if (length > 0) {
929
+ throw new errors.NotSupported(this.id + ' unWatchPositions() does not support a list of symbols, unWatch from all markets only');
930
+ }
931
+ }
932
+ await this.loadMarkets();
933
+ const request = {
934
+ 'action': 'unsubscribe',
935
+ 'args': ['futures/position'],
936
+ };
937
+ const messageHash = 'unsubscribe::positions';
938
+ const url = this.implodeHostname(this.urls['api']['ws']['swap']['private']);
939
+ return await this.watch(url, messageHash, this.deepExtend(request, params), messageHash);
940
+ }
774
941
  handlePositions(client, message) {
775
942
  //
776
943
  // {
@@ -807,7 +974,7 @@ class bitmart extends bitmart$1["default"] {
807
974
  // ]
808
975
  // }
809
976
  //
810
- const data = this.safeValue(message, 'data', []);
977
+ const data = this.safeList(message, 'data', []);
811
978
  if (this.positions === undefined) {
812
979
  this.positions = new Cache.ArrayCacheBySymbolBySide();
813
980
  }
@@ -919,7 +1086,7 @@ class bitmart extends bitmart$1["default"] {
919
1086
  // ]
920
1087
  // }
921
1088
  //
922
- const data = this.safeValue(message, 'data');
1089
+ const data = this.safeList(message, 'data');
923
1090
  if (data === undefined) {
924
1091
  return;
925
1092
  }
@@ -1057,7 +1224,7 @@ class bitmart extends bitmart$1["default"] {
1057
1224
  rawTickers = this.safeList(message, 'data', []);
1058
1225
  }
1059
1226
  else {
1060
- rawTickers = [this.safeValue(message, 'data', {})];
1227
+ rawTickers = [this.safeDict(message, 'data', {})];
1061
1228
  }
1062
1229
  if (!rawTickers.length) {
1063
1230
  return;
@@ -1129,8 +1296,8 @@ class bitmart extends bitmart$1["default"] {
1129
1296
  symbol = this.symbol(symbol);
1130
1297
  const market = this.market(symbol);
1131
1298
  let type = 'spot';
1132
- [type, params] = this.handleMarketTypeAndParams('watchOrderBook', market, params);
1133
- const timeframes = this.safeValue(this.options, 'timeframes', {});
1299
+ [type, params] = this.handleMarketTypeAndParams('watchOHLCV', market, params);
1300
+ const timeframes = this.safeDict(this.options, 'timeframes', {});
1134
1301
  const interval = this.safeString(timeframes, timeframe);
1135
1302
  let name = undefined;
1136
1303
  if (type === 'spot') {
@@ -1145,6 +1312,35 @@ class bitmart extends bitmart$1["default"] {
1145
1312
  }
1146
1313
  return this.filterBySinceLimit(ohlcv, since, limit, 0, true);
1147
1314
  }
1315
+ /**
1316
+ * @method
1317
+ * @name bitmart#unWatchOHLCV
1318
+ * @description unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1319
+ * @see https://developer-pro.bitmart.com/en/spot/#public-kline-channel
1320
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#public-klinebin-channel
1321
+ * @param {string} symbol unified symbol of the market to fetch OHLCV data for
1322
+ * @param {string} timeframe the length of time each candle represents
1323
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1324
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
1325
+ */
1326
+ async unWatchOHLCV(symbol, timeframe = '1m', params = {}) {
1327
+ await this.loadMarkets();
1328
+ symbol = this.symbol(symbol);
1329
+ const market = this.market(symbol);
1330
+ let type = 'spot';
1331
+ [type, params] = this.handleMarketTypeAndParams('unWatchOHLCV', market, params);
1332
+ const timeframes = this.safeDict(this.options, 'timeframes', {});
1333
+ const interval = this.safeString(timeframes, timeframe);
1334
+ let name = undefined;
1335
+ if (type === 'spot') {
1336
+ name = 'kline' + interval;
1337
+ }
1338
+ else {
1339
+ name = 'klineBin' + interval;
1340
+ }
1341
+ params = this.extend(params, { 'unsubscribe': true });
1342
+ return await this.subscribe(name, symbol, type, params);
1343
+ }
1148
1344
  handleOHLCV(client, message) {
1149
1345
  //
1150
1346
  // {
@@ -1194,7 +1390,7 @@ class bitmart extends bitmart$1["default"] {
1194
1390
  const intervalParts = interval.split(':');
1195
1391
  interval = this.safeString(intervalParts, 0);
1196
1392
  // use a reverse lookup in a static map instead
1197
- const timeframes = this.safeValue(this.options, 'timeframes', {});
1393
+ const timeframes = this.safeDict(this.options, 'timeframes', {});
1198
1394
  const timeframe = this.findTimeframe(interval, timeframes);
1199
1395
  const duration = this.parseTimeframe(timeframe);
1200
1396
  const durationInMs = duration * 1000;
@@ -1203,7 +1399,7 @@ class bitmart extends bitmart$1["default"] {
1203
1399
  const marketId = this.safeString(data[i], 'symbol');
1204
1400
  const market = this.safeMarket(marketId);
1205
1401
  const symbol = market['symbol'];
1206
- const rawOHLCV = this.safeValue(data[i], 'candle');
1402
+ const rawOHLCV = this.safeList(data[i], 'candle');
1207
1403
  const parsed = this.parseOHLCV(rawOHLCV, market);
1208
1404
  parsed[0] = this.parseToInt(parsed[0] / durationInMs) * durationInMs;
1209
1405
  this.ohlcvs[symbol] = this.safeValue(this.ohlcvs, symbol, {});
@@ -1222,7 +1418,7 @@ class bitmart extends bitmart$1["default"] {
1222
1418
  const marketId = this.safeString(data, 'symbol');
1223
1419
  const market = this.safeMarket(marketId, undefined, undefined, 'swap');
1224
1420
  const symbol = market['symbol'];
1225
- const items = this.safeValue(data, 'items', []);
1421
+ const items = this.safeList(data, 'items', []);
1226
1422
  this.ohlcvs[symbol] = this.safeValue(this.ohlcvs, symbol, {});
1227
1423
  let stored = this.safeValue(this.ohlcvs[symbol], timeframe);
1228
1424
  if (stored === undefined) {
@@ -1249,11 +1445,11 @@ class bitmart extends bitmart$1["default"] {
1249
1445
  * @param {int} [limit] the maximum amount of order book entries to return
1250
1446
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1251
1447
  * @param {string} [params.speed] *futures only* '100ms' or '200ms'
1252
- * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
1448
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/?id=order-book-structure} indexed by market symbols
1253
1449
  */
1254
1450
  async watchOrderBook(symbol, limit = undefined, params = {}) {
1255
1451
  await this.loadMarkets();
1256
- const options = this.safeValue(this.options, 'watchOrderBook', {});
1452
+ const options = this.safeDict(this.options, 'watchOrderBook', {});
1257
1453
  let depth = this.safeString(options, 'depth', 'depth/increase100');
1258
1454
  symbol = this.symbol(symbol);
1259
1455
  const market = this.market(symbol);
@@ -1265,6 +1461,31 @@ class bitmart extends bitmart$1["default"] {
1265
1461
  const orderbook = await this.subscribe(depth, symbol, type, params);
1266
1462
  return orderbook.limit();
1267
1463
  }
1464
+ /**
1465
+ * @method
1466
+ * @name bitmart#unWatchOrderBook
1467
+ * @description unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
1468
+ * @see https://developer-pro.bitmart.com/en/spot/#public-depth-all-channel
1469
+ * @see https://developer-pro.bitmart.com/en/spot/#public-depth-increase-channel
1470
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#public-depth-channel
1471
+ * @param {string} symbol unified array of symbols
1472
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1473
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
1474
+ */
1475
+ async unWatchOrderBook(symbol, params = {}) {
1476
+ await this.loadMarkets();
1477
+ const options = this.safeDict(this.options, 'watchOrderBook', {});
1478
+ let depth = this.safeString(options, 'depth', 'depth/increase100');
1479
+ symbol = this.symbol(symbol);
1480
+ const market = this.market(symbol);
1481
+ let type = 'spot';
1482
+ [type, params] = this.handleMarketTypeAndParams('unWatchOrderBook', market, params);
1483
+ if (type === 'swap' && depth === 'depth/increase100') {
1484
+ depth = 'depth50';
1485
+ }
1486
+ params = this.extend(params, { 'unsubscribe': true });
1487
+ return await this.subscribe(depth, symbol, type, params);
1488
+ }
1268
1489
  handleDelta(bookside, delta) {
1269
1490
  const price = this.safeFloat(delta, 0);
1270
1491
  const amount = this.safeFloat(delta, 1);
@@ -1483,7 +1704,7 @@ class bitmart extends bitmart$1["default"] {
1483
1704
  * @param {int} [limit] the maximum amount of order book entries to return
1484
1705
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1485
1706
  * @param {string} [params.depth] the type of order book to subscribe to, default is 'depth/increase100', also accepts 'depth5' or 'depth20' or depth50
1486
- * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
1707
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/?id=order-book-structure} indexed by market symbols
1487
1708
  */
1488
1709
  async watchOrderBookForSymbols(symbols, limit = undefined, params = {}) {
1489
1710
  await this.loadMarkets();
@@ -1497,6 +1718,28 @@ class bitmart extends bitmart$1["default"] {
1497
1718
  const orderbook = await this.subscribeMultiple(channel, type, symbols, params);
1498
1719
  return orderbook.limit();
1499
1720
  }
1721
+ /**
1722
+ * @method
1723
+ * @name bitmart#unWatchOrderBookForSymbols
1724
+ * @description unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
1725
+ * @see https://developer-pro.bitmart.com/en/spot/#public-depth-increase-channel
1726
+ * @param {string[]} symbols unified array of symbols
1727
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1728
+ * @param {string} [params.depth] the type of order book to subscribe to, default is 'depth/increase100', also accepts 'depth5' or 'depth20' or depth50
1729
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
1730
+ */
1731
+ async unWatchOrderBookForSymbols(symbols, params = {}) {
1732
+ await this.loadMarkets();
1733
+ let type = undefined;
1734
+ [symbols, type, params] = this.getParamsForMultipleSub('unWatchOrderBookForSymbols', symbols, undefined, params);
1735
+ let channel = undefined;
1736
+ [channel, params] = this.handleOptionAndParams(params, 'unWatchOrderBookForSymbols', 'depth', 'depth/increase100');
1737
+ if (type === 'swap' && channel === 'depth/increase100') {
1738
+ channel = 'depth50';
1739
+ }
1740
+ params = this.extend(params, { 'unsubscribe': true });
1741
+ return await this.subscribeMultiple(channel, type, symbols, params);
1742
+ }
1500
1743
  async authenticate(type, params = {}) {
1501
1744
  this.checkRequiredCredentials();
1502
1745
  const url = this.implodeHostname(this.urls['api']['ws'][type]['private']);
@@ -1594,6 +1837,119 @@ class bitmart extends bitmart$1["default"] {
1594
1837
  return true;
1595
1838
  }
1596
1839
  }
1840
+ handleUnSubscription(client, message) {
1841
+ //
1842
+ // spot
1843
+ // {
1844
+ // "topic": "spot/ticker:ETH_USDT",
1845
+ // "event": "unsubscribe"
1846
+ // }
1847
+ //
1848
+ // swap
1849
+ // {
1850
+ // "action": "unsubscribe",
1851
+ // "group": "futures/ticker:ETHUSDT",
1852
+ // "success": true,
1853
+ // "request": {
1854
+ // "action": "unsubscribe",
1855
+ // "args": [
1856
+ // "futures/ticker:ETHUSDT"
1857
+ // ]
1858
+ // }
1859
+ // }
1860
+ //
1861
+ const messageTopic = this.safeString2(message, 'topic', 'group');
1862
+ const unSubMessageTopic = 'unsubscribe::' + messageTopic;
1863
+ // one message includes info about one unsubscription only even if we requested multiple
1864
+ // so we can not just create subscription object in unWatch method and use it here
1865
+ // we need to reconstruct subscription params from the messageTopic
1866
+ const subscription = this.getUnSubParams(messageTopic);
1867
+ const subHash = this.safeString(subscription, 'subHash');
1868
+ const unsubHash = 'unsubscribe::' + subHash;
1869
+ const subHashIsPrefix = this.safeBool(subscription, 'subHashIsPrefix', false);
1870
+ // clean up both ways of storing subscription and unsubscription
1871
+ this.cleanUnsubscription(client, subHash, unsubHash, subHashIsPrefix);
1872
+ this.cleanUnsubscription(client, messageTopic, unSubMessageTopic, subHashIsPrefix);
1873
+ this.cleanCache(subscription);
1874
+ }
1875
+ getUnSubParams(messageTopic) {
1876
+ const parts = messageTopic.split(':');
1877
+ const channel = this.safeString(parts, 0);
1878
+ const marketTypeAndTopic = channel.split('/');
1879
+ const rawMarketType = this.safeStringLower(marketTypeAndTopic, 0);
1880
+ const marketType = this.parseMarketType(rawMarketType);
1881
+ let topic = this.safeString(marketTypeAndTopic, 1);
1882
+ const thirdPart = this.safeString(marketTypeAndTopic, 2);
1883
+ if (thirdPart !== undefined) {
1884
+ topic += '/' + thirdPart;
1885
+ }
1886
+ const marketId = this.safeString(parts, 1);
1887
+ const symbols = [];
1888
+ let symbol = undefined;
1889
+ let subHash = topic;
1890
+ let hashDelimiter = ':';
1891
+ let subHashIsPrefix = false;
1892
+ const parsedTopic = this.parseTopic(topic);
1893
+ if ((parsedTopic === 'orders') || (parsedTopic === 'positions')) {
1894
+ subHash = parsedTopic;
1895
+ hashDelimiter = '::';
1896
+ }
1897
+ if ((marketId !== undefined) && (marketId !== 'ALL_SYMBOLS')) {
1898
+ // if marketId is defined, we have a single symbol subscription
1899
+ const delimiter = (marketType === 'spot') ? '_' : '';
1900
+ const market = this.safeMarket(marketId, undefined, delimiter, marketType);
1901
+ symbol = market['symbol'];
1902
+ subHash += hashDelimiter + symbol;
1903
+ symbols.push(symbol);
1904
+ }
1905
+ else {
1906
+ subHashIsPrefix = true; // need to clean all subHashes with this prefix
1907
+ }
1908
+ const symbolsAndTimeframes = [];
1909
+ if (topic.startsWith('kline')) {
1910
+ let interval = topic.replace('kline', '');
1911
+ if (interval.startsWith('Bin')) {
1912
+ // swap market
1913
+ interval = interval.replace('Bin', '');
1914
+ }
1915
+ const timeframes = this.safeDict(this.options, 'timeframes', {});
1916
+ const timeframe = this.findTimeframe(interval, timeframes);
1917
+ const symbolAndTimeframe = [symbol, timeframe];
1918
+ symbolsAndTimeframes.push(symbolAndTimeframe);
1919
+ }
1920
+ const result = {
1921
+ 'topic': parsedTopic,
1922
+ 'symbols': symbols,
1923
+ 'subHash': subHash,
1924
+ 'symbolsAndTimeframes': symbolsAndTimeframes,
1925
+ 'subHashIsPrefix': subHashIsPrefix,
1926
+ };
1927
+ return result;
1928
+ }
1929
+ parseTopic(topic) {
1930
+ if (topic.startsWith('depth')) {
1931
+ return 'orderbook';
1932
+ }
1933
+ if (topic.startsWith('kline')) {
1934
+ return 'ohlcv';
1935
+ }
1936
+ const topics = {
1937
+ 'ticker': 'ticker',
1938
+ 'trade': 'trades',
1939
+ 'user/order': 'orders',
1940
+ 'user/orders': 'orders',
1941
+ 'order': 'orders',
1942
+ 'position': 'positions',
1943
+ };
1944
+ return this.safeString(topics, topic, topic);
1945
+ }
1946
+ parseMarketType(marketType) {
1947
+ const types = {
1948
+ 'spot': 'spot',
1949
+ 'futures': 'swap',
1950
+ };
1951
+ return this.safeString(types, marketType, marketType);
1952
+ }
1597
1953
  handleMessage(client, message) {
1598
1954
  if (this.handleErrorMessage(client, message)) {
1599
1955
  return;
@@ -1653,6 +2009,7 @@ class bitmart extends bitmart$1["default"] {
1653
2009
  'login': this.handleAuthenticate,
1654
2010
  'access': this.handleAuthenticate,
1655
2011
  'subscribe': this.handleSubscriptionStatus,
2012
+ 'unsubscribe': this.handleUnSubscription,
1656
2013
  };
1657
2014
  const method = this.safeValue(methods, event);
1658
2015
  if (method !== undefined) {