ccxt-ir 4.10.0 → 4.12.0

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 (1059) hide show
  1. package/README.md +4 -4
  2. package/dist/ccxt.browser.min.js +2 -2
  3. package/dist/cjs/ccxt.js +10 -1
  4. package/dist/cjs/src/abstract/bidarz.js +11 -0
  5. package/dist/cjs/src/bidarz.js +337 -0
  6. package/dist/cjs/src/bit24.js +4 -3
  7. package/dist/cjs/src/changefa.js +342 -0
  8. package/dist/cjs/src/ourbit.js +445 -0
  9. package/js/ccxt.d.ts +11 -2
  10. package/js/ccxt.js +8 -2
  11. package/js/src/abstract/bidarz.d.ts +9 -0
  12. package/js/src/abstract/bidarz.js +11 -0
  13. package/js/src/abstract/changefa.d.ts +8 -0
  14. package/js/src/abstract/changefa.js +11 -0
  15. package/js/src/abstract/ourbit.d.ts +10 -0
  16. package/js/src/abstract/ourbit.js +11 -0
  17. package/js/src/bidarz.d.ts +22 -0
  18. package/js/src/bidarz.js +336 -0
  19. package/js/src/bit24.js +4 -3
  20. package/js/src/changefa.d.ts +20 -0
  21. package/js/src/changefa.js +341 -0
  22. package/js/src/ourbit.d.ts +21 -0
  23. package/js/src/ourbit.js +444 -0
  24. package/js/src/src/abantether.d.ts +21 -0
  25. package/js/src/src/abantether.js +353 -0
  26. package/js/src/src/abstract/abantether.d.ts +8 -0
  27. package/js/src/src/abstract/abantether.js +11 -0
  28. package/js/src/src/abstract/afratether.d.ts +9 -0
  29. package/js/src/src/abstract/afratether.js +11 -0
  30. package/js/src/src/abstract/alpaca.d.ts +77 -0
  31. package/js/src/src/abstract/alpaca.js +11 -0
  32. package/js/src/src/abstract/apex.d.ts +34 -0
  33. package/js/src/src/abstract/apex.js +11 -0
  34. package/js/src/src/abstract/arzinja.d.ts +8 -0
  35. package/js/src/src/abstract/arzinja.js +11 -0
  36. package/js/src/src/abstract/arzplus.d.ts +11 -0
  37. package/js/src/src/abstract/arzplus.js +11 -0
  38. package/js/src/src/abstract/ascendex.d.ts +80 -0
  39. package/js/src/src/abstract/ascendex.js +11 -0
  40. package/js/src/src/abstract/asretether.d.ts +8 -0
  41. package/js/src/src/abstract/asretether.js +11 -0
  42. package/js/src/src/abstract/bidarz.d.ts +9 -0
  43. package/js/src/src/abstract/bidarz.js +11 -0
  44. package/js/src/src/abstract/bigone.d.ts +48 -0
  45. package/js/src/src/abstract/bigone.js +11 -0
  46. package/js/src/src/abstract/binance.d.ts +773 -0
  47. package/js/src/src/abstract/binance.js +11 -0
  48. package/js/src/src/abstract/bingx.d.ts +165 -0
  49. package/js/src/src/abstract/bingx.js +11 -0
  50. package/js/src/src/abstract/bit24.d.ts +9 -0
  51. package/js/src/src/abstract/bit24.js +11 -0
  52. package/js/src/src/abstract/bit2c.d.ts +30 -0
  53. package/js/src/src/abstract/bit2c.js +11 -0
  54. package/js/src/src/abstract/bitbank.d.ts +35 -0
  55. package/js/src/src/abstract/bitbank.js +11 -0
  56. package/js/src/src/abstract/bitbarg.d.ts +8 -0
  57. package/js/src/src/abstract/bitbarg.js +11 -0
  58. package/js/src/src/abstract/bitbns.d.ts +43 -0
  59. package/js/src/src/abstract/bitbns.js +11 -0
  60. package/js/src/src/abstract/bitfinex.d.ts +143 -0
  61. package/js/src/src/abstract/bitfinex.js +11 -0
  62. package/js/src/src/abstract/bitflyer.d.ts +42 -0
  63. package/js/src/src/abstract/bitflyer.js +11 -0
  64. package/js/src/src/abstract/bitget.d.ts +578 -0
  65. package/js/src/src/abstract/bitget.js +11 -0
  66. package/js/src/src/abstract/bithumb.d.ts +35 -0
  67. package/js/src/src/abstract/bithumb.js +11 -0
  68. package/js/src/src/abstract/bitimen.d.ts +10 -0
  69. package/js/src/src/abstract/bitimen.js +11 -0
  70. package/js/src/src/abstract/bitir.d.ts +10 -0
  71. package/js/src/src/abstract/bitir.js +11 -0
  72. package/js/src/src/abstract/bitmart.d.ts +120 -0
  73. package/js/src/src/abstract/bitmart.js +11 -0
  74. package/js/src/src/abstract/bitmex.d.ts +100 -0
  75. package/js/src/src/abstract/bitmex.js +11 -0
  76. package/js/src/src/abstract/bitopro.d.ts +33 -0
  77. package/js/src/src/abstract/bitopro.js +11 -0
  78. package/js/src/src/abstract/bitpin.d.ts +11 -0
  79. package/js/src/src/abstract/bitpin.js +11 -0
  80. package/js/src/src/abstract/bitrue.d.ts +75 -0
  81. package/js/src/src/abstract/bitrue.js +11 -0
  82. package/js/src/src/abstract/bitso.d.ts +46 -0
  83. package/js/src/src/abstract/bitso.js +11 -0
  84. package/js/src/src/abstract/bitstamp.d.ts +262 -0
  85. package/js/src/src/abstract/bitstamp.js +11 -0
  86. package/js/src/src/abstract/bitteam.d.ts +32 -0
  87. package/js/src/src/abstract/bitteam.js +11 -0
  88. package/js/src/src/abstract/bittrade.d.ts +117 -0
  89. package/js/src/src/abstract/bittrade.js +11 -0
  90. package/js/src/src/abstract/bitunix.d.ts +9 -0
  91. package/js/src/src/abstract/bitunix.js +11 -0
  92. package/js/src/src/abstract/bitvavo.d.ts +30 -0
  93. package/js/src/src/abstract/bitvavo.js +11 -0
  94. package/js/src/src/abstract/blockchaincom.d.ts +31 -0
  95. package/js/src/src/abstract/blockchaincom.js +11 -0
  96. package/js/src/src/abstract/blofin.d.ts +70 -0
  97. package/js/src/src/abstract/blofin.js +11 -0
  98. package/js/src/src/abstract/btcalpha.d.ts +21 -0
  99. package/js/src/src/abstract/btcalpha.js +11 -0
  100. package/js/src/src/abstract/btcbox.d.ts +18 -0
  101. package/js/src/src/abstract/btcbox.js +11 -0
  102. package/js/src/src/abstract/btcmarkets.d.ts +42 -0
  103. package/js/src/src/abstract/btcmarkets.js +11 -0
  104. package/js/src/src/abstract/btcturk.d.ts +23 -0
  105. package/js/src/src/abstract/btcturk.js +11 -0
  106. package/js/src/src/abstract/bybit.d.ts +316 -0
  107. package/js/src/src/abstract/bybit.js +11 -0
  108. package/js/src/src/abstract/bydfi.d.ts +11 -0
  109. package/js/src/src/abstract/bydfi.js +11 -0
  110. package/js/src/src/abstract/cafearz.d.ts +8 -0
  111. package/js/src/src/abstract/cafearz.js +11 -0
  112. package/js/src/src/abstract/cex.d.ts +35 -0
  113. package/js/src/src/abstract/cex.js +11 -0
  114. package/js/src/src/abstract/coinbase.d.ts +97 -0
  115. package/js/src/src/abstract/coinbase.js +11 -0
  116. package/js/src/src/abstract/coinbaseexchange.d.ts +71 -0
  117. package/js/src/src/abstract/coinbaseexchange.js +11 -0
  118. package/js/src/src/abstract/coinbaseinternational.d.ts +42 -0
  119. package/js/src/src/abstract/coinbaseinternational.js +11 -0
  120. package/js/src/src/abstract/coincatch.d.ts +97 -0
  121. package/js/src/src/abstract/coincatch.js +11 -0
  122. package/js/src/src/abstract/coincheck.d.ts +36 -0
  123. package/js/src/src/abstract/coincheck.js +11 -0
  124. package/js/src/src/abstract/coinex.d.ts +240 -0
  125. package/js/src/src/abstract/coinex.js +11 -0
  126. package/js/src/src/abstract/coinmate.d.ts +65 -0
  127. package/js/src/src/abstract/coinmate.js +11 -0
  128. package/js/src/src/abstract/coinmetro.d.ts +37 -0
  129. package/js/src/src/abstract/coinmetro.js +11 -0
  130. package/js/src/src/abstract/coinone.d.ts +70 -0
  131. package/js/src/src/abstract/coinone.js +11 -0
  132. package/js/src/src/abstract/coinsph.d.ts +57 -0
  133. package/js/src/src/abstract/coinsph.js +11 -0
  134. package/js/src/src/abstract/coinspot.d.ts +31 -0
  135. package/js/src/src/abstract/coinspot.js +11 -0
  136. package/js/src/src/abstract/cryptocom.d.ts +126 -0
  137. package/js/src/src/abstract/cryptocom.js +11 -0
  138. package/js/src/src/abstract/cryptomus.d.ts +23 -0
  139. package/js/src/src/abstract/cryptomus.js +11 -0
  140. package/js/src/src/abstract/defx.d.ts +72 -0
  141. package/js/src/src/abstract/defx.js +11 -0
  142. package/js/src/src/abstract/delta.d.ts +53 -0
  143. package/js/src/src/abstract/delta.js +11 -0
  144. package/js/src/src/abstract/deribit.d.ts +129 -0
  145. package/js/src/src/abstract/deribit.js +11 -0
  146. package/js/src/src/abstract/derive.d.ts +120 -0
  147. package/js/src/src/abstract/derive.js +11 -0
  148. package/js/src/src/abstract/digifinex.d.ts +95 -0
  149. package/js/src/src/abstract/digifinex.js +11 -0
  150. package/js/src/src/abstract/ellipx.d.ts +28 -0
  151. package/js/src/src/abstract/ellipx.js +11 -0
  152. package/js/src/src/abstract/eterex.d.ts +8 -0
  153. package/js/src/src/abstract/eterex.js +11 -0
  154. package/js/src/src/abstract/excoino.d.ts +10 -0
  155. package/js/src/src/abstract/excoino.js +11 -0
  156. package/js/src/src/abstract/exir.d.ts +11 -0
  157. package/js/src/src/abstract/exir.js +11 -0
  158. package/js/src/src/abstract/exmo.d.ts +58 -0
  159. package/js/src/src/abstract/exmo.js +11 -0
  160. package/js/src/src/abstract/exnovin.d.ts +9 -0
  161. package/js/src/src/abstract/exnovin.js +11 -0
  162. package/js/src/src/abstract/farhadexchange.d.ts +8 -0
  163. package/js/src/src/abstract/farhadexchange.js +11 -0
  164. package/js/src/src/abstract/foxbit.d.ts +29 -0
  165. package/js/src/src/abstract/foxbit.js +11 -0
  166. package/js/src/src/abstract/gate.d.ts +287 -0
  167. package/js/src/src/abstract/gate.js +11 -0
  168. package/js/src/src/abstract/gemini.d.ts +62 -0
  169. package/js/src/src/abstract/gemini.js +11 -0
  170. package/js/src/src/abstract/hamtapay.d.ts +9 -0
  171. package/js/src/src/abstract/hamtapay.js +11 -0
  172. package/js/src/src/abstract/hashkey.d.ts +70 -0
  173. package/js/src/src/abstract/hashkey.js +11 -0
  174. package/js/src/src/abstract/hibachi.d.ts +29 -0
  175. package/js/src/src/abstract/hibachi.js +11 -0
  176. package/js/src/src/abstract/hitbtc.d.ts +118 -0
  177. package/js/src/src/abstract/hitbtc.js +11 -0
  178. package/js/src/src/abstract/hitobit.d.ts +11 -0
  179. package/js/src/src/abstract/hitobit.js +11 -0
  180. package/js/src/src/abstract/hollaex.d.ts +36 -0
  181. package/js/src/src/abstract/hollaex.js +11 -0
  182. package/js/src/src/abstract/htx.d.ts +551 -0
  183. package/js/src/src/abstract/htx.js +11 -0
  184. package/js/src/src/abstract/hyperliquid.d.ts +9 -0
  185. package/js/src/src/abstract/hyperliquid.js +11 -0
  186. package/js/src/src/abstract/independentreserve.d.ts +46 -0
  187. package/js/src/src/abstract/independentreserve.js +11 -0
  188. package/js/src/src/abstract/indodax.d.ts +29 -0
  189. package/js/src/src/abstract/indodax.js +11 -0
  190. package/js/src/src/abstract/iranexchange.d.ts +9 -0
  191. package/js/src/src/abstract/iranexchange.js +11 -0
  192. package/js/src/src/abstract/jibitex.d.ts +10 -0
  193. package/js/src/src/abstract/jibitex.js +11 -0
  194. package/js/src/src/abstract/kcex.d.ts +10 -0
  195. package/js/src/src/abstract/kcex.js +11 -0
  196. package/js/src/src/abstract/kifpoolme.d.ts +9 -0
  197. package/js/src/src/abstract/kifpoolme.js +11 -0
  198. package/js/src/src/abstract/kraken.d.ts +61 -0
  199. package/js/src/src/abstract/kraken.js +11 -0
  200. package/js/src/src/abstract/krakenfutures.d.ts +45 -0
  201. package/js/src/src/abstract/krakenfutures.js +11 -0
  202. package/js/src/src/abstract/kucoin.d.ts +227 -0
  203. package/js/src/src/abstract/kucoin.js +11 -0
  204. package/js/src/src/abstract/kucoinfutures.d.ts +254 -0
  205. package/js/src/src/abstract/kucoinfutures.js +11 -0
  206. package/js/src/src/abstract/latoken.d.ts +59 -0
  207. package/js/src/src/abstract/latoken.js +11 -0
  208. package/js/src/src/abstract/lbank.d.ts +65 -0
  209. package/js/src/src/abstract/lbank.js +11 -0
  210. package/js/src/src/abstract/luno.d.ts +41 -0
  211. package/js/src/src/abstract/luno.js +11 -0
  212. package/js/src/src/abstract/mazdax.d.ts +11 -0
  213. package/js/src/src/abstract/mazdax.js +11 -0
  214. package/js/src/src/abstract/mercado.d.ts +28 -0
  215. package/js/src/src/abstract/mercado.js +11 -0
  216. package/js/src/src/abstract/mexc.d.ts +183 -0
  217. package/js/src/src/abstract/mexc.js +11 -0
  218. package/js/src/src/abstract/modetrade.d.ts +122 -0
  219. package/js/src/src/abstract/modetrade.js +11 -0
  220. package/js/src/src/abstract/ndax.d.ts +100 -0
  221. package/js/src/src/abstract/ndax.js +11 -0
  222. package/js/src/src/abstract/nobitex.d.ts +10 -0
  223. package/js/src/src/abstract/nobitex.js +11 -0
  224. package/js/src/src/abstract/novadax.d.ts +32 -0
  225. package/js/src/src/abstract/novadax.js +11 -0
  226. package/js/src/src/abstract/oceanex.d.ts +30 -0
  227. package/js/src/src/abstract/oceanex.js +11 -0
  228. package/js/src/src/abstract/okcoin.d.ts +77 -0
  229. package/js/src/src/abstract/okcoin.js +11 -0
  230. package/js/src/src/abstract/okexchange.d.ts +11 -0
  231. package/js/src/src/abstract/okexchange.js +11 -0
  232. package/js/src/src/abstract/okx.d.ts +352 -0
  233. package/js/src/src/abstract/okx.js +11 -0
  234. package/js/src/src/abstract/ompfinex.d.ts +10 -0
  235. package/js/src/src/abstract/ompfinex.js +11 -0
  236. package/js/src/src/abstract/onetrading.d.ts +26 -0
  237. package/js/src/src/abstract/onetrading.js +11 -0
  238. package/js/src/src/abstract/oxfun.d.ts +37 -0
  239. package/js/src/src/abstract/oxfun.js +11 -0
  240. package/js/src/src/abstract/p2b.d.ts +25 -0
  241. package/js/src/src/abstract/p2b.js +11 -0
  242. package/js/src/src/abstract/paradex.d.ts +66 -0
  243. package/js/src/src/abstract/paradex.js +11 -0
  244. package/js/src/src/abstract/paymium.d.ts +31 -0
  245. package/js/src/src/abstract/paymium.js +11 -0
  246. package/js/src/src/abstract/phemex.d.ts +120 -0
  247. package/js/src/src/abstract/phemex.js +11 -0
  248. package/js/src/src/abstract/pingi.d.ts +9 -0
  249. package/js/src/src/abstract/pingi.js +11 -0
  250. package/js/src/src/abstract/poloniex.d.ts +108 -0
  251. package/js/src/src/abstract/poloniex.js +11 -0
  252. package/js/src/src/abstract/pooleno.d.ts +8 -0
  253. package/js/src/src/abstract/pooleno.js +11 -0
  254. package/js/src/src/abstract/probit.d.ts +26 -0
  255. package/js/src/src/abstract/probit.js +11 -0
  256. package/js/src/src/abstract/raastin.d.ts +11 -0
  257. package/js/src/src/abstract/raastin.js +11 -0
  258. package/js/src/src/abstract/ramzinex.d.ts +10 -0
  259. package/js/src/src/abstract/ramzinex.js +11 -0
  260. package/js/src/src/abstract/sarmayex.d.ts +8 -0
  261. package/js/src/src/abstract/sarmayex.js +11 -0
  262. package/js/src/src/abstract/sarrafex.d.ts +10 -0
  263. package/js/src/src/abstract/sarrafex.js +11 -0
  264. package/js/src/src/abstract/tabdeal.d.ts +10 -0
  265. package/js/src/src/abstract/tabdeal.js +11 -0
  266. package/js/src/src/abstract/tehran_exchange.d.ts +9 -0
  267. package/js/src/src/abstract/tehran_exchange.js +11 -0
  268. package/js/src/src/abstract/tetherland.d.ts +8 -0
  269. package/js/src/src/abstract/tetherland.js +11 -0
  270. package/js/src/src/abstract/timex.d.ts +65 -0
  271. package/js/src/src/abstract/timex.js +11 -0
  272. package/js/src/src/abstract/tokocrypto.d.ts +40 -0
  273. package/js/src/src/abstract/tokocrypto.js +11 -0
  274. package/js/src/src/abstract/toobit.d.ts +10 -0
  275. package/js/src/src/abstract/toobit.js +11 -0
  276. package/js/src/src/abstract/tradeogre.d.ts +21 -0
  277. package/js/src/src/abstract/tradeogre.js +11 -0
  278. package/js/src/src/abstract/twox.d.ts +8 -0
  279. package/js/src/src/abstract/twox.js +11 -0
  280. package/js/src/src/abstract/ubitex.d.ts +10 -0
  281. package/js/src/src/abstract/ubitex.js +11 -0
  282. package/js/src/src/abstract/upbit.d.ts +58 -0
  283. package/js/src/src/abstract/upbit.js +11 -0
  284. package/js/src/src/abstract/vertex.d.ts +22 -0
  285. package/js/src/src/abstract/vertex.js +11 -0
  286. package/js/src/src/abstract/wallex.d.ts +11 -0
  287. package/js/src/src/abstract/wallex.js +11 -0
  288. package/js/src/src/abstract/wavesexchange.d.ts +157 -0
  289. package/js/src/src/abstract/wavesexchange.js +11 -0
  290. package/js/src/src/abstract/whitebit.d.ts +117 -0
  291. package/js/src/src/abstract/whitebit.js +11 -0
  292. package/js/src/src/abstract/woo.d.ts +144 -0
  293. package/js/src/src/abstract/woo.js +11 -0
  294. package/js/src/src/abstract/woofipro.d.ts +122 -0
  295. package/js/src/src/abstract/woofipro.js +11 -0
  296. package/js/src/src/abstract/xt.d.ts +160 -0
  297. package/js/src/src/abstract/xt.js +11 -0
  298. package/js/src/src/abstract/yobit.d.ts +19 -0
  299. package/js/src/src/abstract/yobit.js +11 -0
  300. package/js/src/src/abstract/zaif.d.ts +41 -0
  301. package/js/src/src/abstract/zaif.js +11 -0
  302. package/js/src/src/abstract/zonda.d.ts +56 -0
  303. package/js/src/src/abstract/zonda.js +11 -0
  304. package/js/src/src/afratether.d.ts +21 -0
  305. package/js/src/src/afratether.js +356 -0
  306. package/js/src/src/alpaca.d.ts +332 -0
  307. package/js/src/src/alpaca.js +1908 -0
  308. package/js/src/src/apex.d.ts +333 -0
  309. package/js/src/src/apex.js +1942 -0
  310. package/js/src/src/arzinja.d.ts +21 -0
  311. package/js/src/src/arzinja.js +298 -0
  312. package/js/src/src/arzplus.d.ts +26 -0
  313. package/js/src/src/arzplus.js +581 -0
  314. package/js/src/src/ascendex.d.ts +424 -0
  315. package/js/src/src/ascendex.js +3699 -0
  316. package/js/src/src/asretether.d.ts +21 -0
  317. package/js/src/src/asretether.js +324 -0
  318. package/js/src/src/base/Exchange.d.ts +926 -0
  319. package/js/src/src/base/Exchange.js +7399 -0
  320. package/js/src/src/base/Precise.d.ts +42 -0
  321. package/js/src/src/base/Precise.js +275 -0
  322. package/js/src/src/base/errors.d.ts +168 -0
  323. package/js/src/src/base/errors.js +255 -0
  324. package/js/src/src/base/functions/crypto.d.ts +16 -0
  325. package/js/src/src/base/functions/crypto.js +131 -0
  326. package/js/src/src/base/functions/encode.d.ts +4 -0
  327. package/js/src/src/base/functions/encode.js +32 -0
  328. package/js/src/src/base/functions/generic.d.ts +29 -0
  329. package/js/src/src/base/functions/generic.js +203 -0
  330. package/js/src/src/base/functions/misc.d.ts +9 -0
  331. package/js/src/src/base/functions/misc.js +101 -0
  332. package/js/src/src/base/functions/number.d.ts +27 -0
  333. package/js/src/src/base/functions/number.js +313 -0
  334. package/js/src/src/base/functions/platform.d.ts +7 -0
  335. package/js/src/src/base/functions/platform.js +27 -0
  336. package/js/src/src/base/functions/rsa.d.ts +5 -0
  337. package/js/src/src/base/functions/rsa.js +49 -0
  338. package/js/src/src/base/functions/string.d.ts +7 -0
  339. package/js/src/src/base/functions/string.js +44 -0
  340. package/js/src/src/base/functions/throttle.d.ts +6 -0
  341. package/js/src/src/base/functions/throttle.js +67 -0
  342. package/js/src/src/base/functions/time.d.ts +21 -0
  343. package/js/src/src/base/functions/time.js +171 -0
  344. package/js/src/src/base/functions/totp.d.ts +3 -0
  345. package/js/src/src/base/functions/totp.js +25 -0
  346. package/js/src/src/base/functions/type.d.ts +37 -0
  347. package/js/src/src/base/functions/type.js +179 -0
  348. package/js/src/src/base/functions.d.ts +10 -0
  349. package/js/src/src/base/functions.js +18 -0
  350. package/js/src/src/base/types.d.ts +586 -0
  351. package/js/src/src/base/types.js +7 -0
  352. package/js/src/src/base/ws/Cache.d.ts +27 -0
  353. package/js/src/src/base/ws/Cache.js +260 -0
  354. package/js/src/src/base/ws/Client.d.ts +53 -0
  355. package/js/src/src/base/ws/Client.js +307 -0
  356. package/js/src/src/base/ws/Future.d.ts +8 -0
  357. package/js/src/src/base/ws/Future.js +35 -0
  358. package/js/src/src/base/ws/OrderBook.d.ts +25 -0
  359. package/js/src/src/base/ws/OrderBook.js +130 -0
  360. package/js/src/src/base/ws/OrderBookSide.d.ts +40 -0
  361. package/js/src/src/base/ws/OrderBookSide.js +286 -0
  362. package/js/src/src/base/ws/WsClient.d.ts +11 -0
  363. package/js/src/src/base/ws/WsClient.js +69 -0
  364. package/js/src/src/bequant.d.ts +4 -0
  365. package/js/src/src/bequant.js +35 -0
  366. package/js/src/src/bidarz.d.ts +16 -0
  367. package/js/src/src/bidarz.js +327 -0
  368. package/js/src/src/bigone.d.ts +296 -0
  369. package/js/src/src/bigone.js +2340 -0
  370. package/js/src/src/binance.d.ts +1667 -0
  371. package/js/src/src/binance.js +14400 -0
  372. package/js/src/src/binancecoinm.d.ts +6 -0
  373. package/js/src/src/binancecoinm.js +51 -0
  374. package/js/src/src/binanceus.d.ts +4 -0
  375. package/js/src/src/binanceus.js +225 -0
  376. package/js/src/src/binanceusdm.d.ts +6 -0
  377. package/js/src/src/binanceusdm.js +63 -0
  378. package/js/src/src/bingx.d.ts +778 -0
  379. package/js/src/src/bingx.js +6705 -0
  380. package/js/src/src/bit24.d.ts +24 -0
  381. package/js/src/src/bit24.js +520 -0
  382. package/js/src/src/bit2c.d.ts +146 -0
  383. package/js/src/src/bit2c.js +1029 -0
  384. package/js/src/src/bitbank.d.ts +181 -0
  385. package/js/src/src/bitbank.js +1146 -0
  386. package/js/src/src/bitbarg.d.ts +21 -0
  387. package/js/src/src/bitbarg.js +312 -0
  388. package/js/src/src/bitbns.d.ts +184 -0
  389. package/js/src/src/bitbns.js +1288 -0
  390. package/js/src/src/bitfinex.d.ts +516 -0
  391. package/js/src/src/bitfinex.js +3951 -0
  392. package/js/src/src/bitflyer.d.ts +229 -0
  393. package/js/src/src/bitflyer.js +1209 -0
  394. package/js/src/src/bitget.d.ts +1109 -0
  395. package/js/src/src/bitget.js +11033 -0
  396. package/js/src/src/bithumb.d.ts +165 -0
  397. package/js/src/src/bithumb.js +1257 -0
  398. package/js/src/src/bitimen.d.ts +23 -0
  399. package/js/src/src/bitimen.js +424 -0
  400. package/js/src/src/bitir.d.ts +23 -0
  401. package/js/src/src/bitir.js +521 -0
  402. package/js/src/src/bitmart.d.ts +736 -0
  403. package/js/src/src/bitmart.js +5639 -0
  404. package/js/src/src/bitmex.d.ts +395 -0
  405. package/js/src/src/bitmex.js +3088 -0
  406. package/js/src/src/bitopro.d.ts +295 -0
  407. package/js/src/src/bitopro.js +1892 -0
  408. package/js/src/src/bitpin.d.ts +23 -0
  409. package/js/src/src/bitpin.js +487 -0
  410. package/js/src/src/bitrue.d.ts +384 -0
  411. package/js/src/src/bitrue.js +3382 -0
  412. package/js/src/src/bitso.d.ts +270 -0
  413. package/js/src/src/bitso.js +1881 -0
  414. package/js/src/src/bitstamp.d.ts +355 -0
  415. package/js/src/src/bitstamp.js +2445 -0
  416. package/js/src/src/bitteam.d.ts +229 -0
  417. package/js/src/src/bitteam.js +2420 -0
  418. package/js/src/src/bittrade.d.ts +298 -0
  419. package/js/src/src/bittrade.js +2050 -0
  420. package/js/src/src/bitunix.d.ts +21 -0
  421. package/js/src/src/bitunix.js +326 -0
  422. package/js/src/src/bitvavo.d.ts +311 -0
  423. package/js/src/src/bitvavo.js +2204 -0
  424. package/js/src/src/blockchaincom.d.ts +256 -0
  425. package/js/src/src/blockchaincom.js +1259 -0
  426. package/js/src/src/blofin.d.ts +439 -0
  427. package/js/src/src/blofin.js +2576 -0
  428. package/js/src/src/btcalpha.d.ts +209 -0
  429. package/js/src/src/btcalpha.js +1056 -0
  430. package/js/src/src/btcbox.d.ts +144 -0
  431. package/js/src/src/btcbox.js +834 -0
  432. package/js/src/src/btcmarkets.d.ts +253 -0
  433. package/js/src/src/btcmarkets.js +1418 -0
  434. package/js/src/src/btcturk.d.ts +161 -0
  435. package/js/src/src/btcturk.js +1058 -0
  436. package/js/src/src/bybit.d.ts +1097 -0
  437. package/js/src/src/bybit.js +9382 -0
  438. package/js/src/src/bydfi.d.ts +23 -0
  439. package/js/src/src/bydfi.js +434 -0
  440. package/js/src/src/cafearz.d.ts +21 -0
  441. package/js/src/src/cafearz.js +346 -0
  442. package/js/src/src/cex.d.ts +286 -0
  443. package/js/src/src/cex.js +1799 -0
  444. package/js/src/src/coinbase.d.ts +623 -0
  445. package/js/src/src/coinbase.js +5220 -0
  446. package/js/src/src/coinbaseadvanced.d.ts +4 -0
  447. package/js/src/src/coinbaseadvanced.js +18 -0
  448. package/js/src/src/coinbaseexchange.d.ts +334 -0
  449. package/js/src/src/coinbaseexchange.js +2127 -0
  450. package/js/src/src/coinbaseinternational.d.ts +443 -0
  451. package/js/src/src/coinbaseinternational.js +2336 -0
  452. package/js/src/src/coincatch.d.ts +786 -0
  453. package/js/src/src/coincatch.js +5492 -0
  454. package/js/src/src/coincheck.d.ts +147 -0
  455. package/js/src/src/coincheck.js +962 -0
  456. package/js/src/src/coinex.d.ts +719 -0
  457. package/js/src/src/coinex.js +6166 -0
  458. package/js/src/src/coinmate.d.ts +202 -0
  459. package/js/src/src/coinmate.js +1215 -0
  460. package/js/src/src/coinmetro.d.ts +244 -0
  461. package/js/src/src/coinmetro.js +2024 -0
  462. package/js/src/src/coinone.d.ts +158 -0
  463. package/js/src/src/coinone.js +1278 -0
  464. package/js/src/src/coinsph.d.ts +310 -0
  465. package/js/src/src/coinsph.js +2203 -0
  466. package/js/src/src/coinspot.d.ts +108 -0
  467. package/js/src/src/coinspot.js +653 -0
  468. package/js/src/src/cryptocom.d.ts +463 -0
  469. package/js/src/src/cryptocom.js +3549 -0
  470. package/js/src/src/cryptomus.d.ts +158 -0
  471. package/js/src/src/cryptomus.js +1169 -0
  472. package/js/src/src/defx.d.ts +348 -0
  473. package/js/src/src/defx.js +2139 -0
  474. package/js/src/src/delta.d.ts +407 -0
  475. package/js/src/src/delta.js +3654 -0
  476. package/js/src/src/deribit.d.ts +516 -0
  477. package/js/src/src/deribit.js +3790 -0
  478. package/js/src/src/derive.d.ts +324 -0
  479. package/js/src/src/derive.js +2655 -0
  480. package/js/src/src/digifinex.d.ts +544 -0
  481. package/js/src/src/digifinex.js +4453 -0
  482. package/js/src/src/ellipx.d.ts +237 -0
  483. package/js/src/src/ellipx.js +2071 -0
  484. package/js/src/src/eterex.d.ts +21 -0
  485. package/js/src/src/eterex.js +299 -0
  486. package/js/src/src/excoino.d.ts +23 -0
  487. package/js/src/src/excoino.js +426 -0
  488. package/js/src/src/exir.d.ts +23 -0
  489. package/js/src/src/exir.js +403 -0
  490. package/js/src/src/exmo.d.ts +426 -0
  491. package/js/src/src/exmo.js +2825 -0
  492. package/js/src/src/exnovin.d.ts +22 -0
  493. package/js/src/src/exnovin.js +378 -0
  494. package/js/src/src/farhadexchange.d.ts +21 -0
  495. package/js/src/src/farhadexchange.js +280 -0
  496. package/js/src/src/fmfwio.d.ts +4 -0
  497. package/js/src/src/fmfwio.js +35 -0
  498. package/js/src/src/foxbit.d.ts +352 -0
  499. package/js/src/src/foxbit.js +2016 -0
  500. package/js/src/src/gate.d.ts +1071 -0
  501. package/js/src/src/gate.js +8282 -0
  502. package/js/src/src/gateio.d.ts +4 -0
  503. package/js/src/src/gateio.js +17 -0
  504. package/js/src/src/gemini.d.ts +257 -0
  505. package/js/src/src/gemini.js +2006 -0
  506. package/js/src/src/hamtapay.d.ts +21 -0
  507. package/js/src/src/hamtapay.js +303 -0
  508. package/js/src/src/hashkey.d.ts +628 -0
  509. package/js/src/src/hashkey.js +4363 -0
  510. package/js/src/src/hibachi.d.ts +346 -0
  511. package/js/src/src/hibachi.js +2137 -0
  512. package/js/src/src/hitbtc.d.ts +558 -0
  513. package/js/src/src/hitbtc.js +3847 -0
  514. package/js/src/src/hitobit.d.ts +23 -0
  515. package/js/src/src/hitobit.js +412 -0
  516. package/js/src/src/hollaex.d.ts +305 -0
  517. package/js/src/src/hollaex.js +2046 -0
  518. package/js/src/src/htx.d.ts +961 -0
  519. package/js/src/src/htx.js +9668 -0
  520. package/js/src/src/huobi.d.ts +4 -0
  521. package/js/src/src/huobi.js +17 -0
  522. package/js/src/src/hyperliquid.d.ts +651 -0
  523. package/js/src/src/hyperliquid.js +3937 -0
  524. package/js/src/src/independentreserve.d.ts +169 -0
  525. package/js/src/src/independentreserve.js +1115 -0
  526. package/js/src/src/indodax.d.ts +217 -0
  527. package/js/src/src/indodax.js +1454 -0
  528. package/js/src/src/iranexchange.d.ts +21 -0
  529. package/js/src/src/iranexchange.js +399 -0
  530. package/js/src/src/jibitex.d.ts +23 -0
  531. package/js/src/src/jibitex.js +416 -0
  532. package/js/src/src/kcex.d.ts +21 -0
  533. package/js/src/src/kcex.js +335 -0
  534. package/js/src/src/kifpoolme.d.ts +23 -0
  535. package/js/src/src/kifpoolme.js +410 -0
  536. package/js/src/src/kraken.d.ts +484 -0
  537. package/js/src/src/kraken.js +3518 -0
  538. package/js/src/src/krakenfutures.d.ts +362 -0
  539. package/js/src/src/krakenfutures.js +2885 -0
  540. package/js/src/src/kucoin.d.ts +759 -0
  541. package/js/src/src/kucoin.js +5153 -0
  542. package/js/src/src/kucoinfutures.d.ts +521 -0
  543. package/js/src/src/kucoinfutures.js +3381 -0
  544. package/js/src/src/latoken.d.ts +274 -0
  545. package/js/src/src/latoken.js +1824 -0
  546. package/js/src/src/lbank.d.ts +350 -0
  547. package/js/src/src/lbank.js +3146 -0
  548. package/js/src/src/luno.d.ts +252 -0
  549. package/js/src/src/luno.js +1479 -0
  550. package/js/src/src/mazdax.d.ts +23 -0
  551. package/js/src/src/mazdax.js +534 -0
  552. package/js/src/src/mercado.d.ts +160 -0
  553. package/js/src/src/mercado.js +1011 -0
  554. package/js/src/src/mexc.d.ts +768 -0
  555. package/js/src/src/mexc.js +6102 -0
  556. package/js/src/src/modetrade.d.ts +496 -0
  557. package/js/src/src/modetrade.js +2936 -0
  558. package/js/src/src/myokx.d.ts +4 -0
  559. package/js/src/src/myokx.js +54 -0
  560. package/js/src/src/ndax.d.ts +285 -0
  561. package/js/src/src/ndax.js +2598 -0
  562. package/js/src/src/nobitex.d.ts +23 -0
  563. package/js/src/src/nobitex.js +454 -0
  564. package/js/src/src/novadax.d.ts +279 -0
  565. package/js/src/src/novadax.js +1676 -0
  566. package/js/src/src/oceanex.d.ts +231 -0
  567. package/js/src/src/oceanex.js +1123 -0
  568. package/js/src/src/okcoin.d.ts +346 -0
  569. package/js/src/src/okcoin.js +3211 -0
  570. package/js/src/src/okexchange.d.ts +23 -0
  571. package/js/src/src/okexchange.js +373 -0
  572. package/js/src/src/okx.d.ts +1125 -0
  573. package/js/src/src/okx.js +9009 -0
  574. package/js/src/src/okxus.d.ts +4 -0
  575. package/js/src/src/okxus.js +54 -0
  576. package/js/src/src/ompfinex.d.ts +23 -0
  577. package/js/src/src/ompfinex.js +510 -0
  578. package/js/src/src/onetrading.d.ts +228 -0
  579. package/js/src/src/onetrading.js +1769 -0
  580. package/js/src/src/oxfun.d.ts +442 -0
  581. package/js/src/src/oxfun.js +2920 -0
  582. package/js/src/src/p2b.d.ts +189 -0
  583. package/js/src/src/p2b.js +1344 -0
  584. package/js/src/src/paradex.d.ts +389 -0
  585. package/js/src/src/paradex.js +2607 -0
  586. package/js/src/src/paymium.d.ts +133 -0
  587. package/js/src/src/paymium.js +644 -0
  588. package/js/src/src/phemex.d.ts +497 -0
  589. package/js/src/src/phemex.js +5333 -0
  590. package/js/src/src/pingi.d.ts +22 -0
  591. package/js/src/src/pingi.js +446 -0
  592. package/js/src/src/poloniex.d.ts +441 -0
  593. package/js/src/src/poloniex.js +3681 -0
  594. package/js/src/src/pooleno.d.ts +21 -0
  595. package/js/src/src/pooleno.js +347 -0
  596. package/js/src/src/pro/alpaca.d.ts +95 -0
  597. package/js/src/src/pro/alpaca.js +724 -0
  598. package/js/src/src/pro/apex.d.ts +160 -0
  599. package/js/src/src/pro/apex.js +1044 -0
  600. package/js/src/src/pro/ascendex.d.ts +99 -0
  601. package/js/src/src/pro/ascendex.js +1012 -0
  602. package/js/src/src/pro/bequant.d.ts +4 -0
  603. package/js/src/src/pro/bequant.js +42 -0
  604. package/js/src/src/pro/binance.d.ts +796 -0
  605. package/js/src/src/pro/binance.js +4373 -0
  606. package/js/src/src/pro/binancecoinm.d.ts +4 -0
  607. package/js/src/src/pro/binancecoinm.js +32 -0
  608. package/js/src/src/pro/binanceus.d.ts +4 -0
  609. package/js/src/src/pro/binanceus.js +52 -0
  610. package/js/src/src/pro/binanceusdm.d.ts +4 -0
  611. package/js/src/src/pro/binanceusdm.js +37 -0
  612. package/js/src/src/pro/bingx.d.ts +151 -0
  613. package/js/src/src/pro/bingx.js +1568 -0
  614. package/js/src/src/pro/bitfinex.d.ts +99 -0
  615. package/js/src/src/pro/bitfinex.js +1165 -0
  616. package/js/src/src/pro/bitget.d.ts +257 -0
  617. package/js/src/src/pro/bitget.js +2327 -0
  618. package/js/src/src/pro/bithumb.d.ts +59 -0
  619. package/js/src/src/pro/bithumb.js +395 -0
  620. package/js/src/src/pro/bitmart.d.ts +168 -0
  621. package/js/src/src/pro/bitmart.js +1686 -0
  622. package/js/src/src/pro/bitmex.d.ts +170 -0
  623. package/js/src/src/pro/bitmex.js +1760 -0
  624. package/js/src/src/pro/bitopro.d.ts +69 -0
  625. package/js/src/src/pro/bitopro.js +477 -0
  626. package/js/src/src/pro/bitrue.d.ts +40 -0
  627. package/js/src/src/pro/bitrue.js +461 -0
  628. package/js/src/src/pro/bitstamp.d.ts +53 -0
  629. package/js/src/src/pro/bitstamp.js +587 -0
  630. package/js/src/src/pro/bittrade.d.ts +66 -0
  631. package/js/src/src/pro/bittrade.js +606 -0
  632. package/js/src/src/pro/bitvavo.d.ts +321 -0
  633. package/js/src/src/pro/bitvavo.js +1451 -0
  634. package/js/src/src/pro/blockchaincom.d.ts +89 -0
  635. package/js/src/src/pro/blockchaincom.js +777 -0
  636. package/js/src/src/pro/blofin.d.ts +174 -0
  637. package/js/src/src/pro/blofin.js +743 -0
  638. package/js/src/src/pro/bybit.d.ts +397 -0
  639. package/js/src/src/pro/bybit.js +2519 -0
  640. package/js/src/src/pro/cex.d.ts +220 -0
  641. package/js/src/src/pro/cex.js +1535 -0
  642. package/js/src/src/pro/coinbase.d.ts +119 -0
  643. package/js/src/src/pro/coinbase.js +736 -0
  644. package/js/src/src/pro/coinbaseadvanced.d.ts +4 -0
  645. package/js/src/src/pro/coinbaseadvanced.js +18 -0
  646. package/js/src/src/pro/coinbaseexchange.d.ts +133 -0
  647. package/js/src/src/pro/coinbaseexchange.js +969 -0
  648. package/js/src/src/pro/coinbaseinternational.d.ts +143 -0
  649. package/js/src/src/pro/coinbaseinternational.js +804 -0
  650. package/js/src/src/pro/coincatch.d.ts +207 -0
  651. package/js/src/src/pro/coincatch.js +1562 -0
  652. package/js/src/src/pro/coincheck.d.ts +33 -0
  653. package/js/src/src/pro/coincheck.js +210 -0
  654. package/js/src/src/pro/coinex.d.ts +147 -0
  655. package/js/src/src/pro/coinex.js +1426 -0
  656. package/js/src/src/pro/coinone.d.ts +51 -0
  657. package/js/src/src/pro/coinone.js +413 -0
  658. package/js/src/src/pro/cryptocom.d.ts +300 -0
  659. package/js/src/src/pro/cryptocom.js +1414 -0
  660. package/js/src/src/pro/defx.d.ts +236 -0
  661. package/js/src/src/pro/defx.js +865 -0
  662. package/js/src/src/pro/deribit.d.ts +163 -0
  663. package/js/src/src/pro/deribit.js +1066 -0
  664. package/js/src/src/pro/derive.d.ts +100 -0
  665. package/js/src/src/pro/derive.js +753 -0
  666. package/js/src/src/pro/exmo.d.ts +97 -0
  667. package/js/src/src/pro/exmo.js +903 -0
  668. package/js/src/src/pro/gate.d.ts +360 -0
  669. package/js/src/src/pro/gate.js +2119 -0
  670. package/js/src/src/pro/gateio.d.ts +4 -0
  671. package/js/src/src/pro/gateio.js +17 -0
  672. package/js/src/src/pro/gemini.d.ts +106 -0
  673. package/js/src/src/pro/gemini.js +932 -0
  674. package/js/src/src/pro/hashkey.d.ts +121 -0
  675. package/js/src/src/pro/hashkey.js +843 -0
  676. package/js/src/src/pro/hitbtc.d.ts +235 -0
  677. package/js/src/src/pro/hitbtc.js +1400 -0
  678. package/js/src/src/pro/hollaex.d.ts +77 -0
  679. package/js/src/src/pro/hollaex.js +604 -0
  680. package/js/src/src/pro/htx.d.ts +141 -0
  681. package/js/src/src/pro/htx.js +2415 -0
  682. package/js/src/src/pro/huobi.d.ts +4 -0
  683. package/js/src/src/pro/huobi.js +17 -0
  684. package/js/src/src/pro/hyperliquid.d.ts +218 -0
  685. package/js/src/src/pro/hyperliquid.js +1126 -0
  686. package/js/src/src/pro/independentreserve.d.ts +36 -0
  687. package/js/src/src/pro/independentreserve.js +287 -0
  688. package/js/src/src/pro/kraken.d.ts +233 -0
  689. package/js/src/src/pro/kraken.js +1785 -0
  690. package/js/src/src/pro/krakenfutures.d.ts +178 -0
  691. package/js/src/src/pro/krakenfutures.js +1592 -0
  692. package/js/src/src/pro/kucoin.d.ts +221 -0
  693. package/js/src/src/pro/kucoin.js +1430 -0
  694. package/js/src/src/pro/kucoinfutures.d.ts +205 -0
  695. package/js/src/src/pro/kucoinfutures.js +1295 -0
  696. package/js/src/src/pro/lbank.d.ts +134 -0
  697. package/js/src/src/pro/lbank.js +950 -0
  698. package/js/src/src/pro/luno.d.ts +44 -0
  699. package/js/src/src/pro/luno.js +322 -0
  700. package/js/src/src/pro/mexc.d.ts +210 -0
  701. package/js/src/src/pro/mexc.js +2009 -0
  702. package/js/src/src/pro/modetrade.d.ts +155 -0
  703. package/js/src/src/pro/modetrade.js +1335 -0
  704. package/js/src/src/pro/myokx.d.ts +4 -0
  705. package/js/src/src/pro/myokx.js +39 -0
  706. package/js/src/src/pro/ndax.d.ts +60 -0
  707. package/js/src/src/pro/ndax.js +545 -0
  708. package/js/src/src/pro/okcoin.d.ts +91 -0
  709. package/js/src/src/pro/okcoin.js +763 -0
  710. package/js/src/src/pro/okx.d.ts +408 -0
  711. package/js/src/src/pro/okx.js +2479 -0
  712. package/js/src/src/pro/okxus.d.ts +4 -0
  713. package/js/src/src/pro/okxus.js +39 -0
  714. package/js/src/src/pro/onetrading.d.ts +107 -0
  715. package/js/src/src/pro/onetrading.js +1343 -0
  716. package/js/src/src/pro/oxfun.d.ts +234 -0
  717. package/js/src/src/pro/oxfun.js +1112 -0
  718. package/js/src/src/pro/p2b.d.ts +104 -0
  719. package/js/src/src/pro/p2b.js +506 -0
  720. package/js/src/src/pro/paradex.d.ts +54 -0
  721. package/js/src/src/pro/paradex.js +370 -0
  722. package/js/src/src/pro/phemex.d.ts +129 -0
  723. package/js/src/src/pro/phemex.js +1569 -0
  724. package/js/src/src/pro/poloniex.d.ts +214 -0
  725. package/js/src/src/pro/poloniex.js +1318 -0
  726. package/js/src/src/pro/probit.d.ts +91 -0
  727. package/js/src/src/pro/probit.js +593 -0
  728. package/js/src/src/pro/tradeogre.d.ts +49 -0
  729. package/js/src/src/pro/tradeogre.js +284 -0
  730. package/js/src/src/pro/upbit.d.ts +124 -0
  731. package/js/src/src/pro/upbit.js +689 -0
  732. package/js/src/src/pro/vertex.d.ts +104 -0
  733. package/js/src/src/pro/vertex.js +999 -0
  734. package/js/src/src/pro/whitebit.d.ts +123 -0
  735. package/js/src/src/pro/whitebit.js +971 -0
  736. package/js/src/src/pro/woo.d.ts +161 -0
  737. package/js/src/src/pro/woo.js +1351 -0
  738. package/js/src/src/pro/woofipro.d.ts +155 -0
  739. package/js/src/src/pro/woofipro.js +1335 -0
  740. package/js/src/src/pro/xt.d.ts +165 -0
  741. package/js/src/src/pro/xt.js +1230 -0
  742. package/js/src/src/probit.d.ts +283 -0
  743. package/js/src/src/probit.js +1935 -0
  744. package/js/src/src/protobuf/mexc/compiled.cjs +7186 -0
  745. package/js/src/src/protobuf/mexc/compiled.d.cts +8 -0
  746. package/js/src/src/raastin.d.ts +24 -0
  747. package/js/src/src/raastin.js +494 -0
  748. package/js/src/src/ramzinex.d.ts +23 -0
  749. package/js/src/src/ramzinex.js +510 -0
  750. package/js/src/src/sarmayex.d.ts +21 -0
  751. package/js/src/src/sarmayex.js +376 -0
  752. package/js/src/src/sarrafex.d.ts +23 -0
  753. package/js/src/src/sarrafex.js +501 -0
  754. package/js/src/src/static_dependencies/ethers/abi-coder.d.ts +50 -0
  755. package/js/src/src/static_dependencies/ethers/abi-coder.js +148 -0
  756. package/js/src/src/static_dependencies/ethers/address/address.d.ts +55 -0
  757. package/js/src/src/static_dependencies/ethers/address/address.js +162 -0
  758. package/js/src/src/static_dependencies/ethers/address/checks.d.ts +80 -0
  759. package/js/src/src/static_dependencies/ethers/address/checks.js +119 -0
  760. package/js/src/src/static_dependencies/ethers/address/contract-address.d.ts +47 -0
  761. package/js/src/src/static_dependencies/ethers/address/contract-address.js +73 -0
  762. package/js/src/src/static_dependencies/ethers/address/index.d.ts +48 -0
  763. package/js/src/src/static_dependencies/ethers/address/index.js +24 -0
  764. package/js/src/src/static_dependencies/ethers/bytes32.d.ts +14 -0
  765. package/js/src/src/static_dependencies/ethers/bytes32.js +45 -0
  766. package/js/src/src/static_dependencies/ethers/coders/abstract-coder.d.ts +120 -0
  767. package/js/src/src/static_dependencies/ethers/coders/abstract-coder.js +424 -0
  768. package/js/src/src/static_dependencies/ethers/coders/address.d.ts +12 -0
  769. package/js/src/src/static_dependencies/ethers/coders/address.js +34 -0
  770. package/js/src/src/static_dependencies/ethers/coders/anonymous.d.ts +14 -0
  771. package/js/src/src/static_dependencies/ethers/coders/anonymous.js +27 -0
  772. package/js/src/src/static_dependencies/ethers/coders/array.d.ts +24 -0
  773. package/js/src/src/static_dependencies/ethers/coders/array.js +162 -0
  774. package/js/src/src/static_dependencies/ethers/coders/boolean.d.ts +12 -0
  775. package/js/src/src/static_dependencies/ethers/coders/boolean.js +26 -0
  776. package/js/src/src/static_dependencies/ethers/coders/bytes.d.ts +18 -0
  777. package/js/src/src/static_dependencies/ethers/coders/bytes.js +39 -0
  778. package/js/src/src/static_dependencies/ethers/coders/fixed-bytes.d.ts +14 -0
  779. package/js/src/src/static_dependencies/ethers/coders/fixed-bytes.js +32 -0
  780. package/js/src/src/static_dependencies/ethers/coders/null.d.ts +11 -0
  781. package/js/src/src/static_dependencies/ethers/coders/null.js +29 -0
  782. package/js/src/src/static_dependencies/ethers/coders/number.d.ts +15 -0
  783. package/js/src/src/static_dependencies/ethers/coders/number.js +48 -0
  784. package/js/src/src/static_dependencies/ethers/coders/string.d.ts +12 -0
  785. package/js/src/src/static_dependencies/ethers/coders/string.js +26 -0
  786. package/js/src/src/static_dependencies/ethers/coders/tuple.d.ts +15 -0
  787. package/js/src/src/static_dependencies/ethers/coders/tuple.js +67 -0
  788. package/js/src/src/static_dependencies/ethers/fragments.d.ts +458 -0
  789. package/js/src/src/static_dependencies/ethers/fragments.js +1252 -0
  790. package/js/src/src/static_dependencies/ethers/hash/index.d.ts +10 -0
  791. package/js/src/src/static_dependencies/ethers/hash/index.js +15 -0
  792. package/js/src/src/static_dependencies/ethers/hash/solidity.d.ts +30 -0
  793. package/js/src/src/static_dependencies/ethers/hash/solidity.js +107 -0
  794. package/js/src/src/static_dependencies/ethers/hash/typed-data.d.ts +144 -0
  795. package/js/src/src/static_dependencies/ethers/hash/typed-data.js +490 -0
  796. package/js/src/src/static_dependencies/ethers/index.d.ts +19 -0
  797. package/js/src/src/static_dependencies/ethers/index.js +22 -0
  798. package/js/src/src/static_dependencies/ethers/interface.d.ts +380 -0
  799. package/js/src/src/static_dependencies/ethers/interface.js +990 -0
  800. package/js/src/src/static_dependencies/ethers/typed.d.ts +569 -0
  801. package/js/src/src/static_dependencies/ethers/typed.js +608 -0
  802. package/js/src/src/static_dependencies/ethers/utils/base58.d.ts +22 -0
  803. package/js/src/src/static_dependencies/ethers/utils/base58.js +68 -0
  804. package/js/src/src/static_dependencies/ethers/utils/base64.d.ts +39 -0
  805. package/js/src/src/static_dependencies/ethers/utils/base64.js +58 -0
  806. package/js/src/src/static_dependencies/ethers/utils/data.d.ts +92 -0
  807. package/js/src/src/static_dependencies/ethers/utils/data.js +175 -0
  808. package/js/src/src/static_dependencies/ethers/utils/errors.d.ts +509 -0
  809. package/js/src/src/static_dependencies/ethers/utils/errors.js +227 -0
  810. package/js/src/src/static_dependencies/ethers/utils/events.d.ts +76 -0
  811. package/js/src/src/static_dependencies/ethers/utils/events.js +52 -0
  812. package/js/src/src/static_dependencies/ethers/utils/fixednumber.d.ts +251 -0
  813. package/js/src/src/static_dependencies/ethers/utils/fixednumber.js +529 -0
  814. package/js/src/src/static_dependencies/ethers/utils/index.d.ts +30 -0
  815. package/js/src/src/static_dependencies/ethers/utils/index.js +38 -0
  816. package/js/src/src/static_dependencies/ethers/utils/maths.d.ts +65 -0
  817. package/js/src/src/static_dependencies/ethers/utils/maths.js +220 -0
  818. package/js/src/src/static_dependencies/ethers/utils/properties.d.ts +22 -0
  819. package/js/src/src/static_dependencies/ethers/utils/properties.js +59 -0
  820. package/js/src/src/static_dependencies/ethers/utils/rlp-decode.d.ts +5 -0
  821. package/js/src/src/static_dependencies/ethers/utils/rlp-decode.js +84 -0
  822. package/js/src/src/static_dependencies/ethers/utils/rlp-encode.d.ts +5 -0
  823. package/js/src/src/static_dependencies/ethers/utils/rlp-encode.js +54 -0
  824. package/js/src/src/static_dependencies/ethers/utils/rlp.d.ts +16 -0
  825. package/js/src/src/static_dependencies/ethers/utils/rlp.js +14 -0
  826. package/js/src/src/static_dependencies/ethers/utils/units.d.ts +23 -0
  827. package/js/src/src/static_dependencies/ethers/utils/units.js +88 -0
  828. package/js/src/src/static_dependencies/ethers/utils/utf8.d.ts +95 -0
  829. package/js/src/src/static_dependencies/ethers/utils/utf8.js +225 -0
  830. package/js/src/src/static_dependencies/ethers/utils/uuid.d.ts +7 -0
  831. package/js/src/src/static_dependencies/ethers/utils/uuid.js +35 -0
  832. package/js/src/src/static_dependencies/fflake/browser.d.ts +222 -0
  833. package/js/src/src/static_dependencies/fflake/browser.js +2578 -0
  834. package/js/src/src/static_dependencies/jsencrypt/JSEncrypt.d.ts +116 -0
  835. package/js/src/src/static_dependencies/jsencrypt/JSEncrypt.js +194 -0
  836. package/js/src/src/static_dependencies/jsencrypt/JSEncryptRSAKey.d.ts +142 -0
  837. package/js/src/src/static_dependencies/jsencrypt/JSEncryptRSAKey.js +307 -0
  838. package/js/src/src/static_dependencies/jsencrypt/lib/asn1js/asn1.d.ts +51 -0
  839. package/js/src/src/static_dependencies/jsencrypt/lib/asn1js/asn1.js +565 -0
  840. package/js/src/src/static_dependencies/jsencrypt/lib/asn1js/base64.d.ts +5 -0
  841. package/js/src/src/static_dependencies/jsencrypt/lib/asn1js/base64.js +94 -0
  842. package/js/src/src/static_dependencies/jsencrypt/lib/asn1js/hex.d.ts +3 -0
  843. package/js/src/src/static_dependencies/jsencrypt/lib/asn1js/hex.js +70 -0
  844. package/js/src/src/static_dependencies/jsencrypt/lib/asn1js/int10.d.ts +9 -0
  845. package/js/src/src/static_dependencies/jsencrypt/lib/asn1js/int10.js +91 -0
  846. package/js/src/src/static_dependencies/jsencrypt/lib/jsbn/base64.d.ts +3 -0
  847. package/js/src/src/static_dependencies/jsencrypt/lib/jsbn/base64.js +25 -0
  848. package/js/src/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +101 -0
  849. package/js/src/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.js +1757 -0
  850. package/js/src/src/static_dependencies/jsencrypt/lib/jsbn/prng4.d.ts +10 -0
  851. package/js/src/src/static_dependencies/jsencrypt/lib/jsbn/prng4.js +50 -0
  852. package/js/src/src/static_dependencies/jsencrypt/lib/jsbn/rng.d.ts +3 -0
  853. package/js/src/src/static_dependencies/jsencrypt/lib/jsbn/rng.js +80 -0
  854. package/js/src/src/static_dependencies/jsencrypt/lib/jsbn/rsa.d.ts +23 -0
  855. package/js/src/src/static_dependencies/jsencrypt/lib/jsbn/rsa.js +377 -0
  856. package/js/src/src/static_dependencies/jsencrypt/lib/jsbn/util.d.ts +7 -0
  857. package/js/src/src/static_dependencies/jsencrypt/lib/jsbn/util.js +64 -0
  858. package/js/src/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.d.ts +24 -0
  859. package/js/src/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +1627 -0
  860. package/js/src/src/static_dependencies/noble-curves/_shortw_utils.d.ts +60 -0
  861. package/js/src/src/static_dependencies/noble-curves/_shortw_utils.js +22 -0
  862. package/js/src/src/static_dependencies/noble-curves/abstract/curve.d.ts +67 -0
  863. package/js/src/src/static_dependencies/noble-curves/abstract/curve.js +157 -0
  864. package/js/src/src/static_dependencies/noble-curves/abstract/edwards.d.ts +79 -0
  865. package/js/src/src/static_dependencies/noble-curves/abstract/edwards.js +432 -0
  866. package/js/src/src/static_dependencies/noble-curves/abstract/hash-to-curve.d.ts +56 -0
  867. package/js/src/src/static_dependencies/noble-curves/abstract/hash-to-curve.js +171 -0
  868. package/js/src/src/static_dependencies/noble-curves/abstract/modular.d.ts +68 -0
  869. package/js/src/src/static_dependencies/noble-curves/abstract/modular.js +351 -0
  870. package/js/src/src/static_dependencies/noble-curves/abstract/montgomery.d.ts +25 -0
  871. package/js/src/src/static_dependencies/noble-curves/abstract/montgomery.js +162 -0
  872. package/js/src/src/static_dependencies/noble-curves/abstract/poseidon.d.ts +29 -0
  873. package/js/src/src/static_dependencies/noble-curves/abstract/poseidon.js +115 -0
  874. package/js/src/src/static_dependencies/noble-curves/abstract/utils.d.ts +53 -0
  875. package/js/src/src/static_dependencies/noble-curves/abstract/utils.js +227 -0
  876. package/js/src/src/static_dependencies/noble-curves/abstract/weierstrass.d.ts +204 -0
  877. package/js/src/src/static_dependencies/noble-curves/abstract/weierstrass.js +1016 -0
  878. package/js/src/src/static_dependencies/noble-curves/ed25519.d.ts +53 -0
  879. package/js/src/src/static_dependencies/noble-curves/ed25519.js +402 -0
  880. package/js/src/src/static_dependencies/noble-curves/p256.d.ts +103 -0
  881. package/js/src/src/static_dependencies/noble-curves/p256.js +47 -0
  882. package/js/src/src/static_dependencies/noble-curves/secp256k1.d.ts +91 -0
  883. package/js/src/src/static_dependencies/noble-curves/secp256k1.js +257 -0
  884. package/js/src/src/static_dependencies/noble-hashes/_assert.d.ts +21 -0
  885. package/js/src/src/static_dependencies/noble-hashes/_assert.js +48 -0
  886. package/js/src/src/static_dependencies/noble-hashes/_sha2.d.ts +23 -0
  887. package/js/src/src/static_dependencies/noble-hashes/_sha2.js +119 -0
  888. package/js/src/src/static_dependencies/noble-hashes/_u64.d.ts +35 -0
  889. package/js/src/src/static_dependencies/noble-hashes/_u64.js +66 -0
  890. package/js/src/src/static_dependencies/noble-hashes/crypto.d.ts +1 -0
  891. package/js/src/src/static_dependencies/noble-hashes/crypto.js +7 -0
  892. package/js/src/src/static_dependencies/noble-hashes/hmac.d.ts +26 -0
  893. package/js/src/src/static_dependencies/noble-hashes/hmac.js +82 -0
  894. package/js/src/src/static_dependencies/noble-hashes/md5.d.ts +18 -0
  895. package/js/src/src/static_dependencies/noble-hashes/md5.js +242 -0
  896. package/js/src/src/static_dependencies/noble-hashes/sha1.d.ts +21 -0
  897. package/js/src/src/static_dependencies/noble-hashes/sha1.js +90 -0
  898. package/js/src/src/static_dependencies/noble-hashes/sha256.d.ts +34 -0
  899. package/js/src/src/static_dependencies/noble-hashes/sha256.js +129 -0
  900. package/js/src/src/static_dependencies/noble-hashes/sha3.d.ts +97 -0
  901. package/js/src/src/static_dependencies/noble-hashes/sha3.js +211 -0
  902. package/js/src/src/static_dependencies/noble-hashes/sha512.d.ts +66 -0
  903. package/js/src/src/static_dependencies/noble-hashes/sha512.js +236 -0
  904. package/js/src/src/static_dependencies/noble-hashes/utils.d.ts +77 -0
  905. package/js/src/src/static_dependencies/noble-hashes/utils.js +147 -0
  906. package/js/src/src/static_dependencies/proxies/agent-base/helpers.d.ts +14 -0
  907. package/js/src/src/static_dependencies/proxies/agent-base/helpers.js +42 -0
  908. package/js/src/src/static_dependencies/proxies/agent-base/index.d.ts +33 -0
  909. package/js/src/src/static_dependencies/proxies/agent-base/index.js +82 -0
  910. package/js/src/src/static_dependencies/proxies/http-proxy-agent/index.d.ts +40 -0
  911. package/js/src/src/static_dependencies/proxies/http-proxy-agent/index.js +119 -0
  912. package/js/src/src/static_dependencies/proxies/https-proxy-agent/index.d.ts +45 -0
  913. package/js/src/src/static_dependencies/proxies/https-proxy-agent/index.js +150 -0
  914. package/js/src/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.d.ts +15 -0
  915. package/js/src/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.js +95 -0
  916. package/js/src/src/static_dependencies/qs/formats.cjs +22 -0
  917. package/js/src/src/static_dependencies/qs/formats.d.cts +14 -0
  918. package/js/src/src/static_dependencies/qs/index.cjs +15 -0
  919. package/js/src/src/static_dependencies/qs/index.d.cts +10 -0
  920. package/js/src/src/static_dependencies/qs/parse.cjs +208 -0
  921. package/js/src/src/static_dependencies/qs/parse.d.cts +8 -0
  922. package/js/src/src/static_dependencies/qs/stringify.cjs +192 -0
  923. package/js/src/src/static_dependencies/qs/stringify.d.cts +8 -0
  924. package/js/src/src/static_dependencies/qs/utils.cjs +202 -0
  925. package/js/src/src/static_dependencies/qs/utils.d.cts +15 -0
  926. package/js/src/src/static_dependencies/scure-base/index.d.ts +92 -0
  927. package/js/src/src/static_dependencies/scure-base/index.js +420 -0
  928. package/js/src/src/static_dependencies/scure-starknet/index.d.ts +79 -0
  929. package/js/src/src/static_dependencies/scure-starknet/index.js +323 -0
  930. package/js/src/src/static_dependencies/starknet/constants.d.ts +61 -0
  931. package/js/src/src/static_dependencies/starknet/constants.js +67 -0
  932. package/js/src/src/static_dependencies/starknet/index.d.ts +3 -0
  933. package/js/src/src/static_dependencies/starknet/index.js +9 -0
  934. package/js/src/src/static_dependencies/starknet/types/cairoEnum.d.ts +2 -0
  935. package/js/src/src/static_dependencies/starknet/types/cairoEnum.js +7 -0
  936. package/js/src/src/static_dependencies/starknet/types/calldata.d.ts +19 -0
  937. package/js/src/src/static_dependencies/starknet/types/calldata.js +28 -0
  938. package/js/src/src/static_dependencies/starknet/types/index.d.ts +13 -0
  939. package/js/src/src/static_dependencies/starknet/types/index.js +16 -0
  940. package/js/src/src/static_dependencies/starknet/types/lib/contract/abi.d.ts +71 -0
  941. package/js/src/src/static_dependencies/starknet/types/lib/contract/abi.js +13 -0
  942. package/js/src/src/static_dependencies/starknet/types/lib/contract/index.d.ts +24 -0
  943. package/js/src/src/static_dependencies/starknet/types/lib/contract/index.js +16 -0
  944. package/js/src/src/static_dependencies/starknet/types/lib/contract/legacy.d.ts +33 -0
  945. package/js/src/src/static_dependencies/starknet/types/lib/contract/legacy.js +7 -0
  946. package/js/src/src/static_dependencies/starknet/types/lib/contract/sierra.d.ts +52 -0
  947. package/js/src/src/static_dependencies/starknet/types/lib/contract/sierra.js +7 -0
  948. package/js/src/src/static_dependencies/starknet/types/lib/index.d.ts +248 -0
  949. package/js/src/src/static_dependencies/starknet/types/lib/index.js +52 -0
  950. package/js/src/src/static_dependencies/starknet/types/typedData.d.ts +44 -0
  951. package/js/src/src/static_dependencies/starknet/types/typedData.js +19 -0
  952. package/js/src/src/static_dependencies/starknet/utils/assert.d.ts +7 -0
  953. package/js/src/src/static_dependencies/starknet/utils/assert.js +17 -0
  954. package/js/src/src/static_dependencies/starknet/utils/cairoDataTypes/felt.d.ts +6 -0
  955. package/js/src/src/static_dependencies/starknet/utils/cairoDataTypes/felt.js +43 -0
  956. package/js/src/src/static_dependencies/starknet/utils/cairoDataTypes/uint256.d.ts +72 -0
  957. package/js/src/src/static_dependencies/starknet/utils/cairoDataTypes/uint256.js +117 -0
  958. package/js/src/src/static_dependencies/starknet/utils/cairoDataTypes/uint512.d.ts +76 -0
  959. package/js/src/src/static_dependencies/starknet/utils/cairoDataTypes/uint512.js +136 -0
  960. package/js/src/src/static_dependencies/starknet/utils/calldata/byteArray.d.ts +32 -0
  961. package/js/src/src/static_dependencies/starknet/utils/calldata/byteArray.js +59 -0
  962. package/js/src/src/static_dependencies/starknet/utils/calldata/cairo.d.ts +183 -0
  963. package/js/src/src/static_dependencies/starknet/utils/calldata/cairo.js +229 -0
  964. package/js/src/src/static_dependencies/starknet/utils/calldata/enum/CairoCustomEnum.d.ts +38 -0
  965. package/js/src/src/static_dependencies/starknet/utils/calldata/enum/CairoCustomEnum.js +57 -0
  966. package/js/src/src/static_dependencies/starknet/utils/calldata/enum/CairoOption.d.ts +35 -0
  967. package/js/src/src/static_dependencies/starknet/utils/calldata/enum/CairoOption.js +64 -0
  968. package/js/src/src/static_dependencies/starknet/utils/calldata/enum/CairoResult.d.ts +34 -0
  969. package/js/src/src/static_dependencies/starknet/utils/calldata/enum/CairoResult.js +63 -0
  970. package/js/src/src/static_dependencies/starknet/utils/calldata/enum/index.d.ts +3 -0
  971. package/js/src/src/static_dependencies/starknet/utils/calldata/enum/index.js +9 -0
  972. package/js/src/src/static_dependencies/starknet/utils/calldata/formatter.d.ts +9 -0
  973. package/js/src/src/static_dependencies/starknet/utils/calldata/formatter.js +67 -0
  974. package/js/src/src/static_dependencies/starknet/utils/calldata/index.d.ts +89 -0
  975. package/js/src/src/static_dependencies/starknet/utils/calldata/index.js +280 -0
  976. package/js/src/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +5 -0
  977. package/js/src/src/static_dependencies/starknet/utils/calldata/parser/index.js +30 -0
  978. package/js/src/src/static_dependencies/starknet/utils/calldata/parser/interface.d.ts +20 -0
  979. package/js/src/src/static_dependencies/starknet/utils/calldata/parser/interface.js +8 -0
  980. package/js/src/src/static_dependencies/starknet/utils/calldata/parser/parser-0-1.1.0.d.ts +24 -0
  981. package/js/src/src/static_dependencies/starknet/utils/calldata/parser/parser-0-1.1.0.js +36 -0
  982. package/js/src/src/static_dependencies/starknet/utils/calldata/parser/parser-2.0.0.d.ts +23 -0
  983. package/js/src/src/static_dependencies/starknet/utils/calldata/parser/parser-2.0.0.js +40 -0
  984. package/js/src/src/static_dependencies/starknet/utils/calldata/propertyOrder.d.ts +2 -0
  985. package/js/src/src/static_dependencies/starknet/utils/calldata/propertyOrder.js +155 -0
  986. package/js/src/src/static_dependencies/starknet/utils/calldata/requestParser.d.ts +11 -0
  987. package/js/src/src/static_dependencies/starknet/utils/calldata/requestParser.js +248 -0
  988. package/js/src/src/static_dependencies/starknet/utils/calldata/responseParser.d.ts +11 -0
  989. package/js/src/src/static_dependencies/starknet/utils/calldata/responseParser.js +214 -0
  990. package/js/src/src/static_dependencies/starknet/utils/calldata/tuple.d.ts +6 -0
  991. package/js/src/src/static_dependencies/starknet/utils/calldata/tuple.js +113 -0
  992. package/js/src/src/static_dependencies/starknet/utils/calldata/validate.d.ts +6 -0
  993. package/js/src/src/static_dependencies/starknet/utils/calldata/validate.js +208 -0
  994. package/js/src/src/static_dependencies/starknet/utils/encode.d.ts +207 -0
  995. package/js/src/src/static_dependencies/starknet/utils/encode.js +282 -0
  996. package/js/src/src/static_dependencies/starknet/utils/hash/classHash.d.ts +57 -0
  997. package/js/src/src/static_dependencies/starknet/utils/hash/classHash.js +223 -0
  998. package/js/src/src/static_dependencies/starknet/utils/hash/index.d.ts +6 -0
  999. package/js/src/src/static_dependencies/starknet/utils/hash/index.js +13 -0
  1000. package/js/src/src/static_dependencies/starknet/utils/merkle.d.ts +35 -0
  1001. package/js/src/src/static_dependencies/starknet/utils/merkle.js +84 -0
  1002. package/js/src/src/static_dependencies/starknet/utils/num.d.ts +182 -0
  1003. package/js/src/src/static_dependencies/starknet/utils/num.js +244 -0
  1004. package/js/src/src/static_dependencies/starknet/utils/selector.d.ts +48 -0
  1005. package/js/src/src/static_dependencies/starknet/utils/selector.js +85 -0
  1006. package/js/src/src/static_dependencies/starknet/utils/shortString.d.ts +57 -0
  1007. package/js/src/src/static_dependencies/starknet/utils/shortString.js +96 -0
  1008. package/js/src/src/static_dependencies/starknet/utils/typedData.d.ts +54 -0
  1009. package/js/src/src/static_dependencies/starknet/utils/typedData.js +321 -0
  1010. package/js/src/src/static_dependencies/watchable/src/types.d.ts +28 -0
  1011. package/js/src/src/static_dependencies/watchable/src/types.js +8 -0
  1012. package/js/src/src/static_dependencies/watchable/src/unpromise.d.ts +120 -0
  1013. package/js/src/src/static_dependencies/watchable/src/unpromise.js +297 -0
  1014. package/js/src/src/static_dependencies/zklink/zklink-sdk-web.d.ts +1279 -0
  1015. package/js/src/src/static_dependencies/zklink/zklink-sdk-web.js +4282 -0
  1016. package/js/src/src/tabdeal.d.ts +23 -0
  1017. package/js/src/src/tabdeal.js +387 -0
  1018. package/js/src/src/tehran_exchange.d.ts +21 -0
  1019. package/js/src/src/tehran_exchange.js +333 -0
  1020. package/js/src/src/tetherland.d.ts +21 -0
  1021. package/js/src/src/tetherland.js +367 -0
  1022. package/js/src/src/timex.d.ts +247 -0
  1023. package/js/src/src/timex.js +1792 -0
  1024. package/js/src/src/tokocrypto.d.ts +261 -0
  1025. package/js/src/src/tokocrypto.js +2641 -0
  1026. package/js/src/src/toobit.d.ts +22 -0
  1027. package/js/src/src/toobit.js +445 -0
  1028. package/js/src/src/tradeogre.d.ts +149 -0
  1029. package/js/src/src/tradeogre.js +878 -0
  1030. package/js/src/src/twox.d.ts +21 -0
  1031. package/js/src/src/twox.js +371 -0
  1032. package/js/src/src/ubitex.d.ts +23 -0
  1033. package/js/src/src/ubitex.js +433 -0
  1034. package/js/src/src/upbit.d.ts +377 -0
  1035. package/js/src/src/upbit.js +2340 -0
  1036. package/js/src/src/vertex.d.ts +346 -0
  1037. package/js/src/src/vertex.js +3146 -0
  1038. package/js/src/src/wallex.d.ts +23 -0
  1039. package/js/src/src/wallex.js +467 -0
  1040. package/js/src/src/wavesexchange.d.ts +244 -0
  1041. package/js/src/src/wavesexchange.js +2747 -0
  1042. package/js/src/src/whitebit.d.ts +571 -0
  1043. package/js/src/src/whitebit.js +3437 -0
  1044. package/js/src/src/woo.d.ts +727 -0
  1045. package/js/src/src/woo.js +4183 -0
  1046. package/js/src/src/woofipro.d.ts +497 -0
  1047. package/js/src/src/woofipro.js +2941 -0
  1048. package/js/src/src/xt.d.ts +568 -0
  1049. package/js/src/src/xt.js +5184 -0
  1050. package/js/src/src/yobit.d.ts +197 -0
  1051. package/js/src/src/yobit.js +1453 -0
  1052. package/js/src/src/zaif.d.ts +136 -0
  1053. package/js/src/src/zaif.js +821 -0
  1054. package/js/src/src/zonda.d.ts +214 -0
  1055. package/js/src/src/zonda.js +1984 -0
  1056. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
  1057. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +1 -1
  1058. package/js/test.js +9 -17
  1059. package/package.json +1 -1
