ccxt 4.5.28 → 4.5.30

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 (522) hide show
  1. package/README.md +24 -7
  2. package/dist/ccxt.browser.min.js +7 -7
  3. package/dist/cjs/ccxt.js +6 -1
  4. package/dist/cjs/src/abstract/bydfi.js +11 -0
  5. package/dist/cjs/src/alpaca.js +21 -21
  6. package/dist/cjs/src/apex.js +20 -20
  7. package/dist/cjs/src/arkham.js +22 -22
  8. package/dist/cjs/src/ascendex.js +28 -28
  9. package/dist/cjs/src/backpack.js +22 -22
  10. package/dist/cjs/src/base/Exchange.js +48 -38
  11. package/dist/cjs/src/base/functions/throttle.js +54 -5
  12. package/dist/cjs/src/bigone.js +19 -19
  13. package/dist/cjs/src/binance.js +83 -82
  14. package/dist/cjs/src/bingx.js +47 -47
  15. package/dist/cjs/src/bit2c.js +11 -11
  16. package/dist/cjs/src/bitbank.js +49 -48
  17. package/dist/cjs/src/bitbns.js +13 -13
  18. package/dist/cjs/src/bitfinex.js +33 -33
  19. package/dist/cjs/src/bitflyer.js +17 -17
  20. package/dist/cjs/src/bitget.js +58 -57
  21. package/dist/cjs/src/bithumb.js +10 -10
  22. package/dist/cjs/src/bitmart.js +44 -44
  23. package/dist/cjs/src/bitmex.js +24 -24
  24. package/dist/cjs/src/bitopro.js +20 -20
  25. package/dist/cjs/src/bitrue.js +18 -18
  26. package/dist/cjs/src/bitso.js +20 -20
  27. package/dist/cjs/src/bitstamp.js +21 -21
  28. package/dist/cjs/src/bittrade.js +20 -20
  29. package/dist/cjs/src/bitvavo.js +19 -19
  30. package/dist/cjs/src/blockchaincom.js +20 -20
  31. package/dist/cjs/src/blofin.js +26 -26
  32. package/dist/cjs/src/btcalpha.js +35 -34
  33. package/dist/cjs/src/btcbox.js +10 -10
  34. package/dist/cjs/src/btcmarkets.js +16 -16
  35. package/dist/cjs/src/btcturk.js +10 -10
  36. package/dist/cjs/src/bullish.js +27 -27
  37. package/dist/cjs/src/bybit.js +69 -67
  38. package/dist/cjs/src/bydfi.js +2907 -0
  39. package/dist/cjs/src/cex.js +18 -18
  40. package/dist/cjs/src/coinbase.js +74 -41
  41. package/dist/cjs/src/coinbaseexchange.js +22 -22
  42. package/dist/cjs/src/coinbaseinternational.js +22 -22
  43. package/dist/cjs/src/coincatch.js +39 -39
  44. package/dist/cjs/src/coincheck.js +11 -11
  45. package/dist/cjs/src/coinex.js +48 -48
  46. package/dist/cjs/src/coinmate.js +14 -14
  47. package/dist/cjs/src/coinmetro.js +14 -14
  48. package/dist/cjs/src/coinone.js +11 -11
  49. package/dist/cjs/src/coinsph.js +20 -20
  50. package/dist/cjs/src/coinspot.js +8 -8
  51. package/dist/cjs/src/cryptocom.js +32 -32
  52. package/dist/cjs/src/cryptomus.js +9 -9
  53. package/dist/cjs/src/deepcoin.js +33 -33
  54. package/dist/cjs/src/defx.js +23 -23
  55. package/dist/cjs/src/delta.js +29 -29
  56. package/dist/cjs/src/deribit.js +36 -36
  57. package/dist/cjs/src/derive.js +19 -19
  58. package/dist/cjs/src/digifinex.js +36 -36
  59. package/dist/cjs/src/dydx.js +25 -25
  60. package/dist/cjs/src/exmo.js +29 -29
  61. package/dist/cjs/src/foxbit.js +23 -23
  62. package/dist/cjs/src/gate.js +60 -59
  63. package/dist/cjs/src/gemini.js +16 -16
  64. package/dist/cjs/src/hashkey.js +35 -35
  65. package/dist/cjs/src/hibachi.js +24 -24
  66. package/dist/cjs/src/hitbtc.js +38 -38
  67. package/dist/cjs/src/hollaex.js +22 -22
  68. package/dist/cjs/src/htx.js +50 -50
  69. package/dist/cjs/src/hyperliquid.js +86 -45
  70. package/dist/cjs/src/independentreserve.js +13 -13
  71. package/dist/cjs/src/indodax.js +14 -14
  72. package/dist/cjs/src/kraken.js +30 -30
  73. package/dist/cjs/src/krakenfutures.js +21 -21
  74. package/dist/cjs/src/kucoin.js +156 -48
  75. package/dist/cjs/src/kucoinfutures.js +42 -40
  76. package/dist/cjs/src/latoken.js +16 -16
  77. package/dist/cjs/src/lbank.js +23 -23
  78. package/dist/cjs/src/luno.js +17 -17
  79. package/dist/cjs/src/mercado.js +11 -11
  80. package/dist/cjs/src/mexc.js +47 -47
  81. package/dist/cjs/src/modetrade.js +37 -35
  82. package/dist/cjs/src/ndax.js +19 -19
  83. package/dist/cjs/src/novadax.js +19 -19
  84. package/dist/cjs/src/oceanex.js +16 -16
  85. package/dist/cjs/src/okx.js +83 -83
  86. package/dist/cjs/src/onetrading.js +34 -33
  87. package/dist/cjs/src/oxfun.js +25 -25
  88. package/dist/cjs/src/p2b.js +11 -11
  89. package/dist/cjs/src/paradex.js +54 -54
  90. package/dist/cjs/src/paymium.js +20 -21
  91. package/dist/cjs/src/phemex.js +35 -35
  92. package/dist/cjs/src/poloniex.js +27 -27
  93. package/dist/cjs/src/pro/alpaca.js +5 -5
  94. package/dist/cjs/src/pro/apex.js +13 -11
  95. package/dist/cjs/src/pro/arkham.js +5 -5
  96. package/dist/cjs/src/pro/ascendex.js +5 -5
  97. package/dist/cjs/src/pro/backpack.js +16 -16
  98. package/dist/cjs/src/pro/binance.js +45 -41
  99. package/dist/cjs/src/pro/bingx.js +14 -12
  100. package/dist/cjs/src/pro/bitfinex.js +8 -8
  101. package/dist/cjs/src/pro/bitget.js +12 -12
  102. package/dist/cjs/src/pro/bithumb.js +3 -3
  103. package/dist/cjs/src/pro/bitmart.js +393 -34
  104. package/dist/cjs/src/pro/bitmex.js +9 -9
  105. package/dist/cjs/src/pro/bitopro.js +5 -5
  106. package/dist/cjs/src/pro/bitrue.js +2 -2
  107. package/dist/cjs/src/pro/bitstamp.js +3 -3
  108. package/dist/cjs/src/pro/bittrade.js +3 -3
  109. package/dist/cjs/src/pro/bitvavo.js +19 -19
  110. package/dist/cjs/src/pro/blockchaincom.js +5 -5
  111. package/dist/cjs/src/pro/blofin.js +10 -10
  112. package/dist/cjs/src/pro/bullish.js +6 -6
  113. package/dist/cjs/src/pro/bybit.js +24 -22
  114. package/dist/cjs/src/pro/bydfi.js +1077 -0
  115. package/dist/cjs/src/pro/cex.js +13 -13
  116. package/dist/cjs/src/pro/coinbase.js +13 -13
  117. package/dist/cjs/src/pro/coinbaseexchange.js +10 -10
  118. package/dist/cjs/src/pro/coinbaseinternational.js +8 -8
  119. package/dist/cjs/src/pro/coincatch.js +10 -10
  120. package/dist/cjs/src/pro/coincheck.js +2 -2
  121. package/dist/cjs/src/pro/coinex.js +10 -10
  122. package/dist/cjs/src/pro/coinone.js +3 -3
  123. package/dist/cjs/src/pro/cryptocom.js +25 -23
  124. package/dist/cjs/src/pro/deepcoin.js +8 -8
  125. package/dist/cjs/src/pro/defx.js +15 -15
  126. package/dist/cjs/src/pro/deribit.js +10 -10
  127. package/dist/cjs/src/pro/derive.js +6 -6
  128. package/dist/cjs/src/pro/dydx.js +3 -3
  129. package/dist/cjs/src/pro/exmo.js +7 -7
  130. package/dist/cjs/src/pro/gate.js +26 -62
  131. package/dist/cjs/src/pro/gemini.js +6 -6
  132. package/dist/cjs/src/pro/hashkey.js +11 -9
  133. package/dist/cjs/src/pro/hitbtc.js +8 -8
  134. package/dist/cjs/src/pro/hollaex.js +5 -5
  135. package/dist/cjs/src/pro/htx.js +9 -9
  136. package/dist/cjs/src/pro/hyperliquid.js +103 -14
  137. package/dist/cjs/src/pro/independentreserve.js +2 -2
  138. package/dist/cjs/src/pro/kraken.js +15 -15
  139. package/dist/cjs/src/pro/krakenfutures.js +10 -10
  140. package/dist/cjs/src/pro/kucoin.js +15 -15
  141. package/dist/cjs/src/pro/kucoinfutures.js +18 -16
  142. package/dist/cjs/src/pro/lbank.js +5 -5
  143. package/dist/cjs/src/pro/luno.js +2 -2
  144. package/dist/cjs/src/pro/mexc.js +13 -13
  145. package/dist/cjs/src/pro/modetrade.js +13 -11
  146. package/dist/cjs/src/pro/ndax.js +3 -3
  147. package/dist/cjs/src/pro/okx.js +25 -25
  148. package/dist/cjs/src/pro/onetrading.js +6 -6
  149. package/dist/cjs/src/pro/oxfun.js +13 -13
  150. package/dist/cjs/src/pro/p2b.js +5 -5
  151. package/dist/cjs/src/pro/paradex.js +8 -8
  152. package/dist/cjs/src/pro/phemex.js +7 -7
  153. package/dist/cjs/src/pro/poloniex.js +8 -8
  154. package/dist/cjs/src/pro/probit.js +6 -6
  155. package/dist/cjs/src/pro/toobit.js +20 -16
  156. package/dist/cjs/src/pro/upbit.js +9 -9
  157. package/dist/cjs/src/pro/whitebit.js +7 -7
  158. package/dist/cjs/src/pro/woo.js +18 -16
  159. package/dist/cjs/src/pro/woofipro.js +25 -23
  160. package/dist/cjs/src/pro/xt.js +7 -5
  161. package/dist/cjs/src/probit.js +18 -18
  162. package/dist/cjs/src/static_dependencies/ethers/utils/index.js +11 -0
  163. package/dist/cjs/src/timex.js +16 -16
  164. package/dist/cjs/src/tokocrypto.js +17 -17
  165. package/dist/cjs/src/toobit.js +33 -30
  166. package/dist/cjs/src/upbit.js +23 -23
  167. package/dist/cjs/src/wavesexchange.js +86 -85
  168. package/dist/cjs/src/whitebit.js +44 -44
  169. package/dist/cjs/src/woo.js +51 -49
  170. package/dist/cjs/src/woofipro.js +104 -82
  171. package/dist/cjs/src/xt.js +17 -12
  172. package/dist/cjs/src/yobit.js +15 -15
  173. package/dist/cjs/src/zaif.js +38 -9
  174. package/dist/cjs/src/zebpay.js +35 -20
  175. package/dist/cjs/src/zonda.js +14 -14
  176. package/js/ccxt.d.ts +8 -2
  177. package/js/ccxt.js +6 -2
  178. package/js/src/abstract/bydfi.d.ts +52 -0
  179. package/js/src/abstract/bydfi.js +11 -0
  180. package/js/src/alpaca.d.ts +21 -21
  181. package/js/src/alpaca.js +21 -21
  182. package/js/src/apex.d.ts +20 -20
  183. package/js/src/apex.js +20 -20
  184. package/js/src/arkham.d.ts +22 -22
  185. package/js/src/arkham.js +22 -22
  186. package/js/src/ascendex.d.ts +28 -28
  187. package/js/src/ascendex.js +28 -28
  188. package/js/src/backpack.d.ts +21 -21
  189. package/js/src/backpack.js +22 -22
  190. package/js/src/base/Exchange.d.ts +6 -3
  191. package/js/src/base/Exchange.js +48 -38
  192. package/js/src/base/functions/throttle.d.ts +22 -0
  193. package/js/src/base/functions/throttle.js +54 -5
  194. package/js/src/bigone.d.ts +19 -19
  195. package/js/src/bigone.js +19 -19
  196. package/js/src/binance.d.ts +82 -82
  197. package/js/src/binance.js +83 -82
  198. package/js/src/bingx.d.ts +46 -46
  199. package/js/src/bingx.js +47 -47
  200. package/js/src/bit2c.d.ts +11 -11
  201. package/js/src/bit2c.js +11 -11
  202. package/js/src/bitbank.d.ts +12 -12
  203. package/js/src/bitbank.js +49 -48
  204. package/js/src/bitbns.d.ts +13 -13
  205. package/js/src/bitbns.js +13 -13
  206. package/js/src/bitfinex.d.ts +33 -33
  207. package/js/src/bitfinex.js +33 -33
  208. package/js/src/bitflyer.d.ts +17 -17
  209. package/js/src/bitflyer.js +17 -17
  210. package/js/src/bitget.d.ts +57 -57
  211. package/js/src/bitget.js +58 -57
  212. package/js/src/bithumb.d.ts +10 -10
  213. package/js/src/bithumb.js +10 -10
  214. package/js/src/bitmart.d.ts +42 -42
  215. package/js/src/bitmart.js +44 -44
  216. package/js/src/bitmex.d.ts +24 -24
  217. package/js/src/bitmex.js +24 -24
  218. package/js/src/bitopro.d.ts +20 -20
  219. package/js/src/bitopro.js +20 -20
  220. package/js/src/bitrue.d.ts +18 -18
  221. package/js/src/bitrue.js +18 -18
  222. package/js/src/bitso.d.ts +20 -20
  223. package/js/src/bitso.js +20 -20
  224. package/js/src/bitstamp.d.ts +21 -21
  225. package/js/src/bitstamp.js +21 -21
  226. package/js/src/bittrade.d.ts +20 -20
  227. package/js/src/bittrade.js +20 -20
  228. package/js/src/bitvavo.d.ts +19 -19
  229. package/js/src/bitvavo.js +19 -19
  230. package/js/src/blockchaincom.d.ts +20 -20
  231. package/js/src/blockchaincom.js +20 -20
  232. package/js/src/blofin.d.ts +26 -26
  233. package/js/src/blofin.js +26 -26
  234. package/js/src/btcalpha.d.ts +14 -14
  235. package/js/src/btcalpha.js +35 -34
  236. package/js/src/btcbox.d.ts +10 -10
  237. package/js/src/btcbox.js +10 -10
  238. package/js/src/btcmarkets.d.ts +16 -16
  239. package/js/src/btcmarkets.js +16 -16
  240. package/js/src/btcturk.d.ts +10 -10
  241. package/js/src/btcturk.js +10 -10
  242. package/js/src/bullish.d.ts +26 -26
  243. package/js/src/bullish.js +27 -27
  244. package/js/src/bybit.d.ts +66 -66
  245. package/js/src/bybit.js +69 -67
  246. package/js/src/bydfi.d.ts +472 -0
  247. package/js/src/bydfi.js +2905 -0
  248. package/js/src/cex.d.ts +18 -18
  249. package/js/src/cex.js +18 -18
  250. package/js/src/coinbase.d.ts +51 -40
  251. package/js/src/coinbase.js +74 -41
  252. package/js/src/coinbaseexchange.d.ts +22 -22
  253. package/js/src/coinbaseexchange.js +22 -22
  254. package/js/src/coinbaseinternational.d.ts +22 -22
  255. package/js/src/coinbaseinternational.js +22 -22
  256. package/js/src/coincatch.d.ts +39 -39
  257. package/js/src/coincatch.js +39 -39
  258. package/js/src/coincheck.d.ts +11 -11
  259. package/js/src/coincheck.js +11 -11
  260. package/js/src/coinex.d.ts +48 -48
  261. package/js/src/coinex.js +48 -48
  262. package/js/src/coinmate.d.ts +14 -14
  263. package/js/src/coinmate.js +14 -14
  264. package/js/src/coinmetro.d.ts +14 -14
  265. package/js/src/coinmetro.js +14 -14
  266. package/js/src/coinone.d.ts +11 -11
  267. package/js/src/coinone.js +11 -11
  268. package/js/src/coinsph.d.ts +20 -20
  269. package/js/src/coinsph.js +20 -20
  270. package/js/src/coinspot.d.ts +8 -8
  271. package/js/src/coinspot.js +8 -8
  272. package/js/src/cryptocom.d.ts +32 -32
  273. package/js/src/cryptocom.js +32 -32
  274. package/js/src/cryptomus.d.ts +9 -9
  275. package/js/src/cryptomus.js +9 -9
  276. package/js/src/deepcoin.d.ts +33 -33
  277. package/js/src/deepcoin.js +33 -33
  278. package/js/src/defx.d.ts +23 -23
  279. package/js/src/defx.js +23 -23
  280. package/js/src/delta.d.ts +29 -29
  281. package/js/src/delta.js +29 -29
  282. package/js/src/deribit.d.ts +36 -36
  283. package/js/src/deribit.js +36 -36
  284. package/js/src/derive.d.ts +19 -19
  285. package/js/src/derive.js +19 -19
  286. package/js/src/digifinex.d.ts +36 -36
  287. package/js/src/digifinex.js +36 -36
  288. package/js/src/dydx.d.ts +22 -22
  289. package/js/src/dydx.js +25 -25
  290. package/js/src/exmo.d.ts +29 -29
  291. package/js/src/exmo.js +29 -29
  292. package/js/src/foxbit.d.ts +23 -23
  293. package/js/src/foxbit.js +23 -23
  294. package/js/src/gate.d.ts +57 -57
  295. package/js/src/gate.js +60 -59
  296. package/js/src/gemini.d.ts +16 -16
  297. package/js/src/gemini.js +16 -16
  298. package/js/src/hashkey.d.ts +35 -35
  299. package/js/src/hashkey.js +35 -35
  300. package/js/src/hibachi.d.ts +24 -24
  301. package/js/src/hibachi.js +24 -24
  302. package/js/src/hitbtc.d.ts +38 -38
  303. package/js/src/hitbtc.js +38 -38
  304. package/js/src/hollaex.d.ts +22 -22
  305. package/js/src/hollaex.js +22 -22
  306. package/js/src/htx.d.ts +50 -50
  307. package/js/src/htx.js +50 -50
  308. package/js/src/hyperliquid.d.ts +46 -36
  309. package/js/src/hyperliquid.js +86 -45
  310. package/js/src/independentreserve.d.ts +13 -13
  311. package/js/src/independentreserve.js +13 -13
  312. package/js/src/indodax.d.ts +14 -14
  313. package/js/src/indodax.js +14 -14
  314. package/js/src/kraken.d.ts +30 -30
  315. package/js/src/kraken.js +30 -30
  316. package/js/src/krakenfutures.d.ts +21 -21
  317. package/js/src/krakenfutures.js +21 -21
  318. package/js/src/kucoin.d.ts +58 -44
  319. package/js/src/kucoin.js +156 -48
  320. package/js/src/kucoinfutures.d.ts +35 -35
  321. package/js/src/kucoinfutures.js +42 -40
  322. package/js/src/latoken.d.ts +16 -16
  323. package/js/src/latoken.js +16 -16
  324. package/js/src/lbank.d.ts +23 -23
  325. package/js/src/lbank.js +23 -23
  326. package/js/src/luno.d.ts +17 -17
  327. package/js/src/luno.js +17 -17
  328. package/js/src/mercado.d.ts +11 -11
  329. package/js/src/mercado.js +11 -11
  330. package/js/src/mexc.d.ts +47 -47
  331. package/js/src/mexc.js +47 -47
  332. package/js/src/modetrade.d.ts +31 -31
  333. package/js/src/modetrade.js +37 -35
  334. package/js/src/ndax.d.ts +19 -19
  335. package/js/src/ndax.js +19 -19
  336. package/js/src/novadax.d.ts +19 -19
  337. package/js/src/novadax.js +19 -19
  338. package/js/src/oceanex.d.ts +16 -16
  339. package/js/src/oceanex.js +16 -16
  340. package/js/src/okx.d.ts +74 -74
  341. package/js/src/okx.js +83 -83
  342. package/js/src/onetrading.d.ts +34 -33
  343. package/js/src/onetrading.js +34 -33
  344. package/js/src/oxfun.d.ts +25 -25
  345. package/js/src/oxfun.js +25 -25
  346. package/js/src/p2b.d.ts +11 -11
  347. package/js/src/p2b.js +11 -11
  348. package/js/src/paradex.d.ts +54 -54
  349. package/js/src/paradex.js +54 -54
  350. package/js/src/paymium.d.ts +20 -21
  351. package/js/src/paymium.js +20 -21
  352. package/js/src/phemex.d.ts +30 -30
  353. package/js/src/phemex.js +35 -35
  354. package/js/src/poloniex.d.ts +26 -26
  355. package/js/src/poloniex.js +27 -27
  356. package/js/src/pro/alpaca.d.ts +5 -5
  357. package/js/src/pro/alpaca.js +5 -5
  358. package/js/src/pro/apex.d.ts +8 -8
  359. package/js/src/pro/apex.js +13 -11
  360. package/js/src/pro/arkham.d.ts +5 -5
  361. package/js/src/pro/arkham.js +5 -5
  362. package/js/src/pro/ascendex.d.ts +5 -5
  363. package/js/src/pro/ascendex.js +5 -5
  364. package/js/src/pro/backpack.d.ts +16 -16
  365. package/js/src/pro/backpack.js +16 -16
  366. package/js/src/pro/binance.d.ts +35 -35
  367. package/js/src/pro/binance.js +45 -41
  368. package/js/src/pro/bingx.d.ts +9 -9
  369. package/js/src/pro/bingx.js +14 -12
  370. package/js/src/pro/bitfinex.d.ts +8 -8
  371. package/js/src/pro/bitfinex.js +8 -8
  372. package/js/src/pro/bitget.d.ts +12 -12
  373. package/js/src/pro/bitget.js +12 -12
  374. package/js/src/pro/bithumb.d.ts +3 -3
  375. package/js/src/pro/bithumb.js +3 -3
  376. package/js/src/pro/bitmart.d.ts +120 -9
  377. package/js/src/pro/bitmart.js +393 -34
  378. package/js/src/pro/bitmex.d.ts +9 -9
  379. package/js/src/pro/bitmex.js +9 -9
  380. package/js/src/pro/bitopro.d.ts +5 -5
  381. package/js/src/pro/bitopro.js +5 -5
  382. package/js/src/pro/bitrue.d.ts +2 -2
  383. package/js/src/pro/bitrue.js +2 -2
  384. package/js/src/pro/bitstamp.d.ts +3 -3
  385. package/js/src/pro/bitstamp.js +3 -3
  386. package/js/src/pro/bittrade.d.ts +3 -3
  387. package/js/src/pro/bittrade.js +3 -3
  388. package/js/src/pro/bitvavo.d.ts +19 -19
  389. package/js/src/pro/bitvavo.js +19 -19
  390. package/js/src/pro/blockchaincom.d.ts +5 -5
  391. package/js/src/pro/blockchaincom.js +5 -5
  392. package/js/src/pro/blofin.d.ts +10 -10
  393. package/js/src/pro/blofin.js +10 -10
  394. package/js/src/pro/bullish.d.ts +6 -6
  395. package/js/src/pro/bullish.js +6 -6
  396. package/js/src/pro/bybit.d.ts +19 -19
  397. package/js/src/pro/bybit.js +24 -22
  398. package/js/src/pro/bydfi.d.ts +206 -0
  399. package/js/src/pro/bydfi.js +1076 -0
  400. package/js/src/pro/cex.d.ts +13 -13
  401. package/js/src/pro/cex.js +13 -13
  402. package/js/src/pro/coinbase.d.ts +13 -13
  403. package/js/src/pro/coinbase.js +13 -13
  404. package/js/src/pro/coinbaseexchange.d.ts +10 -10
  405. package/js/src/pro/coinbaseexchange.js +10 -10
  406. package/js/src/pro/coinbaseinternational.d.ts +8 -8
  407. package/js/src/pro/coinbaseinternational.js +8 -8
  408. package/js/src/pro/coincatch.d.ts +10 -10
  409. package/js/src/pro/coincatch.js +10 -10
  410. package/js/src/pro/coincheck.d.ts +2 -2
  411. package/js/src/pro/coincheck.js +2 -2
  412. package/js/src/pro/coinex.d.ts +10 -10
  413. package/js/src/pro/coinex.js +10 -10
  414. package/js/src/pro/coinone.d.ts +3 -3
  415. package/js/src/pro/coinone.js +3 -3
  416. package/js/src/pro/cryptocom.d.ts +20 -20
  417. package/js/src/pro/cryptocom.js +25 -23
  418. package/js/src/pro/deepcoin.d.ts +8 -8
  419. package/js/src/pro/deepcoin.js +8 -8
  420. package/js/src/pro/defx.d.ts +15 -15
  421. package/js/src/pro/defx.js +15 -15
  422. package/js/src/pro/deribit.d.ts +10 -10
  423. package/js/src/pro/deribit.js +10 -10
  424. package/js/src/pro/derive.d.ts +6 -6
  425. package/js/src/pro/derive.js +6 -6
  426. package/js/src/pro/dydx.d.ts +3 -3
  427. package/js/src/pro/dydx.js +3 -3
  428. package/js/src/pro/exmo.d.ts +7 -7
  429. package/js/src/pro/exmo.js +7 -7
  430. package/js/src/pro/gate.d.ts +22 -23
  431. package/js/src/pro/gate.js +26 -62
  432. package/js/src/pro/gemini.d.ts +6 -6
  433. package/js/src/pro/gemini.js +6 -6
  434. package/js/src/pro/hashkey.d.ts +6 -6
  435. package/js/src/pro/hashkey.js +11 -9
  436. package/js/src/pro/hitbtc.d.ts +8 -8
  437. package/js/src/pro/hitbtc.js +8 -8
  438. package/js/src/pro/hollaex.d.ts +5 -5
  439. package/js/src/pro/hollaex.js +5 -5
  440. package/js/src/pro/htx.d.ts +9 -9
  441. package/js/src/pro/htx.js +9 -9
  442. package/js/src/pro/hyperliquid.d.ts +38 -14
  443. package/js/src/pro/hyperliquid.js +103 -14
  444. package/js/src/pro/independentreserve.d.ts +2 -2
  445. package/js/src/pro/independentreserve.js +2 -2
  446. package/js/src/pro/kraken.d.ts +15 -15
  447. package/js/src/pro/kraken.js +15 -15
  448. package/js/src/pro/krakenfutures.d.ts +10 -10
  449. package/js/src/pro/krakenfutures.js +10 -10
  450. package/js/src/pro/kucoin.d.ts +15 -15
  451. package/js/src/pro/kucoin.js +15 -15
  452. package/js/src/pro/kucoinfutures.d.ts +13 -13
  453. package/js/src/pro/kucoinfutures.js +18 -16
  454. package/js/src/pro/lbank.d.ts +5 -5
  455. package/js/src/pro/lbank.js +5 -5
  456. package/js/src/pro/luno.d.ts +2 -2
  457. package/js/src/pro/luno.js +2 -2
  458. package/js/src/pro/mexc.d.ts +13 -13
  459. package/js/src/pro/mexc.js +13 -13
  460. package/js/src/pro/modetrade.d.ts +8 -8
  461. package/js/src/pro/modetrade.js +13 -11
  462. package/js/src/pro/ndax.d.ts +3 -3
  463. package/js/src/pro/ndax.js +3 -3
  464. package/js/src/pro/okx.d.ts +25 -25
  465. package/js/src/pro/okx.js +25 -25
  466. package/js/src/pro/onetrading.d.ts +6 -6
  467. package/js/src/pro/onetrading.js +6 -6
  468. package/js/src/pro/oxfun.d.ts +13 -13
  469. package/js/src/pro/oxfun.js +13 -13
  470. package/js/src/pro/p2b.d.ts +5 -5
  471. package/js/src/pro/p2b.js +5 -5
  472. package/js/src/pro/paradex.d.ts +8 -8
  473. package/js/src/pro/paradex.js +8 -8
  474. package/js/src/pro/phemex.d.ts +7 -7
  475. package/js/src/pro/phemex.js +7 -7
  476. package/js/src/pro/poloniex.d.ts +8 -8
  477. package/js/src/pro/poloniex.js +8 -8
  478. package/js/src/pro/probit.d.ts +6 -6
  479. package/js/src/pro/probit.js +6 -6
  480. package/js/src/pro/toobit.d.ts +9 -9
  481. package/js/src/pro/toobit.js +20 -16
  482. package/js/src/pro/upbit.d.ts +9 -9
  483. package/js/src/pro/upbit.js +9 -9
  484. package/js/src/pro/whitebit.d.ts +7 -7
  485. package/js/src/pro/whitebit.js +7 -7
  486. package/js/src/pro/woo.d.ts +13 -13
  487. package/js/src/pro/woo.js +18 -16
  488. package/js/src/pro/woofipro.d.ts +20 -20
  489. package/js/src/pro/woofipro.js +25 -23
  490. package/js/src/pro/xt.d.ts +2 -2
  491. package/js/src/pro/xt.js +7 -5
  492. package/js/src/probit.d.ts +18 -18
  493. package/js/src/probit.js +18 -18
  494. package/js/src/static_dependencies/ethers/utils/index.d.ts +2 -1
  495. package/js/src/static_dependencies/ethers/utils/index.js +8 -1
  496. package/js/src/timex.d.ts +16 -16
  497. package/js/src/timex.js +16 -16
  498. package/js/src/tokocrypto.d.ts +17 -17
  499. package/js/src/tokocrypto.js +17 -17
  500. package/js/src/toobit.d.ts +27 -27
  501. package/js/src/toobit.js +33 -30
  502. package/js/src/upbit.d.ts +23 -23
  503. package/js/src/upbit.js +23 -23
  504. package/js/src/wavesexchange.d.ts +15 -15
  505. package/js/src/wavesexchange.js +86 -85
  506. package/js/src/whitebit.d.ts +44 -44
  507. package/js/src/whitebit.js +44 -44
  508. package/js/src/woo.d.ts +45 -45
  509. package/js/src/woo.js +51 -49
  510. package/js/src/woofipro.d.ts +77 -77
  511. package/js/src/woofipro.js +104 -82
  512. package/js/src/xt.d.ts +12 -12
  513. package/js/src/xt.js +17 -12
  514. package/js/src/yobit.d.ts +15 -15
  515. package/js/src/yobit.js +15 -15
  516. package/js/src/zaif.d.ts +9 -9
  517. package/js/src/zaif.js +38 -9
  518. package/js/src/zebpay.d.ts +20 -20
  519. package/js/src/zebpay.js +35 -20
  520. package/js/src/zonda.d.ts +14 -14
  521. package/js/src/zonda.js +14 -14
  522. package/package.json +1 -1
@@ -145,6 +145,8 @@ export default class Exchange {
145
145
  tokenBucket: Dictionary<number>;
146
146
  throttler: any;
147
147
  enableRateLimit: boolean;
148
+ rollingWindowSize: number;
149
+ rateLimiterAlgorithm: string;
148
150
  httpExceptions: Dictionary<any>;
149
151
  limits: {
150
152
  amount?: MinMax;
@@ -754,7 +756,7 @@ export default class Exchange {
754
756
  * @param {string} clientOrderId client order Id
755
757
  * @param {string} symbol unified symbol of the market to create an order in
756
758
  * @param {object} [params] extra parameters specific to the exchange API endpoint
757
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
759
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
758
760
  */
759
761
  fetchOrderWithClientOrderId(clientOrderId: string, symbol?: Str, params?: {}): Promise<Order>;
760
762
  fetchOrderWs(id: string, symbol?: Str, params?: {}): Promise<Order>;
@@ -793,7 +795,7 @@ export default class Exchange {
793
795
  * @param {string} clientOrderId client order Id
794
796
  * @param {string} symbol unified symbol of the market to create an order in
795
797
  * @param {object} [params] extra parameters specific to the exchange API endpoint
796
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
798
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
797
799
  */
798
800
  cancelOrderWithClientOrderId(clientOrderId: string, symbol?: Str, params?: {}): Promise<Order>;
799
801
  cancelOrderWs(id: string, symbol?: Str, params?: {}): Promise<Order>;
@@ -805,7 +807,7 @@ export default class Exchange {
805
807
  * @param {string[]} clientOrderIds client order Ids
806
808
  * @param {string} symbol unified symbol of the market to create an order in
807
809
  * @param {object} [params] extra parameters specific to the exchange API endpoint
808
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
810
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
809
811
  */
810
812
  cancelOrdersWithClientOrderIds(clientOrderIds: string[], symbol?: Str, params?: {}): Promise<Order[]>;
811
813
  cancelOrdersWs(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
@@ -890,6 +892,7 @@ export default class Exchange {
890
892
  createStopLimitOrderWs(symbol: string, side: OrderSide, amount: number, price: number, triggerPrice: number, params?: {}): Promise<Order>;
891
893
  createStopMarketOrder(symbol: string, side: OrderSide, amount: number, triggerPrice: number, params?: {}): Promise<Order>;
892
894
  createStopMarketOrderWs(symbol: string, side: OrderSide, amount: number, triggerPrice: number, params?: {}): Promise<Order>;
895
+ createSubAccount(name: string, params?: {}): Promise<{}>;
893
896
  safeCurrencyCode(currencyId: Str, currency?: Currency): Str;
894
897
  filterBySymbolSinceLimit(array: any, symbol?: Str, since?: Int, limit?: Int, tail?: boolean): any;
895
898
  filterByCurrencySinceLimit(array: any, code?: any, since?: Int, limit?: Int, tail?: boolean): any;
@@ -123,6 +123,8 @@ export default class Exchange {
123
123
  this.tokenBucket = undefined;
124
124
  this.throttler = undefined;
125
125
  this.enableRateLimit = undefined;
126
+ this.rollingWindowSize = 0.0; // set to 0.0 to use leaky bucket rate limiter
127
+ this.rateLimiterAlgorithm = 'leakyBucket';
126
128
  this.httpExceptions = undefined;
127
129
  this.limits = undefined;
128
130
  this.markets_by_id = undefined;
@@ -1905,6 +1907,7 @@ export default class Exchange {
1905
1907
  'price': { 'min': undefined, 'max': undefined },
1906
1908
  'cost': { 'min': undefined, 'max': undefined },
1907
1909
  },
1910
+ 'rollingWindowSize': 60000, // default 60 seconds, requires rateLimiterAlgorithm to be set as 'rollingWindow'
1908
1911
  };
1909
1912
  }
1910
1913
  safeBoolN(dictionaryOrList, keys, defaultValue = undefined) {
@@ -2615,7 +2618,7 @@ export default class Exchange {
2615
2618
  * @param {int} [since] timestamp in ms of the earliest change to fetch
2616
2619
  * @param {int} [limit] the maximum amount of changes to fetch
2617
2620
  * @param {object} params extra parameters specific to the exchange api endpoint
2618
- * @returns {object[]} a list of [margin structures]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
2621
+ * @returns {object[]} a list of [margin structures]{@link https://docs.ccxt.com/?id=margin-loan-structure}
2619
2622
  */
2620
2623
  throw new NotSupported(this.id + ' fetchMarginAdjustmentHistory() is not supported yet');
2621
2624
  }
@@ -2700,12 +2703,16 @@ export default class Exchange {
2700
2703
  if (this.rateLimit > 0) {
2701
2704
  refillRate = 1 / this.rateLimit;
2702
2705
  }
2706
+ const useLeaky = (this.rollingWindowSize === 0.0) || (this.rateLimiterAlgorithm === 'leakyBucket');
2707
+ const algorithm = useLeaky ? 'leakyBucket' : 'rollingWindow';
2703
2708
  const defaultBucket = {
2704
2709
  'delay': 0.001,
2705
2710
  'capacity': 1,
2706
2711
  'cost': 1,
2707
- 'maxCapacity': this.safeInteger(this.options, 'maxRequestsQueue', 1000),
2708
2712
  'refillRate': refillRate,
2713
+ 'algorithm': algorithm,
2714
+ 'windowSize': this.rollingWindowSize,
2715
+ 'rateLimit': this.rateLimit,
2709
2716
  };
2710
2717
  const existingBucket = (this.tokenBucket === undefined) ? {} : this.tokenBucket;
2711
2718
  this.tokenBucket = this.extend(defaultBucket, existingBucket);
@@ -4946,7 +4953,7 @@ export default class Exchange {
4946
4953
  * @description fetches all open positions for specific symbol, unlike fetchPositions (which is designed to work with multiple symbols) so this method might be preffered for one-market position, because of less rate-limit consumption and speed
4947
4954
  * @param {string} symbol unified market symbol
4948
4955
  * @param {object} params extra parameters specific to the endpoint
4949
- * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure} with maximum 3 items - possible one position for "one-way" mode, and possible two positions (long & short) for "two-way" (a.k.a. hedge) mode
4956
+ * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/?id=position-structure} with maximum 3 items - possible one position for "one-way" mode, and possible two positions (long & short) for "two-way" (a.k.a. hedge) mode
4950
4957
  */
4951
4958
  throw new NotSupported(this.id + ' fetchPositionsForSymbol() is not supported yet');
4952
4959
  }
@@ -4957,7 +4964,7 @@ export default class Exchange {
4957
4964
  * @description fetches all open positions for specific symbol, unlike fetchPositions (which is designed to work with multiple symbols) so this method might be preffered for one-market position, because of less rate-limit consumption and speed
4958
4965
  * @param {string} symbol unified market symbol
4959
4966
  * @param {object} params extra parameters specific to the endpoint
4960
- * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure} with maximum 3 items - possible one position for "one-way" mode, and possible two positions (long & short) for "two-way" (a.k.a. hedge) mode
4967
+ * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/?id=position-structure} with maximum 3 items - possible one position for "one-way" mode, and possible two positions (long & short) for "two-way" (a.k.a. hedge) mode
4961
4968
  */
4962
4969
  throw new NotSupported(this.id + ' fetchPositionsForSymbol() is not supported yet');
4963
4970
  }
@@ -5414,7 +5421,7 @@ export default class Exchange {
5414
5421
  * @param {string} clientOrderId client order Id
5415
5422
  * @param {string} symbol unified symbol of the market to create an order in
5416
5423
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5417
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
5424
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
5418
5425
  */
5419
5426
  async fetchOrderWithClientOrderId(clientOrderId, symbol = undefined, params = {}) {
5420
5427
  const extendedParams = this.extend(params, { 'clientOrderId': clientOrderId });
@@ -5460,7 +5467,7 @@ export default class Exchange {
5460
5467
  * @param {float} trailingAmount the quote amount to trail away from the current market price
5461
5468
  * @param {float} [trailingTriggerPrice] the price to activate a trailing order, default uses the price argument
5462
5469
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5463
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
5470
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
5464
5471
  */
5465
5472
  if (trailingAmount === undefined) {
5466
5473
  throw new ArgumentsRequired(this.id + ' createTrailingAmountOrder() requires a trailingAmount argument');
@@ -5487,7 +5494,7 @@ export default class Exchange {
5487
5494
  * @param {float} trailingAmount the quote amount to trail away from the current market price
5488
5495
  * @param {float} [trailingTriggerPrice] the price to activate a trailing order, default uses the price argument
5489
5496
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5490
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
5497
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
5491
5498
  */
5492
5499
  if (trailingAmount === undefined) {
5493
5500
  throw new ArgumentsRequired(this.id + ' createTrailingAmountOrderWs() requires a trailingAmount argument');
@@ -5514,7 +5521,7 @@ export default class Exchange {
5514
5521
  * @param {float} trailingPercent the percent to trail away from the current market price
5515
5522
  * @param {float} [trailingTriggerPrice] the price to activate a trailing order, default uses the price argument
5516
5523
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5517
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
5524
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
5518
5525
  */
5519
5526
  if (trailingPercent === undefined) {
5520
5527
  throw new ArgumentsRequired(this.id + ' createTrailingPercentOrder() requires a trailingPercent argument');
@@ -5541,7 +5548,7 @@ export default class Exchange {
5541
5548
  * @param {float} trailingPercent the percent to trail away from the current market price
5542
5549
  * @param {float} [trailingTriggerPrice] the price to activate a trailing order, default uses the price argument
5543
5550
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5544
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
5551
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
5545
5552
  */
5546
5553
  if (trailingPercent === undefined) {
5547
5554
  throw new ArgumentsRequired(this.id + ' createTrailingPercentOrderWs() requires a trailingPercent argument');
@@ -5564,7 +5571,7 @@ export default class Exchange {
5564
5571
  * @param {string} side 'buy' or 'sell'
5565
5572
  * @param {float} cost how much you want to trade in units of the quote currency
5566
5573
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5567
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
5574
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
5568
5575
  */
5569
5576
  if (this.has['createMarketOrderWithCost'] || (this.has['createMarketBuyOrderWithCost'] && this.has['createMarketSellOrderWithCost'])) {
5570
5577
  return await this.createOrder(symbol, 'market', side, cost, 1, params);
@@ -5579,7 +5586,7 @@ export default class Exchange {
5579
5586
  * @param {string} symbol unified symbol of the market to create an order in
5580
5587
  * @param {float} cost how much you want to trade in units of the quote currency
5581
5588
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5582
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
5589
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
5583
5590
  */
5584
5591
  if (this.options['createMarketBuyOrderRequiresPrice'] || this.has['createMarketBuyOrderWithCost']) {
5585
5592
  return await this.createOrder(symbol, 'market', 'buy', cost, 1, params);
@@ -5594,7 +5601,7 @@ export default class Exchange {
5594
5601
  * @param {string} symbol unified symbol of the market to create an order in
5595
5602
  * @param {float} cost how much you want to trade in units of the quote currency
5596
5603
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5597
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
5604
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
5598
5605
  */
5599
5606
  if (this.options['createMarketSellOrderRequiresPrice'] || this.has['createMarketSellOrderWithCost']) {
5600
5607
  return await this.createOrder(symbol, 'market', 'sell', cost, 1, params);
@@ -5610,7 +5617,7 @@ export default class Exchange {
5610
5617
  * @param {string} side 'buy' or 'sell'
5611
5618
  * @param {float} cost how much you want to trade in units of the quote currency
5612
5619
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5613
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
5620
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
5614
5621
  */
5615
5622
  if (this.has['createMarketOrderWithCostWs'] || (this.has['createMarketBuyOrderWithCostWs'] && this.has['createMarketSellOrderWithCostWs'])) {
5616
5623
  return await this.createOrderWs(symbol, 'market', side, cost, 1, params);
@@ -5629,7 +5636,7 @@ export default class Exchange {
5629
5636
  * @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
5630
5637
  * @param {float} triggerPrice the price to trigger the stop order, in units of the quote currency
5631
5638
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5632
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
5639
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
5633
5640
  */
5634
5641
  if (triggerPrice === undefined) {
5635
5642
  throw new ArgumentsRequired(this.id + ' createTriggerOrder() requires a triggerPrice argument');
@@ -5652,7 +5659,7 @@ export default class Exchange {
5652
5659
  * @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
5653
5660
  * @param {float} triggerPrice the price to trigger the stop order, in units of the quote currency
5654
5661
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5655
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
5662
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
5656
5663
  */
5657
5664
  if (triggerPrice === undefined) {
5658
5665
  throw new ArgumentsRequired(this.id + ' createTriggerOrderWs() requires a triggerPrice argument');
@@ -5675,7 +5682,7 @@ export default class Exchange {
5675
5682
  * @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
5676
5683
  * @param {float} stopLossPrice the price to trigger the stop loss order, in units of the quote currency
5677
5684
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5678
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
5685
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
5679
5686
  */
5680
5687
  if (stopLossPrice === undefined) {
5681
5688
  throw new ArgumentsRequired(this.id + ' createStopLossOrder() requires a stopLossPrice argument');
@@ -5698,7 +5705,7 @@ export default class Exchange {
5698
5705
  * @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
5699
5706
  * @param {float} stopLossPrice the price to trigger the stop loss order, in units of the quote currency
5700
5707
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5701
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
5708
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
5702
5709
  */
5703
5710
  if (stopLossPrice === undefined) {
5704
5711
  throw new ArgumentsRequired(this.id + ' createStopLossOrderWs() requires a stopLossPrice argument');
@@ -5721,7 +5728,7 @@ export default class Exchange {
5721
5728
  * @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
5722
5729
  * @param {float} takeProfitPrice the price to trigger the take profit order, in units of the quote currency
5723
5730
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5724
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
5731
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
5725
5732
  */
5726
5733
  if (takeProfitPrice === undefined) {
5727
5734
  throw new ArgumentsRequired(this.id + ' createTakeProfitOrder() requires a takeProfitPrice argument');
@@ -5744,7 +5751,7 @@ export default class Exchange {
5744
5751
  * @param {float} [price] the price to fulfill the order, in units of the quote currency, ignored in market orders
5745
5752
  * @param {float} takeProfitPrice the price to trigger the take profit order, in units of the quote currency
5746
5753
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5747
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
5754
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
5748
5755
  */
5749
5756
  if (takeProfitPrice === undefined) {
5750
5757
  throw new ArgumentsRequired(this.id + ' createTakeProfitOrderWs() requires a takeProfitPrice argument');
@@ -5776,7 +5783,7 @@ export default class Exchange {
5776
5783
  * @param {float} [params.stopLossLimitPrice] *not available on all exchanges* stop loss for a limit stop loss order
5777
5784
  * @param {float} [params.takeProfitAmount] *not available on all exchanges* the amount for a take profit
5778
5785
  * @param {float} [params.stopLossAmount] *not available on all exchanges* the amount for a stop loss
5779
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
5786
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
5780
5787
  */
5781
5788
  params = this.setTakeProfitAndStopLossParams(symbol, type, side, amount, price, takeProfit, stopLoss, params);
5782
5789
  if (this.has['createOrderWithTakeProfitAndStopLoss']) {
@@ -5854,7 +5861,7 @@ export default class Exchange {
5854
5861
  * @param {float} [params.stopLossLimitPrice] *not available on all exchanges* stop loss for a limit stop loss order
5855
5862
  * @param {float} [params.takeProfitAmount] *not available on all exchanges* the amount for a take profit
5856
5863
  * @param {float} [params.stopLossAmount] *not available on all exchanges* the amount for a stop loss
5857
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
5864
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
5858
5865
  */
5859
5866
  params = this.setTakeProfitAndStopLossParams(symbol, type, side, amount, price, takeProfit, stopLoss, params);
5860
5867
  if (this.has['createOrderWithTakeProfitAndStopLossWs']) {
@@ -5881,7 +5888,7 @@ export default class Exchange {
5881
5888
  * @param {string} clientOrderId client order Id
5882
5889
  * @param {string} symbol unified symbol of the market to create an order in
5883
5890
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5884
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
5891
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
5885
5892
  */
5886
5893
  async cancelOrderWithClientOrderId(clientOrderId, symbol = undefined, params = {}) {
5887
5894
  const extendedParams = this.extend(params, { 'clientOrderId': clientOrderId });
@@ -5900,7 +5907,7 @@ export default class Exchange {
5900
5907
  * @param {string[]} clientOrderIds client order Ids
5901
5908
  * @param {string} symbol unified symbol of the market to create an order in
5902
5909
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5903
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
5910
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
5904
5911
  */
5905
5912
  async cancelOrdersWithClientOrderIds(clientOrderIds, symbol = undefined, params = {}) {
5906
5913
  const extendedParams = this.extend(params, { 'clientOrderIds': clientOrderIds });
@@ -6009,7 +6016,7 @@ export default class Exchange {
6009
6016
  * @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
6010
6017
  * @param {int} [limit] max number of deposit/withdrawals to return, default is undefined
6011
6018
  * @param {object} [params] extra parameters specific to the exchange API endpoint
6012
- * @returns {object} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
6019
+ * @returns {object} a list of [transaction structures]{@link https://docs.ccxt.com/?id=transaction-structure}
6013
6020
  */
6014
6021
  throw new NotSupported(this.id + ' fetchDepositsWithdrawals() is not supported yet');
6015
6022
  }
@@ -6424,6 +6431,9 @@ export default class Exchange {
6424
6431
  const query = this.extend(params, { 'stopPrice': triggerPrice });
6425
6432
  return await this.createOrderWs(symbol, 'market', side, amount, undefined, query);
6426
6433
  }
6434
+ async createSubAccount(name, params = {}) {
6435
+ throw new NotSupported(this.id + ' createSubAccount() is not supported yet');
6436
+ }
6427
6437
  safeCurrencyCode(currencyId, currency = undefined) {
6428
6438
  currency = this.safeCurrency(currencyId, currency);
6429
6439
  return currency['code'];
@@ -7039,7 +7049,7 @@ export default class Exchange {
7039
7049
  * @param {object} market ccxt market
7040
7050
  * @param {int} [since] when defined, the response items are filtered to only include items after this timestamp
7041
7051
  * @param {int} [limit] limits the number of items in the response
7042
- * @returns {object[]} an array of [funding history structures]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
7052
+ * @returns {object[]} an array of [funding history structures]{@link https://docs.ccxt.com/?id=funding-history-structure}
7043
7053
  */
7044
7054
  const result = [];
7045
7055
  for (let i = 0; i < incomes.length; i++) {
@@ -7076,7 +7086,7 @@ export default class Exchange {
7076
7086
  * @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
7077
7087
  * @param {int} [limit] max number of deposit/withdrawals to return, default is undefined
7078
7088
  * @param {object} [params] extra parameters specific to the exchange API endpoint
7079
- * @returns {object} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
7089
+ * @returns {object} a list of [transaction structures]{@link https://docs.ccxt.com/?id=transaction-structure}
7080
7090
  */
7081
7091
  if (this.has['fetchDepositsWithdrawals']) {
7082
7092
  return await this.fetchDepositsWithdrawals(code, since, limit, params);
@@ -7482,7 +7492,7 @@ export default class Exchange {
7482
7492
  * @param {object} market ccxt market
7483
7493
  * @param {int} [since] when defined, the response items are filtered to only include items after this timestamp
7484
7494
  * @param {int} [limit] limits the number of items in the response
7485
- * @returns {object[]} an array of [liquidation structures]{@link https://docs.ccxt.com/#/?id=liquidation-structure}
7495
+ * @returns {object[]} an array of [liquidation structures]{@link https://docs.ccxt.com/?id=liquidation-structure}
7486
7496
  */
7487
7497
  const result = [];
7488
7498
  for (let i = 0; i < liquidations.length; i++) {
@@ -7697,7 +7707,7 @@ export default class Exchange {
7697
7707
  * @param {int} [since] timestamp in ms of the position
7698
7708
  * @param {int} [limit] the maximum amount of candles to fetch, default=1000
7699
7709
  * @param {object} params extra parameters specific to the exchange api endpoint
7700
- * @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
7710
+ * @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/?id=position-structure}
7701
7711
  */
7702
7712
  if (this.has['fetchPositionsHistory']) {
7703
7713
  const positions = await this.fetchPositionsHistory([symbol], since, limit, params);
@@ -7716,7 +7726,7 @@ export default class Exchange {
7716
7726
  * @param {int} [since] timestamp in ms of the position
7717
7727
  * @param {int} [limit] the maximum amount of candles to fetch, default=1000
7718
7728
  * @param {object} params extra parameters specific to the exchange api endpoint
7719
- * @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
7729
+ * @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/?id=position-structure}
7720
7730
  */
7721
7731
  throw new NotSupported(this.id + ' fetchPositionsHistory () is not supported yet');
7722
7732
  }
@@ -7743,7 +7753,7 @@ export default class Exchange {
7743
7753
  * @param {string} id transfer id
7744
7754
  * @param {[string]} code unified currency code
7745
7755
  * @param {object} params extra parameters specific to the exchange api endpoint
7746
- * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
7756
+ * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/?id=transfer-structure}
7747
7757
  */
7748
7758
  throw new NotSupported(this.id + ' fetchTransfer () is not supported yet');
7749
7759
  }
@@ -7756,7 +7766,7 @@ export default class Exchange {
7756
7766
  * @param {int} [since] timestamp in ms of the earliest transfer to fetch
7757
7767
  * @param {int} [limit] the maximum amount of transfers to fetch
7758
7768
  * @param {object} params extra parameters specific to the exchange api endpoint
7759
- * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
7769
+ * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/?id=transfer-structure}
7760
7770
  */
7761
7771
  throw new NotSupported(this.id + ' fetchTransfers () is not supported yet');
7762
7772
  }
@@ -7779,7 +7789,7 @@ export default class Exchange {
7779
7789
  * @description watches a mark price for a specific market
7780
7790
  * @param {string} symbol unified symbol of the market to fetch the ticker for
7781
7791
  * @param {object} [params] extra parameters specific to the exchange API endpoint
7782
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
7792
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/?id=ticker-structure}
7783
7793
  */
7784
7794
  throw new NotSupported(this.id + ' watchMarkPrice () is not supported yet');
7785
7795
  }
@@ -7790,7 +7800,7 @@ export default class Exchange {
7790
7800
  * @description watches the mark price for all markets
7791
7801
  * @param {string[]} symbols unified symbol of the market to fetch the ticker for
7792
7802
  * @param {object} [params] extra parameters specific to the exchange API endpoint
7793
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
7803
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/?id=ticker-structure}
7794
7804
  */
7795
7805
  throw new NotSupported(this.id + ' watchMarkPrices () is not supported yet');
7796
7806
  }
@@ -7804,7 +7814,7 @@ export default class Exchange {
7804
7814
  * @param {string} address the address to withdraw to
7805
7815
  * @param {string} tag
7806
7816
  * @param {object} [params] extra parameters specific to the bitvavo api endpoint
7807
- * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
7817
+ * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/?id=transaction-structure}
7808
7818
  */
7809
7819
  throw new NotSupported(this.id + ' withdrawWs () is not supported yet');
7810
7820
  }
@@ -7815,7 +7825,7 @@ export default class Exchange {
7815
7825
  * @description unWatches information on multiple trades made by the user
7816
7826
  * @param {string} symbol unified market symbol of the market orders were made in
7817
7827
  * @param {object} [params] extra parameters specific to the exchange API endpoint
7818
- * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
7828
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/?id=order-structure}
7819
7829
  */
7820
7830
  throw new NotSupported(this.id + ' unWatchMyTrades () is not supported yet');
7821
7831
  }
@@ -7826,7 +7836,7 @@ export default class Exchange {
7826
7836
  * @description create a list of trade orders
7827
7837
  * @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
7828
7838
  * @param {object} [params] extra parameters specific to the exchange API endpoint
7829
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
7839
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
7830
7840
  */
7831
7841
  throw new NotSupported(this.id + ' createOrdersWs () is not supported yet');
7832
7842
  }
@@ -7838,7 +7848,7 @@ export default class Exchange {
7838
7848
  * @param {string} symbol unified symbol of the market to fetch the order book for
7839
7849
  * @param {int} [limit] the maximum amount of order book entries to return
7840
7850
  * @param {object} [params] extra parameters specific to the exchange API endpoint
7841
- * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
7851
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/?id=order-book-structure} indexed by market symbols
7842
7852
  */
7843
7853
  throw new NotSupported(this.id + ' fetchOrdersByStatusWs () is not supported yet');
7844
7854
  }
@@ -7849,7 +7859,7 @@ export default class Exchange {
7849
7859
  * @description unWatches best bid & ask for symbols
7850
7860
  * @param {string[]} symbols unified symbol of the market to fetch the ticker for
7851
7861
  * @param {object} [params] extra parameters specific to the exchange API endpoint
7852
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
7862
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/?id=ticker-structure}
7853
7863
  */
7854
7864
  throw new NotSupported(this.id + ' unWatchBidsAsks () is not supported yet');
7855
7865
  }
@@ -1,5 +1,27 @@
1
1
  declare class Throttler {
2
+ running: boolean;
3
+ queue: {
4
+ resolver: any;
5
+ cost: number;
6
+ }[];
7
+ config: {
8
+ refillRate: number;
9
+ delay: number;
10
+ capacity: number;
11
+ tokens: number;
12
+ cost: number;
13
+ algorithm: string;
14
+ rateLimit: number;
15
+ windowSize: number;
16
+ maxWeight: number;
17
+ };
18
+ timestamps: {
19
+ timestamp: number;
20
+ cost: number;
21
+ }[];
2
22
  constructor(config: any);
23
+ leakyBucketLoop(): Promise<void>;
24
+ rollingWindowLoop(): Promise<void>;
3
25
  loop(): Promise<void>;
4
26
  throttle(cost?: any): Promise<unknown>;
5
27
  }
@@ -14,15 +14,21 @@ class Throttler {
14
14
  'refillRate': 1.0,
15
15
  'delay': 0.001,
16
16
  'capacity': 1.0,
17
- 'maxCapacity': 2000,
18
17
  'tokens': 0,
19
18
  'cost': 1.0,
19
+ 'algorithm': 'leakyBucket',
20
+ 'windowSize': 60000.0,
21
+ 'maxWeight': undefined, // rolling window - rollingWindowSize / rateLimit // ms_of_window / ms_of_rate_limit
20
22
  };
21
23
  Object.assign(this.config, config);
24
+ if (this.config['algorithm'] !== 'leakyBucket') {
25
+ this.config['maxWeight'] = this.config.windowSize / this.config.rateLimit;
26
+ }
22
27
  this.queue = [];
23
28
  this.running = false;
29
+ this.timestamps = [];
24
30
  }
25
- async loop() {
31
+ async leakyBucketLoop() {
26
32
  let lastTimestamp = now();
27
33
  while (this.running) {
28
34
  const { resolver, cost } = this.queue[0];
@@ -46,14 +52,57 @@ class Throttler {
46
52
  }
47
53
  }
48
54
  }
55
+ async rollingWindowLoop() {
56
+ while (this.running) {
57
+ const { resolver, cost } = this.queue[0];
58
+ const nowTime = now();
59
+ const cutOffTime = nowTime - this.config.windowSize;
60
+ let totalCost = 0;
61
+ // Remove expired timestamps & sum the remaining requests
62
+ const timestamps = [];
63
+ for (let i = 0; i < this.timestamps.length; i++) {
64
+ const element = this.timestamps[i];
65
+ if (element.timestamp > cutOffTime) {
66
+ totalCost += element.cost;
67
+ timestamps.push(element);
68
+ }
69
+ }
70
+ this.timestamps = timestamps;
71
+ // handle current request
72
+ if (totalCost + cost <= this.config.maxWeight) {
73
+ // Enough capacity, proceed with request
74
+ this.timestamps.push({ timestamp: nowTime, cost });
75
+ resolver();
76
+ this.queue.shift();
77
+ await Promise.resolve(); // Yield control to event loop
78
+ if (this.queue.length === 0) {
79
+ this.running = false;
80
+ }
81
+ }
82
+ else {
83
+ // Calculate the wait time until the oldest request expires
84
+ const earliestRequestTime = this.timestamps[0].timestamp;
85
+ const waitTime = (earliestRequestTime + this.config.windowSize) - nowTime;
86
+ // Ensure waitTime is positive before sleeping
87
+ if (waitTime > 0) {
88
+ await sleep(waitTime);
89
+ }
90
+ }
91
+ }
92
+ }
93
+ async loop() {
94
+ if (this.config['algorithm'] === 'leakyBucket') {
95
+ await this.leakyBucketLoop();
96
+ }
97
+ else {
98
+ await this.rollingWindowLoop();
99
+ }
100
+ }
49
101
  throttle(cost = undefined) {
50
102
  let resolver;
51
103
  const promise = new Promise((resolve, reject) => {
52
104
  resolver = resolve;
53
105
  });
54
- if (this.queue.length > this.config['maxCapacity']) {
55
- throw new Error('throttle queue is over maxCapacity (' + this.config['maxCapacity'].toString() + '), see https://docs.ccxt.com/#/README?id=maximum-requests-capacity');
56
- }
57
106
  cost = (cost === undefined) ? this.config['cost'] : cost;
58
107
  this.queue.push({ resolver, cost });
59
108
  if (!this.running) {