@@ -0,0 +1,4183 @@
1
+ // ----------------------------------------------------------------------------
2
+
3
+ // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
+ // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
+ // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
+
7
+ // ---------------------------------------------------------------------------
8
+ import Exchange from './abstract/woo.js';
9
+ import { AuthenticationError, RateLimitExceeded, BadRequest, OperationFailed, ExchangeError, InvalidOrder, ArgumentsRequired, NotSupported, OnMaintenance } from './base/errors.js';
10
+ import { Precise } from './base/Precise.js';
11
+ import { TICK_SIZE } from './base/functions/number.js';
12
+ import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
13
+ // ---------------------------------------------------------------------------
14
+ /**
15
+ * @class woo
16
+ * @augments Exchange
17
+ */
18
+ export default class woo extends Exchange {
19
+ describe() {
20
+ return this.deepExtend(super.describe(), {
21
+ 'id': 'woo',
22
+ 'name': 'WOO X',
23
+ 'countries': ['KY'],
24
+ 'rateLimit': 100,
25
+ 'version': 'v1',
26
+ 'certified': true,
27
+ 'pro': true,
28
+ 'hostname': 'woox.io',
29
+ 'has': {
30
+ 'CORS': undefined,
31
+ 'spot': true,
32
+ 'margin': true,
33
+ 'swap': true,
34
+ 'future': false,
35
+ 'option': false,
36
+ 'addMargin': true,
37
+ 'cancelAllOrders': true,
38
+ 'cancelAllOrdersAfter': true,
39
+ 'cancelOrder': true,
40
+ 'cancelWithdraw': false,
41
+ 'closeAllPositions': false,
42
+ 'closePosition': false,
43
+ 'createConvertTrade': true,
44
+ 'createDepositAddress': false,
45
+ 'createMarketBuyOrderWithCost': true,
46
+ 'createMarketOrder': false,
47
+ 'createMarketOrderWithCost': false,
48
+ 'createMarketSellOrderWithCost': true,
49
+ 'createOrder': true,
50
+ 'createOrderWithTakeProfitAndStopLoss': true,
51
+ 'createReduceOnlyOrder': true,
52
+ 'createStopLimitOrder': false,
53
+ 'createStopLossOrder': true,
54
+ 'createStopMarketOrder': false,
55
+ 'createStopOrder': false,
56
+ 'createTakeProfitOrder': true,
57
+ 'createTrailingAmountOrder': true,
58
+ 'createTrailingPercentOrder': true,
59
+ 'createTriggerOrder': true,
60
+ 'fetchAccounts': true,
61
+ 'fetchBalance': true,
62
+ 'fetchCanceledOrders': false,
63
+ 'fetchClosedOrder': false,
64
+ 'fetchClosedOrders': true,
65
+ 'fetchConvertCurrencies': true,
66
+ 'fetchConvertQuote': true,
67
+ 'fetchConvertTrade': true,
68
+ 'fetchConvertTradeHistory': true,
69
+ 'fetchCurrencies': true,
70
+ 'fetchDepositAddress': true,
71
+ 'fetchDepositAddresses': false,
72
+ 'fetchDepositAddressesByNetwork': false,
73
+ 'fetchDeposits': true,
74
+ 'fetchDepositsWithdrawals': true,
75
+ 'fetchFundingHistory': true,
76
+ 'fetchFundingInterval': true,
77
+ 'fetchFundingIntervals': false,
78
+ 'fetchFundingRate': true,
79
+ 'fetchFundingRateHistory': true,
80
+ 'fetchFundingRates': true,
81
+ 'fetchIndexOHLCV': false,
82
+ 'fetchLedger': true,
83
+ 'fetchLeverage': true,
84
+ 'fetchMarginAdjustmentHistory': false,
85
+ 'fetchMarginMode': false,
86
+ 'fetchMarkets': true,
87
+ 'fetchMarkOHLCV': false,
88
+ 'fetchMyTrades': true,
89
+ 'fetchOHLCV': true,
90
+ 'fetchOpenInterestHistory': false,
91
+ 'fetchOpenOrder': false,
92
+ 'fetchOpenOrders': true,
93
+ 'fetchOrder': true,
94
+ 'fetchOrderBook': true,
95
+ 'fetchOrders': true,
96
+ 'fetchOrderTrades': true,
97
+ 'fetchPosition': true,
98
+ 'fetchPositionHistory': false,
99
+ 'fetchPositionMode': false,
100
+ 'fetchPositions': true,
101
+ 'fetchPositionsHistory': false,
102
+ 'fetchPremiumIndexOHLCV': false,
103
+ 'fetchStatus': true,
104
+ 'fetchTicker': false,
105
+ 'fetchTickers': false,
106
+ 'fetchTime': true,
107
+ 'fetchTrades': true,
108
+ 'fetchTradingFee': true,
109
+ 'fetchTradingFees': true,
110
+ 'fetchTransactions': 'emulated',
111
+ 'fetchTransfers': true,
112
+ 'fetchWithdrawals': true,
113
+ 'reduceMargin': false,
114
+ 'sandbox': true,
115
+ 'setLeverage': true,
116
+ 'setMargin': false,
117
+ 'setPositionMode': true,
118
+ 'transfer': true,
119
+ 'withdraw': true, // exchange have that endpoint disabled atm, but was once implemented in ccxt per old docs: https://docx.woo.io/wootrade-documents/#token-withdraw
120
+ },
121
+ 'timeframes': {
122
+ '1m': '1m',
123
+ '5m': '5m',
124
+ '15m': '15m',
125
+ '30m': '30m',
126
+ '1h': '1h',
127
+ '4h': '4h',
128
+ '12h': '12h',
129
+ '1d': '1d',
130
+ '1w': '1w',
131
+ '1M': '1mon',
132
+ '1y': '1y',
133
+ },
134
+ 'urls': {
135
+ 'logo': 'https://user-images.githubusercontent.com/1294454/150730761-1a00e5e0-d28c-480f-9e65-089ce3e6ef3b.jpg',
136
+ 'api': {
137
+ 'pub': 'https://api-pub.woox.io',
138
+ 'public': 'https://api.{hostname}',
139
+ 'private': 'https://api.{hostname}',
140
+ },
141
+ 'test': {
142
+ 'pub': 'https://api-pub.staging.woox.io',
143
+ 'public': 'https://api.staging.woox.io',
144
+ 'private': 'https://api.staging.woox.io',
145
+ },
146
+ 'www': 'https://woox.io/',
147
+ 'doc': [
148
+ 'https://docs.woox.io/',
149
+ ],
150
+ 'fees': [
151
+ 'https://support.woox.io/hc/en-001/articles/4404611795353--Trading-Fees',
152
+ ],
153
+ 'referral': {
154
+ 'url': 'https://woox.io/register?ref=DIJT0CNL',
155
+ 'discount': 0.35,
156
+ },
157
+ },
158
+ 'api': {
159
+ 'v1': {
160
+ 'pub': {
161
+ 'get': {
162
+ 'hist/kline': 10,
163
+ 'hist/trades': 10,
164
+ },
165
+ },
166
+ 'public': {
167
+ 'get': {
168
+ 'info': 1,
169
+ 'info/{symbol}': 1,
170
+ 'system_info': 1,
171
+ 'market_trades': 1,
172
+ 'token': 1,
173
+ 'token_network': 1,
174
+ 'funding_rates': 1,
175
+ 'funding_rate/{symbol}': 1,
176
+ 'funding_rate_history': 1,
177
+ 'futures': 1,
178
+ 'futures/{symbol}': 1,
179
+ 'orderbook/{symbol}': 1,
180
+ 'kline': 1,
181
+ },
182
+ },
183
+ 'private': {
184
+ 'get': {
185
+ 'client/token': 1,
186
+ 'order/{oid}': 1,
187
+ 'client/order/{client_order_id}': 1,
188
+ 'orders': 1,
189
+ 'client/trade/{tid}': 1,
190
+ 'order/{oid}/trades': 1,
191
+ 'client/trades': 1,
192
+ 'client/hist_trades': 1,
193
+ 'staking/yield_history': 1,
194
+ 'client/holding': 1,
195
+ 'asset/deposit': 10,
196
+ 'asset/history': 60,
197
+ 'sub_account/all': 60,
198
+ 'sub_account/assets': 60,
199
+ 'sub_account/asset_detail': 60,
200
+ 'sub_account/ip_restriction': 10,
201
+ 'asset/main_sub_transfer_history': 30,
202
+ 'token_interest': 60,
203
+ 'token_interest/{token}': 60,
204
+ 'interest/history': 60,
205
+ 'interest/repay': 60,
206
+ 'funding_fee/history': 30,
207
+ 'positions': 3.33,
208
+ 'position/{symbol}': 3.33,
209
+ 'client/transaction_history': 60,
210
+ 'client/futures_leverage': 60,
211
+ },
212
+ 'post': {
213
+ 'order': 1,
214
+ 'order/cancel_all_after': 1,
215
+ 'asset/main_sub_transfer': 30,
216
+ 'asset/ltv': 30,
217
+ 'asset/withdraw': 30,
218
+ 'asset/internal_withdraw': 30,
219
+ 'interest/repay': 60,
220
+ 'client/account_mode': 120,
221
+ 'client/position_mode': 5,
222
+ 'client/leverage': 120,
223
+ 'client/futures_leverage': 30,
224
+ 'client/isolated_margin': 30,
225
+ },
226
+ 'delete': {
227
+ 'order': 1,
228
+ 'client/order': 1,
229
+ 'orders': 1,
230
+ 'asset/withdraw': 120, // implemented in ccxt, disabled on the exchange side https://docx.woo.io/wootrade-documents/#cancel-withdraw-request
231
+ },
232
+ },
233
+ },
234
+ 'v2': {
235
+ 'private': {
236
+ 'get': {
237
+ 'client/holding': 1,
238
+ },
239
+ },
240
+ },
241
+ 'v3': {
242
+ 'public': {
243
+ 'get': {
244
+ 'systemInfo': 1,
245
+ 'instruments': 1,
246
+ 'token': 1,
247
+ 'tokenNetwork': 1,
248
+ 'tokenInfo': 1,
249
+ 'marketTrades': 1,
250
+ 'marketTradesHistory': 1,
251
+ 'orderbook': 1,
252
+ 'kline': 1,
253
+ 'klineHistory': 1,
254
+ 'futures': 1,
255
+ 'fundingRate': 1,
256
+ 'fundingRateHistory': 1,
257
+ 'insuranceFund': 1, // 10/1s
258
+ },
259
+ },
260
+ 'private': {
261
+ 'get': {
262
+ 'trade/order': 2,
263
+ 'trade/orders': 1,
264
+ 'trade/algoOrder': 1,
265
+ 'trade/algoOrders': 1,
266
+ 'trade/transaction': 1,
267
+ 'trade/transactionHistory': 5,
268
+ 'trade/tradingFee': 5,
269
+ 'account/info': 60,
270
+ 'account/tokenConfig': 1,
271
+ 'account/symbolConfig': 1,
272
+ 'account/subAccounts/all': 60,
273
+ 'account/referral/summary': 60,
274
+ 'account/referral/rewardHistory': 60,
275
+ 'account/credentials': 60,
276
+ 'asset/balances': 1,
277
+ 'asset/token/history': 60,
278
+ 'asset/transfer/history': 30,
279
+ 'asset/wallet/history': 60,
280
+ 'asset/wallet/deposit': 60,
281
+ 'asset/staking/yieldHistory': 60,
282
+ 'futures/positions': 3.33,
283
+ 'futures/leverage': 60,
284
+ 'futures/defaultMarginMode': 60,
285
+ 'futures/fundingFee/history': 30,
286
+ 'spotMargin/interestRate': 60,
287
+ 'spotMargin/interestHistory': 60,
288
+ 'spotMargin/maxMargin': 60,
289
+ 'algo/order/{oid}': 1,
290
+ 'algo/orders': 1,
291
+ 'balances': 1,
292
+ 'positions': 3.33,
293
+ 'buypower': 1,
294
+ 'convert/exchangeInfo': 1,
295
+ 'convert/assetInfo': 1,
296
+ 'convert/rfq': 60,
297
+ 'convert/trade': 1,
298
+ 'convert/trades': 1,
299
+ },
300
+ 'post': {
301
+ 'trade/order': 2,
302
+ 'trade/algoOrder': 5,
303
+ 'trade/cancelAllAfter': 1,
304
+ 'account/tradingMode': 120,
305
+ 'account/listenKey': 20,
306
+ 'asset/transfer': 30,
307
+ 'asset/wallet/withdraw': 60,
308
+ 'spotMargin/leverage': 120,
309
+ 'spotMargin/interestRepay': 60,
310
+ 'algo/order': 5,
311
+ 'convert/rft': 60,
312
+ },
313
+ 'put': {
314
+ 'trade/order': 2,
315
+ 'trade/algoOrder': 2,
316
+ 'futures/leverage': 60,
317
+ 'futures/positionMode': 120,
318
+ 'order/{oid}': 2,
319
+ 'order/client/{client_order_id}': 2,
320
+ 'algo/order/{oid}': 2,
321
+ 'algo/order/client/{client_order_id}': 2,
322
+ },
323
+ 'delete': {
324
+ 'trade/order': 1,
325
+ 'trade/orders': 1,
326
+ 'trade/algoOrder': 1,
327
+ 'trade/algoOrders': 1,
328
+ 'trade/allOrders': 1,
329
+ 'algo/order/{order_id}': 1,
330
+ 'algo/orders/pending': 1,
331
+ 'algo/orders/pending/{symbol}': 1,
332
+ 'orders/pending': 1,
333
+ },
334
+ },
335
+ },
336
+ },
337
+ 'fees': {
338
+ 'trading': {
339
+ 'tierBased': true,
340
+ 'percentage': true,
341
+ 'maker': this.parseNumber('0.0002'),
342
+ 'taker': this.parseNumber('0.0005'),
343
+ },
344
+ },
345
+ 'options': {
346
+ 'timeDifference': 0,
347
+ 'adjustForTimeDifference': false,
348
+ 'sandboxMode': false,
349
+ 'createMarketBuyOrderRequiresPrice': true,
350
+ // these network aliases require manual mapping here
351
+ 'network-aliases-for-tokens': {
352
+ 'HT': 'ERC20',
353
+ 'OMG': 'ERC20',
354
+ 'UATOM': 'ATOM',
355
+ 'ZRX': 'ZRX',
356
+ },
357
+ 'networks': {
358
+ 'TRX': 'TRON',
359
+ 'TRC20': 'TRON',
360
+ 'ERC20': 'ETH',
361
+ 'BEP20': 'BSC',
362
+ 'ARB': 'Arbitrum',
363
+ },
364
+ 'networksById': {
365
+ 'TRX': 'TRC20',
366
+ 'TRON': 'TRC20',
367
+ },
368
+ // override defaultNetworkCodePriorities for a specific currency
369
+ 'defaultNetworkCodeForCurrencies': {
370
+ // 'USDT': 'TRC20',
371
+ // 'BTC': 'BTC',
372
+ },
373
+ 'transfer': {
374
+ 'fillResponseFromRequest': true,
375
+ },
376
+ 'brokerId': 'bc830de7-50f3-460b-9ee0-f430f83f9dad',
377
+ },
378
+ 'features': {
379
+ 'default': {
380
+ 'sandbox': true,
381
+ 'createOrder': {
382
+ 'marginMode': true,
383
+ 'triggerPrice': true,
384
+ 'triggerPriceType': {
385
+ 'last': true,
386
+ 'mark': true,
387
+ 'index': false,
388
+ },
389
+ 'triggerDirection': false,
390
+ 'stopLossPrice': false,
391
+ 'takeProfitPrice': false,
392
+ 'attachedStopLossTakeProfit': undefined,
393
+ 'timeInForce': {
394
+ 'IOC': true,
395
+ 'FOK': true,
396
+ 'PO': true,
397
+ 'GTD': true,
398
+ },
399
+ 'hedged': false,
400
+ 'trailing': true,
401
+ 'leverage': false,
402
+ 'marketBuyByCost': true,
403
+ 'marketBuyRequiresPrice': false,
404
+ 'selfTradePrevention': false,
405
+ 'iceberg': true, // todo implement
406
+ },
407
+ 'createOrders': undefined,
408
+ 'fetchMyTrades': {
409
+ 'marginMode': false,
410
+ 'limit': 500,
411
+ 'daysBack': 90,
412
+ 'untilDays': 10000,
413
+ 'symbolRequired': false,
414
+ },
415
+ 'fetchOrder': {
416
+ 'marginMode': false,
417
+ 'trigger': true,
418
+ 'trailing': false,
419
+ 'symbolRequired': false,
420
+ },
421
+ 'fetchOpenOrders': {
422
+ 'marginMode': false,
423
+ 'limit': 500,
424
+ 'trigger': true,
425
+ 'trailing': true,
426
+ 'symbolRequired': false,
427
+ },
428
+ 'fetchOrders': {
429
+ 'marginMode': false,
430
+ 'limit': 500,
431
+ 'daysBack': undefined,
432
+ 'untilDays': 100000,
433
+ 'trigger': true,
434
+ 'trailing': true,
435
+ 'symbolRequired': false,
436
+ },
437
+ 'fetchClosedOrders': {
438
+ 'marginMode': false,
439
+ 'limit': 500,
440
+ 'daysBack': undefined,
441
+ 'daysBackCanceled': undefined,
442
+ 'untilDays': 100000,
443
+ 'trigger': true,
444
+ 'trailing': true,
445
+ 'symbolRequired': false,
446
+ },
447
+ 'fetchOHLCV': {
448
+ 'limit': 1000,
449
+ },
450
+ },
451
+ 'spot': {
452
+ 'extends': 'default',
453
+ },
454
+ 'forSwap': {
455
+ 'extends': 'default',
456
+ 'createOrder': {
457
+ 'hedged': true,
458
+ },
459
+ },
460
+ 'swap': {
461
+ 'linear': {
462
+ 'extends': 'forSwap',
463
+ },
464
+ 'inverse': undefined,
465
+ },
466
+ 'future': {
467
+ 'linear': undefined,
468
+ 'inverse': undefined,
469
+ },
470
+ },
471
+ 'commonCurrencies': {},
472
+ 'exceptions': {
473
+ 'exact': {
474
+ '-1000': OperationFailed,
475
+ '-1001': AuthenticationError,
476
+ '-1002': AuthenticationError,
477
+ '-1003': RateLimitExceeded,
478
+ '-1004': BadRequest,
479
+ '-1005': BadRequest,
480
+ '-1006': BadRequest,
481
+ '-1007': BadRequest,
482
+ '-1008': InvalidOrder,
483
+ '-1009': BadRequest,
484
+ '-1012': BadRequest,
485
+ '-1101': InvalidOrder,
486
+ '-1102': InvalidOrder,
487
+ '-1103': InvalidOrder,
488
+ '-1104': InvalidOrder,
489
+ '-1105': InvalidOrder, // { "code": -1105, "message": "Price is X% too high or X% too low from the mid price." }
490
+ },
491
+ 'broad': {
492
+ 'Can not place': ExchangeError,
493
+ 'maintenance': OnMaintenance,
494
+ 'symbol must not be blank': BadRequest,
495
+ 'The token is not supported': BadRequest,
496
+ 'Your order and symbol are not valid or already canceled': BadRequest,
497
+ 'Insufficient WOO. Please enable margin trading for leverage trading': BadRequest, // when selling insufficent token [-1012]
498
+ },
499
+ },
500
+ 'precisionMode': TICK_SIZE,
501
+ });
502
+ }
503
+ /**
504
+ * @method
505
+ * @name woo#fetchStatus
506
+ * @description the latest known information on the availability of the exchange API
507
+ * @see https://developer.woox.io/api-reference/endpoint/public_data/systemInfo
508
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
509
+ * @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
510
+ */
511
+ async fetchStatus(params = {}) {
512
+ const response = await this.v3PublicGetSystemInfo(params);
513
+ //
514
+ // {
515
+ // "success": true,
516
+ // "data": {
517
+ // "status": 0,
518
+ // "msg": "System is functioning properly.",
519
+ // "estimatedEndTime": 1749963600362
520
+ // },
521
+ // "timestamp": 1751442989564
522
+ // }
523
+ //
524
+ const data = this.safeDict(response, 'data', {});
525
+ let status = this.safeString(data, 'status');
526
+ if (status === undefined) {
527
+ status = 'error';
528
+ }
529
+ else if (status === '0') {
530
+ status = 'ok';
531
+ }
532
+ else {
533
+ status = 'maintenance';
534
+ }
535
+ return {
536
+ 'status': status,
537
+ 'updated': undefined,
538
+ 'eta': undefined,
539
+ 'url': undefined,
540
+ 'info': response,
541
+ };
542
+ }
543
+ /**
544
+ * @method
545
+ * @name woo#fetchTime
546
+ * @description fetches the current integer timestamp in milliseconds from the exchange server
547
+ * @see https://developer.woox.io/api-reference/endpoint/public_data/systemInfo
548
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
549
+ * @returns {int} the current integer timestamp in milliseconds from the exchange server
550
+ */
551
+ async fetchTime(params = {}) {
552
+ const response = await this.v3PublicGetSystemInfo(params);
553
+ //
554
+ // {
555
+ // "success": true,
556
+ // "data": {
557
+ // "status": 0,
558
+ // "msg": "System is functioning properly.",
559
+ // "estimatedEndTime": 1749963600362
560
+ // },
561
+ // "timestamp": 1751442989564
562
+ // }
563
+ //
564
+ return this.safeInteger(response, 'timestamp');
565
+ }
566
+ /**
567
+ * @method
568
+ * @name woo#fetchMarkets
569
+ * @description retrieves data on all markets for woo
570
+ * @see https://developer.woox.io/api-reference/endpoint/public_data/instruments
571
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
572
+ * @returns {object[]} an array of objects representing market data
573
+ */
574
+ async fetchMarkets(params = {}) {
575
+ if (this.options['adjustForTimeDifference']) {
576
+ await this.loadTimeDifference();
577
+ }
578
+ const response = await this.v3PublicGetInstruments(params);
579
+ //
580
+ // {
581
+ // "success": true,
582
+ // "data": {
583
+ // "rows": [
584
+ // {
585
+ // "symbol": "SPOT_AAVE_USDT",
586
+ // "status": "TRADING",
587
+ // "baseAsset": "AAVE",
588
+ // "baseAssetMultiplier": 1,
589
+ // "quoteAsset": "USDT",
590
+ // "quoteMin": "0",
591
+ // "quoteMax": "100000",
592
+ // "quoteTick": "0.01",
593
+ // "baseMin": "0.005",
594
+ // "baseMax": "5000",
595
+ // "baseTick": "0.0001",
596
+ // "minNotional": "1",
597
+ // "bidCapRatio": "1.1",
598
+ // "bidFloorRatio": null,
599
+ // "askCapRatio": null,
600
+ // "askFloorRatio": "0.9",
601
+ // "orderMode": "NORMAL",
602
+ // "impactNotional": null,
603
+ // "isAllowedRpi": false,
604
+ // "tickGranularity": null
605
+ // }
606
+ // ]
607
+ // },
608
+ // "timestamp": 1751512951338
609
+ // }
610
+ //
611
+ const data = this.safeDict(response, 'data', {});
612
+ const rows = this.safeList(data, 'rows', []);
613
+ return this.parseMarkets(rows);
614
+ }
615
+ parseMarket(market) {
616
+ const marketId = this.safeString(market, 'symbol');
617
+ const parts = marketId.split('_');
618
+ const first = this.safeString(parts, 0);
619
+ let marketType;
620
+ let spot = false;
621
+ let swap = false;
622
+ if (first === 'SPOT') {
623
+ spot = true;
624
+ marketType = 'spot';
625
+ }
626
+ else if (first === 'PERP') {
627
+ swap = true;
628
+ marketType = 'swap';
629
+ }
630
+ const baseId = this.safeString(parts, 1);
631
+ const quoteId = this.safeString(parts, 2);
632
+ const base = this.safeCurrencyCode(baseId);
633
+ const quote = this.safeCurrencyCode(quoteId);
634
+ let settleId = undefined;
635
+ let settle = undefined;
636
+ let symbol = base + '/' + quote;
637
+ let contractSize = undefined;
638
+ let linear = undefined;
639
+ let inverse = undefined;
640
+ let margin = true;
641
+ const contract = swap;
642
+ if (contract) {
643
+ margin = false;
644
+ settleId = this.safeString(parts, 2);
645
+ settle = this.safeCurrencyCode(settleId);
646
+ symbol = base + '/' + quote + ':' + settle;
647
+ contractSize = this.parseNumber('1');
648
+ linear = true;
649
+ inverse = false;
650
+ }
651
+ const active = this.safeString(market, 'status') === 'TRADING';
652
+ return {
653
+ 'id': marketId,
654
+ 'symbol': symbol,
655
+ 'base': base,
656
+ 'quote': quote,
657
+ 'settle': settle,
658
+ 'baseId': baseId,
659
+ 'quoteId': quoteId,
660
+ 'settleId': settleId,
661
+ 'type': marketType,
662
+ 'spot': spot,
663
+ 'margin': margin,
664
+ 'swap': swap,
665
+ 'future': false,
666
+ 'option': false,
667
+ 'active': active,
668
+ 'contract': contract,
669
+ 'linear': linear,
670
+ 'inverse': inverse,
671
+ 'contractSize': contractSize,
672
+ 'expiry': undefined,
673
+ 'expiryDatetime': undefined,
674
+ 'strike': undefined,
675
+ 'optionType': undefined,
676
+ 'precision': {
677
+ 'amount': this.safeNumber(market, 'baseTick'),
678
+ 'price': this.safeNumber(market, 'quoteTick'),
679
+ },
680
+ 'limits': {
681
+ 'leverage': {
682
+ 'min': undefined,
683
+ 'max': undefined,
684
+ },
685
+ 'amount': {
686
+ 'min': this.safeNumber(market, 'baseMin'),
687
+ 'max': this.safeNumber(market, 'baseMax'),
688
+ },
689
+ 'price': {
690
+ 'min': this.safeNumber(market, 'quoteMin'),
691
+ 'max': this.safeNumber(market, 'quoteMax'),
692
+ },
693
+ 'cost': {
694
+ 'min': this.safeNumber(market, 'minNotional'),
695
+ 'max': undefined,
696
+ },
697
+ },
698
+ 'created': undefined,
699
+ 'info': market,
700
+ };
701
+ }
702
+ /**
703
+ * @method
704
+ * @name woo#fetchTrades
705
+ * @description get the list of most recent trades for a particular symbol
706
+ * @see https://developer.woox.io/api-reference/endpoint/public_data/marketTrades
707
+ * @param {string} symbol unified symbol of the market to fetch trades for
708
+ * @param {int} [since] timestamp in ms of the earliest trade to fetch
709
+ * @param {int} [limit] the maximum amount of trades to fetch
710
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
711
+ * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
712
+ */
713
+ async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
714
+ await this.loadMarkets();
715
+ const market = this.market(symbol);
716
+ const request = {
717
+ 'symbol': market['id'],
718
+ };
719
+ if (limit !== undefined) {
720
+ request['limit'] = limit;
721
+ }
722
+ const response = await this.v3PublicGetMarketTrades(this.extend(request, params));
723
+ //
724
+ // {
725
+ // "success": true,
726
+ // "data": {
727
+ // "rows": [
728
+ // {
729
+ // "symbol": "SPOT_BTC_USDT",
730
+ // "side": "SELL",
731
+ // "source": 0,
732
+ // "executedPrice": "108741.01",
733
+ // "executedQuantity": "0.02477",
734
+ // "executedTimestamp": 1751513940144
735
+ // }
736
+ // ]
737
+ // },
738
+ // "timestamp": 1751513988543
739
+ // }
740
+ //
741
+ const data = this.safeDict(response, 'data', {});
742
+ const rows = this.safeList(data, 'rows', []);
743
+ return this.parseTrades(rows, market, since, limit);
744
+ }
745
+ parseTrade(trade, market = undefined) {
746
+ //
747
+ // public/market_trades
748
+ //
749
+ // {
750
+ // "symbol": "SPOT_BTC_USDT",
751
+ // "side": "SELL",
752
+ // "source": 0,
753
+ // "executedPrice": "108741.01",
754
+ // "executedQuantity": "0.02477",
755
+ // "executedTimestamp": 1751513940144
756
+ // }
757
+ //
758
+ // fetchOrderTrades, fetchOrder
759
+ //
760
+ // {
761
+ // "id": 1734947821,
762
+ // "symbol": "SPOT_LTC_USDT",
763
+ // "orderId": 60780383217,
764
+ // "executedPrice": 87.86,
765
+ // "executedQuantity": 0.1,
766
+ // "fee": 0.0001,
767
+ // "realizedPnl": null,
768
+ // "feeAsset": "LTC",
769
+ // "orderTag": "default",
770
+ // "side": "BUY",
771
+ // "executedTimestamp": "1752055173.630",
772
+ // "isMaker": 0
773
+ // }
774
+ //
775
+ const isFromFetchOrder = ('id' in trade);
776
+ const timestampString = this.safeString2(trade, 'executed_timestamp', 'executedTimestamp');
777
+ let timestamp = undefined;
778
+ if (timestampString !== undefined) {
779
+ if (timestampString.indexOf('.') > -1) {
780
+ timestamp = this.safeTimestamp2(trade, 'executed_timestamp', 'executedTimestamp');
781
+ }
782
+ else {
783
+ timestamp = this.safeInteger(trade, 'executedTimestamp');
784
+ }
785
+ }
786
+ const marketId = this.safeString(trade, 'symbol');
787
+ market = this.safeMarket(marketId, market);
788
+ const symbol = market['symbol'];
789
+ const price = this.safeString2(trade, 'executed_price', 'executedPrice');
790
+ const amount = this.safeString2(trade, 'executed_quantity', 'executedQuantity');
791
+ const order_id = this.safeString2(trade, 'order_id', 'orderId');
792
+ const fee = this.parseTokenAndFeeTemp(trade, ['fee_asset', 'feeAsset'], ['fee']);
793
+ const feeCost = this.safeString(fee, 'cost');
794
+ if (feeCost !== undefined) {
795
+ fee['cost'] = feeCost;
796
+ }
797
+ const cost = Precise.stringMul(price, amount);
798
+ const side = this.safeStringLower(trade, 'side');
799
+ const id = this.safeString(trade, 'id');
800
+ let takerOrMaker = undefined;
801
+ if (isFromFetchOrder) {
802
+ const isMaker = this.safeString2(trade, 'is_maker', 'isMaker') === '1';
803
+ takerOrMaker = isMaker ? 'maker' : 'taker';
804
+ }
805
+ return this.safeTrade({
806
+ 'id': id,
807
+ 'timestamp': timestamp,
808
+ 'datetime': this.iso8601(timestamp),
809
+ 'symbol': symbol,
810
+ 'side': side,
811
+ 'price': price,
812
+ 'amount': amount,
813
+ 'cost': cost,
814
+ 'order': order_id,
815
+ 'takerOrMaker': takerOrMaker,
816
+ 'type': undefined,
817
+ 'fee': fee,
818
+ 'info': trade,
819
+ }, market);
820
+ }
821
+ parseTokenAndFeeTemp(item, feeTokenKeys, feeAmountKeys) {
822
+ const feeCost = this.safeStringN(item, feeAmountKeys);
823
+ let fee = undefined;
824
+ if (feeCost !== undefined) {
825
+ const feeCurrencyId = this.safeStringN(item, feeTokenKeys);
826
+ const feeCurrencyCode = this.safeCurrencyCode(feeCurrencyId);
827
+ fee = {
828
+ 'cost': feeCost,
829
+ 'currency': feeCurrencyCode,
830
+ };
831
+ }
832
+ return fee;
833
+ }
834
+ parseTradingFee(fee, market = undefined) {
835
+ const marketId = this.safeString(fee, 'symbol');
836
+ const symbol = this.safeSymbol(marketId, market);
837
+ return {
838
+ 'info': fee,
839
+ 'symbol': symbol,
840
+ 'maker': this.parseNumber(Precise.stringDiv(this.safeString(fee, 'makerFee'), '100')),
841
+ 'taker': this.parseNumber(Precise.stringDiv(this.safeString(fee, 'takerFee'), '100')),
842
+ 'percentage': undefined,
843
+ 'tierBased': undefined,
844
+ };
845
+ }
846
+ /**
847
+ * @method
848
+ * @name woo#fetchTradingFee
849
+ * @description fetch the trading fees for a market
850
+ * @see https://developer.woox.io/api-reference/endpoint/trading/get_tradingFee
851
+ * @param {string} symbol unified market symbol
852
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
853
+ * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch trading fees in a portfolio margin account
854
+ * @param {string} [params.subType] "linear" or "inverse"
855
+ * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
856
+ */
857
+ async fetchTradingFee(symbol, params = {}) {
858
+ await this.loadMarkets();
859
+ const market = this.market(symbol);
860
+ const request = {
861
+ 'symbol': market['id'],
862
+ };
863
+ const response = await this.v3PrivateGetTradeTradingFee(this.extend(request, params));
864
+ //
865
+ // {
866
+ // "success": true,
867
+ // "data": {
868
+ // "symbol": "SPOT_BTC_USDT",
869
+ // "takerFee": "10",
870
+ // "makerFee": "8"
871
+ // },
872
+ // "timestamp": 1751858977368
873
+ // }
874
+ //
875
+ const data = this.safeDict(response, 'data', {});
876
+ return this.parseTradingFee(data, market);
877
+ }
878
+ /**
879
+ * @method
880
+ * @name woo#fetchTradingFees
881
+ * @description fetch the trading fees for multiple markets
882
+ * @see https://developer.woox.io/api-reference/endpoint/account/get_account_info
883
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
884
+ * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
885
+ */
886
+ async fetchTradingFees(params = {}) {
887
+ await this.loadMarkets();
888
+ const response = await this.v3PrivateGetAccountInfo(params);
889
+ //
890
+ // {
891
+ // "success": true,
892
+ // "data": {
893
+ // "applicationId": "251bf5c4-f3c8-4544-bb8b-80001007c3c0",
894
+ // "account": "carlos_jose_lima@yahoo.com",
895
+ // "alias": "carlos_jose_lima@yahoo.com",
896
+ // "otpauth": true,
897
+ // "accountMode": "FUTURES",
898
+ // "positionMode": "ONE_WAY",
899
+ // "leverage": 0,
900
+ // "makerFeeRate": 0,
901
+ // "takerFeeRate": 0,
902
+ // "marginRatio": "10",
903
+ // "openMarginRatio": "10",
904
+ // "initialMarginRatio": "10",
905
+ // "maintenanceMarginRatio": "0.03",
906
+ // "totalCollateral": "165.55629469",
907
+ // "freeCollateral": "165.55629469",
908
+ // "totalAccountValue": "167.32418611",
909
+ // "totalTradingValue": "167.32418611",
910
+ // "totalVaultValue": "0",
911
+ // "totalStakingValue": "0",
912
+ // "totalLaunchpadValue": "0",
913
+ // "totalEarnValue": "0",
914
+ // "referrerID": null,
915
+ // "accountType": "Main"
916
+ // },
917
+ // "timestamp": 1752062807915
918
+ // }
919
+ //
920
+ const data = this.safeDict(response, 'data', {});
921
+ const maker = this.safeString(data, 'makerFeeRate');
922
+ const taker = this.safeString(data, 'takerFeeRate');
923
+ const result = {};
924
+ for (let i = 0; i < this.symbols.length; i++) {
925
+ const symbol = this.symbols[i];
926
+ result[symbol] = {
927
+ 'info': response,
928
+ 'symbol': symbol,
929
+ 'maker': this.parseNumber(Precise.stringDiv(maker, '10000')),
930
+ 'taker': this.parseNumber(Precise.stringDiv(taker, '10000')),
931
+ 'percentage': true,
932
+ 'tierBased': true,
933
+ };
934
+ }
935
+ return result;
936
+ }
937
+ /**
938
+ * @method
939
+ * @name woo#fetchCurrencies
940
+ * @description fetches all available currencies on an exchange
941
+ * @see https://docs.woox.io/#available-token-public
942
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
943
+ * @returns {object} an associative dictionary of currencies
944
+ */
945
+ async fetchCurrencies(params = {}) {
946
+ const result = {};
947
+ const tokenResponsePromise = this.v1PublicGetToken(params);
948
+ //
949
+ // {
950
+ // "rows": [
951
+ // {
952
+ // "token": "ETH_USDT",
953
+ // "fullname": "Tether",
954
+ // "network": "ETH",
955
+ // "decimals": "6",
956
+ // "delisted": false,
957
+ // "balance_token": "USDT",
958
+ // "created_time": "1710123398",
959
+ // "updated_time": "1746528481",
960
+ // "can_collateral": true,
961
+ // "can_short": true
962
+ // },
963
+ // {
964
+ // "token": "BSC_USDT",
965
+ // "fullname": "Tether",
966
+ // "network": "BSC",
967
+ // "decimals": "18",
968
+ // "delisted": false,
969
+ // "balance_token": "USDT",
970
+ // "created_time": "1710123395",
971
+ // "updated_time": "1746528601",
972
+ // "can_collateral": true,
973
+ // "can_short": true
974
+ // },
975
+ // {
976
+ // "token": "ALGO",
977
+ // "fullname": "Algorand",
978
+ // "network": "ALGO",
979
+ // "decimals": "6",
980
+ // "delisted": false,
981
+ // "balance_token": "ALGO",
982
+ // "created_time": "1710123394",
983
+ // "updated_time": "1723087518",
984
+ // "can_collateral": true,
985
+ // "can_short": true
986
+ // },
987
+ // ...
988
+ // ],
989
+ // "success": true
990
+ // }
991
+ //
992
+ // only make one request for currrencies...
993
+ const tokenNetworkResponsePromise = this.v1PublicGetTokenNetwork(params);
994
+ //
995
+ // {
996
+ // "rows": [
997
+ // {
998
+ // "protocol": "ERC20",
999
+ // "network": "ETH",
1000
+ // "token": "USDT",
1001
+ // "name": "Ethereum (ERC20)",
1002
+ // "minimum_withdrawal": "10.00000000",
1003
+ // "withdrawal_fee": "2.00000000",
1004
+ // "allow_deposit": "1",
1005
+ // "allow_withdraw": "1"
1006
+ // },
1007
+ // {
1008
+ // "protocol": "TRC20",
1009
+ // "network": "TRX",
1010
+ // "token": "USDT",
1011
+ // "name": "Tron (TRC20)",
1012
+ // "minimum_withdrawal": "10.00000000",
1013
+ // "withdrawal_fee": "4.50000000",
1014
+ // "allow_deposit": "1",
1015
+ // "allow_withdraw": "1"
1016
+ // },
1017
+ // ...
1018
+ // ],
1019
+ // "success": true
1020
+ // }
1021
+ //
1022
+ const [tokenResponse, tokenNetworkResponse] = await Promise.all([tokenResponsePromise, tokenNetworkResponsePromise]);
1023
+ const tokenRows = this.safeList(tokenResponse, 'rows', []);
1024
+ const tokenNetworkRows = this.safeList(tokenNetworkResponse, 'rows', []);
1025
+ const networksById = this.groupBy(tokenNetworkRows, 'token');
1026
+ const tokensById = this.groupBy(tokenRows, 'balance_token');
1027
+ const currencyIds = Object.keys(tokensById);
1028
+ for (let i = 0; i < currencyIds.length; i++) {
1029
+ const currencyId = currencyIds[i];
1030
+ const code = this.safeCurrencyCode(currencyId);
1031
+ const tokensByNetworkId = this.indexBy(tokensById[currencyId], 'network');
1032
+ const chainsByNetworkId = this.indexBy(networksById[currencyId], 'network');
1033
+ const keys = Object.keys(chainsByNetworkId);
1034
+ const resultingNetworks = {};
1035
+ for (let j = 0; j < keys.length; j++) {
1036
+ const networkId = keys[j];
1037
+ const tokenEntry = this.safeDict(tokensByNetworkId, networkId, {});
1038
+ const networkEntry = this.safeDict(chainsByNetworkId, networkId, {});
1039
+ const networkCode = this.networkIdToCode(networkId, code);
1040
+ const specialNetworkId = this.safeString(tokenEntry, 'token');
1041
+ resultingNetworks[networkCode] = {
1042
+ 'id': networkId,
1043
+ 'currencyNetworkId': specialNetworkId,
1044
+ 'network': networkCode,
1045
+ 'active': undefined,
1046
+ 'deposit': this.safeString(networkEntry, 'allow_deposit') === '1',
1047
+ 'withdraw': this.safeString(networkEntry, 'allow_withdraw') === '1',
1048
+ 'fee': this.safeNumber(networkEntry, 'withdrawal_fee'),
1049
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(tokenEntry, 'decimals'))),
1050
+ 'limits': {
1051
+ 'withdraw': {
1052
+ 'min': this.safeNumber(networkEntry, 'minimum_withdrawal'),
1053
+ 'max': undefined,
1054
+ },
1055
+ 'deposit': {
1056
+ 'min': undefined,
1057
+ 'max': undefined,
1058
+ },
1059
+ },
1060
+ 'info': [networkEntry, tokenEntry],
1061
+ };
1062
+ }
1063
+ result[code] = this.safeCurrencyStructure({
1064
+ 'id': currencyId,
1065
+ 'name': undefined,
1066
+ 'code': code,
1067
+ 'precision': undefined,
1068
+ 'active': undefined,
1069
+ 'fee': undefined,
1070
+ 'networks': resultingNetworks,
1071
+ 'deposit': undefined,
1072
+ 'withdraw': undefined,
1073
+ 'type': 'crypto',
1074
+ 'limits': {
1075
+ 'deposit': {
1076
+ 'min': undefined,
1077
+ 'max': undefined,
1078
+ },
1079
+ 'withdraw': {
1080
+ 'min': undefined,
1081
+ 'max': undefined,
1082
+ },
1083
+ },
1084
+ 'info': [tokensByNetworkId, chainsByNetworkId],
1085
+ });
1086
+ }
1087
+ return result;
1088
+ }
1089
+ /**
1090
+ * @method
1091
+ * @name woo#createMarketBuyOrderWithCost
1092
+ * @description create a market buy order by providing the symbol and cost
1093
+ * @see https://docs.woox.io/#send-order
1094
+ * @param {string} symbol unified symbol of the market to create an order in
1095
+ * @param {float} cost how much you want to trade in units of the quote currency
1096
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1097
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1098
+ */
1099
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
1100
+ await this.loadMarkets();
1101
+ const market = this.market(symbol);
1102
+ if (!market['spot']) {
1103
+ throw new NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
1104
+ }
1105
+ return await this.createOrder(symbol, 'market', 'buy', cost, 1, params);
1106
+ }
1107
+ /**
1108
+ * @method
1109
+ * @name woo#createMarketSellOrderWithCost
1110
+ * @description create a market sell order by providing the symbol and cost
1111
+ * @see https://docs.woox.io/#send-order
1112
+ * @param {string} symbol unified symbol of the market to create an order in
1113
+ * @param {float} cost how much you want to trade in units of the quote currency
1114
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1115
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1116
+ */
1117
+ async createMarketSellOrderWithCost(symbol, cost, params = {}) {
1118
+ await this.loadMarkets();
1119
+ const market = this.market(symbol);
1120
+ if (!market['spot']) {
1121
+ throw new NotSupported(this.id + ' createMarketSellOrderWithCost() supports spot orders only');
1122
+ }
1123
+ return await this.createOrder(symbol, 'market', 'sell', cost, 1, params);
1124
+ }
1125
+ /**
1126
+ * @method
1127
+ * @name woo#createTrailingAmountOrder
1128
+ * @description create a trailing order by providing the symbol, type, side, amount, price and trailingAmount
1129
+ * @see https://docs.woox.io/#send-algo-order
1130
+ * @param {string} symbol unified symbol of the market to create an order in
1131
+ * @param {string} type 'market' or 'limit'
1132
+ * @param {string} side 'buy' or 'sell'
1133
+ * @param {float} amount how much you want to trade in units of the base currency, or number of contracts
1134
+ * @param {float} [price] the price for the order to be filled at, in units of the quote currency, ignored in market orders
1135
+ * @param {float} trailingAmount the quote amount to trail away from the current market price
1136
+ * @param {float} trailingTriggerPrice the price to activate a trailing order, default uses the price argument
1137
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1138
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1139
+ */
1140
+ async createTrailingAmountOrder(symbol, type, side, amount, price = undefined, trailingAmount = undefined, trailingTriggerPrice = undefined, params = {}) {
1141
+ if (trailingAmount === undefined) {
1142
+ throw new ArgumentsRequired(this.id + ' createTrailingAmountOrder() requires a trailingAmount argument');
1143
+ }
1144
+ if (trailingTriggerPrice === undefined) {
1145
+ throw new ArgumentsRequired(this.id + ' createTrailingAmountOrder() requires a trailingTriggerPrice argument');
1146
+ }
1147
+ params['trailingAmount'] = trailingAmount;
1148
+ params['trailingTriggerPrice'] = trailingTriggerPrice;
1149
+ return await this.createOrder(symbol, type, side, amount, price, params);
1150
+ }
1151
+ /**
1152
+ * @method
1153
+ * @name woo#createTrailingPercentOrder
1154
+ * @description create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
1155
+ * @see https://docs.woox.io/#send-algo-order
1156
+ * @param {string} symbol unified symbol of the market to create an order in
1157
+ * @param {string} type 'market' or 'limit'
1158
+ * @param {string} side 'buy' or 'sell'
1159
+ * @param {float} amount how much you want to trade in units of the base currency, or number of contracts
1160
+ * @param {float} [price] the price for the order to be filled at, in units of the quote currency, ignored in market orders
1161
+ * @param {float} trailingPercent the percent to trail away from the current market price
1162
+ * @param {float} trailingTriggerPrice the price to activate a trailing order, default uses the price argument
1163
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1164
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1165
+ */
1166
+ async createTrailingPercentOrder(symbol, type, side, amount, price = undefined, trailingPercent = undefined, trailingTriggerPrice = undefined, params = {}) {
1167
+ if (trailingPercent === undefined) {
1168
+ throw new ArgumentsRequired(this.id + ' createTrailingPercentOrder() requires a trailingPercent argument');
1169
+ }
1170
+ if (trailingTriggerPrice === undefined) {
1171
+ throw new ArgumentsRequired(this.id + ' createTrailingPercentOrder() requires a trailingTriggerPrice argument');
1172
+ }
1173
+ params['trailingPercent'] = trailingPercent;
1174
+ params['trailingTriggerPrice'] = trailingTriggerPrice;
1175
+ return await this.createOrder(symbol, type, side, amount, price, params);
1176
+ }
1177
+ /**
1178
+ * @method
1179
+ * @name woo#createOrder
1180
+ * @description create a trade order
1181
+ * @see https://developer.woox.io/api-reference/endpoint/trading/post_order
1182
+ * @see https://developer.woox.io/api-reference/endpoint/trading/post_algo_order
1183
+ * @param {string} symbol unified symbol of the market to create an order in
1184
+ * @param {string} type 'market' or 'limit'
1185
+ * @param {string} side 'buy' or 'sell'
1186
+ * @param {float} amount how much of currency you want to trade in units of base currency
1187
+ * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1188
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1189
+ * @param {string} [params.marginMode] *for swap markets only* 'cross' or 'isolated', default 'cross'
1190
+ * @param {float} [params.triggerPrice] The price a trigger order is triggered at
1191
+ * @param {object} [params.takeProfit] *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered (perpetual swap markets only)
1192
+ * @param {float} [params.takeProfit.triggerPrice] take profit trigger price
1193
+ * @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered (perpetual swap markets only)
1194
+ * @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
1195
+ * @param {float} [params.algoType] 'STOP' or 'TRAILING_STOP' or 'OCO' or 'CLOSE_POSITION'
1196
+ * @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
1197
+ * @param {string} [params.trailingAmount] the quote amount to trail away from the current market price
1198
+ * @param {string} [params.trailingPercent] the percent to trail away from the current market price
1199
+ * @param {string} [params.trailingTriggerPrice] the price to trigger a trailing order, default uses the price argument
1200
+ * @param {string} [params.position_side] 'SHORT' or 'LONG' - if position mode is HEDGE_MODE and the trading involves futures, then is required, otherwise this parameter is not required
1201
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1202
+ */
1203
+ async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
1204
+ const reduceOnly = this.safeBool2(params, 'reduceOnly', 'reduce_only');
1205
+ params = this.omit(params, ['reduceOnly', 'reduce_only']);
1206
+ const orderType = type.toUpperCase();
1207
+ await this.loadMarkets();
1208
+ const market = this.market(symbol);
1209
+ const orderSide = side.toUpperCase();
1210
+ const request = {
1211
+ 'symbol': market['id'],
1212
+ 'side': orderSide,
1213
+ };
1214
+ let marginMode = undefined;
1215
+ [marginMode, params] = this.handleMarginModeAndParams('createOrder', params);
1216
+ if (marginMode !== undefined) {
1217
+ request['marginMode'] = this.encodeMarginMode(marginMode);
1218
+ }
1219
+ const triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
1220
+ const stopLoss = this.safeValue(params, 'stopLoss');
1221
+ const takeProfit = this.safeValue(params, 'takeProfit');
1222
+ const algoType = this.safeString(params, 'algoType');
1223
+ const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activatedPrice', this.numberToString(price));
1224
+ const trailingAmount = this.safeString2(params, 'trailingAmount', 'callbackValue');
1225
+ const trailingPercent = this.safeString2(params, 'trailingPercent', 'callbackRate');
1226
+ const isTrailingAmountOrder = trailingAmount !== undefined;
1227
+ const isTrailingPercentOrder = trailingPercent !== undefined;
1228
+ const isTrailing = isTrailingAmountOrder || isTrailingPercentOrder;
1229
+ const isConditional = isTrailing || triggerPrice !== undefined || stopLoss !== undefined || takeProfit !== undefined || (this.safeValue(params, 'childOrders') !== undefined);
1230
+ const isMarket = orderType === 'MARKET';
1231
+ const timeInForce = this.safeStringLower(params, 'timeInForce');
1232
+ const postOnly = this.isPostOnly(isMarket, undefined, params);
1233
+ const clientOrderIdKey = isConditional ? 'clientAlgoOrderId' : 'clientOrderId';
1234
+ request['type'] = orderType; // LIMIT/MARKET/IOC/FOK/POST_ONLY/ASK/BID
1235
+ if (!isConditional) {
1236
+ if (postOnly) {
1237
+ request['type'] = 'POST_ONLY';
1238
+ }
1239
+ else if (timeInForce === 'fok') {
1240
+ request['type'] = 'FOK';
1241
+ }
1242
+ else if (timeInForce === 'ioc') {
1243
+ request['type'] = 'IOC';
1244
+ }
1245
+ }
1246
+ if (reduceOnly) {
1247
+ request['reduceOnly'] = reduceOnly;
1248
+ }
1249
+ if (!isMarket && price !== undefined) {
1250
+ request['price'] = this.priceToPrecision(symbol, price);
1251
+ }
1252
+ if (isMarket && !isConditional) {
1253
+ // for market buy it requires the amount of quote currency to spend
1254
+ const cost = this.safeStringN(params, ['cost', 'order_amount', 'orderAmount']);
1255
+ params = this.omit(params, ['cost', 'order_amount', 'orderAmount']);
1256
+ const isPriceProvided = price !== undefined;
1257
+ if (market['spot'] && (isPriceProvided || (cost !== undefined))) {
1258
+ let quoteAmount = undefined;
1259
+ if (cost !== undefined) {
1260
+ quoteAmount = this.costToPrecision(symbol, cost);
1261
+ }
1262
+ else {
1263
+ const amountString = this.numberToString(amount);
1264
+ const priceString = this.numberToString(price);
1265
+ const costRequest = Precise.stringMul(amountString, priceString);
1266
+ quoteAmount = this.costToPrecision(symbol, costRequest);
1267
+ }
1268
+ request['amount'] = quoteAmount;
1269
+ }
1270
+ else {
1271
+ request['quantity'] = this.amountToPrecision(symbol, amount);
1272
+ }
1273
+ }
1274
+ else if (algoType !== 'POSITIONAL_TP_SL') {
1275
+ request['quantity'] = this.amountToPrecision(symbol, amount);
1276
+ }
1277
+ const clientOrderId = this.safeStringN(params, ['clOrdID', 'clientOrderId', 'client_order_id']);
1278
+ if (clientOrderId !== undefined) {
1279
+ request[clientOrderIdKey] = clientOrderId;
1280
+ }
1281
+ if (isTrailing) {
1282
+ if (trailingTriggerPrice === undefined) {
1283
+ throw new ArgumentsRequired(this.id + ' createOrder() requires a trailingTriggerPrice parameter for trailing orders');
1284
+ }
1285
+ request['activatedPrice'] = this.priceToPrecision(symbol, trailingTriggerPrice);
1286
+ request['algoType'] = 'TRAILING_STOP';
1287
+ if (isTrailingAmountOrder) {
1288
+ request['callbackValue'] = trailingAmount;
1289
+ }
1290
+ else if (isTrailingPercentOrder) {
1291
+ const convertedTrailingPercent = Precise.stringDiv(trailingPercent, '100');
1292
+ request['callbackRate'] = convertedTrailingPercent;
1293
+ }
1294
+ }
1295
+ else if (triggerPrice !== undefined) {
1296
+ if (algoType !== 'TRAILING_STOP') {
1297
+ request['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
1298
+ request['algoType'] = 'STOP';
1299
+ }
1300
+ }
1301
+ else if ((stopLoss !== undefined) || (takeProfit !== undefined)) {
1302
+ request['algoType'] = 'BRACKET';
1303
+ const outterOrder = {
1304
+ 'symbol': market['id'],
1305
+ 'reduceOnly': false,
1306
+ 'algoType': 'POSITIONAL_TP_SL',
1307
+ 'childOrders': [],
1308
+ };
1309
+ const childOrders = outterOrder['childOrders'];
1310
+ const closeSide = (orderSide === 'BUY') ? 'SELL' : 'BUY';
1311
+ if (stopLoss !== undefined) {
1312
+ const stopLossPrice = this.safeString(stopLoss, 'triggerPrice', stopLoss);
1313
+ const stopLossOrder = {
1314
+ 'side': closeSide,
1315
+ 'algoType': 'STOP_LOSS',
1316
+ 'triggerPrice': this.priceToPrecision(symbol, stopLossPrice),
1317
+ 'type': 'CLOSE_POSITION',
1318
+ 'reduceOnly': true,
1319
+ };
1320
+ childOrders.push(stopLossOrder);
1321
+ }
1322
+ if (takeProfit !== undefined) {
1323
+ const takeProfitPrice = this.safeString(takeProfit, 'triggerPrice', takeProfit);
1324
+ const takeProfitOrder = {
1325
+ 'side': closeSide,
1326
+ 'algoType': 'TAKE_PROFIT',
1327
+ 'triggerPrice': this.priceToPrecision(symbol, takeProfitPrice),
1328
+ 'type': 'CLOSE_POSITION',
1329
+ 'reduceOnly': true,
1330
+ };
1331
+ childOrders.push(takeProfitOrder);
1332
+ }
1333
+ request['childOrders'] = [outterOrder];
1334
+ }
1335
+ params = this.omit(params, ['clOrdID', 'clientOrderId', 'client_order_id', 'postOnly', 'timeInForce', 'stopPrice', 'triggerPrice', 'stopLoss', 'takeProfit', 'trailingPercent', 'trailingAmount', 'trailingTriggerPrice']);
1336
+ let response = undefined;
1337
+ if (isConditional) {
1338
+ response = await this.v3PrivatePostTradeAlgoOrder(this.extend(request, params));
1339
+ //
1340
+ // {
1341
+ // "success": true,
1342
+ // "data": {
1343
+ // "rows": [
1344
+ // {
1345
+ // "orderId": "1578938",
1346
+ // "clientOrderId": "0",
1347
+ // "algoType": "STOP_LOSS",
1348
+ // "quantity": "0.1"
1349
+ // }
1350
+ // ]
1351
+ // },
1352
+ // "timestamp": "1686149372216"
1353
+ // }
1354
+ //
1355
+ }
1356
+ else {
1357
+ response = await this.v3PrivatePostTradeOrder(this.extend(request, params));
1358
+ //
1359
+ // {
1360
+ // "success": true,
1361
+ // "data": {
1362
+ // "orderId": 60667653330,
1363
+ // "clientOrderId": 0,
1364
+ // "type": "LIMIT",
1365
+ // "price": 60,
1366
+ // "quantity": 0.1,
1367
+ // "amount": null,
1368
+ // "bidAskLevel": null
1369
+ // },
1370
+ // "timestamp": 1751871779855
1371
+ // }
1372
+ //
1373
+ }
1374
+ let data = this.safeDict(response, 'data', {});
1375
+ data = this.safeDict(this.safeList(data, 'rows'), 0, data);
1376
+ data['timestamp'] = this.safeString(response, 'timestamp');
1377
+ return this.parseOrder(data, market);
1378
+ }
1379
+ encodeMarginMode(mode) {
1380
+ const modes = {
1381
+ 'cross': 'CROSS',
1382
+ 'isolated': 'ISOLATED',
1383
+ };
1384
+ return this.safeString(modes, mode, mode);
1385
+ }
1386
+ /**
1387
+ * @method
1388
+ * @name woo#editOrder
1389
+ * @description edit a trade order
1390
+ * @see https://docs.woox.io/#edit-order
1391
+ * @see https://docs.woox.io/#edit-order-by-client_order_id
1392
+ * @see https://docs.woox.io/#edit-algo-order
1393
+ * @see https://docs.woox.io/#edit-algo-order-by-client_order_id
1394
+ * @param {string} id order id
1395
+ * @param {string} symbol unified symbol of the market to create an order in
1396
+ * @param {string} type 'market' or 'limit'
1397
+ * @param {string} side 'buy' or 'sell'
1398
+ * @param {float} amount how much of currency you want to trade in units of base currency
1399
+ * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1400
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1401
+ * @param {float} [params.triggerPrice] The price a trigger order is triggered at
1402
+ * @param {float} [params.stopLossPrice] price to trigger stop-loss orders
1403
+ * @param {float} [params.takeProfitPrice] price to trigger take-profit orders
1404
+ * @param {string} [params.trailingAmount] the quote amount to trail away from the current market price
1405
+ * @param {string} [params.trailingPercent] the percent to trail away from the current market price
1406
+ * @param {string} [params.trailingTriggerPrice] the price to trigger a trailing order, default uses the price argument
1407
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1408
+ */
1409
+ async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
1410
+ await this.loadMarkets();
1411
+ const market = this.market(symbol);
1412
+ const request = {
1413
+ // 'quantity': this.amountToPrecision (symbol, amount),
1414
+ // 'price': this.priceToPrecision (symbol, price),
1415
+ };
1416
+ if (price !== undefined) {
1417
+ request['price'] = this.priceToPrecision(symbol, price);
1418
+ }
1419
+ if (amount !== undefined) {
1420
+ request['quantity'] = this.amountToPrecision(symbol, amount);
1421
+ }
1422
+ const clientOrderIdUnified = this.safeString2(params, 'clOrdID', 'clientOrderId');
1423
+ const clientOrderIdExchangeSpecific = this.safeString(params, 'client_order_id', clientOrderIdUnified);
1424
+ const isByClientOrder = clientOrderIdExchangeSpecific !== undefined;
1425
+ const triggerPrice = this.safeNumberN(params, ['triggerPrice', 'stopPrice', 'takeProfitPrice', 'stopLossPrice']);
1426
+ if (triggerPrice !== undefined) {
1427
+ request['triggerPrice'] = this.priceToPrecision(symbol, triggerPrice);
1428
+ }
1429
+ const trailingTriggerPrice = this.safeString2(params, 'trailingTriggerPrice', 'activatedPrice', this.numberToString(price));
1430
+ const trailingAmount = this.safeString2(params, 'trailingAmount', 'callbackValue');
1431
+ const trailingPercent = this.safeString2(params, 'trailingPercent', 'callbackRate');
1432
+ const isTrailingAmountOrder = trailingAmount !== undefined;
1433
+ const isTrailingPercentOrder = trailingPercent !== undefined;
1434
+ const isTrailing = isTrailingAmountOrder || isTrailingPercentOrder;
1435
+ if (isTrailing) {
1436
+ if (trailingTriggerPrice !== undefined) {
1437
+ request['activatedPrice'] = this.priceToPrecision(symbol, trailingTriggerPrice);
1438
+ }
1439
+ if (isTrailingAmountOrder) {
1440
+ request['callbackValue'] = trailingAmount;
1441
+ }
1442
+ else if (isTrailingPercentOrder) {
1443
+ const convertedTrailingPercent = Precise.stringDiv(trailingPercent, '100');
1444
+ request['callbackRate'] = convertedTrailingPercent;
1445
+ }
1446
+ }
1447
+ params = this.omit(params, ['clOrdID', 'clientOrderId', 'client_order_id', 'stopPrice', 'triggerPrice', 'takeProfitPrice', 'stopLossPrice', 'trailingTriggerPrice', 'trailingAmount', 'trailingPercent']);
1448
+ const isConditional = isTrailing || (triggerPrice !== undefined) || (this.safeValue(params, 'childOrders') !== undefined);
1449
+ let response = undefined;
1450
+ if (isByClientOrder) {
1451
+ request['client_order_id'] = clientOrderIdExchangeSpecific;
1452
+ if (isConditional) {
1453
+ response = await this.v3PrivatePutAlgoOrderClientClientOrderId(this.extend(request, params));
1454
+ }
1455
+ else {
1456
+ response = await this.v3PrivatePutOrderClientClientOrderId(this.extend(request, params));
1457
+ }
1458
+ }
1459
+ else {
1460
+ request['oid'] = id;
1461
+ if (isConditional) {
1462
+ response = await this.v3PrivatePutAlgoOrderOid(this.extend(request, params));
1463
+ }
1464
+ else {
1465
+ response = await this.v3PrivatePutOrderOid(this.extend(request, params));
1466
+ }
1467
+ }
1468
+ //
1469
+ // {
1470
+ // "code": 0,
1471
+ // "data": {
1472
+ // "status": "string",
1473
+ // "success": true
1474
+ // },
1475
+ // "message": "string",
1476
+ // "success": true,
1477
+ // "timestamp": 0
1478
+ // }
1479
+ //
1480
+ const data = this.safeDict(response, 'data', {});
1481
+ return this.parseOrder(data, market);
1482
+ }
1483
+ /**
1484
+ * @method
1485
+ * @name woo#cancelOrder
1486
+ * @see https://developer.woox.io/api-reference/endpoint/trading/cancel_order
1487
+ * @see https://developer.woox.io/api-reference/endpoint/trading/cancel_algo_order
1488
+ * @description cancels an open order
1489
+ * @param {string} id order id
1490
+ * @param {string} symbol unified symbol of the market the order was made in
1491
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1492
+ * @param {boolean} [params.trigger] whether the order is a trigger/algo order
1493
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1494
+ */
1495
+ async cancelOrder(id, symbol = undefined, params = {}) {
1496
+ const isTrigger = this.safeBool2(params, 'trigger', 'stop', false);
1497
+ params = this.omit(params, ['trigger', 'stop']);
1498
+ if (!isTrigger && (symbol === undefined)) {
1499
+ throw new ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
1500
+ }
1501
+ await this.loadMarkets();
1502
+ let market = undefined;
1503
+ if (symbol !== undefined) {
1504
+ market = this.market(symbol);
1505
+ }
1506
+ const request = {};
1507
+ const clientOrderIdUnified = this.safeString2(params, 'clOrdID', 'clientOrderId');
1508
+ const clientOrderIdExchangeSpecific = this.safeString(params, 'client_order_id', clientOrderIdUnified);
1509
+ params = this.omit(params, ['clOrdID', 'clientOrderId', 'client_order_id']);
1510
+ const isByClientOrder = clientOrderIdExchangeSpecific !== undefined;
1511
+ let response = undefined;
1512
+ if (isTrigger) {
1513
+ if (isByClientOrder) {
1514
+ request['clientAlgoOrderId'] = clientOrderIdExchangeSpecific;
1515
+ }
1516
+ else {
1517
+ request['algoOrderId'] = id;
1518
+ }
1519
+ response = await this.v3PrivateDeleteTradeAlgoOrder(this.extend(request, params));
1520
+ }
1521
+ else {
1522
+ request['symbol'] = market['id'];
1523
+ if (isByClientOrder) {
1524
+ request['clientOrderId'] = clientOrderIdExchangeSpecific;
1525
+ }
1526
+ else {
1527
+ request['orderId'] = id;
1528
+ }
1529
+ response = await this.v3PrivateDeleteTradeOrder(this.extend(request, params));
1530
+ }
1531
+ //
1532
+ // {
1533
+ // "success": true,
1534
+ // "data": {
1535
+ // "status": "CANCEL_SENT"
1536
+ // },
1537
+ // "timestamp": 1751940315838
1538
+ // }
1539
+ //
1540
+ const data = this.safeDict(response, 'data', {});
1541
+ data['timestamp'] = this.safeString(response, 'timestamp');
1542
+ if (isByClientOrder) {
1543
+ data['clientOrderId'] = clientOrderIdExchangeSpecific;
1544
+ }
1545
+ else {
1546
+ data['orderId'] = id;
1547
+ }
1548
+ return this.parseOrder(data, market);
1549
+ }
1550
+ /**
1551
+ * @method
1552
+ * @name woo#cancelAllOrders
1553
+ * @see https://developer.woox.io/api-reference/endpoint/trading/cancel_all_order
1554
+ * @see https://developer.woox.io/api-reference/endpoint/trading/cancel_algo_orders
1555
+ * @description cancel all open orders in a market
1556
+ * @param {string} symbol unified market symbol
1557
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1558
+ * @param {boolean} [params.trigger] whether the order is a trigger/algo order
1559
+ * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1560
+ */
1561
+ async cancelAllOrders(symbol = undefined, params = {}) {
1562
+ await this.loadMarkets();
1563
+ const trigger = this.safeBool2(params, 'stop', 'trigger');
1564
+ params = this.omit(params, ['stop', 'trigger']);
1565
+ const request = {};
1566
+ if (symbol !== undefined) {
1567
+ const market = this.market(symbol);
1568
+ request['symbol'] = market['id'];
1569
+ }
1570
+ let response = undefined;
1571
+ if (trigger) {
1572
+ response = await this.v3PrivateDeleteTradeAlgoOrders(params);
1573
+ }
1574
+ else {
1575
+ response = await this.v3PrivateDeleteTradeOrders(this.extend(request, params));
1576
+ }
1577
+ //
1578
+ // {
1579
+ // "success": true,
1580
+ // "data": {
1581
+ // "status": "CANCEL_ALL_SENT"
1582
+ // },
1583
+ // "timestamp": 1751941988134
1584
+ // }
1585
+ //
1586
+ const data = this.safeDict(response, 'data', {});
1587
+ return [this.safeOrder({ 'info': data })];
1588
+ }
1589
+ /**
1590
+ * @method
1591
+ * @name woo#cancelAllOrdersAfter
1592
+ * @description dead man's switch, cancel all orders after the given timeout
1593
+ * @see https://developer.woox.io/api-reference/endpoint/trading/cancel_all_after
1594
+ * @param {number} timeout time in milliseconds, 0 represents cancel the timer
1595
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1596
+ * @returns {object} the api result
1597
+ */
1598
+ async cancelAllOrdersAfter(timeout, params = {}) {
1599
+ await this.loadMarkets();
1600
+ const request = {
1601
+ 'triggerAfter': (timeout > 0) ? Math.min(timeout, 900000) : 0,
1602
+ };
1603
+ const response = await this.v3PrivatePostTradeCancelAllAfter(this.extend(request, params));
1604
+ //
1605
+ // {
1606
+ // "success": true,
1607
+ // "timestamp": 123,
1608
+ // "data": {
1609
+ // "expectedTriggerTime": 123
1610
+ // }
1611
+ // }
1612
+ //
1613
+ return response;
1614
+ }
1615
+ /**
1616
+ * @method
1617
+ * @name woo#fetchOrder
1618
+ * @see https://developer.woox.io/api-reference/endpoint/trading/get_order
1619
+ * @see https://developer.woox.io/api-reference/endpoint/trading/get_algo_order
1620
+ * @description fetches information on an order made by the user
1621
+ * @param {string} id the order id
1622
+ * @param {string} symbol unified symbol of the market the order was made in
1623
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1624
+ * @param {boolean} [params.trigger] whether the order is a trigger/algo order
1625
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1626
+ */
1627
+ async fetchOrder(id, symbol = undefined, params = {}) {
1628
+ await this.loadMarkets();
1629
+ let market = undefined;
1630
+ if (symbol !== undefined) {
1631
+ market = this.market(symbol);
1632
+ }
1633
+ const trigger = this.safeBool2(params, 'stop', 'trigger');
1634
+ params = this.omit(params, ['stop', 'trigger']);
1635
+ const request = {};
1636
+ const clientOrderId = this.safeString2(params, 'clOrdID', 'clientOrderId');
1637
+ let response = undefined;
1638
+ if (trigger) {
1639
+ if (clientOrderId !== undefined) {
1640
+ request['clientAlgoOrderId'] = id;
1641
+ }
1642
+ else {
1643
+ request['algoOrderId'] = id;
1644
+ }
1645
+ response = await this.v3PrivateGetTradeAlgoOrder(this.extend(request, params));
1646
+ //
1647
+ // {
1648
+ // "success": true,
1649
+ // "data": {
1650
+ // "algoOrderId": 10399260,
1651
+ // "clientAlgoOrderId": 0,
1652
+ // "rootAlgoOrderId": 10399260,
1653
+ // "parentAlgoOrderId": 0,
1654
+ // "symbol": "SPOT_LTC_USDT",
1655
+ // "algoOrderTag": "default",
1656
+ // "algoType": "TAKE_PROFIT",
1657
+ // "side": "BUY",
1658
+ // "quantity": 0.1,
1659
+ // "isTriggered": false,
1660
+ // "triggerPrice": 65,
1661
+ // "triggerStatus": "USELESS",
1662
+ // "type": "LIMIT",
1663
+ // "rootAlgoStatus": "NEW",
1664
+ // "algoStatus": "NEW",
1665
+ // "triggerPriceType": "MARKET_PRICE",
1666
+ // "price": 60,
1667
+ // "triggerTime": "0",
1668
+ // "totalExecutedQuantity": 0,
1669
+ // "visibleQuantity": 0.1,
1670
+ // "averageExecutedPrice": 0,
1671
+ // "totalFee": 0,
1672
+ // "feeAsset": "",
1673
+ // "totalRebate": 0,
1674
+ // "rebateAsset": "",
1675
+ // "reduceOnly": false,
1676
+ // "createdTime": "1752049747.732",
1677
+ // "updatedTime": "1752049747.732",
1678
+ // "positionSide": "BOTH"
1679
+ // },
1680
+ // "timestamp": 1752049767550
1681
+ // }
1682
+ //
1683
+ }
1684
+ else {
1685
+ if (clientOrderId !== undefined) {
1686
+ request['clientOrderId'] = clientOrderId;
1687
+ }
1688
+ else {
1689
+ request['orderId'] = id;
1690
+ }
1691
+ response = await this.v3PrivateGetTradeOrder(this.extend(request, params));
1692
+ //
1693
+ // {
1694
+ // "success": true,
1695
+ // "data": {
1696
+ // "orderId": 60780315704,
1697
+ // "clientOrderId": 0,
1698
+ // "symbol": "SPOT_LTC_USDT",
1699
+ // "orderTag": "default",
1700
+ // "side": "BUY",
1701
+ // "quantity": 0.1,
1702
+ // "amount": null,
1703
+ // "type": "LIMIT",
1704
+ // "status": "NEW",
1705
+ // "price": 60,
1706
+ // "executed": 0,
1707
+ // "visible": 0.1,
1708
+ // "averageExecutedPrice": 0,
1709
+ // "totalFee": 0,
1710
+ // "feeAsset": "LTC",
1711
+ // "totalRebate": 0,
1712
+ // "rebateAsset": "USDT",
1713
+ // "reduceOnly": false,
1714
+ // "createdTime": "1752049062.496",
1715
+ // "realizedPnl": null,
1716
+ // "positionSide": "BOTH",
1717
+ // "bidAskLevel": null
1718
+ // },
1719
+ // "timestamp": 1752049393466
1720
+ // }
1721
+ //
1722
+ }
1723
+ const data = this.safeDict(response, 'data', {});
1724
+ return this.parseOrder(data, market);
1725
+ }
1726
+ /**
1727
+ * @method
1728
+ * @name woo#fetchOrders
1729
+ * @description fetches information on multiple orders made by the user
1730
+ * @see https://developer.woox.io/api-reference/endpoint/trading/get_orders
1731
+ * @see https://developer.woox.io/api-reference/endpoint/trading/get_algo_orders
1732
+ * @param {string} symbol unified market symbol of the market orders were made in
1733
+ * @param {int} [since] the earliest time in ms to fetch orders for
1734
+ * @param {int} [limit] the maximum number of order structures to retrieve
1735
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1736
+ * @param {boolean} [params.trigger] whether the order is a trigger/algo order
1737
+ * @param {boolean} [params.isTriggered] whether the order has been triggered (false by default)
1738
+ * @param {string} [params.side] 'buy' or 'sell'
1739
+ * @param {boolean} [params.paginate] set to true if you want to fetch orders with pagination
1740
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1741
+ */
1742
+ async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1743
+ await this.loadMarkets();
1744
+ let paginate = false;
1745
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOrders', 'paginate');
1746
+ if (paginate) {
1747
+ return await this.fetchPaginatedCallIncremental('fetchOrders', symbol, since, limit, params, 'page', 500);
1748
+ }
1749
+ const request = {};
1750
+ let market = undefined;
1751
+ const trigger = this.safeBool2(params, 'stop', 'trigger');
1752
+ params = this.omit(params, ['stop', 'trigger']);
1753
+ if (symbol !== undefined) {
1754
+ market = this.market(symbol);
1755
+ request['symbol'] = market['id'];
1756
+ }
1757
+ if (since !== undefined) {
1758
+ request['startTime'] = since;
1759
+ }
1760
+ const until = this.safeInteger(params, 'until'); // unified in milliseconds
1761
+ params = this.omit(params, ['until']);
1762
+ if (until !== undefined) {
1763
+ request['endTime'] = until;
1764
+ }
1765
+ if (limit !== undefined) {
1766
+ request['size'] = Math.min(limit, 500);
1767
+ }
1768
+ let response = undefined;
1769
+ if (trigger) {
1770
+ response = await this.v3PrivateGetTradeAlgoOrders(this.extend(request, params));
1771
+ //
1772
+ // {
1773
+ // "success": true,
1774
+ // "data": {
1775
+ // "rows": [
1776
+ // {
1777
+ // "algoOrderId": 10399260,
1778
+ // "clientAlgoOrderId": 0,
1779
+ // "rootAlgoOrderId": 10399260,
1780
+ // "parentAlgoOrderId": 0,
1781
+ // "symbol": "SPOT_LTC_USDT",
1782
+ // "algoOrderTag": "default",
1783
+ // "algoType": "TAKE_PROFIT",
1784
+ // "side": "BUY",
1785
+ // "quantity": 0.1,
1786
+ // "isTriggered": false,
1787
+ // "triggerPrice": 65,
1788
+ // "triggerStatus": "USELESS",
1789
+ // "type": "LIMIT",
1790
+ // "rootAlgoStatus": "NEW",
1791
+ // "algoStatus": "NEW",
1792
+ // "triggerPriceType": "MARKET_PRICE",
1793
+ // "price": 60,
1794
+ // "triggerTime": "0",
1795
+ // "totalExecutedQuantity": 0,
1796
+ // "visibleQuantity": 0.1,
1797
+ // "averageExecutedPrice": 0,
1798
+ // "totalFee": 0,
1799
+ // "feeAsset": "",
1800
+ // "totalRebate": 0,
1801
+ // "rebateAsset": "",
1802
+ // "reduceOnly": false,
1803
+ // "createdTime": "1752049747.730",
1804
+ // "updatedTime": "1752049747.730",
1805
+ // "positionSide": "BOTH"
1806
+ // }
1807
+ // ],
1808
+ // "meta": {
1809
+ // "total": 7,
1810
+ // "recordsPerPage": 1,
1811
+ // "currentPage": 1
1812
+ // }
1813
+ // },
1814
+ // "timestamp": 1752053127448
1815
+ // }
1816
+ //
1817
+ }
1818
+ else {
1819
+ response = await this.v3PrivateGetTradeOrders(this.extend(request, params));
1820
+ //
1821
+ // {
1822
+ // "success": true,
1823
+ // "data": {
1824
+ // "rows": [
1825
+ // {
1826
+ // "orderId": 60780315704,
1827
+ // "clientOrderId": 0,
1828
+ // "symbol": "SPOT_LTC_USDT",
1829
+ // "orderTag": "default",
1830
+ // "side": "BUY",
1831
+ // "quantity": 0.1,
1832
+ // "amount": null,
1833
+ // "type": "LIMIT",
1834
+ // "status": "NEW",
1835
+ // "price": 60,
1836
+ // "executed": 0,
1837
+ // "visible": 0.1,
1838
+ // "averageExecutedPrice": 0,
1839
+ // "totalFee": 0,
1840
+ // "feeAsset": "LTC",
1841
+ // "totalRebate": 0,
1842
+ // "rebateAsset": "USDT",
1843
+ // "reduceOnly": false,
1844
+ // "createdTime": "1752049062.496",
1845
+ // "realizedPnl": null,
1846
+ // "positionSide": "BOTH",
1847
+ // "bidAskLevel": null
1848
+ // }
1849
+ // ],
1850
+ // "meta": {
1851
+ // "total": 11,
1852
+ // "recordsPerPage": 1,
1853
+ // "currentPage": 1
1854
+ // }
1855
+ // },
1856
+ // "timestamp": 1752053061236
1857
+ // }
1858
+ //
1859
+ }
1860
+ const data = this.safeValue(response, 'data', {});
1861
+ const orders = this.safeList(data, 'rows', []);
1862
+ return this.parseOrders(orders, market, since, limit);
1863
+ }
1864
+ /**
1865
+ * @method
1866
+ * @name woo#fetchOpenOrders
1867
+ * @description fetches information on multiple orders made by the user
1868
+ * @see https://developer.woox.io/api-reference/endpoint/trading/get_orders
1869
+ * @see https://developer.woox.io/api-reference/endpoint/trading/get_algo_orders
1870
+ * @param {string} symbol unified market symbol of the market orders were made in
1871
+ * @param {int} [since] the earliest time in ms to fetch orders for
1872
+ * @param {int} [limit] the maximum number of order structures to retrieve
1873
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1874
+ * @param {boolean} [params.trigger] whether the order is a trigger/algo order
1875
+ * @param {boolean} [params.isTriggered] whether the order has been triggered (false by default)
1876
+ * @param {string} [params.side] 'buy' or 'sell'
1877
+ * @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
1878
+ * @param {boolean} [params.paginate] set to true if you want to fetch orders with pagination
1879
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1880
+ */
1881
+ async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1882
+ await this.loadMarkets();
1883
+ const extendedParams = this.extend(params, { 'status': 'INCOMPLETE' });
1884
+ return await this.fetchOrders(symbol, since, limit, extendedParams);
1885
+ }
1886
+ /**
1887
+ * @method
1888
+ * @name woo#fetchClosedOrders
1889
+ * @description fetches information on multiple orders made by the user
1890
+ * @see https://developer.woox.io/api-reference/endpoint/trading/get_orders
1891
+ * @see https://developer.woox.io/api-reference/endpoint/trading/get_algo_orders
1892
+ * @param {string} symbol unified market symbol of the market orders were made in
1893
+ * @param {int} [since] the earliest time in ms to fetch orders for
1894
+ * @param {int} [limit] the maximum number of order structures to retrieve
1895
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1896
+ * @param {boolean} [params.trigger] whether the order is a trigger/algo order
1897
+ * @param {boolean} [params.isTriggered] whether the order has been triggered (false by default)
1898
+ * @param {string} [params.side] 'buy' or 'sell'
1899
+ * @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
1900
+ * @param {boolean} [params.paginate] set to true if you want to fetch orders with pagination
1901
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1902
+ */
1903
+ async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1904
+ await this.loadMarkets();
1905
+ const extendedParams = this.extend(params, { 'status': 'COMPLETED' });
1906
+ return await this.fetchOrders(symbol, since, limit, extendedParams);
1907
+ }
1908
+ parseTimeInForce(timeInForce) {
1909
+ const timeInForces = {
1910
+ 'ioc': 'IOC',
1911
+ 'fok': 'FOK',
1912
+ 'post_only': 'PO',
1913
+ };
1914
+ return this.safeString(timeInForces, timeInForce, undefined);
1915
+ }
1916
+ parseOrder(order, market = undefined) {
1917
+ //
1918
+ // createOrder
1919
+ // {
1920
+ // "orderId": 60667653330,
1921
+ // "clientOrderId": 0,
1922
+ // "type": "LIMIT",
1923
+ // "price": 60,
1924
+ // "quantity": 0.1,
1925
+ // "amount": null,
1926
+ // "bidAskLevel": null,
1927
+ // "timestamp": 1751871779855
1928
+ // }
1929
+ //
1930
+ // createOrder - algo
1931
+ // {
1932
+ // "orderId": "1578938",
1933
+ // "clientOrderId": "0",
1934
+ // "algoType": "STOP_LOSS",
1935
+ // "quantity": "0.1",
1936
+ // "timestamp": "1686149372216"
1937
+ // }
1938
+ //
1939
+ // fetchOrder
1940
+ // {
1941
+ // "orderId": 60780315704,
1942
+ // "clientOrderId": 0,
1943
+ // "symbol": "SPOT_LTC_USDT",
1944
+ // "orderTag": "default",
1945
+ // "side": "BUY",
1946
+ // "quantity": 0.1,
1947
+ // "amount": null,
1948
+ // "type": "LIMIT",
1949
+ // "status": "NEW",
1950
+ // "price": 60,
1951
+ // "executed": 0,
1952
+ // "visible": 0.1,
1953
+ // "averageExecutedPrice": 0,
1954
+ // "totalFee": 0,
1955
+ // "feeAsset": "LTC",
1956
+ // "totalRebate": 0,
1957
+ // "rebateAsset": "USDT",
1958
+ // "reduceOnly": false,
1959
+ // "createdTime": "1752049062.496",
1960
+ // "realizedPnl": null,
1961
+ // "positionSide": "BOTH",
1962
+ // "bidAskLevel": null
1963
+ // }
1964
+ //
1965
+ // fetchOrder - algo
1966
+ // {
1967
+ // "algoOrderId": 10399260,
1968
+ // "clientAlgoOrderId": 0,
1969
+ // "rootAlgoOrderId": 10399260,
1970
+ // "parentAlgoOrderId": 0,
1971
+ // "symbol": "SPOT_LTC_USDT",
1972
+ // "algoOrderTag": "default",
1973
+ // "algoType": "TAKE_PROFIT",
1974
+ // "side": "BUY",
1975
+ // "quantity": 0.1,
1976
+ // "isTriggered": false,
1977
+ // "triggerPrice": 65,
1978
+ // "triggerStatus": "USELESS",
1979
+ // "type": "LIMIT",
1980
+ // "rootAlgoStatus": "NEW",
1981
+ // "algoStatus": "NEW",
1982
+ // "triggerPriceType": "MARKET_PRICE",
1983
+ // "price": 60,
1984
+ // "triggerTime": "0",
1985
+ // "totalExecutedQuantity": 0,
1986
+ // "visibleQuantity": 0.1,
1987
+ // "averageExecutedPrice": 0,
1988
+ // "totalFee": 0,
1989
+ // "feeAsset": "",
1990
+ // "totalRebate": 0,
1991
+ // "rebateAsset": "",
1992
+ // "reduceOnly": false,
1993
+ // "createdTime": "1752049747.732",
1994
+ // "updatedTime": "1752049747.732",
1995
+ // "positionSide": "BOTH"
1996
+ // }
1997
+ //
1998
+ let timestamp = this.safeTimestamp(order, 'createdTime');
1999
+ if (timestamp === undefined) {
2000
+ timestamp = this.safeInteger(order, 'timestamp');
2001
+ }
2002
+ const orderId = this.safeString2(order, 'orderId', 'algoOrderId');
2003
+ const clientOrderId = this.omitZero(this.safeString2(order, 'clientOrderId', 'clientAlgoOrderId')); // Somehow, this always returns 0 for limit order
2004
+ const marketId = this.safeString(order, 'symbol');
2005
+ market = this.safeMarket(marketId, market);
2006
+ const symbol = market['symbol'];
2007
+ const price = this.safeString(order, 'price');
2008
+ const amount = this.safeString(order, 'quantity'); // This is base amount
2009
+ const cost = this.safeString(order, 'amount'); // This is quote amount
2010
+ const orderType = this.safeStringLower(order, 'type');
2011
+ const status = this.safeValue2(order, 'status', 'algoStatus');
2012
+ const side = this.safeStringLower(order, 'side');
2013
+ const filled = this.omitZero(this.safeValue2(order, 'executed', 'totalExecutedQuantity'));
2014
+ const average = this.omitZero(this.safeString(order, 'averageExecutedPrice'));
2015
+ // const remaining = Precise.stringSub (cost, filled);
2016
+ const fee = this.safeNumber(order, 'totalFee');
2017
+ const feeCurrency = this.safeString(order, 'feeAsset');
2018
+ const triggerPrice = this.safeNumber(order, 'triggerPrice');
2019
+ const lastUpdateTimestamp = this.safeTimestamp(order, 'updatedTime');
2020
+ return this.safeOrder({
2021
+ 'id': orderId,
2022
+ 'clientOrderId': clientOrderId,
2023
+ 'timestamp': timestamp,
2024
+ 'datetime': this.iso8601(timestamp),
2025
+ 'lastTradeTimestamp': undefined,
2026
+ 'lastUpdateTimestamp': lastUpdateTimestamp,
2027
+ 'status': this.parseOrderStatus(status),
2028
+ 'symbol': symbol,
2029
+ 'type': orderType,
2030
+ 'timeInForce': this.parseTimeInForce(orderType),
2031
+ 'postOnly': undefined,
2032
+ 'reduceOnly': this.safeBool(order, 'reduceOnly'),
2033
+ 'side': side,
2034
+ 'price': price,
2035
+ 'triggerPrice': triggerPrice,
2036
+ 'takeProfitPrice': undefined,
2037
+ 'stopLossPrice': undefined,
2038
+ 'average': average,
2039
+ 'amount': amount,
2040
+ 'filled': filled,
2041
+ 'remaining': undefined,
2042
+ 'cost': cost,
2043
+ 'trades': undefined,
2044
+ 'fee': {
2045
+ 'cost': fee,
2046
+ 'currency': feeCurrency,
2047
+ },
2048
+ 'info': order,
2049
+ }, market);
2050
+ }
2051
+ parseOrderStatus(status) {
2052
+ if (status !== undefined) {
2053
+ const statuses = {
2054
+ 'NEW': 'open',
2055
+ 'FILLED': 'closed',
2056
+ 'CANCEL_SENT': 'canceled',
2057
+ 'CANCEL_ALL_SENT': 'canceled',
2058
+ 'CANCELLED': 'canceled',
2059
+ 'PARTIAL_FILLED': 'open',
2060
+ 'REJECTED': 'rejected',
2061
+ 'INCOMPLETE': 'open',
2062
+ 'COMPLETED': 'closed',
2063
+ };
2064
+ return this.safeString(statuses, status, status);
2065
+ }
2066
+ return status;
2067
+ }
2068
+ /**
2069
+ * @method
2070
+ * @name woo#fetchOrderBook
2071
+ * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
2072
+ * @see https://developer.woox.io/api-reference/endpoint/public_data/orderbook
2073
+ * @param {string} symbol unified symbol of the market to fetch the order book for
2074
+ * @param {int} [limit] the maximum amount of order book entries to return
2075
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2076
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
2077
+ */
2078
+ async fetchOrderBook(symbol, limit = undefined, params = {}) {
2079
+ await this.loadMarkets();
2080
+ const market = this.market(symbol);
2081
+ const request = {
2082
+ 'symbol': market['id'],
2083
+ };
2084
+ if (limit !== undefined) {
2085
+ request['maxLevel'] = limit;
2086
+ }
2087
+ const response = await this.v3PublicGetOrderbook(this.extend(request, params));
2088
+ //
2089
+ // }
2090
+ // {
2091
+ // "success": true,
2092
+ // "timestamp": 1751620923344,
2093
+ // "data": {
2094
+ // "asks": [
2095
+ // {
2096
+ // "price": "108924.86",
2097
+ // "quantity": "0.032126"
2098
+ // }
2099
+ // ],
2100
+ // "bids": [
2101
+ // {
2102
+ // "price": "108924.85",
2103
+ // "quantity": "1.714147"
2104
+ // }
2105
+ // ]
2106
+ // }
2107
+ // }
2108
+ //
2109
+ const data = this.safeDict(response, 'data', {});
2110
+ const timestamp = this.safeInteger(response, 'timestamp');
2111
+ return this.parseOrderBook(data, symbol, timestamp, 'bids', 'asks', 'price', 'quantity');
2112
+ }
2113
+ /**
2114
+ * @method
2115
+ * @name woo#fetchOHLCV
2116
+ * @see https://developer.woox.io/api-reference/endpoint/public_data/klineHistory
2117
+ * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
2118
+ * @param {string} symbol unified symbol of the market to fetch OHLCV data for
2119
+ * @param {string} timeframe the length of time each candle represents
2120
+ * @param {int} [since] timestamp in ms of the earliest candle to fetch
2121
+ * @param {int} [limit] max=1000, max=100 when since is defined and is less than (now - (999 * (timeframe in ms)))
2122
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2123
+ * @param {int} [params.until] the latest time in ms to fetch entries for
2124
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
2125
+ */
2126
+ async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
2127
+ await this.loadMarkets();
2128
+ const market = this.market(symbol);
2129
+ const request = {
2130
+ 'symbol': market['id'],
2131
+ 'type': this.safeString(this.timeframes, timeframe, timeframe),
2132
+ };
2133
+ if (limit !== undefined) {
2134
+ request['limit'] = Math.min(limit, 1000);
2135
+ }
2136
+ if (since !== undefined) {
2137
+ request['after'] = since;
2138
+ }
2139
+ const until = this.safeInteger(params, 'until');
2140
+ params = this.omit(params, 'until');
2141
+ if (until !== undefined) {
2142
+ request['before'] = until;
2143
+ }
2144
+ const response = await this.v3PublicGetKlineHistory(this.extend(request, params));
2145
+ //
2146
+ // {
2147
+ // "success": true,
2148
+ // "data": {
2149
+ // "rows": [
2150
+ // {
2151
+ // "symbol": "SPOT_BTC_USDT",
2152
+ // "open": "108994.16",
2153
+ // "close": "108994.16",
2154
+ // "high": "108994.16",
2155
+ // "low": "108994.16",
2156
+ // "volume": "0",
2157
+ // "amount": "0",
2158
+ // "type": "1m",
2159
+ // "startTimestamp": 1751622120000,
2160
+ // "endTimestamp": 1751622180000
2161
+ // }
2162
+ // ]
2163
+ // },
2164
+ // "timestamp": 1751622205410
2165
+ // }
2166
+ //
2167
+ const data = this.safeDict(response, 'data', {});
2168
+ const rows = this.safeList(data, 'rows', []);
2169
+ return this.parseOHLCVs(rows, market, timeframe, since, limit);
2170
+ }
2171
+ parseOHLCV(ohlcv, market = undefined) {
2172
+ return [
2173
+ this.safeInteger(ohlcv, 'startTimestamp'),
2174
+ this.safeNumber(ohlcv, 'open'),
2175
+ this.safeNumber(ohlcv, 'high'),
2176
+ this.safeNumber(ohlcv, 'low'),
2177
+ this.safeNumber(ohlcv, 'close'),
2178
+ this.safeNumber(ohlcv, 'volume'),
2179
+ ];
2180
+ }
2181
+ /**
2182
+ * @method
2183
+ * @name woo#fetchOrderTrades
2184
+ * @description fetch all the trades made from a single order
2185
+ * @see https://docs.woox.io/#get-trades
2186
+ * @param {string} id order id
2187
+ * @param {string} symbol unified market symbol
2188
+ * @param {int} [since] the earliest time in ms to fetch trades for
2189
+ * @param {int} [limit] the maximum number of trades to retrieve
2190
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2191
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
2192
+ */
2193
+ async fetchOrderTrades(id, symbol = undefined, since = undefined, limit = undefined, params = {}) {
2194
+ await this.loadMarkets();
2195
+ let market = undefined;
2196
+ if (symbol !== undefined) {
2197
+ market = this.market(symbol);
2198
+ }
2199
+ const request = {
2200
+ 'oid': id,
2201
+ };
2202
+ const response = await this.v1PrivateGetOrderOidTrades(this.extend(request, params));
2203
+ // {
2204
+ // "success": true,
2205
+ // "rows": [
2206
+ // {
2207
+ // "id": "99111647",
2208
+ // "symbol": "SPOT_WOO_USDT",
2209
+ // "fee": "0.0024",
2210
+ // "side": "BUY",
2211
+ // "executed_timestamp": "1641482113.084",
2212
+ // "order_id": "87541111",
2213
+ // "order_tag": "default",
2214
+ // "executed_price": "1",
2215
+ // "executed_quantity": "12",
2216
+ // "fee_asset": "WOO",
2217
+ // "is_maker": "1"
2218
+ // }
2219
+ // ]
2220
+ // }
2221
+ const trades = this.safeList(response, 'rows', []);
2222
+ return this.parseTrades(trades, market, since, limit, params);
2223
+ }
2224
+ /**
2225
+ * @method
2226
+ * @name woo#fetchMyTrades
2227
+ * @description fetch all trades made by the user
2228
+ * @see https://developer.woox.io/api-reference/endpoint/trading/get_transactions
2229
+ * @param {string} symbol unified market symbol
2230
+ * @param {int} [since] the earliest time in ms to fetch trades for
2231
+ * @param {int} [limit] the maximum number of trades structures to retrieve
2232
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2233
+ * @param {boolean} [params.paginate] set to true if you want to fetch trades with pagination
2234
+ * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
2235
+ */
2236
+ async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
2237
+ await this.loadMarkets();
2238
+ let paginate = false;
2239
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
2240
+ if (paginate) {
2241
+ return await this.fetchPaginatedCallIncremental('fetchMyTrades', symbol, since, limit, params, 'page', 500);
2242
+ }
2243
+ const request = {};
2244
+ let market = undefined;
2245
+ if (symbol !== undefined) {
2246
+ market = this.market(symbol);
2247
+ request['symbol'] = market['id'];
2248
+ }
2249
+ if (since !== undefined) {
2250
+ request['startTime'] = since;
2251
+ }
2252
+ const until = this.safeInteger(params, 'until'); // unified in milliseconds
2253
+ params = this.omit(params, ['until']);
2254
+ if (until !== undefined) {
2255
+ request['endTime'] = until;
2256
+ }
2257
+ if (limit !== undefined) {
2258
+ request['limit'] = limit;
2259
+ }
2260
+ const response = await this.v3PrivateGetTradeTransactionHistory(this.extend(request, params));
2261
+ //
2262
+ // {
2263
+ // "success": true,
2264
+ // "data": {
2265
+ // "rows": [
2266
+ // {
2267
+ // "id": 1734947821,
2268
+ // "symbol": "SPOT_LTC_USDT",
2269
+ // "orderId": 60780383217,
2270
+ // "executedPrice": 87.86,
2271
+ // "executedQuantity": 0.1,
2272
+ // "fee": 0.0001,
2273
+ // "realizedPnl": null,
2274
+ // "feeAsset": "LTC",
2275
+ // "orderTag": "default",
2276
+ // "side": "BUY",
2277
+ // "executedTimestamp": "1752055173.630",
2278
+ // "isMaker": 0
2279
+ // }
2280
+ // ],
2281
+ // "meta": {
2282
+ // "total": 1,
2283
+ // "recordsPerPage": 100,
2284
+ // "currentPage": 1
2285
+ // }
2286
+ // },
2287
+ // "timestamp": 1752055545121
2288
+ // }
2289
+ //
2290
+ const data = this.safeDict(response, 'data', {});
2291
+ const trades = this.safeList(data, 'rows', []);
2292
+ return this.parseTrades(trades, market, since, limit, params);
2293
+ }
2294
+ /**
2295
+ * @method
2296
+ * @name woo#fetchAccounts
2297
+ * @description fetch all the accounts associated with a profile
2298
+ * @see https://developer.woox.io/api-reference/endpoint/account/get_account_info
2299
+ * @see https://developer.woox.io/api-reference/endpoint/account/sub_accounts
2300
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2301
+ * @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
2302
+ */
2303
+ async fetchAccounts(params = {}) {
2304
+ const mainAccountPromise = this.v3PrivateGetAccountInfo(params);
2305
+ //
2306
+ // {
2307
+ // "success": true,
2308
+ // "data": {
2309
+ // "applicationId": "251bf5c4-f3c8-4544-bb8b-80001007c3c0",
2310
+ // "account": "carlos_jose_lima@yahoo.com",
2311
+ // "alias": "carlos_jose_lima@yahoo.com",
2312
+ // "otpauth": true,
2313
+ // "accountMode": "FUTURES",
2314
+ // "positionMode": "ONE_WAY",
2315
+ // "leverage": 0,
2316
+ // "marginRatio": "10",
2317
+ // "openMarginRatio": "10",
2318
+ // "initialMarginRatio": "10",
2319
+ // "maintenanceMarginRatio": "0.03",
2320
+ // "totalCollateral": "165.55629469",
2321
+ // "freeCollateral": "165.55629469",
2322
+ // "totalAccountValue": "167.32418611",
2323
+ // "totalTradingValue": "167.32418611",
2324
+ // "totalVaultValue": "0",
2325
+ // "totalStakingValue": "0",
2326
+ // "totalLaunchpadValue": "0",
2327
+ // "totalEarnValue": "0",
2328
+ // "referrerID": null,
2329
+ // "accountType": "Main"
2330
+ // },
2331
+ // "timestamp": 1752062807915
2332
+ // }
2333
+ //
2334
+ const subAccountPromise = this.v3PrivateGetAccountSubAccountsAll(params);
2335
+ //
2336
+ // {
2337
+ // "success": true,
2338
+ // "data": {
2339
+ // "rows": [
2340
+ // {
2341
+ // "applicationId": "6b43de5c-0955-4887-9862-d84e4689f9fe",
2342
+ // "name": "sub_account_2",
2343
+ // "createdTime": "1606897264.994"
2344
+ // },
2345
+ // ]
2346
+ // },
2347
+ // "timestamp": 1721295317627
2348
+ // }
2349
+ //
2350
+ const [mainAccountResponse, subAccountResponse] = await Promise.all([mainAccountPromise, subAccountPromise]);
2351
+ const mainData = this.safeDict(mainAccountResponse, 'data', {});
2352
+ const mainRows = [mainData];
2353
+ const subData = this.safeDict(subAccountResponse, 'data', {});
2354
+ const subRows = this.safeList(subData, 'rows', []);
2355
+ const rows = this.arrayConcat(mainRows, subRows);
2356
+ return this.parseAccounts(rows, params);
2357
+ }
2358
+ parseAccount(account) {
2359
+ //
2360
+ // {
2361
+ // "applicationId": "251bf5c4-f3c8-4544-bb8b-80001007c3c0",
2362
+ // "account": "carlos_jose_lima@yahoo.com",
2363
+ // "alias": "carlos_jose_lima@yahoo.com",
2364
+ // "otpauth": true,
2365
+ // "accountMode": "FUTURES",
2366
+ // "positionMode": "ONE_WAY",
2367
+ // "leverage": 0,
2368
+ // "marginRatio": "10",
2369
+ // "openMarginRatio": "10",
2370
+ // "initialMarginRatio": "10",
2371
+ // "maintenanceMarginRatio": "0.03",
2372
+ // "totalCollateral": "165.55629469",
2373
+ // "freeCollateral": "165.55629469",
2374
+ // "totalAccountValue": "167.32418611",
2375
+ // "totalTradingValue": "167.32418611",
2376
+ // "totalVaultValue": "0",
2377
+ // "totalStakingValue": "0",
2378
+ // "totalLaunchpadValue": "0",
2379
+ // "totalEarnValue": "0",
2380
+ // "referrerID": null,
2381
+ // "accountType": "Main"
2382
+ // }
2383
+ //
2384
+ // {
2385
+ // "applicationId": "6b43de5c-0955-4887-9862-d84e4689f9fe",
2386
+ // "name": "sub_account_2",
2387
+ // "createdTime": "1606897264.994"
2388
+ // }
2389
+ //
2390
+ return {
2391
+ 'info': account,
2392
+ 'id': this.safeString(account, 'applicationId'),
2393
+ 'name': this.safeStringN(account, ['name', 'account', 'alias']),
2394
+ 'code': undefined,
2395
+ 'type': this.safeStringLower(account, 'accountType', 'subaccount'),
2396
+ };
2397
+ }
2398
+ /**
2399
+ * @method
2400
+ * @name woo#fetchBalance
2401
+ * @description query for balance and get the amount of funds available for trading or funds locked in orders
2402
+ * @see https://docs.woox.io/#get-current-holding-get-balance-new
2403
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2404
+ * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
2405
+ */
2406
+ async fetchBalance(params = {}) {
2407
+ await this.loadMarkets();
2408
+ const response = await this.v3PrivateGetBalances(params);
2409
+ //
2410
+ // {
2411
+ // "success": true,
2412
+ // "data": {
2413
+ // "holding": [
2414
+ // {
2415
+ // "token": "0_token",
2416
+ // "holding": 1,
2417
+ // "frozen": 0,
2418
+ // "staked": 0,
2419
+ // "unbonding": 0,
2420
+ // "vault": 0,
2421
+ // "interest": 0,
2422
+ // "pendingShortQty": 0,
2423
+ // "pendingLongQty": 0,
2424
+ // "availableBalance": 0,
2425
+ // "updatedTime": 312321.121
2426
+ // }
2427
+ // ]
2428
+ // },
2429
+ // "timestamp": 1673323746259
2430
+ // }
2431
+ //
2432
+ const data = this.safeDict(response, 'data');
2433
+ return this.parseBalance(data);
2434
+ }
2435
+ parseBalance(response) {
2436
+ const result = {
2437
+ 'info': response,
2438
+ };
2439
+ const balances = this.safeList(response, 'holding', []);
2440
+ for (let i = 0; i < balances.length; i++) {
2441
+ const balance = balances[i];
2442
+ const code = this.safeCurrencyCode(this.safeString(balance, 'token'));
2443
+ const account = this.account();
2444
+ account['total'] = this.safeString(balance, 'holding');
2445
+ account['free'] = this.safeString(balance, 'availableBalance');
2446
+ result[code] = account;
2447
+ }
2448
+ return this.safeBalance(result);
2449
+ }
2450
+ /**
2451
+ * @method
2452
+ * @name woo#fetchDepositAddress
2453
+ * @description fetch the deposit address for a currency associated with this account
2454
+ * @see https://developer.woox.io/api-reference/endpoint/assets/get_wallet_deposit
2455
+ * @param {string} code unified currency code
2456
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2457
+ * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
2458
+ */
2459
+ async fetchDepositAddress(code, params = {}) {
2460
+ // this method is TODO because of networks unification
2461
+ await this.loadMarkets();
2462
+ const currency = this.currency(code);
2463
+ let networkCode = undefined;
2464
+ [networkCode, params] = this.handleNetworkCodeAndParams(params);
2465
+ const request = {
2466
+ 'token': currency['id'],
2467
+ 'network': this.networkCodeToId(networkCode),
2468
+ };
2469
+ const response = await this.v3PrivateGetAssetWalletDeposit(this.extend(request, params));
2470
+ //
2471
+ // {
2472
+ // "success": true,
2473
+ // "data": {
2474
+ // "address": "0x31d64B3230f8baDD91dE1710A65DF536aF8f7cDa",
2475
+ // "extra": ""
2476
+ // },
2477
+ // "timestamp": 1721300689532
2478
+ // }
2479
+ //
2480
+ const data = this.safeDict(response, 'data', {});
2481
+ return this.parseDepositAddress(data, currency);
2482
+ }
2483
+ getDedicatedNetworkId(currency, params) {
2484
+ let networkCode = undefined;
2485
+ [networkCode, params] = this.handleNetworkCodeAndParams(params);
2486
+ networkCode = this.networkIdToCode(networkCode, currency['code']);
2487
+ const networkEntry = this.safeDict(currency['networks'], networkCode);
2488
+ if (networkEntry === undefined) {
2489
+ const supportedNetworks = Object.keys(currency['networks']);
2490
+ throw new BadRequest(this.id + ' can not determine a network code, please provide unified "network" param, one from the following: ' + this.json(supportedNetworks));
2491
+ }
2492
+ const currentyNetworkId = this.safeString(networkEntry, 'currencyNetworkId');
2493
+ return [currentyNetworkId, params];
2494
+ }
2495
+ parseDepositAddress(depositEntry, currency = undefined) {
2496
+ const address = this.safeString(depositEntry, 'address');
2497
+ this.checkAddress(address);
2498
+ return {
2499
+ 'info': depositEntry,
2500
+ 'currency': this.safeString(currency, 'code'),
2501
+ 'network': undefined,
2502
+ 'address': address,
2503
+ 'tag': this.safeString(depositEntry, 'extra'),
2504
+ };
2505
+ }
2506
+ async getAssetHistoryRows(code = undefined, since = undefined, limit = undefined, params = {}) {
2507
+ await this.loadMarkets();
2508
+ const request = {};
2509
+ let currency = undefined;
2510
+ if (code !== undefined) {
2511
+ currency = this.currency(code);
2512
+ request['token'] = currency['id'];
2513
+ }
2514
+ let networkCode = undefined;
2515
+ [networkCode, params] = this.handleNetworkCodeAndParams(params);
2516
+ if (networkCode !== undefined) {
2517
+ request['network'] = this.networkCodeToId(networkCode);
2518
+ }
2519
+ if (since !== undefined) {
2520
+ request['startTime'] = since;
2521
+ }
2522
+ if (limit !== undefined) {
2523
+ request['size'] = Math.min(limit, 1000);
2524
+ }
2525
+ const transactionType = this.safeString(params, 'type');
2526
+ params = this.omit(params, 'type');
2527
+ if (transactionType !== undefined) {
2528
+ request['type'] = transactionType;
2529
+ }
2530
+ const response = await this.v3PrivateGetAssetWalletHistory(this.extend(request, params));
2531
+ //
2532
+ // {
2533
+ // "success": true,
2534
+ // "data": {
2535
+ // "rows": [
2536
+ // {
2537
+ // "createdTime": "1734964440.523",
2538
+ // "updatedTime": "1734964614.081",
2539
+ // "id": "24122314340000585",
2540
+ // "externalId": "241223143600621",
2541
+ // "applicationId": "251bf5c4-f3c8-4544-bb8b-80001007c3c0",
2542
+ // "token": "ARB_USDCNATIVE",
2543
+ // "targetAddress": "0x4d6802d2736daa85e6242ef0dc0f00aa0e68f635",
2544
+ // "sourceAddress": "0x63DFE4e34A3bFC00eB0220786238a7C6cEF8Ffc4",
2545
+ // "extra": "",
2546
+ // "type": "BALANCE",
2547
+ // "tokenSide": "WITHDRAW",
2548
+ // "amount": "10.00000000",
2549
+ // "txId": "0x891ade0a47fd55466bb9d06702bea4edcb75ed9367d9afbc47b93a84f496d2e6",
2550
+ // "feeToken": "USDC",
2551
+ // "feeAmount": "2",
2552
+ // "status": "COMPLETED",
2553
+ // "confirmingThreshold": null,
2554
+ // "confirmedNumber": null
2555
+ // }
2556
+ // ],
2557
+ // "meta": {
2558
+ // "total": 1,
2559
+ // "records_per_page": 25,
2560
+ // "current_page": 1
2561
+ // }
2562
+ // },
2563
+ // "timestamp": 1752485344719
2564
+ // }
2565
+ //
2566
+ const data = this.safeDict(response, 'data', {});
2567
+ return [currency, this.safeList(data, 'rows', [])];
2568
+ }
2569
+ /**
2570
+ * @method
2571
+ * @name woo#fetchLedger
2572
+ * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
2573
+ * @see https://developer.woox.io/api-reference/endpoint/assets/get_wallet_history
2574
+ * @param {string} [code] unified currency code, default is undefined
2575
+ * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
2576
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
2577
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2578
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger}
2579
+ */
2580
+ async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
2581
+ const currencyRows = await this.getAssetHistoryRows(code, since, limit, params);
2582
+ const currency = this.safeValue(currencyRows, 0);
2583
+ const rows = this.safeList(currencyRows, 1);
2584
+ return this.parseLedger(rows, currency, since, limit, params);
2585
+ }
2586
+ parseLedgerEntry(item, currency = undefined) {
2587
+ //
2588
+ // {
2589
+ // "createdTime": "1734964440.523",
2590
+ // "updatedTime": "1734964614.081",
2591
+ // "id": "24122314340000585",
2592
+ // "externalId": "241223143600621",
2593
+ // "applicationId": "251bf5c4-f3c8-4544-bb8b-80001007c3c0",
2594
+ // "token": "ARB_USDCNATIVE",
2595
+ // "targetAddress": "0x4d6802d2736daa85e6242ef0dc0f00aa0e68f635",
2596
+ // "sourceAddress": "0x63DFE4e34A3bFC00eB0220786238a7C6cEF8Ffc4",
2597
+ // "extra": "",
2598
+ // "type": "BALANCE",
2599
+ // "tokenSide": "WITHDRAW",
2600
+ // "amount": "10.00000000",
2601
+ // "txId": "0x891ade0a47fd55466bb9d06702bea4edcb75ed9367d9afbc47b93a84f496d2e6",
2602
+ // "feeToken": "USDC",
2603
+ // "feeAmount": "2",
2604
+ // "status": "COMPLETED",
2605
+ // "confirmingThreshold": null,
2606
+ // "confirmedNumber": null
2607
+ // }
2608
+ //
2609
+ const networkizedCode = this.safeString(item, 'token');
2610
+ const code = this.safeCurrencyCode(networkizedCode, currency);
2611
+ currency = this.safeCurrency(code, currency);
2612
+ const amount = this.safeNumber(item, 'amount');
2613
+ const side = this.safeString(item, 'tokenSide');
2614
+ const direction = (side === 'DEPOSIT') ? 'in' : 'out';
2615
+ const timestamp = this.safeTimestamp(item, 'createdTime');
2616
+ const fee = this.parseTokenAndFeeTemp(item, ['feeToken'], ['feeAmount']);
2617
+ return this.safeLedgerEntry({
2618
+ 'info': item,
2619
+ 'id': this.safeString(item, 'id'),
2620
+ 'currency': code,
2621
+ 'account': this.safeString(item, 'account'),
2622
+ 'referenceAccount': undefined,
2623
+ 'referenceId': this.safeString(item, 'txId'),
2624
+ 'status': this.parseTransactionStatus(this.safeString(item, 'status')),
2625
+ 'amount': amount,
2626
+ 'before': undefined,
2627
+ 'after': undefined,
2628
+ 'direction': direction,
2629
+ 'timestamp': timestamp,
2630
+ 'datetime': this.iso8601(timestamp),
2631
+ 'type': this.parseLedgerEntryType(this.safeString(item, 'type')),
2632
+ 'fee': fee,
2633
+ }, currency);
2634
+ }
2635
+ parseLedgerEntryType(type) {
2636
+ const types = {
2637
+ 'BALANCE': 'transaction',
2638
+ 'COLLATERAL': 'transfer', // Funds moved between portfolios
2639
+ };
2640
+ return this.safeString(types, type, type);
2641
+ }
2642
+ getCurrencyFromChaincode(networkizedCode, currency) {
2643
+ if (currency !== undefined) {
2644
+ return currency;
2645
+ }
2646
+ else {
2647
+ const parts = networkizedCode.split('_');
2648
+ const partsLength = parts.length;
2649
+ const firstPart = this.safeString(parts, 0);
2650
+ let currencyId = this.safeString(parts, 1, firstPart);
2651
+ if (partsLength > 2) {
2652
+ currencyId += '_' + this.safeString(parts, 2);
2653
+ }
2654
+ currency = this.safeCurrency(currencyId);
2655
+ }
2656
+ return currency;
2657
+ }
2658
+ /**
2659
+ * @method
2660
+ * @name woo#fetchDeposits
2661
+ * @description fetch all deposits made to an account
2662
+ * @see https://developer.woox.io/api-reference/endpoint/assets/get_wallet_history
2663
+ * @param {string} code unified currency code
2664
+ * @param {int} [since] the earliest time in ms to fetch deposits for
2665
+ * @param {int} [limit] the maximum number of deposits structures to retrieve
2666
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2667
+ * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
2668
+ */
2669
+ async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
2670
+ const request = {
2671
+ 'tokenSide': 'DEPOSIT',
2672
+ };
2673
+ return await this.fetchDepositsWithdrawals(code, since, limit, this.extend(request, params));
2674
+ }
2675
+ /**
2676
+ * @method
2677
+ * @name woo#fetchWithdrawals
2678
+ * @description fetch all withdrawals made from an account
2679
+ * @see https://developer.woox.io/api-reference/endpoint/assets/get_wallet_history
2680
+ * @param {string} code unified currency code
2681
+ * @param {int} [since] the earliest time in ms to fetch withdrawals for
2682
+ * @param {int} [limit] the maximum number of withdrawals structures to retrieve
2683
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2684
+ * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
2685
+ */
2686
+ async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
2687
+ const request = {
2688
+ 'tokenSide': 'WITHDRAW',
2689
+ };
2690
+ return await this.fetchDepositsWithdrawals(code, since, limit, this.extend(request, params));
2691
+ }
2692
+ /**
2693
+ * @method
2694
+ * @name woo#fetchDepositsWithdrawals
2695
+ * @description fetch history of deposits and withdrawals
2696
+ * @see https://developer.woox.io/api-reference/endpoint/assets/get_wallet_history
2697
+ * @param {string} [code] unified currency code for the currency of the deposit/withdrawals, default is undefined
2698
+ * @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
2699
+ * @param {int} [limit] max number of deposit/withdrawals to return, default is undefined
2700
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2701
+ * @returns {object} a list of [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
2702
+ */
2703
+ async fetchDepositsWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
2704
+ const request = {
2705
+ 'type': 'BALANCE',
2706
+ };
2707
+ const currencyRows = await this.getAssetHistoryRows(code, since, limit, this.extend(request, params));
2708
+ const currency = this.safeValue(currencyRows, 0);
2709
+ const rows = this.safeList(currencyRows, 1);
2710
+ return this.parseTransactions(rows, currency, since, limit, params);
2711
+ }
2712
+ parseTransaction(transaction, currency = undefined) {
2713
+ //
2714
+ // {
2715
+ // "createdTime": "1734964440.523",
2716
+ // "updatedTime": "1734964614.081",
2717
+ // "id": "24122314340000585",
2718
+ // "externalId": "241223143600621",
2719
+ // "applicationId": "251bf5c4-f3c8-4544-bb8b-80001007c3c0",
2720
+ // "token": "ARB_USDCNATIVE",
2721
+ // "targetAddress": "0x4d6802d2736daa85e6242ef0dc0f00aa0e68f635",
2722
+ // "sourceAddress": "0x63DFE4e34A3bFC00eB0220786238a7C6cEF8Ffc4",
2723
+ // "extra": "",
2724
+ // "type": "BALANCE",
2725
+ // "tokenSide": "WITHDRAW",
2726
+ // "amount": "10.00000000",
2727
+ // "txId": "0x891ade0a47fd55466bb9d06702bea4edcb75ed9367d9afbc47b93a84f496d2e6",
2728
+ // "feeToken": "USDC",
2729
+ // "feeAmount": "2",
2730
+ // "status": "COMPLETED",
2731
+ // "confirmingThreshold": null,
2732
+ // "confirmedNumber": null
2733
+ // }
2734
+ //
2735
+ const networkizedCode = this.safeString(transaction, 'token');
2736
+ const currencyDefined = this.getCurrencyFromChaincode(networkizedCode, currency);
2737
+ const code = currencyDefined['code'];
2738
+ let movementDirection = this.safeStringLower2(transaction, 'token_side', 'tokenSide');
2739
+ if (movementDirection === 'withdraw') {
2740
+ movementDirection = 'withdrawal';
2741
+ }
2742
+ const fee = this.parseTokenAndFeeTemp(transaction, ['fee_token', 'feeToken'], ['fee_amount', 'feeAmount']);
2743
+ const addressTo = this.safeString2(transaction, 'target_address', 'targetAddress');
2744
+ const addressFrom = this.safeString2(transaction, 'source_address', 'sourceAddress');
2745
+ const timestamp = this.safeTimestamp2(transaction, 'created_time', 'createdTime');
2746
+ return {
2747
+ 'info': transaction,
2748
+ 'id': this.safeStringN(transaction, ['id', 'withdraw_id', 'withdrawId']),
2749
+ 'txid': this.safeString2(transaction, 'tx_id', 'txId'),
2750
+ 'timestamp': timestamp,
2751
+ 'datetime': this.iso8601(timestamp),
2752
+ 'address': undefined,
2753
+ 'addressFrom': addressFrom,
2754
+ 'addressTo': addressTo,
2755
+ 'tag': this.safeString(transaction, 'extra'),
2756
+ 'tagFrom': undefined,
2757
+ 'tagTo': undefined,
2758
+ 'type': movementDirection,
2759
+ 'amount': this.safeNumber(transaction, 'amount'),
2760
+ 'currency': code,
2761
+ 'status': this.parseTransactionStatus(this.safeString(transaction, 'status')),
2762
+ 'updated': this.safeTimestamp2(transaction, 'updated_time', 'updatedTime'),
2763
+ 'comment': undefined,
2764
+ 'internal': undefined,
2765
+ 'fee': fee,
2766
+ 'network': undefined,
2767
+ };
2768
+ }
2769
+ parseTransactionStatus(status) {
2770
+ const statuses = {
2771
+ 'NEW': 'pending',
2772
+ 'CONFIRMING': 'pending',
2773
+ 'PROCESSING': 'pending',
2774
+ 'COMPLETED': 'ok',
2775
+ 'CANCELED': 'canceled',
2776
+ };
2777
+ return this.safeString(statuses, status, status);
2778
+ }
2779
+ /**
2780
+ * @method
2781
+ * @name woo#transfer
2782
+ * @description transfer currency internally between wallets on the same account
2783
+ * @see https://docs.woox.io/#get-transfer-history
2784
+ * @param {string} code unified currency code
2785
+ * @param {float} amount amount to transfer
2786
+ * @param {string} fromAccount account to transfer from
2787
+ * @param {string} toAccount account to transfer to
2788
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2789
+ * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
2790
+ */
2791
+ async transfer(code, amount, fromAccount, toAccount, params = {}) {
2792
+ await this.loadMarkets();
2793
+ const currency = this.currency(code);
2794
+ const request = {
2795
+ 'token': currency['id'],
2796
+ 'amount': this.parseToNumeric(amount),
2797
+ 'from_application_id': fromAccount,
2798
+ 'to_application_id': toAccount,
2799
+ };
2800
+ const response = await this.v1PrivatePostAssetMainSubTransfer(this.extend(request, params));
2801
+ //
2802
+ // {
2803
+ // "success": true,
2804
+ // "id": 200
2805
+ // }
2806
+ //
2807
+ const transfer = this.parseTransfer(response, currency);
2808
+ const transferOptions = this.safeDict(this.options, 'transfer', {});
2809
+ const fillResponseFromRequest = this.safeBool(transferOptions, 'fillResponseFromRequest', true);
2810
+ if (fillResponseFromRequest) {
2811
+ transfer['amount'] = amount;
2812
+ transfer['fromAccount'] = fromAccount;
2813
+ transfer['toAccount'] = toAccount;
2814
+ }
2815
+ return transfer;
2816
+ }
2817
+ /**
2818
+ * @method
2819
+ * @name woo#fetchTransfers
2820
+ * @description fetch a history of internal transfers made on an account
2821
+ * @see https://developer.woox.io/api-reference/endpoint/assets/get_transfer_history
2822
+ * @param {string} code unified currency code of the currency transferred
2823
+ * @param {int} [since] the earliest time in ms to fetch transfers for
2824
+ * @param {int} [limit] the maximum number of transfers structures to retrieve
2825
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2826
+ * @param {int} [params.until] the latest time in ms to fetch entries for
2827
+ * @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
2828
+ */
2829
+ async fetchTransfers(code = undefined, since = undefined, limit = undefined, params = {}) {
2830
+ const request = {};
2831
+ let currency = undefined;
2832
+ if (code !== undefined) {
2833
+ currency = this.currency(code);
2834
+ }
2835
+ if (limit !== undefined) {
2836
+ request['size'] = limit;
2837
+ }
2838
+ if (since !== undefined) {
2839
+ request['startTime'] = since;
2840
+ }
2841
+ const until = this.safeInteger(params, 'until'); // unified in milliseconds
2842
+ params = this.omit(params, ['until']);
2843
+ if (until !== undefined) {
2844
+ request['endTime'] = until;
2845
+ }
2846
+ const response = await this.v3PrivateGetAssetTransferHistory(this.extend(request, params));
2847
+ //
2848
+ // {
2849
+ // "success": true,
2850
+ // "data": {
2851
+ // "rows": [
2852
+ // {
2853
+ // "id": 225,
2854
+ // "token": "USDT",
2855
+ // "amount": "1000000",
2856
+ // "status": "COMPLETED",
2857
+ // "from": {
2858
+ // "applicationId": "046b5c5c-5b44-4d27-9593-ddc32c0a08ae",
2859
+ // "accountName": "Main"
2860
+ // },
2861
+ // "to": {
2862
+ // "applicationId": "082ae5ae-e26a-4fb1-be5b-03e5b4867663",
2863
+ // "accountName": "sub001"
2864
+ // },
2865
+ // "createdTime": "1642660941.534",
2866
+ // "updatedTime": "1642660941.950"
2867
+ // }
2868
+ // ],
2869
+ // "meta": {
2870
+ // "total": 46,
2871
+ // "recordsPerPage": 1,
2872
+ // "currentPage": 1
2873
+ // }
2874
+ // },
2875
+ // "timestamp": 1721295317627
2876
+ // }
2877
+ //
2878
+ const data = this.safeDict(response, 'data', {});
2879
+ const rows = this.safeList(data, 'rows', []);
2880
+ return this.parseTransfers(rows, currency, since, limit, params);
2881
+ }
2882
+ parseTransfer(transfer, currency = undefined) {
2883
+ //
2884
+ // fetchTransfers
2885
+ // {
2886
+ // "id": 46704,
2887
+ // "token": "USDT",
2888
+ // "amount": 30000.00000000,
2889
+ // "status": "COMPLETED",
2890
+ // "from_application_id": "0f1bd3cd-dba2-4563-b8bb-0adb1bfb83a3",
2891
+ // "to_application_id": "c01e6940-a735-4022-9b6c-9d3971cdfdfa",
2892
+ // "from_user": "LeverageLow",
2893
+ // "to_user": "dev",
2894
+ // "created_time": "1709022325.427",
2895
+ // "updated_time": "1709022325.542"
2896
+ // }
2897
+ // {
2898
+ // "id": 225,
2899
+ // "token": "USDT",
2900
+ // "amount": "1000000",
2901
+ // "status": "COMPLETED",
2902
+ // "from": {
2903
+ // "applicationId": "046b5c5c-5b44-4d27-9593-ddc32c0a08ae",
2904
+ // "accountName": "Main"
2905
+ // },
2906
+ // "to": {
2907
+ // "applicationId": "082ae5ae-e26a-4fb1-be5b-03e5b4867663",
2908
+ // "accountName": "sub001"
2909
+ // },
2910
+ // "createdTime": "1642660941.534",
2911
+ // "updatedTime": "1642660941.950"
2912
+ // }
2913
+ //
2914
+ // transfer
2915
+ // {
2916
+ // "success": true,
2917
+ // "id": 200
2918
+ // }
2919
+ //
2920
+ const code = this.safeCurrencyCode(this.safeString(transfer, 'token'), currency);
2921
+ const timestamp = this.safeTimestamp(transfer, 'createdTime');
2922
+ const success = this.safeBool(transfer, 'success');
2923
+ let status = undefined;
2924
+ if (success !== undefined) {
2925
+ status = success ? 'ok' : 'failed';
2926
+ }
2927
+ const fromAccount = this.safeDict(transfer, 'from', {});
2928
+ const toAccount = this.safeDict(transfer, 'to', {});
2929
+ return {
2930
+ 'id': this.safeString(transfer, 'id'),
2931
+ 'timestamp': timestamp,
2932
+ 'datetime': this.iso8601(timestamp),
2933
+ 'currency': code,
2934
+ 'amount': this.safeNumber(transfer, 'amount'),
2935
+ 'fromAccount': this.safeString(fromAccount, 'applicationId'),
2936
+ 'toAccount': this.safeString(toAccount, 'applicationId'),
2937
+ 'status': this.parseTransferStatus(this.safeString(transfer, 'status', status)),
2938
+ 'info': transfer,
2939
+ };
2940
+ }
2941
+ parseTransferStatus(status) {
2942
+ const statuses = {
2943
+ 'NEW': 'pending',
2944
+ 'CONFIRMING': 'pending',
2945
+ 'PROCESSING': 'pending',
2946
+ 'COMPLETED': 'ok',
2947
+ 'CANCELED': 'canceled',
2948
+ };
2949
+ return this.safeString(statuses, status, status);
2950
+ }
2951
+ /**
2952
+ * @method
2953
+ * @name woo#withdraw
2954
+ * @description make a withdrawal
2955
+ * @see https://docs.woox.io/#token-withdraw
2956
+ * @param {string} code unified currency code
2957
+ * @param {float} amount the amount to withdraw
2958
+ * @param {string} address the address to withdraw to
2959
+ * @param {string} tag
2960
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2961
+ * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
2962
+ */
2963
+ async withdraw(code, amount, address, tag = undefined, params = {}) {
2964
+ [tag, params] = this.handleWithdrawTagAndParams(tag, params);
2965
+ await this.loadMarkets();
2966
+ this.checkAddress(address);
2967
+ const currency = this.currency(code);
2968
+ const request = {
2969
+ 'amount': amount,
2970
+ 'address': address,
2971
+ };
2972
+ if (tag !== undefined) {
2973
+ request['extra'] = tag;
2974
+ }
2975
+ let specialNetworkId = undefined;
2976
+ [specialNetworkId, params] = this.getDedicatedNetworkId(currency, params);
2977
+ request['token'] = specialNetworkId;
2978
+ const response = await this.v1PrivatePostAssetWithdraw(this.extend(request, params));
2979
+ //
2980
+ // {
2981
+ // "success": true,
2982
+ // "withdraw_id": "20200119145703654"
2983
+ // }
2984
+ //
2985
+ return this.parseTransaction(response, currency);
2986
+ }
2987
+ /**
2988
+ * @method
2989
+ * @name woo#repayMargin
2990
+ * @description repay borrowed margin and interest
2991
+ * @see https://docs.woox.io/#repay-interest
2992
+ * @param {string} code unified currency code of the currency to repay
2993
+ * @param {float} amount the amount to repay
2994
+ * @param {string} symbol not used by woo.repayMargin ()
2995
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2996
+ * @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
2997
+ */
2998
+ async repayMargin(code, amount, symbol = undefined, params = {}) {
2999
+ await this.loadMarkets();
3000
+ let market = undefined;
3001
+ if (symbol !== undefined) {
3002
+ market = this.market(symbol);
3003
+ symbol = market['symbol'];
3004
+ }
3005
+ const currency = this.currency(code);
3006
+ const request = {
3007
+ 'token': currency['id'],
3008
+ 'amount': this.currencyToPrecision(code, amount),
3009
+ };
3010
+ const response = await this.v1PrivatePostInterestRepay(this.extend(request, params));
3011
+ //
3012
+ // {
3013
+ // "success": true,
3014
+ // }
3015
+ //
3016
+ const transaction = this.parseMarginLoan(response, currency);
3017
+ return this.extend(transaction, {
3018
+ 'amount': amount,
3019
+ 'symbol': symbol,
3020
+ });
3021
+ }
3022
+ parseMarginLoan(info, currency = undefined) {
3023
+ //
3024
+ // {
3025
+ // "success": true,
3026
+ // }
3027
+ //
3028
+ return {
3029
+ 'id': undefined,
3030
+ 'currency': this.safeCurrencyCode(undefined, currency),
3031
+ 'amount': undefined,
3032
+ 'symbol': undefined,
3033
+ 'timestamp': undefined,
3034
+ 'datetime': undefined,
3035
+ 'info': info,
3036
+ };
3037
+ }
3038
+ nonce() {
3039
+ return this.milliseconds() - this.options['timeDifference'];
3040
+ }
3041
+ sign(path, section = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
3042
+ const version = section[0];
3043
+ const access = section[1];
3044
+ const pathWithParams = this.implodeParams(path, params);
3045
+ let url = this.implodeHostname(this.urls['api'][access]);
3046
+ url += '/' + version + '/';
3047
+ params = this.omit(params, this.extractParams(path));
3048
+ params = this.keysort(params);
3049
+ if (access === 'public') {
3050
+ url += access + '/' + pathWithParams;
3051
+ if (Object.keys(params).length) {
3052
+ url += '?' + this.urlencode(params);
3053
+ }
3054
+ }
3055
+ else if (access === 'pub') {
3056
+ url += pathWithParams;
3057
+ if (Object.keys(params).length) {
3058
+ url += '?' + this.urlencode(params);
3059
+ }
3060
+ }
3061
+ else {
3062
+ this.checkRequiredCredentials();
3063
+ if (method === 'POST' && (path === 'trade/algoOrder' || path === 'trade/order')) {
3064
+ const isSandboxMode = this.safeBool(this.options, 'sandboxMode', false);
3065
+ if (!isSandboxMode) {
3066
+ const applicationId = 'bc830de7-50f3-460b-9ee0-f430f83f9dad';
3067
+ const brokerId = this.safeString(this.options, 'brokerId', applicationId);
3068
+ const isTrigger = path.indexOf('algo') > -1;
3069
+ if (isTrigger) {
3070
+ params['brokerId'] = brokerId;
3071
+ }
3072
+ else {
3073
+ params['broker_id'] = brokerId;
3074
+ }
3075
+ }
3076
+ params = this.keysort(params);
3077
+ }
3078
+ let auth = '';
3079
+ const ts = this.nonce().toString();
3080
+ url += pathWithParams;
3081
+ headers = {
3082
+ 'x-api-key': this.apiKey,
3083
+ 'x-api-timestamp': ts,
3084
+ };
3085
+ if (version === 'v3') {
3086
+ auth = ts + method + '/' + version + '/' + pathWithParams;
3087
+ if (method === 'POST' || method === 'PUT') {
3088
+ body = this.json(params);
3089
+ auth += body;
3090
+ headers['content-type'] = 'application/json';
3091
+ }
3092
+ else {
3093
+ if (Object.keys(params).length) {
3094
+ const query = this.urlencode(params);
3095
+ url += '?' + query;
3096
+ auth += '?' + query;
3097
+ }
3098
+ }
3099
+ }
3100
+ else {
3101
+ auth = this.urlencode(params);
3102
+ if (method === 'POST' || method === 'PUT' || method === 'DELETE') {
3103
+ body = auth;
3104
+ }
3105
+ else {
3106
+ if (Object.keys(params).length) {
3107
+ url += '?' + auth;
3108
+ }
3109
+ }
3110
+ auth += '|' + ts;
3111
+ headers['content-type'] = 'application/x-www-form-urlencoded';
3112
+ }
3113
+ headers['x-api-signature'] = this.hmac(this.encode(auth), this.encode(this.secret), sha256);
3114
+ }
3115
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
3116
+ }
3117
+ handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
3118
+ if (!response) {
3119
+ return undefined; // fallback to default error handler
3120
+ }
3121
+ //
3122
+ // 400 Bad Request {"success":false,"code":-1012,"message":"Amount is required for buy market orders when margin disabled."}
3123
+ // {"code":"-1011","message":"The system is under maintenance.","success":false}
3124
+ //
3125
+ const success = this.safeBool(response, 'success');
3126
+ const errorCode = this.safeString(response, 'code');
3127
+ if (!success) {
3128
+ const feedback = this.id + ' ' + this.json(response);
3129
+ this.throwBroadlyMatchedException(this.exceptions['broad'], body, feedback);
3130
+ this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);
3131
+ }
3132
+ return undefined;
3133
+ }
3134
+ parseIncome(income, market = undefined) {
3135
+ //
3136
+ // {
3137
+ // "id": 1286360,
3138
+ // "symbol": "PERP_BTC_USDT",
3139
+ // "fundingRate": -0.00001445,
3140
+ // "markPrice": "26930.60000000",
3141
+ // "fundingFee": "9.56021744",
3142
+ // "fundingIntervalHours": 8,
3143
+ // "paymentType": "Pay",
3144
+ // "status": "COMPLETED",
3145
+ // "createdTime": 1696060873259,
3146
+ // "updatedTime": 1696060873286
3147
+ // }
3148
+ //
3149
+ const marketId = this.safeString(income, 'symbol');
3150
+ const symbol = this.safeSymbol(marketId, market);
3151
+ let amount = this.safeString(income, 'fundingFee');
3152
+ const code = this.safeCurrencyCode('USD');
3153
+ const id = this.safeString(income, 'id');
3154
+ const timestamp = this.safeInteger(income, 'updatedTime');
3155
+ const rate = this.safeNumber(income, 'fundingRate');
3156
+ const paymentType = this.safeString(income, 'paymentType');
3157
+ amount = (paymentType === 'Pay') ? Precise.stringNeg(amount) : amount;
3158
+ return {
3159
+ 'info': income,
3160
+ 'symbol': symbol,
3161
+ 'code': code,
3162
+ 'timestamp': timestamp,
3163
+ 'datetime': this.iso8601(timestamp),
3164
+ 'id': id,
3165
+ 'amount': this.parseNumber(amount),
3166
+ 'rate': rate,
3167
+ };
3168
+ }
3169
+ /**
3170
+ * @method
3171
+ * @name woo#fetchFundingHistory
3172
+ * @description fetch the history of funding payments paid and received on this account
3173
+ * @see https://developer.woox.io/api-reference/endpoint/futures/get_fundingFee_history
3174
+ * @param {string} [symbol] unified market symbol
3175
+ * @param {int} [since] the earliest time in ms to fetch funding history for
3176
+ * @param {int} [limit] the maximum number of funding history structures to retrieve
3177
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3178
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
3179
+ * @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
3180
+ */
3181
+ async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
3182
+ await this.loadMarkets();
3183
+ let paginate = false;
3184
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchFundingHistory', 'paginate');
3185
+ if (paginate) {
3186
+ return await this.fetchPaginatedCallIncremental('fetchFundingHistory', symbol, since, limit, params, 'page', 500);
3187
+ }
3188
+ const request = {};
3189
+ let market = undefined;
3190
+ if (symbol !== undefined) {
3191
+ market = this.market(symbol);
3192
+ request['symbol'] = market['id'];
3193
+ }
3194
+ if (since !== undefined) {
3195
+ request['startTime'] = since;
3196
+ }
3197
+ const until = this.safeInteger(params, 'until'); // unified in milliseconds
3198
+ params = this.omit(params, ['until']);
3199
+ if (until !== undefined) {
3200
+ request['endTime'] = until;
3201
+ }
3202
+ if (limit !== undefined) {
3203
+ request['size'] = Math.min(limit, 500);
3204
+ }
3205
+ const response = await this.v3PrivateGetFuturesFundingFeeHistory(this.extend(request, params));
3206
+ //
3207
+ // {
3208
+ // "success": true,
3209
+ // "data": {
3210
+ // "meta": {
3211
+ // "total": 670,
3212
+ // "recordsPerPage": 25,
3213
+ // "currentPage": 1
3214
+ // },
3215
+ // "rows": [
3216
+ // {
3217
+ // "id": 1286360,
3218
+ // "symbol": "PERP_BTC_USDT",
3219
+ // "fundingRate": -0.00001445,
3220
+ // "markPrice": "26930.60000000",
3221
+ // "fundingFee": "9.56021744",
3222
+ // "fundingIntervalHours": 8,
3223
+ // "paymentType": "Pay",
3224
+ // "status": "COMPLETED",
3225
+ // "createdTime": 1696060873259,
3226
+ // "updatedTime": 1696060873286
3227
+ // }
3228
+ // ]
3229
+ // },
3230
+ // "timestamp": 1721351502594
3231
+ // }
3232
+ //
3233
+ const data = this.safeDict(response, 'data', {});
3234
+ const rows = this.safeList(data, 'rows', []);
3235
+ return this.parseIncomes(rows, market, since, limit);
3236
+ }
3237
+ parseFundingRate(fundingRate, market = undefined) {
3238
+ //
3239
+ // {
3240
+ // "symbol": "PERP_BTC_USDT",
3241
+ // "estFundingRate": "-0.00000441",
3242
+ // "estFundingRateTimestamp": 1751623979022,
3243
+ // "lastFundingRate": "-0.00004953",
3244
+ // "lastFundingRateTimestamp": 1751616000000,
3245
+ // "nextFundingTime": 1751644800000,
3246
+ // "lastFundingIntervalHours": 8,
3247
+ // "estFundingIntervalHours": 8
3248
+ // }
3249
+ //
3250
+ const symbol = this.safeString(fundingRate, 'symbol');
3251
+ market = this.market(symbol);
3252
+ const nextFundingTimestamp = this.safeInteger(fundingRate, 'nextFundingTime');
3253
+ const estFundingRateTimestamp = this.safeInteger(fundingRate, 'estFundingRateTimestamp');
3254
+ const lastFundingRateTimestamp = this.safeInteger(fundingRate, 'lastFundingRateTimestamp');
3255
+ const intervalString = this.safeString(fundingRate, 'estFundingIntervalHours');
3256
+ return {
3257
+ 'info': fundingRate,
3258
+ 'symbol': market['symbol'],
3259
+ 'markPrice': undefined,
3260
+ 'indexPrice': undefined,
3261
+ 'interestRate': this.parseNumber('0'),
3262
+ 'estimatedSettlePrice': undefined,
3263
+ 'timestamp': estFundingRateTimestamp,
3264
+ 'datetime': this.iso8601(estFundingRateTimestamp),
3265
+ 'fundingRate': this.safeNumber(fundingRate, 'estFundingRate'),
3266
+ 'fundingTimestamp': nextFundingTimestamp,
3267
+ 'fundingDatetime': this.iso8601(nextFundingTimestamp),
3268
+ 'nextFundingRate': undefined,
3269
+ 'nextFundingTimestamp': undefined,
3270
+ 'nextFundingDatetime': undefined,
3271
+ 'previousFundingRate': this.safeNumber(fundingRate, 'lastFundingRate'),
3272
+ 'previousFundingTimestamp': lastFundingRateTimestamp,
3273
+ 'previousFundingDatetime': this.iso8601(lastFundingRateTimestamp),
3274
+ 'interval': intervalString + 'h',
3275
+ };
3276
+ }
3277
+ /**
3278
+ * @method
3279
+ * @name woo#fetchFundingInterval
3280
+ * @description fetch the current funding rate interval
3281
+ * @see https://developer.woox.io/api-reference/endpoint/public_data/fundingRate
3282
+ * @param {string} symbol unified market symbol
3283
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3284
+ * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
3285
+ */
3286
+ async fetchFundingInterval(symbol, params = {}) {
3287
+ return await this.fetchFundingRate(symbol, params);
3288
+ }
3289
+ /**
3290
+ * @method
3291
+ * @name woo#fetchFundingRate
3292
+ * @description fetch the current funding rate
3293
+ * @see https://developer.woox.io/api-reference/endpoint/public_data/fundingRate
3294
+ * @param {string} symbol unified market symbol
3295
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3296
+ * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
3297
+ */
3298
+ async fetchFundingRate(symbol, params = {}) {
3299
+ await this.loadMarkets();
3300
+ const market = this.market(symbol);
3301
+ const request = {
3302
+ 'symbol': market['id'],
3303
+ };
3304
+ const response = await this.v3PublicGetFundingRate(this.extend(request, params));
3305
+ //
3306
+ // {
3307
+ // "success": true,
3308
+ // "data": {
3309
+ // "rows": [
3310
+ // {
3311
+ // "symbol": "PERP_BTC_USDT",
3312
+ // "estFundingRate": "-0.00000441",
3313
+ // "estFundingRateTimestamp": 1751623979022,
3314
+ // "lastFundingRate": "-0.00004953",
3315
+ // "lastFundingRateTimestamp": 1751616000000,
3316
+ // "nextFundingTime": 1751644800000,
3317
+ // "lastFundingIntervalHours": 8,
3318
+ // "estFundingIntervalHours": 8
3319
+ // }
3320
+ // ]
3321
+ // },
3322
+ // "timestamp": 1751624037798
3323
+ // }
3324
+ //
3325
+ const data = this.safeDict(response, 'data', {});
3326
+ const rows = this.safeList(data, 'rows', []);
3327
+ const first = this.safeDict(rows, 0, {});
3328
+ return this.parseFundingRate(first, market);
3329
+ }
3330
+ /**
3331
+ * @method
3332
+ * @name woo#fetchFundingRates
3333
+ * @description fetch the funding rate for multiple markets
3334
+ * @see https://developer.woox.io/api-reference/endpoint/public_data/fundingRate
3335
+ * @param {string[]|undefined} symbols list of unified market symbols
3336
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3337
+ * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexed by market symbols
3338
+ */
3339
+ async fetchFundingRates(symbols = undefined, params = {}) {
3340
+ await this.loadMarkets();
3341
+ symbols = this.marketSymbols(symbols);
3342
+ const response = await this.v3PublicGetFundingRate(params);
3343
+ //
3344
+ // {
3345
+ // "success": true,
3346
+ // "data": {
3347
+ // "rows": [
3348
+ // {
3349
+ // "symbol": "PERP_BTC_USDT",
3350
+ // "estFundingRate": "-0.00000441",
3351
+ // "estFundingRateTimestamp": 1751623979022,
3352
+ // "lastFundingRate": "-0.00004953",
3353
+ // "lastFundingRateTimestamp": 1751616000000,
3354
+ // "nextFundingTime": 1751644800000,
3355
+ // "lastFundingIntervalHours": 8,
3356
+ // "estFundingIntervalHours": 8
3357
+ // }
3358
+ // ]
3359
+ // },
3360
+ // "timestamp": 1751624037798
3361
+ // }
3362
+ //
3363
+ const data = this.safeDict(response, 'data', {});
3364
+ const rows = this.safeList(data, 'rows', []);
3365
+ return this.parseFundingRates(rows, symbols);
3366
+ }
3367
+ /**
3368
+ * @method
3369
+ * @name woo#fetchFundingRateHistory
3370
+ * @description fetches historical funding rate prices
3371
+ * @see https://developer.woox.io/api-reference/endpoint/public_data/fundingRateHistory
3372
+ * @param {string} symbol unified symbol of the market to fetch the funding rate history for
3373
+ * @param {int} [since] timestamp in ms of the earliest funding rate to fetch
3374
+ * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} to fetch
3375
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3376
+ * @param {int} [params.until] timestamp in ms of the latest funding rate
3377
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
3378
+ * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
3379
+ */
3380
+ async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
3381
+ await this.loadMarkets();
3382
+ let paginate = false;
3383
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
3384
+ if (paginate) {
3385
+ return await this.fetchPaginatedCallIncremental('fetchFundingRateHistory', symbol, since, limit, params, 'page', 25);
3386
+ }
3387
+ if (symbol === undefined) {
3388
+ throw new ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
3389
+ }
3390
+ const market = this.market(symbol);
3391
+ symbol = market['symbol'];
3392
+ let request = {
3393
+ 'symbol': market['id'],
3394
+ };
3395
+ if (since !== undefined) {
3396
+ request['startTime'] = since;
3397
+ }
3398
+ [request, params] = this.handleUntilOption('endTime', request, params);
3399
+ const response = await this.v3PublicGetFundingRateHistory(this.extend(request, params));
3400
+ //
3401
+ // {
3402
+ // "success": true,
3403
+ // "data": {
3404
+ // "rows": [
3405
+ // {
3406
+ // "symbol": "PERP_BTC_USDT",
3407
+ // "fundingRate": "-0.00004953",
3408
+ // "fundingRateTimestamp": 1751616000000,
3409
+ // "nextFundingTime": 1751644800000,
3410
+ // "markPrice": "108708"
3411
+ // }
3412
+ // ],
3413
+ // "meta": {
3414
+ // "total": 11690,
3415
+ // "recordsPerPage": 25,
3416
+ // "currentPage": 1
3417
+ // }
3418
+ // },
3419
+ // "timestamp": 1751632390031
3420
+ // }
3421
+ //
3422
+ const data = this.safeDict(response, 'data', {});
3423
+ const rows = this.safeList(data, 'rows', []);
3424
+ const rates = [];
3425
+ for (let i = 0; i < rows.length; i++) {
3426
+ const entry = rows[i];
3427
+ const marketId = this.safeString(entry, 'symbol');
3428
+ const timestamp = this.safeInteger(entry, 'fundingRateTimestamp');
3429
+ rates.push({
3430
+ 'info': entry,
3431
+ 'symbol': this.safeSymbol(marketId),
3432
+ 'fundingRate': this.safeNumber(entry, 'fundingRate'),
3433
+ 'timestamp': timestamp,
3434
+ 'datetime': this.iso8601(timestamp),
3435
+ });
3436
+ }
3437
+ const sorted = this.sortBy(rates, 'timestamp');
3438
+ return this.filterBySymbolSinceLimit(sorted, symbol, since, limit);
3439
+ }
3440
+ /**
3441
+ * @method
3442
+ * @name woo#setPositionMode
3443
+ * @description set hedged to true or false for a market
3444
+ * @see https://developer.woox.io/api-reference/endpoint/futures/position_mode
3445
+ * @param {bool} hedged set to true to use HEDGE_MODE, false for ONE_WAY
3446
+ * @param {string} symbol not used by woo setPositionMode
3447
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3448
+ * @returns {object} response from the exchange
3449
+ */
3450
+ async setPositionMode(hedged, symbol = undefined, params = {}) {
3451
+ let hedgeMode = undefined;
3452
+ if (hedged) {
3453
+ hedgeMode = 'HEDGE_MODE';
3454
+ }
3455
+ else {
3456
+ hedgeMode = 'ONE_WAY';
3457
+ }
3458
+ const request = {
3459
+ 'positionMode': hedgeMode,
3460
+ };
3461
+ const response = await this.v3PrivatePutFuturesPositionMode(this.extend(request, params));
3462
+ //
3463
+ // {
3464
+ // "success": true,
3465
+ // "timestamp": 1752550492845
3466
+ // }
3467
+ //
3468
+ return response;
3469
+ }
3470
+ /**
3471
+ * @method
3472
+ * @name woo#fetchLeverage
3473
+ * @description fetch the set leverage for a market
3474
+ * @see https://developer.woox.io/api-reference/endpoint/account/get_account_info
3475
+ * @see https://developer.woox.io/api-reference/endpoint/futures/get_leverage
3476
+ * @param {string} symbol unified market symbol
3477
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3478
+ * @param {string} [params.marginMode] *for swap markets only* 'cross' or 'isolated'
3479
+ * @param {string} [params.positionMode] *for swap markets only* 'ONE_WAY' or 'HEDGE_MODE'
3480
+ * @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
3481
+ */
3482
+ async fetchLeverage(symbol, params = {}) {
3483
+ await this.loadMarkets();
3484
+ const market = this.market(symbol);
3485
+ let response = undefined;
3486
+ if (market['spot']) {
3487
+ response = await this.v3PrivateGetAccountInfo(params);
3488
+ //
3489
+ // {
3490
+ // "success": true,
3491
+ // "data": {
3492
+ // "applicationId": "dsa",
3493
+ // "account": "dsa",
3494
+ // "alias": "haha",
3495
+ // "otpauth": true,
3496
+ // "accountMode": "FUTURES",
3497
+ // "positionMode": "ONE_WAY",
3498
+ // "leverage": 0,
3499
+ // "marginRatio": "10",
3500
+ // "openMarginRatio": "10",
3501
+ // "initialMarginRatio": "10",
3502
+ // "maintenanceMarginRatio": "0.03",
3503
+ // "totalCollateral": "165.6115334",
3504
+ // "freeCollateral": "165.6115334",
3505
+ // "totalAccountValue": "167.52723093",
3506
+ // "totalTradingValue": "167.52723093",
3507
+ // "totalVaultValue": "0",
3508
+ // "totalStakingValue": "0",
3509
+ // "totalLaunchpadValue": "0",
3510
+ // "totalEarnValue": "0",
3511
+ // "referrerID": null,
3512
+ // "accountType": "Main"
3513
+ // },
3514
+ // "timestamp": 1752645129054
3515
+ // }
3516
+ //
3517
+ }
3518
+ else if (market['swap']) {
3519
+ const request = {
3520
+ 'symbol': market['id'],
3521
+ };
3522
+ let marginMode = undefined;
3523
+ [marginMode, params] = this.handleMarginModeAndParams('fetchLeverage', params, 'cross');
3524
+ request['marginMode'] = this.encodeMarginMode(marginMode);
3525
+ response = await this.v3PrivateGetFuturesLeverage(this.extend(request, params));
3526
+ //
3527
+ // HEDGE_MODE
3528
+ // {
3529
+ // "success": true,
3530
+ // "data":
3531
+ // {
3532
+ // "symbol": "PERP_ETH_USDT",
3533
+ // "marginMode": "CROSS",
3534
+ // "positionMode": "HEDGE_MODE",
3535
+ // "details": [
3536
+ // {
3537
+ // "positionSide": "LONG",
3538
+ // "leverage": 10
3539
+ // },
3540
+ // {
3541
+ // "positionSide": "SHORT",
3542
+ // "leverage": 10
3543
+ // }
3544
+ // ]
3545
+ // },
3546
+ // "timestamp": 1720886470482
3547
+ // }
3548
+ //
3549
+ // ONE_WAY
3550
+ // {
3551
+ // "success": true,
3552
+ // "data": {
3553
+ // "symbol": "PERP_ETH_USDT",
3554
+ // "marginMode": "ISOLATED",
3555
+ // "positionMode": "ONE_WAY",
3556
+ // "details": [
3557
+ // {
3558
+ // "positionSide": "BOTH",
3559
+ // "leverage": 10
3560
+ // }
3561
+ // ]
3562
+ // },
3563
+ // "timestamp": 1720886810317
3564
+ // }
3565
+ //
3566
+ }
3567
+ else {
3568
+ throw new NotSupported(this.id + ' fetchLeverage() is not supported for ' + market['type'] + ' markets');
3569
+ }
3570
+ const data = this.safeDict(response, 'data', {});
3571
+ return this.parseLeverage(data, market);
3572
+ }
3573
+ parseLeverage(leverage, market = undefined) {
3574
+ const marketId = this.safeString(leverage, 'symbol');
3575
+ market = this.safeMarket(marketId, market);
3576
+ const marginMode = this.safeStringLower(leverage, 'marginMode');
3577
+ let spotLeverage = this.safeInteger(leverage, 'leverage');
3578
+ if (spotLeverage === 0) {
3579
+ spotLeverage = null;
3580
+ }
3581
+ let longLeverage = spotLeverage;
3582
+ let shortLeverage = spotLeverage;
3583
+ const details = this.safeList(leverage, 'details', []);
3584
+ for (let i = 0; i < details.length; i++) {
3585
+ const position = this.safeDict(details, i, {});
3586
+ const positionLeverage = this.safeInteger(position, 'leverage');
3587
+ const side = this.safeString(position, 'positionSide');
3588
+ if (side === 'BOTH') {
3589
+ longLeverage = positionLeverage;
3590
+ shortLeverage = positionLeverage;
3591
+ }
3592
+ else if (side === 'LONG') {
3593
+ longLeverage = positionLeverage;
3594
+ }
3595
+ else if (side === 'SHORT') {
3596
+ shortLeverage = positionLeverage;
3597
+ }
3598
+ }
3599
+ return {
3600
+ 'info': leverage,
3601
+ 'symbol': market['symbol'],
3602
+ 'marginMode': marginMode,
3603
+ 'longLeverage': longLeverage,
3604
+ 'shortLeverage': shortLeverage,
3605
+ };
3606
+ }
3607
+ /**
3608
+ * @method
3609
+ * @name woo#setLeverage
3610
+ * @description set the level of leverage for a market
3611
+ * @see https://developer.woox.io/api-reference/endpoint/spot_margin/set_leverage
3612
+ * @see https://developer.woox.io/api-reference/endpoint/futures/set_leverage
3613
+ * @param {float} leverage the rate of leverage (1, 2, 3, 4 or 5 for spot markets, 1, 2, 3, 4, 5, 10, 15, 20 for swap markets)
3614
+ * @param {string} [symbol] unified market symbol (is mandatory for swap markets)
3615
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3616
+ * @param {string} [params.marginMode] *for swap markets only* 'cross' or 'isolated'
3617
+ * @param {string} [params.positionMode] *for swap markets only* 'ONE_WAY' or 'HEDGE_MODE'
3618
+ * @returns {object} response from the exchange
3619
+ */
3620
+ async setLeverage(leverage, symbol = undefined, params = {}) {
3621
+ await this.loadMarkets();
3622
+ const request = {
3623
+ 'leverage': leverage,
3624
+ };
3625
+ let market = undefined;
3626
+ if (symbol !== undefined) {
3627
+ market = this.market(symbol);
3628
+ }
3629
+ if ((symbol === undefined) || market['spot']) {
3630
+ return await this.v3PrivatePostSpotMarginLeverage(this.extend(request, params));
3631
+ }
3632
+ else if (market['swap']) {
3633
+ request['symbol'] = market['id'];
3634
+ let marginMode = undefined;
3635
+ [marginMode, params] = this.handleMarginModeAndParams('fetchLeverage', params, 'cross');
3636
+ request['marginMode'] = this.encodeMarginMode(marginMode);
3637
+ return await this.v3PrivatePutFuturesLeverage(this.extend(request, params));
3638
+ }
3639
+ else {
3640
+ throw new NotSupported(this.id + ' fetchLeverage() is not supported for ' + market['type'] + ' markets');
3641
+ }
3642
+ }
3643
+ /**
3644
+ * @method
3645
+ * @name woo#addMargin
3646
+ * @description add margin
3647
+ * @see https://docs.woox.io/#update-isolated-margin-setting
3648
+ * @param {string} symbol unified market symbol
3649
+ * @param {float} amount amount of margin to add
3650
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3651
+ * @param {string} [params.position_side] 'LONG' or 'SHORT' in hedge mode, 'BOTH' in one way mode
3652
+ * @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=add-margin-structure}
3653
+ */
3654
+ async addMargin(symbol, amount, params = {}) {
3655
+ return await this.modifyMarginHelper(symbol, amount, 'ADD', params);
3656
+ }
3657
+ /**
3658
+ * @method
3659
+ * @name woo#reduceMargin
3660
+ * @description remove margin from a position
3661
+ * @see https://docs.woox.io/#update-isolated-margin-setting
3662
+ * @param {string} symbol unified market symbol
3663
+ * @param {float} amount amount of margin to remove
3664
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3665
+ * @param {string} [params.position_side] 'LONG' or 'SHORT' in hedge mode, 'BOTH' in one way mode
3666
+ * @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=reduce-margin-structure}
3667
+ */
3668
+ async reduceMargin(symbol, amount, params = {}) {
3669
+ return await this.modifyMarginHelper(symbol, amount, 'REDUCE', params);
3670
+ }
3671
+ async modifyMarginHelper(symbol, amount, type, params = {}) {
3672
+ await this.loadMarkets();
3673
+ const market = this.market(symbol);
3674
+ const request = {
3675
+ 'symbol': market['id'],
3676
+ 'adjust_token': 'USDT',
3677
+ 'adjust_amount': amount,
3678
+ 'action': type,
3679
+ };
3680
+ return await this.v1PrivatePostClientIsolatedMargin(this.extend(request, params));
3681
+ }
3682
+ /**
3683
+ * @method
3684
+ * @name woo#fetchPosition
3685
+ * @description fetch data on an open position
3686
+ * @see https://developer.woox.io/api-reference/endpoint/futures/get_positions
3687
+ * @param {string} symbol unified market symbol of the market the position is held in
3688
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3689
+ * @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
3690
+ */
3691
+ async fetchPosition(symbol, params = {}) {
3692
+ await this.loadMarkets();
3693
+ const market = this.market(symbol);
3694
+ const request = {
3695
+ 'symbol': market['id'],
3696
+ };
3697
+ const response = await this.v3PrivateGetFuturesPositions(this.extend(request, params));
3698
+ //
3699
+ // {
3700
+ // "success": true,
3701
+ // "data": {
3702
+ // "positions": [
3703
+ // {
3704
+ // "symbol": "PERP_LTC_USDT",
3705
+ // "holding": "0.1",
3706
+ // "pendingLongQty": "0",
3707
+ // "pendingShortQty": "0",
3708
+ // "settlePrice": "96.87",
3709
+ // "averageOpenPrice": "96.87",
3710
+ // "pnl24H": "0",
3711
+ // "fee24H": "0.0048435",
3712
+ // "markPrice": "96.83793449",
3713
+ // "estLiqPrice": "0",
3714
+ // "timestamp": 1752500555823,
3715
+ // "adlQuantile": 2,
3716
+ // "positionSide": "BOTH",
3717
+ // "marginMode": "CROSS",
3718
+ // "isolatedMarginToken": "",
3719
+ // "isolatedMarginAmount": "0",
3720
+ // "isolatedFrozenLong": "0",
3721
+ // "isolatedFrozenShort": "0",
3722
+ // "leverage": 10
3723
+ // }
3724
+ // ]
3725
+ // },
3726
+ // "timestamp": 1752500579848
3727
+ // }
3728
+ //
3729
+ const result = this.safeDict(response, 'data', {});
3730
+ const positions = this.safeList(result, 'positions', []);
3731
+ const first = this.safeDict(positions, 0, {});
3732
+ return this.parsePosition(first, market);
3733
+ }
3734
+ /**
3735
+ * @method
3736
+ * @name woo#fetchPositions
3737
+ * @description fetch all open positions
3738
+ * @see https://developer.woox.io/api-reference/endpoint/futures/get_positions
3739
+ * @param {string[]} [symbols] list of unified market symbols
3740
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3741
+ * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
3742
+ */
3743
+ async fetchPositions(symbols = undefined, params = {}) {
3744
+ await this.loadMarkets();
3745
+ const response = await this.v3PrivateGetFuturesPositions(params);
3746
+ //
3747
+ // {
3748
+ // "success": true,
3749
+ // "data": {
3750
+ // "positions": [
3751
+ // {
3752
+ // "symbol": "PERP_LTC_USDT",
3753
+ // "holding": "0.1",
3754
+ // "pendingLongQty": "0",
3755
+ // "pendingShortQty": "0",
3756
+ // "settlePrice": "96.87",
3757
+ // "averageOpenPrice": "96.87",
3758
+ // "pnl24H": "0",
3759
+ // "fee24H": "0.0048435",
3760
+ // "markPrice": "96.83793449",
3761
+ // "estLiqPrice": "0",
3762
+ // "timestamp": 1752500555823,
3763
+ // "adlQuantile": 2,
3764
+ // "positionSide": "BOTH",
3765
+ // "marginMode": "CROSS",
3766
+ // "isolatedMarginToken": "",
3767
+ // "isolatedMarginAmount": "0",
3768
+ // "isolatedFrozenLong": "0",
3769
+ // "isolatedFrozenShort": "0",
3770
+ // "leverage": 10
3771
+ // }
3772
+ // ]
3773
+ // },
3774
+ // "timestamp": 1752500579848
3775
+ // }
3776
+ //
3777
+ const result = this.safeDict(response, 'data', {});
3778
+ const positions = this.safeList(result, 'positions', []);
3779
+ return this.parsePositions(positions, symbols);
3780
+ }
3781
+ parsePosition(position, market = undefined) {
3782
+ //
3783
+ // v1PrivateGetPositionSymbol
3784
+ // {
3785
+ // "symbol": "PERP_ETH_USDT",
3786
+ // "position_side": "BOTH",
3787
+ // "leverage": 10,
3788
+ // "margin_mode": "CROSS",
3789
+ // "average_open_price": 3139.9,
3790
+ // "isolated_margin_amount": 0.0,
3791
+ // "isolated_margin_token": "",
3792
+ // "opening_time": "1720627963.094",
3793
+ // "mark_price": 3155.19169891,
3794
+ // "pending_short_qty": 0.0,
3795
+ // "pending_long_qty": 0.0,
3796
+ // "holding": -0.7,
3797
+ // "pnl_24_h": 0.0,
3798
+ // "est_liq_price": 9107.40055552,
3799
+ // "settle_price": 3151.0319904,
3800
+ // "success": true,
3801
+ // "fee_24_h": 0.0,
3802
+ // "isolated_frozen_long": 0.0,
3803
+ // "isolated_frozen_short": 0.0,
3804
+ // "timestamp": "1720867502.544"
3805
+ // }
3806
+ //
3807
+ // v3PrivateGetPositions
3808
+ // {
3809
+ // "symbol": "PERP_LTC_USDT",
3810
+ // "holding": "0.1",
3811
+ // "pendingLongQty": "0",
3812
+ // "pendingShortQty": "0",
3813
+ // "settlePrice": "96.87",
3814
+ // "averageOpenPrice": "96.87",
3815
+ // "pnl24H": "0",
3816
+ // "fee24H": "0.0048435",
3817
+ // "markPrice": "96.83793449",
3818
+ // "estLiqPrice": "0",
3819
+ // "timestamp": 1752500555823,
3820
+ // "adlQuantile": 2,
3821
+ // "positionSide": "BOTH",
3822
+ // "marginMode": "CROSS",
3823
+ // "isolatedMarginToken": "",
3824
+ // "isolatedMarginAmount": "0",
3825
+ // "isolatedFrozenLong": "0",
3826
+ // "isolatedFrozenShort": "0",
3827
+ // "leverage": 10
3828
+ // }
3829
+ //
3830
+ const contract = this.safeString(position, 'symbol');
3831
+ market = this.safeMarket(contract, market);
3832
+ let size = this.safeString(position, 'holding');
3833
+ let side = undefined;
3834
+ if (Precise.stringGt(size, '0')) {
3835
+ side = 'long';
3836
+ }
3837
+ else {
3838
+ side = 'short';
3839
+ }
3840
+ const contractSize = this.safeString(market, 'contractSize');
3841
+ const markPrice = this.safeString2(position, 'markPrice', 'mark_price');
3842
+ const timestampString = this.safeString(position, 'timestamp');
3843
+ let timestamp = undefined;
3844
+ if (timestampString !== undefined) {
3845
+ if (timestampString.indexOf('.') > -1) {
3846
+ timestamp = this.safeTimestamp(position, 'timestamp');
3847
+ }
3848
+ else {
3849
+ timestamp = this.safeInteger(position, 'timestamp');
3850
+ }
3851
+ }
3852
+ const entryPrice = this.safeString2(position, 'averageOpenPrice', 'average_open_price');
3853
+ const priceDifference = Precise.stringSub(markPrice, entryPrice);
3854
+ const unrealisedPnl = Precise.stringMul(priceDifference, size);
3855
+ size = Precise.stringAbs(size);
3856
+ const notional = Precise.stringMul(size, markPrice);
3857
+ const positionSide = this.safeString(position, 'positionSide'); // 'SHORT' or 'LONG' for hedged, 'BOTH' for non-hedged
3858
+ return this.safePosition({
3859
+ 'info': position,
3860
+ 'id': undefined,
3861
+ 'symbol': this.safeString(market, 'symbol'),
3862
+ 'timestamp': timestamp,
3863
+ 'datetime': this.iso8601(timestamp),
3864
+ 'lastUpdateTimestamp': undefined,
3865
+ 'initialMargin': undefined,
3866
+ 'initialMarginPercentage': undefined,
3867
+ 'maintenanceMargin': undefined,
3868
+ 'maintenanceMarginPercentage': undefined,
3869
+ 'entryPrice': this.parseNumber(entryPrice),
3870
+ 'notional': this.parseNumber(notional),
3871
+ 'leverage': this.safeNumber(position, 'leverage'),
3872
+ 'unrealizedPnl': this.parseNumber(unrealisedPnl),
3873
+ 'contracts': this.parseNumber(size),
3874
+ 'contractSize': this.parseNumber(contractSize),
3875
+ 'marginRatio': undefined,
3876
+ 'liquidationPrice': this.safeNumber2(position, 'estLiqPrice', 'est_liq_price'),
3877
+ 'markPrice': this.parseNumber(markPrice),
3878
+ 'lastPrice': undefined,
3879
+ 'collateral': undefined,
3880
+ 'marginMode': this.safeStringLower2(position, 'marginMode', 'margin_mode'),
3881
+ 'side': side,
3882
+ 'percentage': undefined,
3883
+ 'hedged': positionSide !== 'BOTH',
3884
+ 'stopLossPrice': undefined,
3885
+ 'takeProfitPrice': undefined,
3886
+ });
3887
+ }
3888
+ /**
3889
+ * @method
3890
+ * @name woo#fetchConvertQuote
3891
+ * @description fetch a quote for converting from one currency to another
3892
+ * @see https://docs.woox.io/#get-quote-rfq
3893
+ * @param {string} fromCode the currency that you want to sell and convert from
3894
+ * @param {string} toCode the currency that you want to buy and convert into
3895
+ * @param {float} [amount] how much you want to trade in units of the from currency
3896
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3897
+ * @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
3898
+ */
3899
+ async fetchConvertQuote(fromCode, toCode, amount = undefined, params = {}) {
3900
+ await this.loadMarkets();
3901
+ const request = {
3902
+ 'sellToken': fromCode.toUpperCase(),
3903
+ 'buyToken': toCode.toUpperCase(),
3904
+ 'sellQuantity': this.numberToString(amount),
3905
+ };
3906
+ const response = await this.v3PrivateGetConvertRfq(this.extend(request, params));
3907
+ //
3908
+ // {
3909
+ // "success": true,
3910
+ // "data": {
3911
+ // "quoteId": 123123123,
3912
+ // "counterPartyId": "",
3913
+ // "sellToken": "ETH",
3914
+ // "sellQuantity": "0.0445",
3915
+ // "buyToken": "USDT",
3916
+ // "buyQuantity": "33.45",
3917
+ // "buyPrice": "6.77",
3918
+ // "expireTimestamp": 1659084466000,
3919
+ // "message": 1659084466000
3920
+ // }
3921
+ // }
3922
+ //
3923
+ const data = this.safeDict(response, 'data', {});
3924
+ const fromCurrencyId = this.safeString(data, 'sellToken', fromCode);
3925
+ const fromCurrency = this.currency(fromCurrencyId);
3926
+ const toCurrencyId = this.safeString(data, 'buyToken', toCode);
3927
+ const toCurrency = this.currency(toCurrencyId);
3928
+ return this.parseConversion(data, fromCurrency, toCurrency);
3929
+ }
3930
+ /**
3931
+ * @method
3932
+ * @name woo#createConvertTrade
3933
+ * @description convert from one currency to another
3934
+ * @see https://docs.woox.io/#send-quote-rft
3935
+ * @param {string} id the id of the trade that you want to make
3936
+ * @param {string} fromCode the currency that you want to sell and convert from
3937
+ * @param {string} toCode the currency that you want to buy and convert into
3938
+ * @param {float} [amount] how much you want to trade in units of the from currency
3939
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3940
+ * @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
3941
+ */
3942
+ async createConvertTrade(id, fromCode, toCode, amount = undefined, params = {}) {
3943
+ await this.loadMarkets();
3944
+ const request = {
3945
+ 'quoteId': id,
3946
+ };
3947
+ const response = await this.v3PrivatePostConvertRft(this.extend(request, params));
3948
+ //
3949
+ // {
3950
+ // "success": true,
3951
+ // "data": {
3952
+ // "quoteId": 123123123,
3953
+ // "counterPartyId": "",
3954
+ // "rftAccepted": 1 // 1 -> success; 2 -> processing; 3 -> fail
3955
+ // }
3956
+ // }
3957
+ //
3958
+ const data = this.safeDict(response, 'data', {});
3959
+ return this.parseConversion(data);
3960
+ }
3961
+ /**
3962
+ * @method
3963
+ * @name woo#fetchConvertTrade
3964
+ * @description fetch the data for a conversion trade
3965
+ * @see https://docs.woox.io/#get-quote-trade
3966
+ * @param {string} id the id of the trade that you want to fetch
3967
+ * @param {string} [code] the unified currency code of the conversion trade
3968
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3969
+ * @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
3970
+ */
3971
+ async fetchConvertTrade(id, code = undefined, params = {}) {
3972
+ await this.loadMarkets();
3973
+ const request = {
3974
+ 'quoteId': id,
3975
+ };
3976
+ const response = await this.v3PrivateGetConvertTrade(this.extend(request, params));
3977
+ //
3978
+ // {
3979
+ // "success": true,
3980
+ // "data": {
3981
+ // "quoteId": 12,
3982
+ // "buyAsset": "",
3983
+ // "sellAsset": "",
3984
+ // "buyAmount": 12.11,
3985
+ // "sellAmount": 12.11,
3986
+ // "tradeStatus": 12,
3987
+ // "createdTime": ""
3988
+ // }
3989
+ // }
3990
+ //
3991
+ const data = this.safeDict(response, 'data', {});
3992
+ const fromCurrencyId = this.safeString(data, 'sellAsset');
3993
+ const toCurrencyId = this.safeString(data, 'buyAsset');
3994
+ let fromCurrency = undefined;
3995
+ let toCurrency = undefined;
3996
+ if (fromCurrencyId !== undefined) {
3997
+ fromCurrency = this.currency(fromCurrencyId);
3998
+ }
3999
+ if (toCurrencyId !== undefined) {
4000
+ toCurrency = this.currency(toCurrencyId);
4001
+ }
4002
+ return this.parseConversion(data, fromCurrency, toCurrency);
4003
+ }
4004
+ /**
4005
+ * @method
4006
+ * @name woo#fetchConvertTradeHistory
4007
+ * @description fetch the users history of conversion trades
4008
+ * @see https://docs.woox.io/#get-quote-trades
4009
+ * @param {string} [code] the unified currency code
4010
+ * @param {int} [since] the earliest time in ms to fetch conversions for
4011
+ * @param {int} [limit] the maximum number of conversion structures to retrieve
4012
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4013
+ * @param {int} [params.until] timestamp in ms of the latest conversion to fetch
4014
+ * @returns {object[]} a list of [conversion structures]{@link https://docs.ccxt.com/#/?id=conversion-structure}
4015
+ */
4016
+ async fetchConvertTradeHistory(code = undefined, since = undefined, limit = undefined, params = {}) {
4017
+ await this.loadMarkets();
4018
+ let request = {};
4019
+ [request, params] = this.handleUntilOption('endTime', request, params);
4020
+ if (since !== undefined) {
4021
+ request['startTime'] = since;
4022
+ }
4023
+ if (limit !== undefined) {
4024
+ request['size'] = limit;
4025
+ }
4026
+ const response = await this.v3PrivateGetConvertTrades(this.extend(request, params));
4027
+ //
4028
+ // {
4029
+ // "success": true,
4030
+ // "data": {
4031
+ // "count": 12,
4032
+ // "tradeVos":[
4033
+ // {
4034
+ // "quoteId": 12,
4035
+ // "buyAsset": "",
4036
+ // "sellAsset": "",
4037
+ // "buyAmount": 12.11,
4038
+ // "sellAmount": 12.11,
4039
+ // "tradeStatus": 12,
4040
+ // "createdTime": ""
4041
+ // }
4042
+ // ...
4043
+ // ]
4044
+ // }
4045
+ // }
4046
+ //
4047
+ const data = this.safeDict(response, 'data', {});
4048
+ const rows = this.safeList(data, 'tradeVos', []);
4049
+ return this.parseConversions(rows, code, 'sellAsset', 'buyAsset', since, limit);
4050
+ }
4051
+ parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
4052
+ //
4053
+ // fetchConvertQuote
4054
+ //
4055
+ // {
4056
+ // "quoteId": 123123123,
4057
+ // "counterPartyId": "",
4058
+ // "sellToken": "ETH",
4059
+ // "sellQuantity": "0.0445",
4060
+ // "buyToken": "USDT",
4061
+ // "buyQuantity": "33.45",
4062
+ // "buyPrice": "6.77",
4063
+ // "expireTimestamp": 1659084466000,
4064
+ // "message": 1659084466000
4065
+ // }
4066
+ //
4067
+ // createConvertTrade
4068
+ //
4069
+ // {
4070
+ // "quoteId": 123123123,
4071
+ // "counterPartyId": "",
4072
+ // "rftAccepted": 1 // 1 -> success; 2 -> processing; 3 -> fail
4073
+ // }
4074
+ //
4075
+ // fetchConvertTrade, fetchConvertTradeHistory
4076
+ //
4077
+ // {
4078
+ // "quoteId": 12,
4079
+ // "buyAsset": "",
4080
+ // "sellAsset": "",
4081
+ // "buyAmount": 12.11,
4082
+ // "sellAmount": 12.11,
4083
+ // "tradeStatus": 12,
4084
+ // "createdTime": ""
4085
+ // }
4086
+ //
4087
+ const timestamp = this.safeInteger2(conversion, 'expireTimestamp', 'createdTime');
4088
+ const fromCurr = this.safeString2(conversion, 'sellToken', 'buyAsset');
4089
+ const fromCode = this.safeCurrencyCode(fromCurr, fromCurrency);
4090
+ const to = this.safeString2(conversion, 'buyToken', 'sellAsset');
4091
+ const toCode = this.safeCurrencyCode(to, toCurrency);
4092
+ return {
4093
+ 'info': conversion,
4094
+ 'timestamp': timestamp,
4095
+ 'datetime': this.iso8601(timestamp),
4096
+ 'id': this.safeString(conversion, 'quoteId'),
4097
+ 'fromCurrency': fromCode,
4098
+ 'fromAmount': this.safeNumber2(conversion, 'sellQuantity', 'sellAmount'),
4099
+ 'toCurrency': toCode,
4100
+ 'toAmount': this.safeNumber2(conversion, 'buyQuantity', 'buyAmount'),
4101
+ 'price': this.safeNumber(conversion, 'buyPrice'),
4102
+ 'fee': undefined,
4103
+ };
4104
+ }
4105
+ /**
4106
+ * @method
4107
+ * @name woo#fetchConvertCurrencies
4108
+ * @description fetches all available currencies that can be converted
4109
+ * @see https://docs.woox.io/#get-quote-asset-info
4110
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4111
+ * @returns {object} an associative dictionary of currencies
4112
+ */
4113
+ async fetchConvertCurrencies(params = {}) {
4114
+ await this.loadMarkets();
4115
+ const response = await this.v3PrivateGetConvertAssetInfo(params);
4116
+ //
4117
+ // {
4118
+ // "success": true,
4119
+ // "rows": [
4120
+ // {
4121
+ // "token": "BTC",
4122
+ // "tick": 0.0001,
4123
+ // "createdTime": "1575014248.99", // Unix epoch time in seconds
4124
+ // "updatedTime": "1575014248.99" // Unix epoch time in seconds
4125
+ // },
4126
+ // ]
4127
+ // }
4128
+ //
4129
+ const result = {};
4130
+ const data = this.safeList(response, 'rows', []);
4131
+ for (let i = 0; i < data.length; i++) {
4132
+ const entry = data[i];
4133
+ const id = this.safeString(entry, 'token');
4134
+ const code = this.safeCurrencyCode(id);
4135
+ result[code] = {
4136
+ 'info': entry,
4137
+ 'id': id,
4138
+ 'code': code,
4139
+ 'networks': undefined,
4140
+ 'type': undefined,
4141
+ 'name': undefined,
4142
+ 'active': undefined,
4143
+ 'deposit': undefined,
4144
+ 'withdraw': undefined,
4145
+ 'fee': undefined,
4146
+ 'precision': this.safeNumber(entry, 'tick'),
4147
+ 'limits': {
4148
+ 'amount': {
4149
+ 'min': undefined,
4150
+ 'max': undefined,
4151
+ },
4152
+ 'withdraw': {
4153
+ 'min': undefined,
4154
+ 'max': undefined,
4155
+ },
4156
+ 'deposit': {
4157
+ 'min': undefined,
4158
+ 'max': undefined,
4159
+ },
4160
+ },
4161
+ 'created': this.safeTimestamp(entry, 'createdTime'),
4162
+ };
4163
+ }
4164
+ return result;
4165
+ }
4166
+ defaultNetworkCodeForCurrency(code) {
4167
+ const currencyItem = this.currency(code);
4168
+ const networks = currencyItem['networks'];
4169
+ const networkKeys = Object.keys(networks);
4170
+ for (let i = 0; i < networkKeys.length; i++) {
4171
+ const network = networkKeys[i];
4172
+ if (network === 'ETH') {
4173
+ return network;
4174
+ }
4175
+ }
4176
+ // if it was not returned according to above options, then return the first network of currency
4177
+ return this.safeValue(networkKeys, 0);
4178
+ }
4179
+ setSandboxMode(enable) {
4180
+ super.setSandboxMode(enable);
4181
+ this.options['sandboxMode'] = enable;
4182
+ }
4183
+ }