ccxt 4.5.51 → 4.5.53

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 (1020) hide show
  1. package/README.md +10 -9
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/abstract/aftermath.js +1 -1
  5. package/dist/cjs/src/abstract/alpaca.js +1 -1
  6. package/dist/cjs/src/abstract/apex.js +1 -1
  7. package/dist/cjs/src/abstract/arkham.js +1 -1
  8. package/dist/cjs/src/abstract/ascendex.js +1 -1
  9. package/dist/cjs/src/abstract/aster.js +1 -1
  10. package/dist/cjs/src/abstract/backpack.js +1 -1
  11. package/dist/cjs/src/abstract/bigone.js +1 -1
  12. package/dist/cjs/src/abstract/binance.js +1 -1
  13. package/dist/cjs/src/abstract/bingx.js +1 -1
  14. package/dist/cjs/src/abstract/bit2c.js +1 -1
  15. package/dist/cjs/src/abstract/bitbank.js +1 -1
  16. package/dist/cjs/src/abstract/bitbns.js +1 -1
  17. package/dist/cjs/src/abstract/bitfinex.js +1 -1
  18. package/dist/cjs/src/abstract/bitflyer.js +1 -1
  19. package/dist/cjs/src/abstract/bitget.js +1 -1
  20. package/dist/cjs/src/abstract/bithumb.js +1 -1
  21. package/dist/cjs/src/abstract/bitmart.js +1 -1
  22. package/dist/cjs/src/abstract/bitmex.js +1 -1
  23. package/dist/cjs/src/abstract/bitopro.js +1 -1
  24. package/dist/cjs/src/abstract/bitrue.js +1 -1
  25. package/dist/cjs/src/abstract/bitso.js +1 -1
  26. package/dist/cjs/src/abstract/bitstamp.js +1 -1
  27. package/dist/cjs/src/abstract/bitteam.js +1 -1
  28. package/dist/cjs/src/abstract/bittrade.js +1 -1
  29. package/dist/cjs/src/abstract/bitvavo.js +1 -1
  30. package/dist/cjs/src/abstract/blockchaincom.js +1 -1
  31. package/dist/cjs/src/abstract/blofin.js +1 -1
  32. package/dist/cjs/src/abstract/btcbox.js +1 -1
  33. package/dist/cjs/src/abstract/btcmarkets.js +1 -1
  34. package/dist/cjs/src/abstract/btcturk.js +1 -1
  35. package/dist/cjs/src/abstract/bullish.js +1 -1
  36. package/dist/cjs/src/abstract/bybit.js +1 -1
  37. package/dist/cjs/src/abstract/bydfi.js +1 -1
  38. package/dist/cjs/src/abstract/cex.js +1 -1
  39. package/dist/cjs/src/abstract/coinbase.js +1 -1
  40. package/dist/cjs/src/abstract/coinbaseexchange.js +1 -1
  41. package/dist/cjs/src/abstract/coinbaseinternational.js +1 -1
  42. package/dist/cjs/src/abstract/coincheck.js +1 -1
  43. package/dist/cjs/src/abstract/coinex.js +1 -1
  44. package/dist/cjs/src/abstract/coinmate.js +1 -1
  45. package/dist/cjs/src/abstract/coinmetro.js +1 -1
  46. package/dist/cjs/src/abstract/coinone.js +1 -1
  47. package/dist/cjs/src/abstract/coinsph.js +1 -1
  48. package/dist/cjs/src/abstract/coinspot.js +1 -1
  49. package/dist/cjs/src/abstract/cryptocom.js +1 -1
  50. package/dist/cjs/src/abstract/cryptomus.js +1 -1
  51. package/dist/cjs/src/abstract/deepcoin.js +1 -1
  52. package/dist/cjs/src/abstract/delta.js +1 -1
  53. package/dist/cjs/src/abstract/deribit.js +1 -1
  54. package/dist/cjs/src/abstract/derive.js +1 -1
  55. package/dist/cjs/src/abstract/digifinex.js +1 -1
  56. package/dist/cjs/src/abstract/dydx.js +1 -1
  57. package/dist/cjs/src/abstract/exmo.js +1 -1
  58. package/dist/cjs/src/abstract/foxbit.js +1 -1
  59. package/dist/cjs/src/abstract/gate.js +1 -1
  60. package/dist/cjs/src/abstract/gemini.js +1 -1
  61. package/dist/cjs/src/abstract/grvt.js +1 -1
  62. package/dist/cjs/src/abstract/hashkey.js +1 -1
  63. package/dist/cjs/src/abstract/hibachi.js +1 -1
  64. package/dist/cjs/src/abstract/hitbtc.js +1 -1
  65. package/dist/cjs/src/abstract/hollaex.js +1 -1
  66. package/dist/cjs/src/abstract/htx.js +1 -1
  67. package/dist/cjs/src/abstract/hyperliquid.js +1 -1
  68. package/dist/cjs/src/abstract/independentreserve.js +1 -1
  69. package/dist/cjs/src/abstract/indodax.js +1 -1
  70. package/dist/cjs/src/abstract/kraken.js +1 -1
  71. package/dist/cjs/src/abstract/krakenfutures.js +1 -1
  72. package/dist/cjs/src/abstract/kucoin.js +1 -1
  73. package/dist/cjs/src/abstract/latoken.js +1 -1
  74. package/dist/cjs/src/abstract/lbank.js +1 -1
  75. package/dist/cjs/src/abstract/lighter.js +1 -1
  76. package/dist/cjs/src/abstract/luno.js +1 -1
  77. package/dist/cjs/src/abstract/mercado.js +1 -1
  78. package/dist/cjs/src/abstract/mexc.js +1 -1
  79. package/dist/cjs/src/abstract/modetrade.js +1 -1
  80. package/dist/cjs/src/abstract/ndax.js +1 -1
  81. package/dist/cjs/src/abstract/novadax.js +1 -1
  82. package/dist/cjs/src/abstract/okx.js +1 -1
  83. package/dist/cjs/src/abstract/onetrading.js +1 -1
  84. package/dist/cjs/src/abstract/oxfun.js +1 -1
  85. package/dist/cjs/src/abstract/p2b.js +1 -1
  86. package/dist/cjs/src/abstract/pacifica.js +1 -1
  87. package/dist/cjs/src/abstract/paradex.js +1 -1
  88. package/dist/cjs/src/abstract/paymium.js +1 -1
  89. package/dist/cjs/src/abstract/phemex.js +1 -1
  90. package/dist/cjs/src/abstract/poloniex.js +1 -1
  91. package/dist/cjs/src/abstract/tokocrypto.js +1 -1
  92. package/dist/cjs/src/abstract/toobit.js +1 -1
  93. package/dist/cjs/src/abstract/upbit.js +1 -1
  94. package/dist/cjs/src/abstract/wavesexchange.js +1 -1
  95. package/dist/cjs/src/abstract/weex.js +1 -1
  96. package/dist/cjs/src/abstract/whitebit.js +1 -1
  97. package/dist/cjs/src/abstract/woo.js +1 -1
  98. package/dist/cjs/src/abstract/woofipro.js +1 -1
  99. package/dist/cjs/src/abstract/xt.js +1 -1
  100. package/dist/cjs/src/abstract/yobit.js +1 -1
  101. package/dist/cjs/src/abstract/zaif.js +1 -1
  102. package/dist/cjs/src/abstract/zebpay.js +1 -1
  103. package/dist/cjs/src/abstract/zonda.js +1 -1
  104. package/dist/cjs/src/aftermath.js +17 -16
  105. package/dist/cjs/src/alpaca.js +1 -1
  106. package/dist/cjs/src/apex.js +1 -1
  107. package/dist/cjs/src/arkham.js +1 -1
  108. package/dist/cjs/src/ascendex.js +1 -1
  109. package/dist/cjs/src/aster.js +1569 -1101
  110. package/dist/cjs/src/backpack.js +1 -1
  111. package/dist/cjs/src/base/Exchange.js +37 -32
  112. package/dist/cjs/src/base/Precise.js +6 -0
  113. package/dist/cjs/src/base/errors.js +6 -0
  114. package/dist/cjs/src/base/functions/crypto.js +1 -1
  115. package/dist/cjs/src/base/functions/encode.js +1 -1
  116. package/dist/cjs/src/base/functions/io.js +1 -1
  117. package/dist/cjs/src/base/functions/misc.js +1 -0
  118. package/dist/cjs/src/base/functions/number.js +6 -0
  119. package/dist/cjs/src/base/functions/platform.js +6 -0
  120. package/dist/cjs/src/base/functions/rsa.js +1 -0
  121. package/dist/cjs/src/base/functions/string.js +6 -0
  122. package/dist/cjs/src/base/functions/throttle.js +1 -1
  123. package/dist/cjs/src/base/functions/time.js +6 -0
  124. package/dist/cjs/src/base/functions/totp.js +1 -0
  125. package/dist/cjs/src/base/functions/type.js +6 -0
  126. package/dist/cjs/src/base/functions.js +1 -1
  127. package/dist/cjs/src/base/ws/Cache.js +6 -0
  128. package/dist/cjs/src/base/ws/Client.js +1 -0
  129. package/dist/cjs/src/base/ws/Future.js +1 -1
  130. package/dist/cjs/src/base/ws/OrderBook.js +1 -1
  131. package/dist/cjs/src/base/ws/OrderBookSide.js +6 -0
  132. package/dist/cjs/src/base/ws/WsClient.js +1 -1
  133. package/dist/cjs/src/bequant.js +9 -1
  134. package/dist/cjs/src/bigone.js +1 -1
  135. package/dist/cjs/src/binance.js +37 -38
  136. package/dist/cjs/src/binancecoinm.js +1 -1
  137. package/dist/cjs/src/binanceus.js +1 -1
  138. package/dist/cjs/src/binanceusdm.js +2 -1
  139. package/dist/cjs/src/bingx.js +1 -1
  140. package/dist/cjs/src/bit2c.js +1 -1
  141. package/dist/cjs/src/bitbank.js +1 -1
  142. package/dist/cjs/src/bitbns.js +1 -1
  143. package/dist/cjs/src/bitfinex.js +2 -4
  144. package/dist/cjs/src/bitflyer.js +1 -1
  145. package/dist/cjs/src/bitget.js +1 -1
  146. package/dist/cjs/src/bithumb.js +1 -1
  147. package/dist/cjs/src/bitmart.js +1 -1
  148. package/dist/cjs/src/bitmex.js +1 -1
  149. package/dist/cjs/src/bitopro.js +1 -1
  150. package/dist/cjs/src/bitrue.js +1 -1
  151. package/dist/cjs/src/bitso.js +1 -1
  152. package/dist/cjs/src/bitstamp.js +2 -2
  153. package/dist/cjs/src/bitteam.js +1 -1
  154. package/dist/cjs/src/bittrade.js +1 -1
  155. package/dist/cjs/src/bitvavo.js +3 -3
  156. package/dist/cjs/src/blockchaincom.js +1 -1
  157. package/dist/cjs/src/blofin.js +91 -2
  158. package/dist/cjs/src/btcbox.js +1 -1
  159. package/dist/cjs/src/btcmarkets.js +1 -1
  160. package/dist/cjs/src/btcturk.js +1 -1
  161. package/dist/cjs/src/bullish.js +1 -1
  162. package/dist/cjs/src/bybit.js +1 -1
  163. package/dist/cjs/src/bydfi.js +1 -1
  164. package/dist/cjs/src/cex.js +1 -1
  165. package/dist/cjs/src/coinbase.js +1 -1
  166. package/dist/cjs/src/coinbaseadvanced.js +1 -1
  167. package/dist/cjs/src/coincheck.js +1 -1
  168. package/dist/cjs/src/coinex.js +1 -1
  169. package/dist/cjs/src/coinmate.js +1 -1
  170. package/dist/cjs/src/coinmetro.js +1 -1
  171. package/dist/cjs/src/coinone.js +1 -1
  172. package/dist/cjs/src/coinsph.js +1 -0
  173. package/dist/cjs/src/coinspot.js +1 -1
  174. package/dist/cjs/src/cryptocom.js +2 -1
  175. package/dist/cjs/src/cryptomus.js +1 -1
  176. package/dist/cjs/src/deepcoin.js +1 -1
  177. package/dist/cjs/src/delta.js +1 -1
  178. package/dist/cjs/src/deribit.js +1 -1
  179. package/dist/cjs/src/derive.js +1 -1
  180. package/dist/cjs/src/digifinex.js +1 -1
  181. package/dist/cjs/src/dydx.js +1 -1
  182. package/dist/cjs/src/exmo.js +1 -1
  183. package/dist/cjs/src/fmfwio.js +1 -1
  184. package/dist/cjs/src/foxbit.js +1 -1
  185. package/dist/cjs/src/gate.js +6 -2
  186. package/dist/cjs/src/gateio.js +1 -1
  187. package/dist/cjs/src/gemini.js +1 -1
  188. package/dist/cjs/src/grvt.js +35 -28
  189. package/dist/cjs/src/hashkey.js +1 -1
  190. package/dist/cjs/src/hibachi.js +1 -1
  191. package/dist/cjs/src/hitbtc.js +1 -0
  192. package/dist/cjs/src/hollaex.js +1 -1
  193. package/dist/cjs/src/htx.js +1 -1
  194. package/dist/cjs/src/huobi.js +1 -1
  195. package/dist/cjs/src/hyperliquid.js +1 -1
  196. package/dist/cjs/src/independentreserve.js +1 -1
  197. package/dist/cjs/src/indodax.js +1 -1
  198. package/dist/cjs/src/kraken.js +7 -2
  199. package/dist/cjs/src/krakenfutures.js +1 -1
  200. package/dist/cjs/src/kucoin.js +1 -1
  201. package/dist/cjs/src/kucoinfutures.js +1 -1
  202. package/dist/cjs/src/latoken.js +1 -1
  203. package/dist/cjs/src/lbank.js +1 -1
  204. package/dist/cjs/src/lighter.js +7 -7
  205. package/dist/cjs/src/luno.js +1 -1
  206. package/dist/cjs/src/mercado.js +1 -1
  207. package/dist/cjs/src/mexc.js +2 -2
  208. package/dist/cjs/src/modetrade.js +1 -1
  209. package/dist/cjs/src/myokx.js +1 -1
  210. package/dist/cjs/src/ndax.js +1 -1
  211. package/dist/cjs/src/novadax.js +1 -1
  212. package/dist/cjs/src/okx.js +2 -1
  213. package/dist/cjs/src/okxus.js +1 -1
  214. package/dist/cjs/src/onetrading.js +1 -1
  215. package/dist/cjs/src/oxfun.js +1 -1
  216. package/dist/cjs/src/p2b.js +1 -1
  217. package/dist/cjs/src/pacifica.js +1 -1
  218. package/dist/cjs/src/paradex.js +1 -1
  219. package/dist/cjs/src/paymium.js +1 -1
  220. package/dist/cjs/src/phemex.js +89 -7
  221. package/dist/cjs/src/poloniex.js +1 -1
  222. package/dist/cjs/src/pro/aftermath.js +2 -2
  223. package/dist/cjs/src/pro/alpaca.js +1 -1
  224. package/dist/cjs/src/pro/apex.js +1 -1
  225. package/dist/cjs/src/pro/arkham.js +1 -1
  226. package/dist/cjs/src/pro/ascendex.js +1 -1
  227. package/dist/cjs/src/pro/aster.js +149 -157
  228. package/dist/cjs/src/pro/backpack.js +1 -1
  229. package/dist/cjs/src/pro/bequant.js +5 -4
  230. package/dist/cjs/src/pro/binance.js +3 -0
  231. package/dist/cjs/src/pro/binancecoinm.js +1 -1
  232. package/dist/cjs/src/pro/binanceus.js +1 -1
  233. package/dist/cjs/src/pro/binanceusdm.js +7 -2
  234. package/dist/cjs/src/pro/bingx.js +1 -1
  235. package/dist/cjs/src/pro/bitfinex.js +1 -1
  236. package/dist/cjs/src/pro/bitget.js +1 -1
  237. package/dist/cjs/src/pro/bithumb.js +1 -1
  238. package/dist/cjs/src/pro/bitmart.js +52 -52
  239. package/dist/cjs/src/pro/bitmex.js +1 -1
  240. package/dist/cjs/src/pro/bitrue.js +1 -1
  241. package/dist/cjs/src/pro/bitstamp.js +1 -1
  242. package/dist/cjs/src/pro/bitvavo.js +1 -1
  243. package/dist/cjs/src/pro/blockchaincom.js +1 -1
  244. package/dist/cjs/src/pro/blofin.js +1 -1
  245. package/dist/cjs/src/pro/bullish.js +1 -1
  246. package/dist/cjs/src/pro/bybit.js +2 -2
  247. package/dist/cjs/src/pro/bydfi.js +1 -1
  248. package/dist/cjs/src/pro/cex.js +1 -1
  249. package/dist/cjs/src/pro/coinbase.js +1 -1
  250. package/dist/cjs/src/pro/coinbaseadvanced.js +1 -1
  251. package/dist/cjs/src/pro/coinbaseexchange.js +1 -1
  252. package/dist/cjs/src/pro/coinbaseinternational.js +1 -1
  253. package/dist/cjs/src/pro/coincheck.js +1 -1
  254. package/dist/cjs/src/pro/coinex.js +1 -1
  255. package/dist/cjs/src/pro/coinone.js +1 -1
  256. package/dist/cjs/src/pro/cryptocom.js +1 -1
  257. package/dist/cjs/src/pro/deepcoin.js +1 -1
  258. package/dist/cjs/src/pro/deribit.js +1 -1
  259. package/dist/cjs/src/pro/dydx.js +1 -1
  260. package/dist/cjs/src/pro/exmo.js +1 -1
  261. package/dist/cjs/src/pro/gate.js +6 -6
  262. package/dist/cjs/src/pro/gateio.js +1 -1
  263. package/dist/cjs/src/pro/gemini.js +1 -1
  264. package/dist/cjs/src/pro/grvt.js +4 -4
  265. package/dist/cjs/src/pro/hashkey.js +1 -1
  266. package/dist/cjs/src/pro/hitbtc.js +1 -1
  267. package/dist/cjs/src/pro/hollaex.js +1 -1
  268. package/dist/cjs/src/pro/htx.js +1 -1
  269. package/dist/cjs/src/pro/huobi.js +1 -1
  270. package/dist/cjs/src/pro/hyperliquid.js +2 -2
  271. package/dist/cjs/src/pro/independentreserve.js +1 -1
  272. package/dist/cjs/src/pro/kraken.js +1 -1
  273. package/dist/cjs/src/pro/krakenfutures.js +22 -9
  274. package/dist/cjs/src/pro/kucoin.js +4 -4
  275. package/dist/cjs/src/pro/kucoinfutures.js +1 -1
  276. package/dist/cjs/src/pro/lbank.js +1 -0
  277. package/dist/cjs/src/pro/lighter.js +16 -16
  278. package/dist/cjs/src/pro/luno.js +1 -1
  279. package/dist/cjs/src/pro/mexc.js +1 -1
  280. package/dist/cjs/src/pro/myokx.js +1 -1
  281. package/dist/cjs/src/pro/ndax.js +1 -1
  282. package/dist/cjs/src/pro/okx.js +1 -1
  283. package/dist/cjs/src/pro/okxus.js +1 -1
  284. package/dist/cjs/src/pro/onetrading.js +1 -1
  285. package/dist/cjs/src/pro/oxfun.js +1 -1
  286. package/dist/cjs/src/pro/p2b.js +1 -1
  287. package/dist/cjs/src/pro/pacifica.js +2 -2
  288. package/dist/cjs/src/pro/paradex.js +1 -1
  289. package/dist/cjs/src/pro/phemex.js +1 -1
  290. package/dist/cjs/src/pro/poloniex.js +1 -1
  291. package/dist/cjs/src/pro/toobit.js +1 -1
  292. package/dist/cjs/src/pro/upbit.js +1 -1
  293. package/dist/cjs/src/pro/weex.js +4 -4
  294. package/dist/cjs/src/pro/whitebit.js +1 -1
  295. package/dist/cjs/src/pro/xt.js +1 -1
  296. package/dist/cjs/src/protobuf/mexc/compiled.cjs.js +0 -1
  297. package/dist/cjs/src/static_dependencies/dydx-v4-client/cosmos/base/v1beta1/coin.js +1 -0
  298. package/dist/cjs/src/static_dependencies/dydx-v4-client/cosmos/crypto/multisig/v1beta1/multisig.js +1 -0
  299. package/dist/cjs/src/static_dependencies/dydx-v4-client/cosmos/crypto/secp256k1/keys.js +1 -0
  300. package/dist/cjs/src/static_dependencies/dydx-v4-client/cosmos/tx/signing/v1beta1/signing.js +1 -0
  301. package/dist/cjs/src/static_dependencies/dydx-v4-client/cosmos/tx/v1beta1/tx.js +1 -0
  302. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/accountplus/tx.js +1 -0
  303. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/clob_pair.js +1 -0
  304. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/order.js +1 -0
  305. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/order_removals.js +1 -0
  306. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/tx.js +1 -0
  307. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/sending/transfer.js +1 -0
  308. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/sending/tx.js +1 -0
  309. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/subaccounts/subaccount.js +1 -0
  310. package/dist/cjs/src/static_dependencies/dydx-v4-client/google/protobuf/any.js +1 -0
  311. package/dist/cjs/src/static_dependencies/dydx-v4-client/helpers.js +6 -0
  312. package/dist/cjs/src/static_dependencies/dydx-v4-client/onboarding.js +1 -0
  313. package/dist/cjs/src/static_dependencies/dydx-v4-client/registry.js +1 -0
  314. package/dist/cjs/src/static_dependencies/ethers/abi-coder.js +6 -0
  315. package/dist/cjs/src/static_dependencies/ethers/address/address.js +1 -1
  316. package/dist/cjs/src/static_dependencies/ethers/coders/abstract-coder.js +6 -0
  317. package/dist/cjs/src/static_dependencies/ethers/coders/address.js +1 -0
  318. package/dist/cjs/src/static_dependencies/ethers/coders/anonymous.js +1 -0
  319. package/dist/cjs/src/static_dependencies/ethers/coders/array.js +1 -0
  320. package/dist/cjs/src/static_dependencies/ethers/coders/boolean.js +1 -0
  321. package/dist/cjs/src/static_dependencies/ethers/coders/bytes.js +1 -0
  322. package/dist/cjs/src/static_dependencies/ethers/coders/fixed-bytes.js +1 -0
  323. package/dist/cjs/src/static_dependencies/ethers/coders/null.js +1 -0
  324. package/dist/cjs/src/static_dependencies/ethers/coders/number.js +1 -0
  325. package/dist/cjs/src/static_dependencies/ethers/coders/string.js +1 -0
  326. package/dist/cjs/src/static_dependencies/ethers/coders/tuple.js +1 -0
  327. package/dist/cjs/src/static_dependencies/ethers/fragments.js +6 -0
  328. package/dist/cjs/src/static_dependencies/ethers/hash/typed-data.js +6 -0
  329. package/dist/cjs/src/static_dependencies/ethers/index.js +1 -10
  330. package/dist/cjs/src/static_dependencies/ethers/interface.js +6 -0
  331. package/dist/cjs/src/static_dependencies/ethers/typed.js +6 -0
  332. package/dist/cjs/src/static_dependencies/ethers/utils/base58.js +1 -13
  333. package/dist/cjs/src/static_dependencies/ethers/utils/data.js +1 -6
  334. package/dist/cjs/src/static_dependencies/ethers/utils/errors.js +1 -9
  335. package/dist/cjs/src/static_dependencies/ethers/utils/events.js +6 -0
  336. package/dist/cjs/src/static_dependencies/ethers/utils/fixednumber.js +6 -0
  337. package/dist/cjs/src/static_dependencies/ethers/utils/index.js +1 -7
  338. package/dist/cjs/src/static_dependencies/ethers/utils/maths.js +1 -5
  339. package/dist/cjs/src/static_dependencies/ethers/utils/properties.js +6 -0
  340. package/dist/cjs/src/static_dependencies/ethers/utils/utf8.js +1 -8
  341. package/dist/cjs/src/static_dependencies/fflake/browser.js +1 -1
  342. package/dist/cjs/src/static_dependencies/jsencrypt/JSEncrypt.js +1 -0
  343. package/dist/cjs/src/static_dependencies/jsencrypt/JSEncryptRSAKey.js +1 -0
  344. package/dist/cjs/src/static_dependencies/jsencrypt/lib/asn1js/asn1.js +1 -1
  345. package/dist/cjs/src/static_dependencies/jsencrypt/lib/asn1js/base64.js +6 -0
  346. package/dist/cjs/src/static_dependencies/jsencrypt/lib/asn1js/hex.js +6 -0
  347. package/dist/cjs/src/static_dependencies/jsencrypt/lib/asn1js/int10.js +6 -0
  348. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/base64.js +1 -0
  349. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.js +1 -1
  350. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/prng4.js +6 -0
  351. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/rng.js +1 -1
  352. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/rsa.js +1 -1
  353. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/util.js +6 -0
  354. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +1 -1
  355. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsrsasign/yahoo.js +6 -0
  356. package/dist/cjs/src/static_dependencies/messagepack/msgpack.js +6 -0
  357. package/dist/cjs/src/static_dependencies/noble-curves/_shortw_utils.js +1 -1
  358. package/dist/cjs/src/static_dependencies/noble-curves/abstract/curve.js +1 -1
  359. package/dist/cjs/src/static_dependencies/noble-curves/abstract/edwards.js +1 -1
  360. package/dist/cjs/src/static_dependencies/noble-curves/abstract/hash-to-curve.js +1 -0
  361. package/dist/cjs/src/static_dependencies/noble-curves/abstract/modular.js +1 -1
  362. package/dist/cjs/src/static_dependencies/noble-curves/abstract/montgomery.js +1 -1
  363. package/dist/cjs/src/static_dependencies/noble-curves/abstract/poseidon.js +1 -1
  364. package/dist/cjs/src/static_dependencies/noble-curves/abstract/utils.js +6 -0
  365. package/dist/cjs/src/static_dependencies/noble-curves/abstract/weierstrass.js +1 -1
  366. package/dist/cjs/src/static_dependencies/noble-curves/ed25519.js +1 -1
  367. package/dist/cjs/src/static_dependencies/noble-curves/p256.js +1 -1
  368. package/dist/cjs/src/static_dependencies/noble-curves/secp256k1.js +1 -1
  369. package/dist/cjs/src/static_dependencies/noble-hashes/_assert.js +6 -0
  370. package/dist/cjs/src/static_dependencies/noble-hashes/_sha2.js +1 -0
  371. package/dist/cjs/src/static_dependencies/noble-hashes/_u64.js +6 -0
  372. package/dist/cjs/src/static_dependencies/noble-hashes/crypto.js +6 -0
  373. package/dist/cjs/src/static_dependencies/noble-hashes/hmac.js +1 -0
  374. package/dist/cjs/src/static_dependencies/noble-hashes/md5.js +1 -0
  375. package/dist/cjs/src/static_dependencies/noble-hashes/pbkdf2.js +1 -0
  376. package/dist/cjs/src/static_dependencies/noble-hashes/ripemd160.js +1 -0
  377. package/dist/cjs/src/static_dependencies/noble-hashes/sha1.js +1 -0
  378. package/dist/cjs/src/static_dependencies/noble-hashes/sha256.js +1 -0
  379. package/dist/cjs/src/static_dependencies/noble-hashes/sha3.js +1 -0
  380. package/dist/cjs/src/static_dependencies/noble-hashes/sha512.js +1 -0
  381. package/dist/cjs/src/static_dependencies/noble-hashes/utils.js +1 -1
  382. package/dist/cjs/src/static_dependencies/node-fetch/body.js +1 -5
  383. package/dist/cjs/src/static_dependencies/node-fetch/errors/abort-error.js +1 -0
  384. package/dist/cjs/src/static_dependencies/node-fetch/errors/base.js +6 -0
  385. package/dist/cjs/src/static_dependencies/node-fetch/errors/fetch-error.js +1 -0
  386. package/dist/cjs/src/static_dependencies/node-fetch/headers.js +1 -5
  387. package/dist/cjs/src/static_dependencies/node-fetch/index.js +1 -7
  388. package/dist/cjs/src/static_dependencies/node-fetch/request.js +1 -7
  389. package/dist/cjs/src/static_dependencies/node-fetch/response.js +1 -5
  390. package/dist/cjs/src/static_dependencies/node-fetch/utils/get-search.js +6 -0
  391. package/dist/cjs/src/static_dependencies/node-fetch/utils/is-redirect.js +6 -0
  392. package/dist/cjs/src/static_dependencies/node-fetch/utils/is.js +6 -0
  393. package/dist/cjs/src/static_dependencies/node-fetch/utils/referrer.js +1 -0
  394. package/dist/cjs/src/static_dependencies/proxies/agent-base/index.js +1 -0
  395. package/dist/cjs/src/static_dependencies/proxies/http-proxy-agent/index.js +1 -0
  396. package/dist/cjs/src/static_dependencies/proxies/https-proxy-agent/index.js +1 -0
  397. package/dist/cjs/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.js +6 -0
  398. package/dist/cjs/src/static_dependencies/qs/formats.js +6 -0
  399. package/dist/cjs/src/static_dependencies/qs/index.js +1 -0
  400. package/dist/cjs/src/static_dependencies/qs/parse.js +1 -0
  401. package/dist/cjs/src/static_dependencies/qs/stringify.js +1 -0
  402. package/dist/cjs/src/static_dependencies/qs/utils.js +6 -0
  403. package/dist/cjs/src/static_dependencies/scure-base/index.js +6 -0
  404. package/dist/cjs/src/static_dependencies/scure-bip32/index.js +1 -19
  405. package/dist/cjs/src/static_dependencies/scure-bip39/index.js +1 -1
  406. package/dist/cjs/src/static_dependencies/scure-bip39/wordlists/english.js +6 -0
  407. package/dist/cjs/src/static_dependencies/scure-starknet/index.js +1 -1
  408. package/dist/cjs/src/static_dependencies/starknet/constants.js +1 -1
  409. package/dist/cjs/src/static_dependencies/starknet/types/calldata.js +6 -0
  410. package/dist/cjs/src/static_dependencies/starknet/types/lib/contract/abi.js +6 -0
  411. package/dist/cjs/src/static_dependencies/starknet/types/lib/contract/index.js +6 -0
  412. package/dist/cjs/src/static_dependencies/starknet/types/lib/index.js +6 -0
  413. package/dist/cjs/src/static_dependencies/starknet/types/typedData.js +6 -0
  414. package/dist/cjs/src/static_dependencies/starknet/utils/assert.js +6 -0
  415. package/dist/cjs/src/static_dependencies/starknet/utils/cairoDataTypes/felt.js +1 -1
  416. package/dist/cjs/src/static_dependencies/starknet/utils/cairoDataTypes/uint256.js +1 -1
  417. package/dist/cjs/src/static_dependencies/starknet/utils/cairoDataTypes/uint512.js +1 -1
  418. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/byteArray.js +1 -0
  419. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/cairo.js +1 -0
  420. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/enum/CairoCustomEnum.js +6 -0
  421. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/enum/CairoOption.js +6 -0
  422. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/enum/CairoResult.js +6 -0
  423. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/formatter.js +1 -0
  424. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/index.js +1 -1
  425. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/parser/index.js +1 -0
  426. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/parser/parser-0-1.1.0.js +1 -0
  427. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/parser/parser-2.0.0.js +6 -0
  428. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/propertyOrder.js +1 -0
  429. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/requestParser.js +1 -0
  430. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/responseParser.js +1 -0
  431. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/tuple.js +1 -1
  432. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/validate.js +1 -4
  433. package/dist/cjs/src/static_dependencies/starknet/utils/encode.js +1 -0
  434. package/dist/cjs/src/static_dependencies/starknet/utils/hash/classHash.js +1 -3
  435. package/dist/cjs/src/static_dependencies/starknet/utils/merkle.js +1 -0
  436. package/dist/cjs/src/static_dependencies/starknet/utils/num.js +1 -0
  437. package/dist/cjs/src/static_dependencies/starknet/utils/selector.js +1 -0
  438. package/dist/cjs/src/static_dependencies/starknet/utils/shortString.js +1 -0
  439. package/dist/cjs/src/static_dependencies/starknet/utils/typedData.js +1 -1
  440. package/dist/cjs/src/static_dependencies/watchable/src/unpromise.js +6 -0
  441. package/dist/cjs/src/static_dependencies/zklink/zklink-sdk-web.js +6 -0
  442. package/dist/cjs/src/tokocrypto.js +1 -1
  443. package/dist/cjs/src/toobit.js +1 -1
  444. package/dist/cjs/src/upbit.js +28 -18
  445. package/dist/cjs/src/wavesexchange.js +1 -1
  446. package/dist/cjs/src/weex.js +8 -5
  447. package/dist/cjs/src/whitebit.js +1 -1
  448. package/dist/cjs/src/woo.js +1 -1
  449. package/dist/cjs/src/woofipro.js +1 -1
  450. package/dist/cjs/src/xt.js +7 -1
  451. package/dist/cjs/src/yobit.js +1 -1
  452. package/dist/cjs/src/zaif.js +1 -1
  453. package/dist/cjs/src/zebpay.js +1 -1
  454. package/dist/cjs/src/zonda.js +1 -1
  455. package/js/ccxt.d.ts +1 -1
  456. package/js/ccxt.js +7 -1
  457. package/js/src/abstract/aftermath.js +6 -0
  458. package/js/src/abstract/alpaca.js +6 -0
  459. package/js/src/abstract/apex.js +6 -0
  460. package/js/src/abstract/arkham.js +6 -0
  461. package/js/src/abstract/ascendex.js +6 -0
  462. package/js/src/abstract/aster.d.ts +43 -9
  463. package/js/src/abstract/aster.js +6 -0
  464. package/js/src/abstract/backpack.js +6 -0
  465. package/js/src/abstract/bequant.js +6 -0
  466. package/js/src/abstract/bigone.js +6 -0
  467. package/js/src/abstract/binance.js +6 -0
  468. package/js/src/abstract/binancecoinm.js +6 -0
  469. package/js/src/abstract/binanceus.js +6 -0
  470. package/js/src/abstract/binanceusdm.js +6 -0
  471. package/js/src/abstract/bingx.js +6 -0
  472. package/js/src/abstract/bit2c.js +6 -0
  473. package/js/src/abstract/bitbank.js +6 -0
  474. package/js/src/abstract/bitbns.js +6 -0
  475. package/js/src/abstract/bitfinex.js +6 -0
  476. package/js/src/abstract/bitflyer.js +6 -0
  477. package/js/src/abstract/bitget.js +6 -0
  478. package/js/src/abstract/bithumb.js +6 -0
  479. package/js/src/abstract/bitmart.js +6 -0
  480. package/js/src/abstract/bitmex.js +6 -0
  481. package/js/src/abstract/bitopro.js +6 -0
  482. package/js/src/abstract/bitrue.js +6 -0
  483. package/js/src/abstract/bitso.js +6 -0
  484. package/js/src/abstract/bitstamp.js +6 -0
  485. package/js/src/abstract/bitteam.js +6 -0
  486. package/js/src/abstract/bittrade.js +6 -0
  487. package/js/src/abstract/bitvavo.js +6 -0
  488. package/js/src/abstract/blockchaincom.js +6 -0
  489. package/js/src/abstract/blofin.js +6 -0
  490. package/js/src/abstract/btcbox.js +6 -0
  491. package/js/src/abstract/btcmarkets.js +6 -0
  492. package/js/src/abstract/btcturk.js +6 -0
  493. package/js/src/abstract/bullish.js +6 -0
  494. package/js/src/abstract/bybit.js +6 -0
  495. package/js/src/abstract/bydfi.js +6 -0
  496. package/js/src/abstract/cex.js +6 -0
  497. package/js/src/abstract/coinbase.js +6 -0
  498. package/js/src/abstract/coinbaseadvanced.js +6 -0
  499. package/js/src/abstract/coinbaseexchange.js +6 -0
  500. package/js/src/abstract/coinbaseinternational.js +6 -0
  501. package/js/src/abstract/coincheck.js +6 -0
  502. package/js/src/abstract/coinex.js +6 -0
  503. package/js/src/abstract/coinmate.js +6 -0
  504. package/js/src/abstract/coinmetro.js +6 -0
  505. package/js/src/abstract/coinone.js +6 -0
  506. package/js/src/abstract/coinsph.js +6 -0
  507. package/js/src/abstract/coinspot.js +6 -0
  508. package/js/src/abstract/cryptocom.js +6 -0
  509. package/js/src/abstract/cryptomus.js +6 -0
  510. package/js/src/abstract/deepcoin.js +6 -0
  511. package/js/src/abstract/delta.js +6 -0
  512. package/js/src/abstract/deribit.js +6 -0
  513. package/js/src/abstract/derive.js +6 -0
  514. package/js/src/abstract/digifinex.js +6 -0
  515. package/js/src/abstract/dydx.js +6 -0
  516. package/js/src/abstract/exmo.js +6 -0
  517. package/js/src/abstract/fmfwio.js +6 -0
  518. package/js/src/abstract/foxbit.js +6 -0
  519. package/js/src/abstract/gate.js +6 -0
  520. package/js/src/abstract/gateio.js +6 -0
  521. package/js/src/abstract/gemini.js +6 -0
  522. package/js/src/abstract/grvt.js +6 -0
  523. package/js/src/abstract/hashkey.js +6 -0
  524. package/js/src/abstract/hibachi.js +6 -0
  525. package/js/src/abstract/hitbtc.js +6 -0
  526. package/js/src/abstract/hollaex.js +6 -0
  527. package/js/src/abstract/htx.js +6 -0
  528. package/js/src/abstract/huobi.js +6 -0
  529. package/js/src/abstract/hyperliquid.js +6 -0
  530. package/js/src/abstract/independentreserve.js +6 -0
  531. package/js/src/abstract/indodax.js +6 -0
  532. package/js/src/abstract/kraken.js +6 -0
  533. package/js/src/abstract/krakenfutures.js +6 -0
  534. package/js/src/abstract/kucoin.js +6 -0
  535. package/js/src/abstract/kucoinfutures.js +6 -0
  536. package/js/src/abstract/latoken.js +6 -0
  537. package/js/src/abstract/lbank.js +6 -0
  538. package/js/src/abstract/lighter.js +6 -0
  539. package/js/src/abstract/luno.js +6 -0
  540. package/js/src/abstract/mercado.js +6 -0
  541. package/js/src/abstract/mexc.js +6 -0
  542. package/js/src/abstract/modetrade.js +6 -0
  543. package/js/src/abstract/myokx.d.ts +1 -0
  544. package/js/src/abstract/myokx.js +6 -0
  545. package/js/src/abstract/ndax.js +6 -0
  546. package/js/src/abstract/novadax.js +6 -0
  547. package/js/src/abstract/okx.d.ts +1 -0
  548. package/js/src/abstract/okx.js +6 -0
  549. package/js/src/abstract/okxus.d.ts +1 -0
  550. package/js/src/abstract/okxus.js +6 -0
  551. package/js/src/abstract/onetrading.js +6 -0
  552. package/js/src/abstract/oxfun.js +6 -0
  553. package/js/src/abstract/p2b.js +6 -0
  554. package/js/src/abstract/pacifica.js +6 -0
  555. package/js/src/abstract/paradex.js +6 -0
  556. package/js/src/abstract/paymium.js +6 -0
  557. package/js/src/abstract/phemex.d.ts +1 -0
  558. package/js/src/abstract/phemex.js +6 -0
  559. package/js/src/abstract/poloniex.js +6 -0
  560. package/js/src/abstract/tokocrypto.js +6 -0
  561. package/js/src/abstract/toobit.js +6 -0
  562. package/js/src/abstract/upbit.js +6 -0
  563. package/js/src/abstract/wavesexchange.js +6 -0
  564. package/js/src/abstract/weex.js +6 -0
  565. package/js/src/abstract/whitebit.js +6 -0
  566. package/js/src/abstract/woo.js +6 -0
  567. package/js/src/abstract/woofipro.js +6 -0
  568. package/js/src/abstract/xt.js +6 -0
  569. package/js/src/abstract/yobit.js +6 -0
  570. package/js/src/abstract/zaif.js +6 -0
  571. package/js/src/abstract/zebpay.js +6 -0
  572. package/js/src/abstract/zonda.js +6 -0
  573. package/js/src/aftermath.d.ts +16 -16
  574. package/js/src/aftermath.js +22 -16
  575. package/js/src/alpaca.js +6 -0
  576. package/js/src/apex.js +6 -0
  577. package/js/src/arkham.js +6 -0
  578. package/js/src/ascendex.js +6 -0
  579. package/js/src/aster.d.ts +165 -100
  580. package/js/src/aster.js +1574 -1100
  581. package/js/src/backpack.js +6 -0
  582. package/js/src/base/Exchange.d.ts +6 -7
  583. package/js/src/base/Exchange.js +43 -32
  584. package/js/src/base/Precise.js +6 -0
  585. package/js/src/base/errorHierarchy.js +6 -0
  586. package/js/src/base/errors.js +6 -0
  587. package/js/src/base/functions/crypto.js +6 -0
  588. package/js/src/base/functions/encode.js +6 -0
  589. package/js/src/base/functions/generic.js +6 -0
  590. package/js/src/base/functions/io.js +6 -0
  591. package/js/src/base/functions/misc.js +6 -0
  592. package/js/src/base/functions/number.js +6 -0
  593. package/js/src/base/functions/platform.js +6 -0
  594. package/js/src/base/functions/rsa.js +6 -0
  595. package/js/src/base/functions/string.js +6 -0
  596. package/js/src/base/functions/throttle.js +6 -0
  597. package/js/src/base/functions/time.js +6 -0
  598. package/js/src/base/functions/totp.js +6 -0
  599. package/js/src/base/functions/type.js +6 -0
  600. package/js/src/base/functions.js +6 -0
  601. package/js/src/base/types.js +6 -0
  602. package/js/src/base/ws/Cache.js +6 -0
  603. package/js/src/base/ws/Client.js +6 -0
  604. package/js/src/base/ws/Future.js +6 -0
  605. package/js/src/base/ws/OrderBook.js +6 -0
  606. package/js/src/base/ws/OrderBookSide.js +6 -0
  607. package/js/src/base/ws/WsClient.js +6 -0
  608. package/js/src/base/ws/functions.js +6 -0
  609. package/js/src/bequant.js +14 -0
  610. package/js/src/bigone.js +6 -0
  611. package/js/src/binance.js +41 -32
  612. package/js/src/binancecoinm.js +6 -0
  613. package/js/src/binanceus.js +6 -0
  614. package/js/src/binanceusdm.js +7 -0
  615. package/js/src/bingx.js +6 -0
  616. package/js/src/bit2c.js +6 -0
  617. package/js/src/bitbank.js +6 -0
  618. package/js/src/bitbns.js +6 -0
  619. package/js/src/bitfinex.js +7 -3
  620. package/js/src/bitflyer.js +6 -0
  621. package/js/src/bitget.js +6 -0
  622. package/js/src/bithumb.js +6 -0
  623. package/js/src/bitmart.js +6 -0
  624. package/js/src/bitmex.js +6 -0
  625. package/js/src/bitopro.js +6 -0
  626. package/js/src/bitrue.js +6 -0
  627. package/js/src/bitso.js +6 -0
  628. package/js/src/bitstamp.d.ts +1 -1
  629. package/js/src/bitstamp.js +7 -1
  630. package/js/src/bitteam.js +6 -0
  631. package/js/src/bittrade.js +6 -0
  632. package/js/src/bitvavo.js +9 -3
  633. package/js/src/blockchaincom.js +6 -0
  634. package/js/src/blofin.d.ts +15 -0
  635. package/js/src/blofin.js +96 -1
  636. package/js/src/btcbox.js +6 -0
  637. package/js/src/btcmarkets.js +6 -0
  638. package/js/src/btcturk.js +6 -0
  639. package/js/src/bullish.js +6 -0
  640. package/js/src/bybit.js +6 -0
  641. package/js/src/bydfi.js +6 -0
  642. package/js/src/cex.js +6 -0
  643. package/js/src/coinbase.d.ts +1 -1
  644. package/js/src/coinbase.js +7 -1
  645. package/js/src/coinbaseadvanced.js +6 -0
  646. package/js/src/coinbaseexchange.d.ts +1 -1
  647. package/js/src/coinbaseexchange.js +6 -0
  648. package/js/src/coinbaseinternational.js +6 -0
  649. package/js/src/coincheck.js +6 -0
  650. package/js/src/coinex.js +6 -0
  651. package/js/src/coinmate.js +6 -0
  652. package/js/src/coinmetro.js +6 -0
  653. package/js/src/coinone.js +6 -0
  654. package/js/src/coinsph.js +6 -0
  655. package/js/src/coinspot.js +6 -0
  656. package/js/src/cryptocom.js +7 -0
  657. package/js/src/cryptomus.js +6 -0
  658. package/js/src/deepcoin.js +6 -0
  659. package/js/src/delta.js +6 -0
  660. package/js/src/deribit.js +6 -0
  661. package/js/src/derive.js +6 -0
  662. package/js/src/digifinex.js +6 -0
  663. package/js/src/dydx.js +6 -0
  664. package/js/src/exmo.js +6 -0
  665. package/js/src/fmfwio.js +6 -0
  666. package/js/src/foxbit.js +6 -0
  667. package/js/src/gate.js +11 -1
  668. package/js/src/gateio.js +6 -0
  669. package/js/src/gemini.js +6 -0
  670. package/js/src/grvt.d.ts +19 -19
  671. package/js/src/grvt.js +40 -27
  672. package/js/src/hashkey.js +6 -0
  673. package/js/src/hibachi.js +6 -0
  674. package/js/src/hitbtc.js +6 -0
  675. package/js/src/hollaex.js +6 -0
  676. package/js/src/htx.js +6 -0
  677. package/js/src/huobi.js +6 -0
  678. package/js/src/hyperliquid.js +6 -0
  679. package/js/src/independentreserve.js +6 -0
  680. package/js/src/indodax.js +6 -0
  681. package/js/src/kraken.js +12 -1
  682. package/js/src/krakenfutures.js +6 -0
  683. package/js/src/kucoin.js +6 -0
  684. package/js/src/kucoinfutures.js +6 -0
  685. package/js/src/latoken.js +6 -0
  686. package/js/src/lbank.js +6 -0
  687. package/js/src/lighter.d.ts +5 -5
  688. package/js/src/lighter.js +12 -6
  689. package/js/src/luno.js +6 -0
  690. package/js/src/mercado.js +6 -0
  691. package/js/src/mexc.js +7 -1
  692. package/js/src/modetrade.js +6 -0
  693. package/js/src/myokx.js +6 -0
  694. package/js/src/ndax.js +6 -0
  695. package/js/src/novadax.js +6 -0
  696. package/js/src/okx.js +7 -0
  697. package/js/src/okxus.js +6 -0
  698. package/js/src/onetrading.js +6 -0
  699. package/js/src/oxfun.js +6 -0
  700. package/js/src/p2b.js +6 -0
  701. package/js/src/pacifica.js +6 -0
  702. package/js/src/paradex.js +6 -0
  703. package/js/src/paymium.js +6 -0
  704. package/js/src/phemex.d.ts +13 -0
  705. package/js/src/phemex.js +95 -7
  706. package/js/src/poloniex.js +6 -0
  707. package/js/src/pro/aftermath.d.ts +2 -2
  708. package/js/src/pro/aftermath.js +8 -2
  709. package/js/src/pro/alpaca.js +6 -0
  710. package/js/src/pro/apex.js +6 -0
  711. package/js/src/pro/arkham.js +6 -0
  712. package/js/src/pro/ascendex.js +6 -0
  713. package/js/src/pro/aster.d.ts +99 -63
  714. package/js/src/pro/aster.js +154 -156
  715. package/js/src/pro/backpack.js +6 -0
  716. package/js/src/pro/bequant.js +10 -3
  717. package/js/src/pro/binance.d.ts +1 -1
  718. package/js/src/pro/binance.js +9 -0
  719. package/js/src/pro/binancecoinm.js +6 -0
  720. package/js/src/pro/binanceus.js +6 -0
  721. package/js/src/pro/binanceusdm.js +12 -1
  722. package/js/src/pro/bingx.js +6 -0
  723. package/js/src/pro/bitfinex.js +6 -0
  724. package/js/src/pro/bitget.js +6 -0
  725. package/js/src/pro/bithumb.js +6 -0
  726. package/js/src/pro/bitmart.d.ts +10 -9
  727. package/js/src/pro/bitmart.js +57 -51
  728. package/js/src/pro/bitmex.js +6 -0
  729. package/js/src/pro/bitopro.js +6 -0
  730. package/js/src/pro/bitrue.js +6 -0
  731. package/js/src/pro/bitstamp.js +6 -0
  732. package/js/src/pro/bittrade.js +6 -0
  733. package/js/src/pro/bitvavo.js +6 -0
  734. package/js/src/pro/blockchaincom.js +6 -0
  735. package/js/src/pro/blofin.js +6 -0
  736. package/js/src/pro/bullish.js +6 -0
  737. package/js/src/pro/bybit.js +7 -1
  738. package/js/src/pro/bydfi.js +6 -0
  739. package/js/src/pro/cex.js +6 -0
  740. package/js/src/pro/coinbase.js +6 -0
  741. package/js/src/pro/coinbaseadvanced.js +6 -0
  742. package/js/src/pro/coinbaseexchange.js +6 -0
  743. package/js/src/pro/coinbaseinternational.js +6 -0
  744. package/js/src/pro/coincheck.js +6 -0
  745. package/js/src/pro/coinex.js +6 -0
  746. package/js/src/pro/coinone.js +6 -0
  747. package/js/src/pro/cryptocom.js +6 -0
  748. package/js/src/pro/deepcoin.js +6 -0
  749. package/js/src/pro/deribit.js +6 -0
  750. package/js/src/pro/derive.js +6 -0
  751. package/js/src/pro/dydx.js +6 -0
  752. package/js/src/pro/exmo.js +6 -0
  753. package/js/src/pro/gate.js +11 -5
  754. package/js/src/pro/gateio.js +6 -0
  755. package/js/src/pro/gemini.js +6 -0
  756. package/js/src/pro/grvt.js +9 -3
  757. package/js/src/pro/hashkey.js +6 -0
  758. package/js/src/pro/hitbtc.js +6 -0
  759. package/js/src/pro/hollaex.js +6 -0
  760. package/js/src/pro/htx.js +6 -0
  761. package/js/src/pro/huobi.js +6 -0
  762. package/js/src/pro/hyperliquid.d.ts +1 -1
  763. package/js/src/pro/hyperliquid.js +7 -1
  764. package/js/src/pro/independentreserve.js +6 -0
  765. package/js/src/pro/kraken.js +6 -0
  766. package/js/src/pro/krakenfutures.d.ts +1 -0
  767. package/js/src/pro/krakenfutures.js +27 -8
  768. package/js/src/pro/kucoin.d.ts +1 -1
  769. package/js/src/pro/kucoin.js +9 -3
  770. package/js/src/pro/kucoinfutures.js +6 -0
  771. package/js/src/pro/lbank.js +6 -0
  772. package/js/src/pro/lighter.d.ts +15 -15
  773. package/js/src/pro/lighter.js +21 -15
  774. package/js/src/pro/luno.js +6 -0
  775. package/js/src/pro/mexc.js +6 -0
  776. package/js/src/pro/modetrade.js +6 -0
  777. package/js/src/pro/myokx.js +6 -0
  778. package/js/src/pro/ndax.js +6 -0
  779. package/js/src/pro/okx.js +6 -0
  780. package/js/src/pro/okxus.js +6 -0
  781. package/js/src/pro/onetrading.js +6 -0
  782. package/js/src/pro/oxfun.js +6 -0
  783. package/js/src/pro/p2b.js +6 -0
  784. package/js/src/pro/pacifica.d.ts +1 -1
  785. package/js/src/pro/pacifica.js +7 -1
  786. package/js/src/pro/paradex.js +6 -0
  787. package/js/src/pro/phemex.js +6 -0
  788. package/js/src/pro/poloniex.js +6 -0
  789. package/js/src/pro/toobit.js +6 -0
  790. package/js/src/pro/upbit.js +6 -0
  791. package/js/src/pro/weex.d.ts +3 -3
  792. package/js/src/pro/weex.js +9 -3
  793. package/js/src/pro/whitebit.js +6 -0
  794. package/js/src/pro/woo.js +6 -0
  795. package/js/src/pro/woofipro.js +6 -0
  796. package/js/src/pro/xt.js +6 -0
  797. package/js/src/protobuf/mexc/compiled.cjs +6 -0
  798. package/js/src/protobuf/mexc/compiled.d.cts +6 -0
  799. package/js/src/static_dependencies/dydx-v4-client/cosmos/base/v1beta1/coin.js +6 -0
  800. package/js/src/static_dependencies/dydx-v4-client/cosmos/crypto/multisig/keys.js +6 -0
  801. package/js/src/static_dependencies/dydx-v4-client/cosmos/crypto/multisig/v1beta1/multisig.js +6 -0
  802. package/js/src/static_dependencies/dydx-v4-client/cosmos/crypto/secp256k1/keys.js +6 -0
  803. package/js/src/static_dependencies/dydx-v4-client/cosmos/tx/signing/v1beta1/signing.js +6 -0
  804. package/js/src/static_dependencies/dydx-v4-client/cosmos/tx/v1beta1/tx.js +6 -0
  805. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/accountplus/tx.js +6 -0
  806. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/block_rate_limit_config.js +6 -0
  807. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/clob_pair.js +6 -0
  808. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/equity_tier_limit_config.js +6 -0
  809. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/finalize_block.js +6 -0
  810. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/liquidations.js +6 -0
  811. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/liquidations_config.js +6 -0
  812. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/matches.js +6 -0
  813. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/order.js +6 -0
  814. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/order_removals.js +6 -0
  815. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/tx.js +6 -0
  816. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/sending/transfer.js +6 -0
  817. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/sending/tx.js +6 -0
  818. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/subaccounts/asset_position.js +6 -0
  819. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/subaccounts/perpetual_position.js +6 -0
  820. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/subaccounts/subaccount.js +6 -0
  821. package/js/src/static_dependencies/dydx-v4-client/google/protobuf/any.js +6 -0
  822. package/js/src/static_dependencies/dydx-v4-client/helpers.js +6 -0
  823. package/js/src/static_dependencies/dydx-v4-client/long/index.cjs +6 -0
  824. package/js/src/static_dependencies/dydx-v4-client/long/index.d.cts +6 -0
  825. package/js/src/static_dependencies/dydx-v4-client/onboarding.js +6 -0
  826. package/js/src/static_dependencies/dydx-v4-client/registry.js +6 -0
  827. package/js/src/static_dependencies/ethers/abi-coder.js +6 -0
  828. package/js/src/static_dependencies/ethers/address/address.js +6 -0
  829. package/js/src/static_dependencies/ethers/address/checks.js +6 -0
  830. package/js/src/static_dependencies/ethers/address/contract-address.js +6 -0
  831. package/js/src/static_dependencies/ethers/address/index.js +6 -0
  832. package/js/src/static_dependencies/ethers/bytes32.js +6 -0
  833. package/js/src/static_dependencies/ethers/coders/abstract-coder.js +6 -0
  834. package/js/src/static_dependencies/ethers/coders/address.js +6 -0
  835. package/js/src/static_dependencies/ethers/coders/anonymous.js +6 -0
  836. package/js/src/static_dependencies/ethers/coders/array.js +6 -0
  837. package/js/src/static_dependencies/ethers/coders/boolean.js +6 -0
  838. package/js/src/static_dependencies/ethers/coders/bytes.js +6 -0
  839. package/js/src/static_dependencies/ethers/coders/fixed-bytes.js +6 -0
  840. package/js/src/static_dependencies/ethers/coders/null.js +6 -0
  841. package/js/src/static_dependencies/ethers/coders/number.js +6 -0
  842. package/js/src/static_dependencies/ethers/coders/string.js +6 -0
  843. package/js/src/static_dependencies/ethers/coders/tuple.js +6 -0
  844. package/js/src/static_dependencies/ethers/fragments.js +6 -0
  845. package/js/src/static_dependencies/ethers/hash/index.js +6 -0
  846. package/js/src/static_dependencies/ethers/hash/solidity.js +6 -0
  847. package/js/src/static_dependencies/ethers/hash/typed-data.js +6 -0
  848. package/js/src/static_dependencies/ethers/index.js +6 -0
  849. package/js/src/static_dependencies/ethers/interface.js +6 -0
  850. package/js/src/static_dependencies/ethers/typed.js +6 -0
  851. package/js/src/static_dependencies/ethers/utils/base58.js +6 -0
  852. package/js/src/static_dependencies/ethers/utils/base64-browser.js +6 -0
  853. package/js/src/static_dependencies/ethers/utils/base64.js +6 -0
  854. package/js/src/static_dependencies/ethers/utils/data.js +6 -0
  855. package/js/src/static_dependencies/ethers/utils/errors.js +6 -0
  856. package/js/src/static_dependencies/ethers/utils/events.js +6 -0
  857. package/js/src/static_dependencies/ethers/utils/fixednumber.js +6 -0
  858. package/js/src/static_dependencies/ethers/utils/index.js +6 -0
  859. package/js/src/static_dependencies/ethers/utils/maths.js +6 -0
  860. package/js/src/static_dependencies/ethers/utils/properties.js +6 -0
  861. package/js/src/static_dependencies/ethers/utils/rlp-decode.js +6 -0
  862. package/js/src/static_dependencies/ethers/utils/rlp-encode.js +6 -0
  863. package/js/src/static_dependencies/ethers/utils/rlp.js +6 -0
  864. package/js/src/static_dependencies/ethers/utils/units.js +6 -0
  865. package/js/src/static_dependencies/ethers/utils/utf8.js +6 -0
  866. package/js/src/static_dependencies/ethers/utils/uuid.js +6 -0
  867. package/js/src/static_dependencies/fflake/browser.d.ts +5 -5
  868. package/js/src/static_dependencies/fflake/browser.js +6 -0
  869. package/js/src/static_dependencies/jsencrypt/JSEncrypt.js +6 -0
  870. package/js/src/static_dependencies/jsencrypt/JSEncryptRSAKey.js +6 -0
  871. package/js/src/static_dependencies/jsencrypt/index.js +6 -0
  872. package/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.js +6 -0
  873. package/js/src/static_dependencies/jsencrypt/lib/asn1js/base64.js +6 -0
  874. package/js/src/static_dependencies/jsencrypt/lib/asn1js/hex.js +6 -0
  875. package/js/src/static_dependencies/jsencrypt/lib/asn1js/int10.js +6 -0
  876. package/js/src/static_dependencies/jsencrypt/lib/asn1js/oids.js +6 -0
  877. package/js/src/static_dependencies/jsencrypt/lib/jsbn/base64.js +6 -0
  878. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.js +6 -0
  879. package/js/src/static_dependencies/jsencrypt/lib/jsbn/prng4.js +6 -0
  880. package/js/src/static_dependencies/jsencrypt/lib/jsbn/rng.js +6 -0
  881. package/js/src/static_dependencies/jsencrypt/lib/jsbn/rsa.js +6 -0
  882. package/js/src/static_dependencies/jsencrypt/lib/jsbn/util.js +6 -0
  883. package/js/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +6 -0
  884. package/js/src/static_dependencies/jsencrypt/lib/jsrsasign/yahoo.js +6 -0
  885. package/js/src/static_dependencies/messagepack/msgpack.js +6 -0
  886. package/js/src/static_dependencies/noble-curves/_shortw_utils.js +6 -0
  887. package/js/src/static_dependencies/noble-curves/abstract/curve.js +6 -0
  888. package/js/src/static_dependencies/noble-curves/abstract/edwards.js +6 -0
  889. package/js/src/static_dependencies/noble-curves/abstract/hash-to-curve.js +6 -0
  890. package/js/src/static_dependencies/noble-curves/abstract/modular.js +6 -0
  891. package/js/src/static_dependencies/noble-curves/abstract/montgomery.js +6 -0
  892. package/js/src/static_dependencies/noble-curves/abstract/poseidon.js +6 -0
  893. package/js/src/static_dependencies/noble-curves/abstract/utils.js +6 -0
  894. package/js/src/static_dependencies/noble-curves/abstract/weierstrass.d.ts +1 -0
  895. package/js/src/static_dependencies/noble-curves/abstract/weierstrass.js +6 -0
  896. package/js/src/static_dependencies/noble-curves/bn.js +6 -0
  897. package/js/src/static_dependencies/noble-curves/ed25519.js +6 -0
  898. package/js/src/static_dependencies/noble-curves/ed448.js +6 -0
  899. package/js/src/static_dependencies/noble-curves/index.js +6 -0
  900. package/js/src/static_dependencies/noble-curves/jubjub.js +6 -0
  901. package/js/src/static_dependencies/noble-curves/p256.js +6 -0
  902. package/js/src/static_dependencies/noble-curves/p384.js +6 -0
  903. package/js/src/static_dependencies/noble-curves/p521.js +6 -0
  904. package/js/src/static_dependencies/noble-curves/pasta.js +6 -0
  905. package/js/src/static_dependencies/noble-curves/secp256k1.js +6 -0
  906. package/js/src/static_dependencies/noble-hashes/_assert.js +6 -0
  907. package/js/src/static_dependencies/noble-hashes/_blake2.js +6 -0
  908. package/js/src/static_dependencies/noble-hashes/_sha2.js +6 -0
  909. package/js/src/static_dependencies/noble-hashes/_u64.js +6 -0
  910. package/js/src/static_dependencies/noble-hashes/argon2.js +6 -0
  911. package/js/src/static_dependencies/noble-hashes/blake2b.js +6 -0
  912. package/js/src/static_dependencies/noble-hashes/blake2s.js +6 -0
  913. package/js/src/static_dependencies/noble-hashes/blake3.js +6 -0
  914. package/js/src/static_dependencies/noble-hashes/crypto.js +6 -0
  915. package/js/src/static_dependencies/noble-hashes/cryptoNode.js +6 -0
  916. package/js/src/static_dependencies/noble-hashes/eskdf.js +6 -0
  917. package/js/src/static_dependencies/noble-hashes/hkdf.js +6 -0
  918. package/js/src/static_dependencies/noble-hashes/hmac.js +6 -0
  919. package/js/src/static_dependencies/noble-hashes/index.js +6 -0
  920. package/js/src/static_dependencies/noble-hashes/md5.js +6 -0
  921. package/js/src/static_dependencies/noble-hashes/pbkdf2.js +6 -0
  922. package/js/src/static_dependencies/noble-hashes/ripemd160.js +6 -0
  923. package/js/src/static_dependencies/noble-hashes/scrypt.js +6 -0
  924. package/js/src/static_dependencies/noble-hashes/sha1.js +6 -0
  925. package/js/src/static_dependencies/noble-hashes/sha256.js +6 -0
  926. package/js/src/static_dependencies/noble-hashes/sha3-addons.js +6 -0
  927. package/js/src/static_dependencies/noble-hashes/sha3.js +6 -0
  928. package/js/src/static_dependencies/noble-hashes/sha512.js +6 -0
  929. package/js/src/static_dependencies/noble-hashes/utils.js +6 -0
  930. package/js/src/static_dependencies/node-fetch/body.js +6 -0
  931. package/js/src/static_dependencies/node-fetch/errors/abort-error.js +6 -0
  932. package/js/src/static_dependencies/node-fetch/errors/base.js +6 -0
  933. package/js/src/static_dependencies/node-fetch/errors/fetch-error.js +6 -0
  934. package/js/src/static_dependencies/node-fetch/headers.js +6 -0
  935. package/js/src/static_dependencies/node-fetch/index.js +6 -0
  936. package/js/src/static_dependencies/node-fetch/request.js +6 -0
  937. package/js/src/static_dependencies/node-fetch/response.js +6 -0
  938. package/js/src/static_dependencies/node-fetch/utils/get-search.js +6 -0
  939. package/js/src/static_dependencies/node-fetch/utils/is-redirect.js +6 -0
  940. package/js/src/static_dependencies/node-fetch/utils/is.js +6 -0
  941. package/js/src/static_dependencies/node-fetch/utils/referrer.js +6 -0
  942. package/js/src/static_dependencies/proxies/agent-base/helpers.js +6 -0
  943. package/js/src/static_dependencies/proxies/agent-base/index.js +6 -0
  944. package/js/src/static_dependencies/proxies/http-proxy-agent/index.js +6 -0
  945. package/js/src/static_dependencies/proxies/https-proxy-agent/index.js +6 -0
  946. package/js/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.js +6 -0
  947. package/js/src/static_dependencies/qs/formats.js +6 -0
  948. package/js/src/static_dependencies/qs/index.js +6 -0
  949. package/js/src/static_dependencies/qs/parse.js +6 -0
  950. package/js/src/static_dependencies/qs/stringify.js +6 -0
  951. package/js/src/static_dependencies/qs/utils.js +6 -0
  952. package/js/src/static_dependencies/scure-base/index.js +6 -0
  953. package/js/src/static_dependencies/scure-bip32/index.js +6 -0
  954. package/js/src/static_dependencies/scure-bip39/index.js +6 -0
  955. package/js/src/static_dependencies/scure-bip39/wordlists/english.js +6 -0
  956. package/js/src/static_dependencies/scure-starknet/index.js +6 -0
  957. package/js/src/static_dependencies/starknet/constants.js +6 -0
  958. package/js/src/static_dependencies/starknet/index.js +6 -0
  959. package/js/src/static_dependencies/starknet/types/cairoEnum.js +6 -0
  960. package/js/src/static_dependencies/starknet/types/calldata.js +6 -0
  961. package/js/src/static_dependencies/starknet/types/index.js +6 -0
  962. package/js/src/static_dependencies/starknet/types/lib/contract/abi.js +6 -0
  963. package/js/src/static_dependencies/starknet/types/lib/contract/index.js +6 -0
  964. package/js/src/static_dependencies/starknet/types/lib/contract/legacy.js +6 -0
  965. package/js/src/static_dependencies/starknet/types/lib/contract/sierra.js +6 -0
  966. package/js/src/static_dependencies/starknet/types/lib/index.js +6 -0
  967. package/js/src/static_dependencies/starknet/types/typedData.js +6 -0
  968. package/js/src/static_dependencies/starknet/utils/address.js +6 -0
  969. package/js/src/static_dependencies/starknet/utils/assert.js +6 -0
  970. package/js/src/static_dependencies/starknet/utils/cairoDataTypes/felt.js +6 -0
  971. package/js/src/static_dependencies/starknet/utils/cairoDataTypes/uint256.js +6 -0
  972. package/js/src/static_dependencies/starknet/utils/cairoDataTypes/uint512.js +6 -0
  973. package/js/src/static_dependencies/starknet/utils/calldata/byteArray.js +6 -0
  974. package/js/src/static_dependencies/starknet/utils/calldata/cairo.js +6 -0
  975. package/js/src/static_dependencies/starknet/utils/calldata/enum/CairoCustomEnum.js +6 -0
  976. package/js/src/static_dependencies/starknet/utils/calldata/enum/CairoOption.js +6 -0
  977. package/js/src/static_dependencies/starknet/utils/calldata/enum/CairoResult.js +6 -0
  978. package/js/src/static_dependencies/starknet/utils/calldata/enum/index.js +6 -0
  979. package/js/src/static_dependencies/starknet/utils/calldata/formatter.js +6 -0
  980. package/js/src/static_dependencies/starknet/utils/calldata/index.js +6 -0
  981. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.js +6 -0
  982. package/js/src/static_dependencies/starknet/utils/calldata/parser/interface.js +6 -0
  983. package/js/src/static_dependencies/starknet/utils/calldata/parser/parser-0-1.1.0.js +6 -0
  984. package/js/src/static_dependencies/starknet/utils/calldata/parser/parser-2.0.0.js +6 -0
  985. package/js/src/static_dependencies/starknet/utils/calldata/propertyOrder.js +6 -0
  986. package/js/src/static_dependencies/starknet/utils/calldata/requestParser.js +6 -0
  987. package/js/src/static_dependencies/starknet/utils/calldata/responseParser.js +6 -0
  988. package/js/src/static_dependencies/starknet/utils/calldata/tuple.js +6 -0
  989. package/js/src/static_dependencies/starknet/utils/calldata/validate.js +6 -0
  990. package/js/src/static_dependencies/starknet/utils/encode.js +6 -0
  991. package/js/src/static_dependencies/starknet/utils/hash/classHash.js +6 -0
  992. package/js/src/static_dependencies/starknet/utils/hash/index.js +6 -0
  993. package/js/src/static_dependencies/starknet/utils/merkle.js +6 -0
  994. package/js/src/static_dependencies/starknet/utils/num.js +6 -0
  995. package/js/src/static_dependencies/starknet/utils/selector.js +6 -0
  996. package/js/src/static_dependencies/starknet/utils/shortString.js +6 -0
  997. package/js/src/static_dependencies/starknet/utils/starknetId.js +6 -0
  998. package/js/src/static_dependencies/starknet/utils/typedData.js +6 -0
  999. package/js/src/static_dependencies/starknet/utils/uint256.js +6 -0
  1000. package/js/src/static_dependencies/starknet/utils/url.js +6 -0
  1001. package/js/src/static_dependencies/watchable/src/index.js +6 -0
  1002. package/js/src/static_dependencies/watchable/src/types.js +6 -0
  1003. package/js/src/static_dependencies/watchable/src/unpromise.js +6 -0
  1004. package/js/src/static_dependencies/zklink/zklink-sdk-web.js +6 -0
  1005. package/js/src/tokocrypto.js +6 -0
  1006. package/js/src/toobit.js +6 -0
  1007. package/js/src/upbit.d.ts +1 -0
  1008. package/js/src/upbit.js +33 -17
  1009. package/js/src/wavesexchange.js +6 -0
  1010. package/js/src/weex.d.ts +4 -4
  1011. package/js/src/weex.js +13 -4
  1012. package/js/src/whitebit.js +6 -0
  1013. package/js/src/woo.js +6 -0
  1014. package/js/src/woofipro.js +6 -0
  1015. package/js/src/xt.js +12 -0
  1016. package/js/src/yobit.js +6 -0
  1017. package/js/src/zaif.js +6 -0
  1018. package/js/src/zebpay.js +6 -0
  1019. package/js/src/zonda.js +6 -0
  1020. package/package.json +6 -3
@@ -6,12 +6,11 @@ var aster$1 = require('./abstract/aster.js');
6
6
  var errors = require('./base/errors.js');
7
7
  var number = require('./base/functions/number.js');
8
8
  var Precise = require('./base/Precise.js');
9
- var sha256 = require('./static_dependencies/noble-hashes/sha256.js');
10
9
  var crypto = require('./base/functions/crypto.js');
11
10
  var sha3 = require('./static_dependencies/noble-hashes/sha3.js');
12
11
  var secp256k1 = require('./static_dependencies/noble-curves/secp256k1.js');
13
12
 
14
- // ---------------------------------------------------------------------------
13
+ // ----------------------------------------------------------------------------
15
14
  // ---------------------------------------------------------------------------xs
16
15
  /**
17
16
  * @class aster
@@ -188,169 +187,217 @@ class aster extends aster$1["default"] {
188
187
  'setMargin': false,
189
188
  'setMarginMode': true,
190
189
  'setPositionMode': true,
191
- 'signIn': false,
190
+ 'signIn': true,
192
191
  'transfer': true,
193
192
  'withdraw': true,
194
193
  },
195
194
  'api': {
196
195
  'fapiPublic': {
197
- 'get': [
198
- 'v1/ping',
199
- 'v3/ping',
200
- 'v1/time',
201
- 'v3/time',
202
- 'v1/exchangeInfo',
203
- 'v3/exchangeInfo',
204
- 'v1/depth',
205
- 'v3/depth',
206
- 'v1/trades',
207
- 'v3/trades',
208
- 'v1/historicalTrades',
209
- 'v3/historicalTrades',
210
- 'v1/aggTrades',
211
- 'v3/aggTrades',
212
- 'v1/klines',
213
- 'v3/klines',
214
- 'v1/indexPriceKlines',
215
- 'v3/indexPriceKlines',
216
- 'v1/markPriceKlines',
217
- 'v3/markPriceKlines',
218
- 'v1/premiumIndex',
219
- 'v3/premiumIndex',
220
- 'v1/fundingRate',
221
- 'v3/fundingRate',
222
- 'v1/fundingInfo',
223
- 'v3/fundingInfo',
224
- 'v1/ticker/24hr',
225
- 'v3/ticker/24hr',
226
- 'v1/ticker/price',
227
- 'v3/ticker/price',
228
- 'v1/ticker/bookTicker',
229
- 'v3/ticker/bookTicker',
230
- 'v3/indexreferences',
231
- 'v1/adlQuantile',
232
- 'v1/forceOrders',
233
- ],
196
+ 'get': {
197
+ 'v1/ping': 1,
198
+ 'v3/ping': 1,
199
+ 'v1/time': 1,
200
+ 'v3/time': 1,
201
+ 'v1/exchangeInfo': 1,
202
+ 'v3/exchangeInfo': 1,
203
+ 'v1/depth': 1,
204
+ 'v3/depth': 2,
205
+ 'v1/trades': 1,
206
+ 'v3/trades': 1,
207
+ 'v1/historicalTrades': 1,
208
+ 'v3/historicalTrades': 20,
209
+ 'v1/aggTrades': 1,
210
+ 'v3/aggTrades': 20,
211
+ 'v1/klines': 1,
212
+ 'v3/klines': 1,
213
+ 'v1/indexPriceKlines': 1,
214
+ 'v3/indexPriceKlines': 1,
215
+ 'v1/markPriceKlines': 1,
216
+ 'v3/markPriceKlines': 1,
217
+ 'v1/premiumIndex': 1,
218
+ 'v3/premiumIndex': 1,
219
+ 'v1/fundingRate': 1,
220
+ 'v3/fundingRate': 1,
221
+ 'v1/fundingInfo': 1,
222
+ 'v3/fundingInfo': 1,
223
+ 'v1/ticker/24hr': 1,
224
+ 'v3/ticker/24hr': 1,
225
+ 'v1/ticker/price': 1,
226
+ 'v3/ticker/price': 1,
227
+ 'v1/ticker/bookTicker': 1,
228
+ 'v3/ticker/bookTicker': 1,
229
+ // different endpoints
230
+ 'v1/adlQuantile': 1,
231
+ 'v1/forceOrders': 1,
232
+ 'v3/indexreferences': 1,
233
+ },
234
234
  },
235
235
  'fapiPrivate': {
236
- 'get': [
237
- 'v1/positionSide/dual',
238
- 'v3/positionSide/dual',
239
- 'v1/multiAssetsMargin',
240
- 'v3/multiAssetsMargin',
241
- 'v1/order',
242
- 'v3/order',
243
- 'v1/openOrder',
244
- 'v3/openOrder',
245
- 'v1/openOrders',
246
- 'v3/openOrders',
247
- 'v1/allOrders',
248
- 'v3/allOrders',
249
- 'v2/balance',
250
- 'v3/balance',
251
- 'v3/account',
252
- 'v3/accountWithJoinMargin',
253
- 'v4/account',
254
- 'v1/positionMargin/history',
255
- 'v3/positionMargin/history',
256
- 'v2/positionRisk',
257
- 'v3/positionRisk',
258
- 'v1/userTrades',
259
- 'v3/userTrades',
260
- 'v1/income',
261
- 'v3/income',
262
- 'v1/leverageBracket',
263
- 'v3/leverageBracket',
264
- 'v3/adlQuantile',
265
- 'v3/forceOrders',
266
- 'v1/commissionRate',
267
- 'v3/commissionRate',
268
- 'v3/mmp',
269
- ],
270
- 'post': [
271
- 'v3/noop',
272
- 'v1/positionSide/dual',
273
- 'v3/positionSide/dual',
274
- 'v1/multiAssetsMargin',
275
- 'v3/multiAssetsMargin',
276
- 'v1/order',
277
- 'v3/order',
278
- 'v1/order/test',
279
- 'v3/order/test',
280
- 'v1/batchOrders',
281
- 'v3/batchOrders',
282
- 'v1/asset/wallet/transfer',
283
- 'v3/asset/wallet/transfer',
284
- 'v1/countdownCancelAll',
285
- 'v3/countdownCancelAll',
286
- 'v1/leverage',
287
- 'v3/leverage',
288
- 'v1/marginType',
289
- 'v3/marginType',
290
- 'v1/positionMargin',
291
- 'v3/positionMargin',
292
- 'v3/mmp',
293
- 'v3/mmpReset',
294
- 'v1/listenKey',
295
- 'v3/listenKey',
296
- ],
297
- 'put': [
298
- 'v1/listenKey',
299
- 'v3/listenKey',
300
- ],
301
- 'delete': [
302
- 'v1/order',
303
- 'v3/order',
304
- 'v1/allOpenOrders',
305
- 'v3/allOpenOrders',
306
- 'v1/batchOrders',
307
- 'v3/batchOrders',
308
- 'v3/mmp',
309
- 'v1/listenKey',
310
- 'v3/listenKey',
311
- ],
236
+ 'get': {
237
+ 'v1/positionSide/dual': 1,
238
+ 'v3/positionSide/dual': 30,
239
+ 'v1/multiAssetsMargin': 1,
240
+ 'v3/multiAssetsMargin': 1,
241
+ 'v1/order': 1,
242
+ 'v3/order': 1,
243
+ 'v1/openOrder': 1,
244
+ 'v3/openOrder': 1,
245
+ 'v1/openOrders': 1,
246
+ 'v3/openOrders': 1,
247
+ 'v1/allOrders': 1,
248
+ 'v3/allOrders': 1,
249
+ 'v2/balance': 1,
250
+ 'v3/balance': 1,
251
+ 'v3/account': 1,
252
+ 'v1/positionMargin/history': 1,
253
+ 'v3/positionMargin/history': 1,
254
+ 'v2/positionRisk': 1,
255
+ 'v3/positionRisk': 1,
256
+ 'v1/userTrades': 1,
257
+ 'v3/userTrades': 5,
258
+ 'v1/income': 1,
259
+ 'v3/income': 1,
260
+ 'v1/leverageBracket': 1,
261
+ 'v3/leverageBracket': 1,
262
+ 'v1/commissionRate': 1,
263
+ 'v3/commissionRate': 1,
264
+ // others
265
+ 'v3/adlQuantile': 1,
266
+ 'v3/forceOrders': 1,
267
+ 'v3/mmp': 1,
268
+ 'v3/accountWithJoinMargin': 1,
269
+ 'v4/account': 1,
270
+ // builder
271
+ 'v3/agent': 1,
272
+ 'v3/builder': 1,
273
+ },
274
+ 'post': {
275
+ 'v1/positionSide/dual': 1,
276
+ 'v3/positionSide/dual': 1,
277
+ 'v1/multiAssetsMargin': 1,
278
+ 'v3/multiAssetsMargin': 1,
279
+ 'v1/order': 1,
280
+ 'v3/order': 1,
281
+ 'v1/order/test': 1,
282
+ 'v3/order/test': 1,
283
+ 'v1/batchOrders': 1,
284
+ 'v3/batchOrders': 1,
285
+ 'v1/asset/wallet/transfer': 1,
286
+ 'v3/asset/wallet/transfer': 1,
287
+ 'v1/countdownCancelAll': 1,
288
+ 'v3/countdownCancelAll': 1,
289
+ 'v1/leverage': 1,
290
+ 'v3/leverage': 1,
291
+ 'v1/marginType': 1,
292
+ 'v3/marginType': 1,
293
+ 'v1/positionMargin': 1,
294
+ 'v3/positionMargin': 1,
295
+ 'v1/listenKey': 1,
296
+ 'v3/listenKey': 1,
297
+ // others
298
+ 'v3/mmp': 1,
299
+ 'v3/mmpReset': 1,
300
+ 'v3/noop': 1,
301
+ // builder
302
+ 'v3/approveAgent': 1,
303
+ 'v3/updateAgent': 1,
304
+ 'v3/approveBuilder': 1,
305
+ 'v3/updateBuilder': 1,
306
+ },
307
+ 'put': {
308
+ 'v1/listenKey': 1,
309
+ 'v3/listenKey': 1,
310
+ },
311
+ 'delete': {
312
+ 'v1/order': 1,
313
+ 'v3/order': 1,
314
+ 'v1/allOpenOrders': 1,
315
+ 'v3/allOpenOrders': 1,
316
+ 'v1/batchOrders': 1,
317
+ 'v3/batchOrders': 1,
318
+ 'v3/mmp': 1,
319
+ 'v1/listenKey': 1,
320
+ 'v3/listenKey': 1,
321
+ // builder
322
+ 'v3/agent': 1,
323
+ 'v3/builder': 1,
324
+ },
312
325
  },
313
326
  'sapiPublic': {
314
- 'get': [
315
- 'v1/ping',
316
- 'v1/time',
317
- 'v1/exchangeInfo',
318
- 'v1/depth',
319
- 'v1/trades',
320
- 'v1/historicalTrades',
321
- 'v1/aggTrades',
322
- 'v1/klines',
323
- 'v1/ticker/24hr',
324
- 'v1/ticker/price',
325
- 'v1/ticker/bookTicker',
326
- 'v1/aster/withdraw/estimateFee',
327
- ],
327
+ 'get': {
328
+ // v1
329
+ 'v1/ping': 1,
330
+ 'v1/time': 1,
331
+ 'v1/exchangeInfo': 1,
332
+ 'v1/depth': 1,
333
+ 'v1/trades': 1,
334
+ 'v1/historicalTrades': 1,
335
+ 'v1/aggTrades': 1,
336
+ 'v1/klines': 1,
337
+ 'v1/ticker/24hr': 1,
338
+ 'v1/ticker/price': 1,
339
+ 'v1/ticker/bookTicker': 1,
340
+ 'v1/aster/withdraw/estimateFee': 1,
341
+ // v3
342
+ 'v3/ping': 1,
343
+ 'v3/time': 1,
344
+ 'v3/exchangeInfo': 1,
345
+ 'v3/depth': { 'cost': 2, 'byLimit': [[50, 2], [100, 5], [500, 10], [1000, 20]] },
346
+ 'v3/trades': 1,
347
+ 'v3/historicalTrades': 20,
348
+ 'v3/aggTrades': 20,
349
+ 'v3/klines': { 'cost': 1, 'byLimit': [[99, 1], [499, 2], [1000, 5], [10000, 10]] },
350
+ 'v3/ticker/24hr': { 'cost': 1, 'noSymbol': 40 },
351
+ 'v3/ticker/price': { 'cost': 1, 'noSymbol': 2 },
352
+ 'v3/ticker/bookTicker': { 'cost': 1, 'noSymbol': 2 },
353
+ 'v3/aster/withdraw/estimateFee': 1,
354
+ },
328
355
  },
329
356
  'sapiPrivate': {
330
- 'get': [
331
- 'v1/commissionRate',
332
- 'v1/order',
333
- 'v1/openOrders',
334
- 'v1/allOrders',
335
- 'v1/transactionHistory',
336
- 'v1/account',
337
- 'v1/userTrades',
338
- ],
339
- 'post': [
340
- 'v1/order',
341
- 'v1/asset/wallet/transfer',
342
- 'v1/asset/sendToAddress',
343
- 'v1/aster/user-withdraw',
344
- 'v1/listenKey',
345
- ],
357
+ 'get': {
358
+ // v1
359
+ 'v1/commissionRate': 1,
360
+ 'v1/order': 1,
361
+ 'v1/openOrders': 1,
362
+ 'v1/allOrders': 1,
363
+ 'v1/transactionHistory': 1,
364
+ 'v1/account': 1,
365
+ 'v1/userTrades': 1,
366
+ // v3
367
+ 'v3/commissionRate': { 'cost': 1, 'noSymbol': 2 },
368
+ 'v3/order': 1,
369
+ 'v3/openOrders': 1,
370
+ 'v3/allOrders': 5,
371
+ 'v3/account': 5,
372
+ 'v3/userTrades': 5,
373
+ 'v3/openOrder': 1,
374
+ },
375
+ 'post': {
376
+ // v1
377
+ 'v1/order': 1,
378
+ 'v1/asset/wallet/transfer': 5,
379
+ 'v1/asset/sendToAddress': 1,
380
+ 'v1/listenKey': 1,
381
+ // v3
382
+ 'v3/order': 1,
383
+ 'v3/asset/wallet/transfer': 5,
384
+ 'v3/aster/user-withdraw': 1,
385
+ 'v3/listenKey': 1,
386
+ },
346
387
  'put': [
347
388
  'v1/listenKey',
389
+ 'v3/listenKey',
348
390
  ],
349
- 'delete': [
350
- 'v1/order',
351
- 'v1/allOpenOrders',
352
- 'v1/listenKey',
353
- ],
391
+ 'delete': {
392
+ // v1
393
+ 'v1/order': 1,
394
+ 'v1/allOpenOrders': 1,
395
+ 'v1/listenKey': 1,
396
+ // v3
397
+ 'v3/allOpenOrders': 1,
398
+ 'v3/order': 1,
399
+ 'v3/listenKey': 1,
400
+ },
354
401
  },
355
402
  },
356
403
  'timeframes': {
@@ -372,8 +419,9 @@ class aster extends aster$1["default"] {
372
419
  },
373
420
  'precisionMode': number.TICK_SIZE,
374
421
  'requiredCredentials': {
375
- 'apiKey': true,
376
- 'secret': true,
422
+ 'apiKey': false,
423
+ 'secret': false,
424
+ 'privateKey': true,
377
425
  },
378
426
  'fees': {
379
427
  'trading': {
@@ -388,28 +436,35 @@ class aster extends aster$1["default"] {
388
436
  'recvWindow': 10 * 1000,
389
437
  'defaultTimeInForce': 'GTC',
390
438
  'zeroAddress': '0x0000000000000000000000000000000000000000',
439
+ 'v3ChainId': 1666,
391
440
  'quoteOrderQty': true,
392
441
  'accountsByType': {
393
442
  'spot': 'SPOT',
443
+ 'swap': 'FUTURE',
394
444
  'future': 'FUTURE',
395
445
  'linear': 'FUTURE',
396
- 'swap': 'FUTURE',
397
446
  },
398
447
  'networks': {
399
448
  'ERC20': 'ETH',
400
449
  'BEP20': 'BSC',
401
- 'ARB': 'Arbitrum',
450
+ 'ARBONE': 'Arbitrum',
402
451
  },
403
452
  'networksToChainId': {
404
453
  'ETH': 1,
405
454
  'BSC': 56,
406
455
  'Arbitrum': 42161,
407
456
  },
457
+ 'fetchOpenOrders': {
458
+ 'warnIfNoSymbol': true, // set to false to suppress warning when calling fetchOpenOrders without symbol
459
+ },
460
+ 'builderFee': true,
461
+ 'builder': '0x1F5877C19e3777Cfd15F9d57253eA4aA5254Ec39',
462
+ 'builderRate': '0.001',
408
463
  },
409
464
  'exceptions': {
410
465
  'exact': {
411
466
  // 10xx - General Server or Network issues
412
- '-1000': errors.OperationFailed,
467
+ '-1000': errors.OperationRejected,
413
468
  '-1001': errors.NetworkError,
414
469
  '-1002': errors.AuthenticationError,
415
470
  '-1003': errors.RateLimitExceeded,
@@ -417,7 +472,7 @@ class aster extends aster$1["default"] {
417
472
  '-1005': errors.BadRequest,
418
473
  '-1006': errors.BadResponse,
419
474
  '-1007': errors.RequestTimeout,
420
- '-1010': errors.OperationFailed,
475
+ '-1010': errors.OperationRejected,
421
476
  '-1011': errors.PermissionDenied,
422
477
  '-1013': errors.BadRequest,
423
478
  '-1014': errors.OrderNotFillable,
@@ -571,7 +626,9 @@ class aster extends aster$1["default"] {
571
626
  '-4183': errors.InvalidOrder,
572
627
  '-4184': errors.InvalidOrder,
573
628
  '-5060': errors.OperationRejected,
574
- '-5076': errors.OperationRejected, // {"code":-5076,"msg":"Total order value should be more than 5 USDT"}
629
+ '-5076': errors.OperationRejected,
630
+ // occured errors:
631
+ '-4168': errors.OperationRejected, // Unable to adjust to isolated-margin mode under the Multi-Assets mode.
575
632
  },
576
633
  'broad': {},
577
634
  },
@@ -597,15 +654,15 @@ class aster extends aster$1["default"] {
597
654
  * @method
598
655
  * @name aster#fetchCurrencies
599
656
  * @description fetches all available currencies on an exchange
600
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api.md#trading-specification-information
601
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#exchange-information
657
+ * @see https://asterdex.github.io/aster-api-website/spot-v3/market-data/#trading-specification-information
658
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/market-data/#exchange-information
602
659
  * @param {object} [params] extra parameters specific to the exchange API endpoint
603
660
  * @returns {object} an associative dictionary of currencies
604
661
  */
605
662
  async fetchCurrencies(params = {}) {
606
663
  const promises = [
607
- this.sapiPublicGetV1ExchangeInfo(params),
608
- this.fapiPublicGetV1ExchangeInfo(params),
664
+ this.sapiPublicGetV3ExchangeInfo(params),
665
+ this.fapiPublicGetV3ExchangeInfo(params),
609
666
  ];
610
667
  const results = await Promise.all(promises);
611
668
  const sapiResult = this.safeDict(results, 0, {});
@@ -617,8 +674,8 @@ class aster extends aster$1["default"] {
617
674
  // [
618
675
  // {
619
676
  // "asset": "USDT",
620
- // "marginAvailable": true,
621
- // "autoAssetExchange": "-10000"
677
+ // "marginAvailable": true, // only in PERP
678
+ // "autoAssetExchange": "-10000" // only in PERP
622
679
  // }
623
680
  // ]
624
681
  //
@@ -661,263 +718,275 @@ class aster extends aster$1["default"] {
661
718
  * @method
662
719
  * @name aster#fetchMarkets
663
720
  * @description retrieves data on all markets for bigone
664
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api.md#trading-specification-information
665
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#exchange-information
721
+ * @see https://asterdex.github.io/aster-api-website/spot-v3/market-data/#trading-specification-information
722
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/market-data/#exchange-information
666
723
  * @param {object} [params] extra parameters specific to the exchange API endpoint
667
724
  * @returns {object[]} an array of objects representing market data
668
725
  */
669
726
  async fetchMarkets(params = {}) {
670
727
  const promises = [
671
- this.sapiPublicGetV1ExchangeInfo(params),
672
- this.fapiPublicGetV1ExchangeInfo(params),
728
+ this.sapiPublicGetV3ExchangeInfo(params),
729
+ this.fapiPublicGetV3ExchangeInfo(params),
673
730
  ];
731
+ promises.push(this.signIn());
674
732
  const results = await Promise.all(promises);
675
733
  const sapiResult = this.safeDict(results, 0, {});
676
734
  const sapiRows = this.safeList(sapiResult, 'symbols', []);
677
735
  const fapiResult = this.safeDict(results, 1, {});
678
736
  const fapiRows = this.safeList(fapiResult, 'symbols', []);
679
- const rows = this.arrayConcat(sapiRows, fapiRows);
737
+ //
738
+ // example:
680
739
  //
681
740
  // [
682
- // {
683
- // "symbol": "BTCUSDT",
684
- // "pair": "BTCUSDT",
685
- // "contractType": "PERPETUAL",
686
- // "deliveryDate": 4133404800000,
687
- // "onboardDate": 1627628400000,
688
- // "status": "TRADING",
689
- // "maintMarginPercent": "2.5000",
690
- // "requiredMarginPercent": "5.0000",
691
- // "baseAsset": "BTC",
692
- // "quoteAsset": "USDT",
693
- // "marginAsset": "USDT",
694
- // "pricePrecision": 1,
695
- // "quantityPrecision": 3,
696
- // "baseAssetPrecision": 8,
697
- // "quotePrecision": 8,
698
- // "underlyingType": "COIN",
699
- // "underlyingSubType": [],
700
- // "settlePlan": 0,
701
- // "triggerProtect": "0.0200",
702
- // "liquidationFee": "0.025000",
703
- // "marketTakeBound": "0.02",
704
- // "filters": [
705
- // {
706
- // "minPrice": "1",
707
- // "maxPrice": "1000000",
708
- // "filterType": "PRICE_FILTER",
709
- // "tickSize": "0.1"
710
- // },
711
- // {
712
- // "stepSize": "0.001",
713
- // "filterType": "LOT_SIZE",
714
- // "maxQty": "100",
715
- // "minQty": "0.001"
716
- // },
717
- // {
718
- // "stepSize": "0.001",
719
- // "filterType": "MARKET_LOT_SIZE",
720
- // "maxQty": "10",
721
- // "minQty": "0.001"
722
- // },
723
- // {
724
- // "limit": 200,
725
- // "filterType": "MAX_NUM_ORDERS"
726
- // },
727
- // {
728
- // "limit": 10,
729
- // "filterType": "MAX_NUM_ALGO_ORDERS"
730
- // },
731
- // {
732
- // "notional": "5",
733
- // "filterType": "MIN_NOTIONAL"
734
- // },
735
- // {
736
- // "multiplierDown": "0.9800",
737
- // "multiplierUp": "1.0200",
738
- // "multiplierDecimal": "4",
739
- // "filterType": "PERCENT_PRICE"
740
- // }
741
- // ],
742
- // "orderTypes": [
743
- // "LIMIT",
744
- // "MARKET",
745
- // "STOP",
746
- // "STOP_MARKET",
747
- // "TAKE_PROFIT",
748
- // "TAKE_PROFIT_MARKET",
749
- // "TRAILING_STOP_MARKET"
750
- // ],
751
- // "timeInForce": [
752
- // "GTC",
753
- // "IOC",
754
- // "FOK",
755
- // "GTX",
756
- // "RPI"
757
- // ]
758
- // }
741
+ // {
742
+ // symbol: "TESTUSDT",
743
+ // status: "TRADING",
744
+ // baseAsset: "TEST",
745
+ // quoteAsset: "USDT",
746
+ // pricePrecision: "2",
747
+ // quantityPrecision: "5",
748
+ // baseAssetPrecision: "8",
749
+ // quotePrecision: "8",
750
+ // listingTime: "1756289680210", // only in SPOT
751
+ // baseAssetAddress: null, // only in SPOT
752
+ // ocoAllowed: false, // only in SPOT
753
+ // pair: "ASTERUSDT", // only in PERP
754
+ // contractType: "PERPETUAL", // only in PERP
755
+ // deliveryDate: "4133404800000", // only in PERP
756
+ // onboardDate: "1758178800000", // only in PERP
757
+ // maintMarginPercent: "12.5000", // only in PERP
758
+ // requiredMarginPercent: "25.0000", // only in PERP
759
+ // marginAsset: "USDT", // only in PERP
760
+ // underlyingType: "COIN", // only in PERP
761
+ // underlyingSubType: [ "Top", ], // only in PERP
762
+ // symbolType: "0", // only in PERP
763
+ // tradingMode: "0", // only in PERP
764
+ // name: "", // only in PERP
765
+ // channel: "{}", // only in PERP
766
+ // sequenceNo: "100", // only in PERP
767
+ // twapMinNotional: "1000", // only in PERP
768
+ // imn: "4000.00", // only in PERP
769
+ // tags: [], // only in PERP
770
+ // settlePlan: "0", // only in PERP
771
+ // triggerProtect: "0.1500", // only in PERP
772
+ // liquidationFee: "0.025000", // only in PERP
773
+ // marketTakeBound: "0.05", // only in PERP
774
+ // createTime: "1758215451058", // only in PERP
775
+ // filters: [
776
+ // {
777
+ // minPrice: "0.01",
778
+ // maxPrice: "1000000",
779
+ // filterType: "PRICE_FILTER",
780
+ // tickSize: "0.01",
781
+ // },
782
+ // {
783
+ // stepSize: "0.00001",
784
+ // filterType: "LOT_SIZE",
785
+ // maxQty: "9000",
786
+ // minQty: "0.00001",
787
+ // },
788
+ // {
789
+ // stepSize: "0.00001",
790
+ // filterType: "MARKET_LOT_SIZE",
791
+ // maxQty: "9000",
792
+ // minQty: "0.00001",
793
+ // },
794
+ // {
795
+ // limit: "200",
796
+ // filterType: "MAX_NUM_ORDERS",
797
+ // },
798
+ // {
799
+ // minNotional: "5",
800
+ // filterType: "MIN_NOTIONAL",
801
+ // },
802
+ // {
803
+ // minNotional: "5",
804
+ // avgPriceMins: "5",
805
+ // applyMinToMarket: true,
806
+ // filterType: "NOTIONAL", // only in SPOT
807
+ // applyMaxToMarket: true,
808
+ // },
809
+ // {
810
+ // multiplierDown: "0.2",
811
+ // multiplierUp: "5",
812
+ // multiplierDecimal: "1",
813
+ // filterType: "PERCENT_PRICE",
814
+ // },
815
+ // {
816
+ // bidMultiplierUp: "5",
817
+ // askMultiplierUp: "5",
818
+ // bidMultiplierDown: "0.2",
819
+ // avgPriceMins: "5",
820
+ // multiplierDecimal: "1",
821
+ // filterType: "PERCENT_PRICE_BY_SIDE", // only in SPOT
822
+ // askMultiplierDown: "0.2",
823
+ // },
824
+ // ],
825
+ // orderTypes: [ "LIMIT", "MARKET", "STOP", "STOP_MARKET", "TAKE_PROFIT", "TAKE_PROFIT_MARKET", "TRAILING_STOP_MARKET", ],
826
+ // timeInForce: [ "GTC", "IOC", "FOK", "GTX", "HIDDEN", ],
827
+ // }
759
828
  // ]
760
829
  //
761
- const fees = this.fees;
762
- const result = [];
763
- for (let i = 0; i < rows.length; i++) {
764
- let swap = false;
765
- const market = rows[i];
766
- const id = this.safeString(market, 'symbol');
767
- const baseId = this.safeString(market, 'baseAsset');
768
- const quoteId = this.safeString(market, 'quoteAsset');
769
- const base = this.safeCurrencyCode(baseId);
770
- const quote = this.safeCurrencyCode(quoteId);
771
- const contractType = this.safeString(market, 'contractType');
772
- const contract = contractType !== undefined;
773
- let spot = true;
774
- if (contractType === 'PERPETUAL') {
775
- swap = true;
776
- spot = false;
777
- }
778
- let contractSize = undefined;
779
- let linear = undefined;
780
- let inverse = undefined;
781
- let symbol = base + '/' + quote;
782
- let settle = undefined;
783
- let settleId = undefined;
784
- if (contract) {
785
- settleId = this.safeString(market, 'marginAsset');
786
- settle = this.safeCurrencyCode(settleId);
787
- if (swap) {
788
- symbol = symbol + ':' + settle;
789
- }
790
- linear = settle === quote;
791
- inverse = settle === base;
792
- contractSize = this.safeNumber2(market, 'contractSize', 'unit', this.parseNumber('1'));
793
- }
794
- let unifiedType = undefined;
795
- if (spot) {
796
- unifiedType = 'spot';
797
- }
798
- else if (swap) {
799
- unifiedType = 'swap';
830
+ //
831
+ const fapiRowsFiltered = [];
832
+ for (let i = 0; i < fapiRows.length; i++) {
833
+ const market = fapiRows[i];
834
+ // tmp skip some markets with base = undefined
835
+ if (this.safeString(market, 'baseAsset')) {
836
+ fapiRowsFiltered.push(market);
800
837
  }
801
- const status = this.safeString(market, 'status');
802
- const active = status === 'TRADING';
803
- const filters = this.safeList(market, 'filters', []);
804
- const filtersByType = this.indexBy(filters, 'filterType');
805
- const entry = this.safeMarketStructure({
806
- 'id': id,
807
- 'symbol': symbol,
808
- 'base': base,
809
- 'quote': quote,
810
- 'settle': settle,
811
- 'baseId': baseId,
812
- 'quoteId': quoteId,
813
- 'settleId': settleId,
814
- 'type': unifiedType,
815
- 'spot': spot,
816
- 'margin': false,
817
- 'swap': swap,
818
- 'future': false,
819
- 'option': false,
820
- 'active': active,
821
- 'contract': contract,
822
- 'linear': linear,
823
- 'inverse': inverse,
824
- 'taker': fees['trading']['taker'],
825
- 'maker': fees['trading']['maker'],
826
- 'contractSize': contractSize,
827
- 'expiry': undefined,
828
- 'expiryDatetime': undefined,
829
- 'strike': undefined,
830
- 'optionType': undefined,
831
- 'precision': {
832
- 'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'quantityPrecision'))),
833
- 'price': this.parseNumber(this.parsePrecision(this.safeString(market, 'pricePrecision'))),
834
- 'base': this.parseNumber(this.parsePrecision(this.safeString(market, 'baseAssetPrecision'))),
835
- 'quote': this.parseNumber(this.parsePrecision(this.safeString(market, 'quotePrecision'))),
838
+ }
839
+ const rows = this.arrayConcat(sapiRows, fapiRowsFiltered);
840
+ return this.parseMarkets(rows);
841
+ }
842
+ parseMarket(market) {
843
+ const id = this.safeString(market, 'symbol');
844
+ const baseId = this.safeString(market, 'baseAsset');
845
+ const quoteId = this.safeString(market, 'quoteAsset');
846
+ const base = this.safeCurrencyCode(baseId);
847
+ const quote = this.safeCurrencyCode(quoteId);
848
+ const active = this.safeString(market, 'status') === 'TRADING';
849
+ let spot = undefined;
850
+ let symbol = undefined;
851
+ let settle = undefined;
852
+ let settleId = undefined;
853
+ let swap = undefined;
854
+ let linear = undefined;
855
+ let inverse = undefined;
856
+ let contractSize = undefined;
857
+ const contractType = this.safeString(market, 'contractType');
858
+ const isContract = contractType !== undefined;
859
+ if (isContract) {
860
+ // currently, there is only perpetuals, not futures
861
+ spot = false;
862
+ swap = true;
863
+ settleId = this.safeString(market, 'marginAsset');
864
+ settle = this.safeCurrencyCode(settleId);
865
+ symbol = base + '/' + quote + ':' + settle;
866
+ linear = settle === quote;
867
+ inverse = settle === base;
868
+ contractSize = this.safeNumber2(market, 'contractSize', 'unit', this.parseNumber('1'));
869
+ }
870
+ else {
871
+ spot = true;
872
+ swap = false;
873
+ symbol = base + '/' + quote;
874
+ }
875
+ // filters
876
+ const filters = this.safeList(market, 'filters', []);
877
+ const filtersByType = this.indexBy(filters, 'filterType');
878
+ const filterNotional = this.safeDict2(filtersByType, 'MIN_NOTIONAL', 'NOTIONAL');
879
+ const filterPrice = this.safeDict(filtersByType, 'PRICE_FILTER');
880
+ const filterLotSize = this.safeDict(filtersByType, 'LOT_SIZE');
881
+ const filterMarketLotSize = this.safeDict(filtersByType, 'MARKET_LOT_SIZE', {});
882
+ let pricePrecision = this.safeNumber(filterPrice, 'tickSize');
883
+ if (pricePrecision === undefined) {
884
+ pricePrecision = this.parseNumber(this.parsePrecision(this.safeString(market, 'pricePrecision')));
885
+ }
886
+ const amountPrecision = (filterLotSize !== undefined) ? this.safeNumber(filterLotSize, 'stepSize') : this.parseNumber(this.parsePrecision(this.safeString(market, 'quantityPrecision')));
887
+ return this.safeMarketStructure({
888
+ 'id': id,
889
+ 'symbol': symbol,
890
+ 'base': base,
891
+ 'quote': quote,
892
+ 'settle': settle,
893
+ 'baseId': baseId,
894
+ 'quoteId': quoteId,
895
+ 'settleId': settleId,
896
+ 'type': isContract ? 'swap' : 'spot',
897
+ 'spot': spot,
898
+ 'margin': false,
899
+ 'swap': swap,
900
+ 'future': false,
901
+ 'option': false,
902
+ 'active': active,
903
+ 'contract': isContract,
904
+ 'linear': linear,
905
+ 'inverse': inverse,
906
+ 'taker': this.fees['trading']['taker'],
907
+ 'maker': this.fees['trading']['maker'],
908
+ 'contractSize': contractSize,
909
+ 'expiry': undefined,
910
+ 'expiryDatetime': undefined,
911
+ 'strike': undefined,
912
+ 'optionType': undefined,
913
+ 'precision': {
914
+ 'amount': amountPrecision,
915
+ 'price': pricePrecision,
916
+ 'base': this.parseNumber(this.parsePrecision(this.safeString(market, 'baseAssetPrecision'))),
917
+ 'quote': this.parseNumber(this.parsePrecision(this.safeString(market, 'quotePrecision'))),
918
+ },
919
+ 'limits': {
920
+ 'leverage': {
921
+ 'min': undefined,
922
+ 'max': undefined,
836
923
  },
837
- 'limits': {
838
- 'leverage': {
839
- 'min': undefined,
840
- 'max': undefined,
841
- },
842
- 'amount': {
843
- 'min': undefined,
844
- 'max': undefined,
845
- },
846
- 'price': {
847
- 'min': undefined,
848
- 'max': undefined,
849
- },
850
- 'cost': {
851
- 'min': undefined,
852
- 'max': undefined,
853
- },
924
+ 'amount': {
925
+ 'min': this.safeNumber(filterLotSize, 'minQty'),
926
+ 'max': this.safeNumber(filterLotSize, 'maxQty'),
854
927
  },
855
- 'created': this.safeInteger(market, 'onboardDate'),
856
- 'info': market,
857
- });
858
- if ('PRICE_FILTER' in filtersByType) {
859
- const filter = this.safeDict(filtersByType, 'PRICE_FILTER', {});
860
- entry['limits']['price'] = {
861
- 'min': this.safeNumber(filter, 'minPrice'),
862
- 'max': this.safeNumber(filter, 'maxPrice'),
863
- };
864
- entry['precision']['price'] = this.safeNumber(filter, 'tickSize');
865
- }
866
- if ('LOT_SIZE' in filtersByType) {
867
- const filter = this.safeDict(filtersByType, 'LOT_SIZE', {});
868
- entry['precision']['amount'] = this.safeNumber(filter, 'stepSize');
869
- entry['limits']['amount'] = {
870
- 'min': this.safeNumber(filter, 'minQty'),
871
- 'max': this.safeNumber(filter, 'maxQty'),
872
- };
873
- }
874
- if ('MARKET_LOT_SIZE' in filtersByType) {
875
- const filter = this.safeDict(filtersByType, 'MARKET_LOT_SIZE', {});
876
- entry['limits']['market'] = {
877
- 'min': this.safeNumber(filter, 'minQty'),
878
- 'max': this.safeNumber(filter, 'maxQty'),
879
- };
880
- }
881
- if (('MIN_NOTIONAL' in filtersByType) || ('NOTIONAL' in filtersByType)) {
882
- const filter = this.safeDict2(filtersByType, 'MIN_NOTIONAL', 'NOTIONAL', {});
883
- entry['limits']['cost']['min'] = this.safeNumber(filter, 'notional');
884
- }
885
- result.push(entry);
886
- }
887
- return result;
928
+ 'price': {
929
+ 'min': this.safeNumber(filterPrice, 'minPrice'),
930
+ 'max': this.safeNumber(filterPrice, 'maxPrice'),
931
+ },
932
+ 'cost': {
933
+ 'min': this.safeNumber2(filterNotional, 'notional', 'minNotional'),
934
+ 'max': undefined,
935
+ },
936
+ 'market': {
937
+ 'min': this.safeNumber(filterMarketLotSize, 'minQty'),
938
+ 'max': this.safeNumber(filterMarketLotSize, 'maxQty'),
939
+ },
940
+ },
941
+ 'created': this.safeInteger2(market, 'listingTime', 'createTime'),
942
+ 'info': market,
943
+ });
888
944
  }
889
945
  /**
890
946
  * @method
891
947
  * @name aster#fetchTime
892
948
  * @description fetches the current integer timestamp in milliseconds from the exchange server
893
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#check-server-time
949
+ * @see https://asterdex.github.io/aster-api-website/spot-v3/market-data/#get-server-time
950
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/market-data/#check-server-time
894
951
  * @param {object} [params] extra parameters specific to the exchange API endpoint
895
952
  * @returns {int} the current integer timestamp in milliseconds from the exchange server
896
953
  */
897
954
  async fetchTime(params = {}) {
898
- const response = await this.fapiPublicGetV1Time(params);
955
+ let marketType = undefined;
956
+ [marketType, params] = this.handleMarketTypeAndParams('fetchTime', undefined, params);
957
+ let response = undefined;
958
+ if (marketType === 'swap') {
959
+ response = await this.fapiPublicGetV3Time(params);
960
+ }
961
+ else {
962
+ response = await this.sapiPublicGetV3Time(params);
963
+ }
899
964
  //
900
- // {
901
- // "serverTime": 1499827319559
902
- // }
965
+ // both SPOT & PERP has same format
966
+ //
967
+ // {
968
+ // "serverTime": 1499827319559
969
+ // }
903
970
  //
904
971
  return this.safeInteger(response, 'serverTime');
905
972
  }
906
973
  parseOHLCV(ohlcv, market = undefined) {
974
+ //
975
+ // spot:
907
976
  //
908
977
  // [
909
- // 1631158560000,
910
- // "208.1850",
911
- // "208.1850",
912
- // "208.1850",
913
- // "208.1850",
914
- // "11.84",
915
- // 1631158619999,
916
- // "2464.910400",
917
- // 1,
918
- // "11.84",
919
- // "2464.910400",
920
- // "0"
978
+ // 1499040000000, // Open time
979
+ // "0.01634790", // Open
980
+ // "0.80000000", // High
981
+ // "0.01575800", // Low
982
+ // "0.01577100", // Close
983
+ // "148976.11427815", // Volume
984
+ // 1499644799999, // Close time
985
+ // "2434.19055334", // Quote asset volume
986
+ // 308, // Number of trades
987
+ // "1756.87402397", // Taker buy base asset volume
988
+ // "28.46694368", // Taker buy quote asset volume
989
+ // "0" // ??
921
990
  // ]
922
991
  //
923
992
  return [
@@ -933,8 +1002,10 @@ class aster extends aster$1["default"] {
933
1002
  * @method
934
1003
  * @name aster#fetchOHLCV
935
1004
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
936
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api.md#k-line-data
937
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#klinecandlestick-data
1005
+ * @see https://asterdex.github.io/aster-api-website/spot-v3/market-data/#k-line-data
1006
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/market-data/#klinecandlestick-data
1007
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/market-data/#index-price-klinecandlestick-data
1008
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/market-data/#mark-price-klinecandlestick-data
938
1009
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
939
1010
  * @param {string} timeframe the length of time each candle represents
940
1011
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -945,9 +1016,6 @@ class aster extends aster$1["default"] {
945
1016
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
946
1017
  */
947
1018
  async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
948
- if (symbol === undefined) {
949
- throw new errors.ArgumentsRequired(this.id + ' fetchOHLCV() requires a symbol argument');
950
- }
951
1019
  await this.loadMarkets();
952
1020
  const market = this.market(symbol);
953
1021
  let request = {};
@@ -955,10 +1023,7 @@ class aster extends aster$1["default"] {
955
1023
  request['startTime'] = since;
956
1024
  }
957
1025
  if (limit !== undefined) {
958
- if (limit > 1500) {
959
- limit = 1500; // Default 500; max 1500.
960
- }
961
- request['limit'] = limit;
1026
+ request['limit'] = Math.min(limit, 1500);
962
1027
  }
963
1028
  [request, params] = this.handleUntilOption('endTime', request, params);
964
1029
  request['interval'] = this.safeString(this.timeframes, timeframe, timeframe);
@@ -969,97 +1034,116 @@ class aster extends aster$1["default"] {
969
1034
  let response = undefined;
970
1035
  if (isMark) {
971
1036
  request['symbol'] = market['id'];
972
- response = await this.fapiPublicGetV1MarkPriceKlines(this.extend(request, params));
1037
+ response = await this.fapiPublicGetV3MarkPriceKlines(this.extend(request, params));
973
1038
  }
974
1039
  else if (isIndex) {
975
1040
  request['pair'] = market['id'];
976
- response = await this.fapiPublicGetV1IndexPriceKlines(this.extend(request, params));
1041
+ response = await this.fapiPublicGetV3IndexPriceKlines(this.extend(request, params));
977
1042
  }
978
1043
  else {
979
1044
  request['symbol'] = market['id'];
980
1045
  if (market['linear']) {
981
- response = await this.fapiPublicGetV1Klines(this.extend(request, params));
1046
+ response = await this.fapiPublicGetV3Klines(this.extend(request, params));
982
1047
  }
983
1048
  else {
984
- response = await this.sapiPublicGetV1Klines(this.extend(request, params));
1049
+ response = await this.sapiPublicGetV3Klines(this.extend(request, params));
985
1050
  }
1051
+ //
1052
+ // both SPOT & PERP has same format
1053
+ //
1054
+ // [
1055
+ // [
1056
+ // 1499040000000, // Open time
1057
+ // "0.01634790", // Open
1058
+ // "0.80000000", // High
1059
+ // "0.01575800", // Low
1060
+ // "0.01577100", // Close
1061
+ // "148976.11427815", // Volume
1062
+ // 1499644799999, // Close time
1063
+ // "2434.19055334", // Quote asset volume
1064
+ // 308, // Number of trades
1065
+ // "1756.87402397", // Taker buy base asset volume
1066
+ // "28.46694368", // Taker buy quote asset volume,
1067
+ // "0"
1068
+ // ]
1069
+ // ]
1070
+ //
986
1071
  }
987
- //
988
- // [
989
- // [
990
- // 1631158560000,
991
- // "208.1850",
992
- // "208.1850",
993
- // "208.1850",
994
- // "208.1850",
995
- // "11.84",
996
- // 1631158619999,
997
- // "2464.910400",
998
- // 1,
999
- // "11.84",
1000
- // "2464.910400",
1001
- // "0"
1002
- // ]
1003
- // ]
1004
- //
1005
1072
  return this.parseOHLCVs(response, market, timeframe, since, limit);
1006
1073
  }
1007
1074
  parseTrade(trade, market = undefined) {
1008
1075
  //
1009
1076
  // fetchTrades
1010
1077
  //
1078
+ // recent trades:
1079
+ //
1011
1080
  // {
1012
1081
  // "id": 3913206,
1013
1082
  // "price": "644.100",
1014
1083
  // "qty": "0.08",
1015
- // "quoteQty": "51.528",
1084
+ // "quoteQty": "51.528", // present in PERP
1085
+ // "baseQty": "4.95049505", // present in SPOT
1016
1086
  // "time": 1749784506633,
1017
1087
  // "isBuyerMaker": true
1018
1088
  // }
1019
1089
  //
1090
+ // aggrTrades
1091
+ //
1020
1092
  // {
1021
- // "id": 657,
1022
- // "price": "1.01000000",
1023
- // "qty": "5.00000000",
1024
- // "baseQty": "4.95049505",
1025
- // "time": 1755156533943,
1026
- // "isBuyerMaker": false
1093
+ // "a": 26129, // Aggregate tradeId
1094
+ // "p": "0.01633102", // Price
1095
+ // "q": "4.70443515", // Quantity
1096
+ // "f": 27781, // First tradeId
1097
+ // "l": 27781, // Last tradeId
1098
+ // "T": 1498793709153, // Timestamp
1099
+ // "m": true, // Was the buyer the maker?
1027
1100
  // }
1028
1101
  //
1029
- // fetchMyTrades
1102
+ // fetchMyTrades (SPOT & PERP have similar format)
1030
1103
  //
1031
- // {
1032
- // "buyer": false,
1033
- // "commission": "-0.07819010",
1034
- // "commissionAsset": "USDT",
1035
- // "id": 698759,
1036
- // "maker": false,
1037
- // "orderId": 25851813,
1038
- // "price": "7819.01",
1039
- // "qty": "0.002",
1040
- // "quoteQty": "15.63802",
1041
- // "realizedPnl": "-0.91539999",
1042
- // "side": "SELL",
1043
- // "positionSide": "SHORT",
1044
- // "symbol": "BTCUSDT",
1045
- // "time": 1569514978020
1046
- // }
1104
+ // {
1105
+ // "symbol": "ETHUSDT",
1106
+ // "id": 2583152,
1107
+ // "orderId": 418588675,
1108
+ // "side": "SELL",
1109
+ // "price": "2330.04",
1110
+ // "qty": "0.0030",
1111
+ // "quoteQty": "6.99000000",
1112
+ // "commission": "0.00279605",
1113
+ // "commissionAsset": "USDT",
1114
+ // "time": 1776409179230,
1115
+ // "counterpartyId": 5143150, // only in SPOT
1116
+ // "createUpdateId": null, // only in SPOT
1117
+ // "maker": false, // only in SPOT
1118
+ // "buyer": false, // only in SPOT
1119
+ // "realizedPnl": "0.00029999", // only in PERP
1120
+ // "marginAsset": "USDT", // only in PERP
1121
+ // "positionSide": "BOTH", // only in PERP
1122
+ // }
1047
1123
  //
1048
- const id = this.safeString(trade, 'id');
1049
- const symbol = market['symbol'];
1050
- const currencyId = this.safeString(trade, 'commissionAsset');
1124
+ const id = this.safeString2(trade, 'id', 'a');
1125
+ const marketId = this.safeString(trade, 'symbol');
1126
+ const marketType = ('positionSide' in trade) ? 'swap' : 'spot';
1127
+ market = this.safeMarket(marketId, market, undefined, marketType);
1128
+ const currencyId = this.safeString2(trade, 'commissionAsset', 'marginAsset');
1051
1129
  const currencyCode = this.safeCurrencyCode(currencyId);
1052
- const amountString = this.safeString(trade, 'qty');
1053
- const priceString = this.safeString(trade, 'price');
1130
+ const amountString = this.safeString2(trade, 'qty', 'q');
1131
+ const priceString = this.safeString2(trade, 'price', 'p');
1054
1132
  const costString = this.safeString2(trade, 'quoteQty', 'baseQty');
1055
- const timestamp = this.safeInteger(trade, 'time');
1133
+ const timestamp = this.safeInteger2(trade, 'time', 'T');
1056
1134
  let side = this.safeStringLower(trade, 'side');
1057
1135
  const isMaker = this.safeBool(trade, 'maker');
1058
1136
  let takerOrMaker = undefined;
1059
1137
  if (isMaker !== undefined) {
1060
1138
  takerOrMaker = isMaker ? 'maker' : 'taker';
1139
+ if (side === undefined) {
1140
+ const isBuyer = this.safeBool(trade, 'buyer');
1141
+ if (isBuyer !== undefined) {
1142
+ side = isBuyer ? 'buy' : 'sell';
1143
+ }
1144
+ }
1061
1145
  }
1062
- const isBuyerMaker = this.safeBool(trade, 'isBuyerMaker');
1146
+ const isBuyerMaker = this.safeBool2(trade, 'isBuyerMaker', 'm');
1063
1147
  if (isBuyerMaker !== undefined) {
1064
1148
  side = isBuyerMaker ? 'sell' : 'buy';
1065
1149
  }
@@ -1068,7 +1152,7 @@ class aster extends aster$1["default"] {
1068
1152
  'info': trade,
1069
1153
  'timestamp': timestamp,
1070
1154
  'datetime': this.iso8601(timestamp),
1071
- 'symbol': symbol,
1155
+ 'symbol': market['symbol'],
1072
1156
  'order': this.safeString(trade, 'orderId'),
1073
1157
  'type': undefined,
1074
1158
  'side': side,
@@ -1086,57 +1170,79 @@ class aster extends aster$1["default"] {
1086
1170
  * @method
1087
1171
  * @name aster#fetchTrades
1088
1172
  * @description get the list of most recent trades for a particular symbol
1089
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api.md#recent-trades-list
1090
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#recent-trades-list
1173
+ * @see https://asterdex.github.io/aster-api-website/spot-v3/market-data/#recent-trades-list
1174
+ * @see https://asterdex.github.io/aster-api-website/spot-v3/market-data/#recent-trades-aggregated
1175
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/market-data/#recent-trades-list
1176
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/market-data/#compressedaggregate-trades-list
1091
1177
  * @param {string} symbol unified symbol of the market to fetch trades for
1092
1178
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
1093
1179
  * @param {int} [limit] the maximum amount of trades to fetch
1094
1180
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1095
- * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
1181
+ * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/?id=public-trades}
1096
1182
  */
1097
1183
  async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
1098
- if (symbol === undefined) {
1099
- throw new errors.ArgumentsRequired(this.id + ' fetchTrades() requires a symbol argument');
1100
- }
1101
1184
  await this.loadMarkets();
1102
1185
  const market = this.market(symbol);
1103
- const request = {
1186
+ let request = {
1104
1187
  'symbol': market['id'],
1105
1188
  };
1106
1189
  if (limit !== undefined) {
1107
- if (limit > 1000) {
1108
- limit = 1000; // Default 500; max 1000.
1109
- }
1110
- request['limit'] = limit;
1190
+ request['limit'] = Math.min(limit, 1000);
1111
1191
  }
1112
1192
  let response = undefined;
1113
- if (market['swap']) {
1114
- response = await this.fapiPublicGetV1Trades(this.extend(request, params));
1193
+ const sinceDefined = since !== undefined;
1194
+ const untilDefined = ('until' in params);
1195
+ if (sinceDefined) {
1196
+ request['startTime'] = since;
1197
+ }
1198
+ if (untilDefined) {
1199
+ request = this.handleUntilOption('endTime', request, params);
1200
+ }
1201
+ // use historical endpoint for targeted requests
1202
+ if ('startTime' in request) {
1203
+ if (market['swap']) {
1204
+ response = await this.fapiPublicGetV3AggTrades(this.extend(request, params));
1205
+ }
1206
+ else {
1207
+ response = await this.sapiPublicGetV3AggTrades(this.extend(request, params));
1208
+ }
1115
1209
  //
1116
- // [
1117
- // {
1118
- // "id": 3913206,
1119
- // "price": "644.100",
1120
- // "qty": "0.08",
1121
- // "quoteQty": "51.528",
1122
- // "time": 1749784506633,
1123
- // "isBuyerMaker": true
1124
- // }
1125
- // ]
1210
+ // both FAPI and SAPI have same response format
1211
+ //
1212
+ // [
1213
+ // {
1214
+ // "a": 26129, // Aggregate tradeId
1215
+ // "p": "0.01633102", // Price
1216
+ // "q": "4.70443515", // Quantity
1217
+ // "f": 27781, // First tradeId
1218
+ // "l": 27781, // Last tradeId
1219
+ // "T": 1498793709153, // Timestamp
1220
+ // "m": true, // Was the buyer the maker?
1221
+ // }
1222
+ // ]
1126
1223
  //
1127
1224
  }
1128
1225
  else {
1129
- response = await this.sapiPublicGetV1Trades(this.extend(request, params));
1130
- // [
1131
- // {
1132
- // "id": 657,
1133
- // "price": "1.01000000",
1134
- // "qty": "5.00000000",
1135
- // "baseQty": "4.95049505",
1136
- // "time": 1755156533943,
1137
- // "isBuyerMaker": false
1138
- // }
1139
- // ]
1226
+ if (market['swap']) {
1227
+ response = await this.fapiPublicGetV3Trades(this.extend(request, params));
1228
+ }
1229
+ else {
1230
+ response = await this.sapiPublicGetV3Trades(this.extend(request, params));
1231
+ }
1232
+ //
1233
+ // SAPI & FAPI have only one field difference
1234
+ //
1235
+ // [
1236
+ // {
1237
+ // "id": "73620768",
1238
+ // "price": "2324.07",
1239
+ // "qty": "0.430",
1240
+ // "quoteQty": "999.35", // only in PERP
1241
+ // "baseQty": "4.95049505", // only in SPOT
1242
+ // "time": "1776407252900",
1243
+ // "isBuyerMaker": false
1244
+ // }, ...
1245
+ //
1140
1246
  }
1141
1247
  return this.parseTrades(response, market, since, limit);
1142
1248
  }
@@ -1144,60 +1250,61 @@ class aster extends aster$1["default"] {
1144
1250
  * @method
1145
1251
  * @name aster#fetchMyTrades
1146
1252
  * @description fetch all trades made by the user
1147
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api.md#account-trade-history-user_data
1148
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#account-trade-list-user_data
1253
+ * @see https://asterdex.github.io/aster-api-website/spot-v3/account%26trades/#account-trade-history-user_data
1254
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#account-trade-list-user_data
1149
1255
  * @param {string} [symbol] unified market symbol
1150
1256
  * @param {int} [since] the earliest time in ms to fetch trades for
1151
1257
  * @param {int} [limit] the maximum number of trades structures to retrieve
1152
1258
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1153
1259
  * @param {int} [params.until] timestamp in ms for the ending date filter, default is undefined
1154
- * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
1260
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/?id=trade-structure}
1155
1261
  */
1156
1262
  async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1157
- if (symbol === undefined) {
1158
- throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
1263
+ await this.loadMarketsAndSignIn();
1264
+ let request = {};
1265
+ let market = undefined;
1266
+ if (symbol !== undefined) {
1267
+ market = this.market(symbol);
1268
+ request['symbol'] = market['id'];
1159
1269
  }
1160
- await this.loadMarkets();
1161
- const market = this.market(symbol);
1162
- let request = {
1163
- 'symbol': market['id'],
1164
- };
1270
+ let marketType = undefined;
1271
+ [marketType, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
1165
1272
  if (since !== undefined) {
1166
1273
  request['startTime'] = since;
1167
1274
  }
1168
1275
  if (limit !== undefined) {
1169
- if (limit > 1000) {
1170
- limit = 1000; // Default 500; max 1000.
1171
- }
1172
- request['limit'] = limit;
1276
+ request['limit'] = Math.min(limit, 1000);
1173
1277
  }
1174
1278
  [request, params] = this.handleUntilOption('endTime', request, params);
1175
1279
  let response = undefined;
1176
- if (market['swap']) {
1177
- response = await this.fapiPrivateGetV1UserTrades(this.extend(request, params));
1280
+ if (marketType === 'swap') {
1281
+ response = await this.fapiPrivateGetV3UserTrades(this.extend(request, params));
1178
1282
  }
1179
1283
  else {
1180
- response = await this.sapiPrivateGetV1UserTrades(this.extend(request, params));
1284
+ response = await this.sapiPrivateGetV3UserTrades(this.extend(request, params));
1181
1285
  }
1182
1286
  //
1183
- // [
1184
- // {
1185
- // "buyer": false,
1186
- // "commission": "-0.07819010",
1187
- // "commissionAsset": "USDT",
1188
- // "id": 698759,
1189
- // "maker": false,
1190
- // "orderId": 25851813,
1191
- // "price": "7819.01",
1192
- // "qty": "0.002",
1193
- // "quoteQty": "15.63802",
1194
- // "realizedPnl": "-0.91539999",
1195
- // "side": "SELL",
1196
- // "positionSide": "SHORT",
1197
- // "symbol": "BTCUSDT",
1198
- // "time": 1569514978020
1199
- // }
1200
- // ]
1287
+ // SPOT & PERP have similar format
1288
+ //
1289
+ // {
1290
+ // "symbol": "ETHUSDT",
1291
+ // "id": 2583152,
1292
+ // "orderId": 418588675,
1293
+ // "side": "SELL",
1294
+ // "price": "2330.04",
1295
+ // "qty": "0.0030",
1296
+ // "quoteQty": "6.99000000",
1297
+ // "commission": "0.00279605",
1298
+ // "commissionAsset": "USDT",
1299
+ // "time": 1776409179230,
1300
+ // "counterpartyId": 5143150, // only in PERP
1301
+ // "createUpdateId": null, // only in PERP
1302
+ // "maker": false, // only in PERP
1303
+ // "buyer": false, // only in PERP
1304
+ // "realizedPnl": "0.00029999", // only in SPOT
1305
+ // "marginAsset": "USDT", // only in SPOT
1306
+ // "positionSide": "BOTH", // only in SPOT
1307
+ // }
1201
1308
  //
1202
1309
  return this.parseTrades(response, market, since, limit, params);
1203
1310
  }
@@ -1205,37 +1312,32 @@ class aster extends aster$1["default"] {
1205
1312
  * @method
1206
1313
  * @name aster#fetchOrderBook
1207
1314
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
1208
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api.md#depth-information
1209
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#order-book
1315
+ * @see https://asterdex.github.io/aster-api-website/spot-v3/market-data/#depth-information
1316
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/market-data/#order-book
1210
1317
  * @param {string} symbol unified symbol of the market to fetch the order book for
1211
1318
  * @param {int} [limit] the maximum amount of order book entries to return
1212
1319
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1213
- * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
1320
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/?id=order-book-structure} indexed by market symbols
1214
1321
  */
1215
1322
  async fetchOrderBook(symbol, limit = undefined, params = {}) {
1216
- if (symbol === undefined) {
1217
- throw new errors.ArgumentsRequired(this.id + ' fetchOrderBook() requires a symbol argument');
1218
- }
1219
1323
  await this.loadMarkets();
1220
1324
  const market = this.market(symbol);
1221
1325
  const request = {
1222
1326
  'symbol': market['id'],
1223
1327
  };
1328
+ let response = undefined;
1224
1329
  if (limit !== undefined) {
1225
- // limit: [5, 10, 20, 50, 100, 500, 1000]. Default: 500
1226
- if (limit > 1000) {
1227
- limit = 1000; // Default 500; max 1000.
1228
- }
1229
- request['limit'] = limit;
1330
+ request['limit'] = this.findNearestCeiling([5, 10, 20, 50, 100, 500, 1000], limit);
1230
1331
  }
1231
- let response = undefined;
1232
1332
  if (market['swap']) {
1233
- response = await this.fapiPublicGetV1Depth(this.extend(request, params));
1333
+ response = await this.fapiPublicGetV3Depth(this.extend(request, params));
1234
1334
  }
1235
1335
  else {
1236
- response = await this.sapiPublicGetV1Depth(this.extend(request, params));
1336
+ response = await this.sapiPublicGetV3Depth(this.extend(request, params));
1237
1337
  }
1238
1338
  //
1339
+ // both SPOT & PERP has same format
1340
+ //
1239
1341
  // {
1240
1342
  // "lastUpdateId": 1027024,
1241
1343
  // "E": 1589436922972, // Message output time
@@ -1257,118 +1359,50 @@ class aster extends aster$1["default"] {
1257
1359
  const timestamp = this.safeInteger(response, 'T');
1258
1360
  return this.parseOrderBook(response, symbol, timestamp, 'bids', 'asks');
1259
1361
  }
1260
- /**
1261
- * @method
1262
- * @name aster#fetchFundingRateHistory
1263
- * @description fetches historical funding rate prices
1264
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#get-funding-rate-history
1265
- * @param {string} symbol unified symbol of the market to fetch the funding rate history for
1266
- * @param {int} [since] timestamp in ms of the earliest funding rate to fetch
1267
- * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} to fetch
1268
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1269
- * @param {int} [params.until] timestamp in ms of the latest funding rate
1270
- * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
1271
- */
1272
- async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1273
- await this.loadMarkets();
1274
- let request = {};
1275
- if (symbol !== undefined) {
1276
- const market = this.market(symbol);
1277
- request['symbol'] = market['id'];
1278
- }
1279
- if (since !== undefined) {
1280
- request['startTime'] = since;
1281
- }
1282
- if (limit !== undefined) {
1283
- if (limit > 1000) {
1284
- limit = 1000; // Default 100; max 1000
1285
- }
1286
- request['limit'] = limit;
1287
- }
1288
- [request, params] = this.handleUntilOption('endTime', request, params);
1289
- const response = await this.fapiPublicGetV1FundingRate(this.extend(request, params));
1362
+ parseTicker(ticker, market = undefined) {
1290
1363
  //
1291
- // [
1292
- // {
1293
- // "symbol": "BTCUSDT",
1294
- // "fundingTime": 1747209600000,
1295
- // "fundingRate": "0.00010000"
1296
- // }
1297
- // ]
1364
+ // fetchTicker & fetchTickers: both SPOT & PERP has similar format
1298
1365
  //
1299
- const rates = [];
1300
- for (let i = 0; i < response.length; i++) {
1301
- const entry = response[i];
1302
- const timestamp = this.safeInteger(entry, 'fundingTime');
1303
- rates.push({
1304
- 'info': entry,
1305
- 'symbol': this.safeSymbol(this.safeString(entry, 'symbol'), undefined, undefined, 'swap'),
1306
- 'fundingRate': this.safeNumber(entry, 'fundingRate'),
1307
- 'timestamp': timestamp,
1308
- 'datetime': this.iso8601(timestamp),
1309
- });
1310
- }
1311
- const sorted = this.sortBy(rates, 'timestamp');
1312
- return this.filterBySymbolSinceLimit(sorted, symbol, since, limit);
1313
- }
1314
- parseTicker(ticker, market = undefined) {
1366
+ // {
1367
+ // "symbol": "ETHUSDT",
1368
+ // "priceChange": "6.54",
1369
+ // "priceChangePercent": "0.279",
1370
+ // "weightedAvgPrice": "2330.70",
1371
+ // "lastPrice": "2350.00",
1372
+ // "lastQty": "4.437",
1373
+ // "openPrice": "2343.46",
1374
+ // "highPrice": "2363.20",
1375
+ // "lowPrice": "2283.86",
1376
+ // "volume": "267154.248",
1377
+ // "quoteVolume": "622657018.70",
1378
+ // "openTime": "1776329400000",
1379
+ // "closeTime": "1776415832593",
1380
+ // "firstId": "73520536",
1381
+ // "lastId": "73630176",
1382
+ // "count": "109640",
1383
+ // "baseAsset": "BTC", // only in SPOT
1384
+ // "quoteAsset": "USDT", // only in SPOT
1385
+ // "bidPrice": "71125.98", // only in SPOT
1386
+ // "bidQty": "0.00737", // only in SPOT
1387
+ // "askPrice": "71152.10", // only in SPOT
1388
+ // "askQty": "0.32399" // only in SPOT
1389
+ // }
1315
1390
  //
1316
- // spot
1317
- // {
1318
- // "symbol": "BTCUSDT",
1319
- // "priceChange": "-2274.38",
1320
- // "priceChangePercent": "-2.049",
1321
- // "weightedAvgPrice": "109524.37084136",
1322
- // "lastPrice": "108738.78",
1323
- // "lastQty": "0.00034",
1324
- // "openPrice": "111013.16",
1325
- // "highPrice": "111975.81",
1326
- // "lowPrice": "107459.25",
1327
- // "volume": "28.67876",
1328
- // "quoteVolume": "3141023.14551030",
1329
- // "openTime": "1760578800000",
1330
- // "closeTime": "1760665024749",
1331
- // "firstId": "37447",
1332
- // "lastId": "39698",
1333
- // "count": "2252",
1334
- // "baseAsset": "BTC",
1335
- // "quoteAsset": "USDT",
1336
- // "bidPrice": "108705.11",
1337
- // "bidQty": "0.03351",
1338
- // "askPrice": "108725.99",
1339
- // "askQty": "0.08724"
1340
- // }
1341
- // swap
1342
- // {
1343
- // "symbol": "BTCUSDT",
1344
- // "priceChange": "1845.7",
1345
- // "priceChangePercent": "1.755",
1346
- // "weightedAvgPrice": "105515.5",
1347
- // "lastPrice": "107037.7",
1348
- // "lastQty": "0.004",
1349
- // "openPrice": "105192.0",
1350
- // "highPrice": "107223.5",
1351
- // "lowPrice": "104431.6",
1352
- // "volume": "8753.286",
1353
- // "quoteVolume": "923607368.61",
1354
- // "openTime": 1749976620000,
1355
- // "closeTime": 1750063053754,
1356
- // "firstId": 24195078,
1357
- // "lastId": 24375783,
1358
- // "count": 180706
1359
- // }
1391
+ //
1392
+ // fetchBidsAsks: SPOT & PERP have only one field difference
1393
+ //
1394
+ // [
1395
+ // {
1396
+ // "symbol": "BMTUSDT",
1397
+ // "bidPrice": "0.004000",
1398
+ // "bidQty": "1250.0",
1399
+ // "askPrice": "0.000000",
1400
+ // "askQty": "0.0",
1401
+ // "time": "1776411276072",
1402
+ // "lastUpdateId": "453174307613" // only in PERP
1403
+ // }, ...
1360
1404
  //
1361
1405
  const timestamp = this.safeInteger(ticker, 'closeTime');
1362
- let marketType = undefined;
1363
- if ('bidQty' in ticker) {
1364
- marketType = 'spot';
1365
- }
1366
- else {
1367
- marketType = 'contract';
1368
- }
1369
- const marketId = this.safeString(ticker, 'symbol');
1370
- market = this.safeMarket(marketId, market, undefined, marketType);
1371
- const symbol = market['symbol'];
1372
1406
  const last = this.safeString(ticker, 'lastPrice');
1373
1407
  const open = this.safeString(ticker, 'openPrice');
1374
1408
  let percentage = this.safeString(ticker, 'priceChangePercent');
@@ -1377,8 +1411,18 @@ class aster extends aster$1["default"] {
1377
1411
  const baseVolume = this.safeString(ticker, 'volume');
1378
1412
  const high = this.safeString(ticker, 'highPrice');
1379
1413
  const low = this.safeString(ticker, 'lowPrice');
1414
+ const isTickerResponse = ('priceChange' in ticker);
1415
+ let marketType = undefined;
1416
+ if (isTickerResponse) {
1417
+ marketType = ('baseAsset' in ticker) ? 'spot' : 'swap';
1418
+ }
1419
+ else {
1420
+ marketType = ('lastUpdateId' in ticker) ? 'swap' : 'spot';
1421
+ }
1422
+ const marketId = this.safeString(ticker, 'symbol');
1423
+ market = this.safeMarket(marketId, market, undefined, marketType);
1380
1424
  return this.safeTicker({
1381
- 'symbol': symbol,
1425
+ 'symbol': market['symbol'],
1382
1426
  'timestamp': timestamp,
1383
1427
  'datetime': this.iso8601(timestamp),
1384
1428
  'high': high,
@@ -1406,16 +1450,13 @@ class aster extends aster$1["default"] {
1406
1450
  * @method
1407
1451
  * @name aster#fetchTicker
1408
1452
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
1409
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api.md#24h-price-change
1410
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#24hr-ticker-price-change-statistics
1453
+ * @see https://asterdex.github.io/aster-api-website/spot-v3/market-data/#24h-price-change
1454
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/market-data/#24hr-ticker-price-change-statistics
1411
1455
  * @param {string} symbol unified symbol of the market to fetch the ticker for
1412
1456
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1413
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
1457
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/?id=ticker-structure}
1414
1458
  */
1415
1459
  async fetchTicker(symbol, params = {}) {
1416
- if (symbol === undefined) {
1417
- throw new errors.ArgumentsRequired(this.id + ' fetchTicker() requires a symbol argument');
1418
- }
1419
1460
  await this.loadMarkets();
1420
1461
  const market = this.market(symbol);
1421
1462
  const request = {
@@ -1423,86 +1464,65 @@ class aster extends aster$1["default"] {
1423
1464
  };
1424
1465
  let response = undefined;
1425
1466
  if (market['swap']) {
1426
- response = await this.fapiPublicGetV1Ticker24hr(this.extend(request, params));
1427
- //
1428
- // {
1429
- // "symbol": "BTCUSDT",
1430
- // "priceChange": "1845.7",
1431
- // "priceChangePercent": "1.755",
1432
- // "weightedAvgPrice": "105515.5",
1433
- // "lastPrice": "107037.7",
1434
- // "lastQty": "0.004",
1435
- // "openPrice": "105192.0",
1436
- // "highPrice": "107223.5",
1437
- // "lowPrice": "104431.6",
1438
- // "volume": "8753.286",
1439
- // "quoteVolume": "923607368.61",
1440
- // "openTime": 1749976620000,
1441
- // "closeTime": 1750063053754,
1442
- // "firstId": 24195078,
1443
- // "lastId": 24375783,
1444
- // "count": 180706
1445
- // }
1446
- //
1467
+ response = await this.fapiPublicGetV3Ticker24hr(this.extend(request, params));
1447
1468
  }
1448
1469
  else {
1449
- response = await this.sapiPublicGetV1Ticker24hr(this.extend(request, params));
1450
- // {
1451
- // "symbol": "BTCUSDT",
1452
- // "priceChange": "-2274.38",
1453
- // "priceChangePercent": "-2.049",
1454
- // "weightedAvgPrice": "109524.37084136",
1455
- // "lastPrice": "108738.78",
1456
- // "lastQty": "0.00034",
1457
- // "openPrice": "111013.16",
1458
- // "highPrice": "111975.81",
1459
- // "lowPrice": "107459.25",
1460
- // "volume": "28.67876",
1461
- // "quoteVolume": "3141023.14551030",
1462
- // "openTime": "1760578800000",
1463
- // "closeTime": "1760665024749",
1464
- // "firstId": "37447",
1465
- // "lastId": "39698",
1466
- // "count": "2252",
1467
- // "baseAsset": "BTC",
1468
- // "quoteAsset": "USDT",
1469
- // "bidPrice": "108705.11",
1470
- // "bidQty": "0.03351",
1471
- // "askPrice": "108725.99",
1472
- // "askQty": "0.08724"
1473
- // }
1470
+ response = await this.sapiPublicGetV3Ticker24hr(this.extend(request, params));
1474
1471
  }
1472
+ //
1473
+ // both SPOT & PERP has same format
1474
+ //
1475
+ // {
1476
+ // "symbol": "ETHUSDT",
1477
+ // "priceChange": "6.54",
1478
+ // "priceChangePercent": "0.279",
1479
+ // "weightedAvgPrice": "2330.70",
1480
+ // "lastPrice": "2350.00",
1481
+ // "lastQty": "4.437",
1482
+ // "openPrice": "2343.46",
1483
+ // "highPrice": "2363.20",
1484
+ // "lowPrice": "2283.86",
1485
+ // "volume": "267154.248",
1486
+ // "quoteVolume": "622657018.70",
1487
+ // "openTime": "1776329400000",
1488
+ // "closeTime": "1776415832593",
1489
+ // "firstId": "73520536",
1490
+ // "lastId": "73630176",
1491
+ // "count": "109640",
1492
+ // "baseAsset": "BTC", // only in SPOT
1493
+ // "quoteAsset": "USDT", // only in SPOT
1494
+ // "bidPrice": "71125.98", // only in SPOT
1495
+ // "bidQty": "0.00737", // only in SPOT
1496
+ // "askPrice": "71152.10", // only in SPOT
1497
+ // "askQty": "0.32399" // only in SPOT
1498
+ // }
1499
+ //
1475
1500
  return this.parseTicker(response, market);
1476
1501
  }
1477
1502
  /**
1478
1503
  * @method
1479
1504
  * @name aster#fetchTickers
1480
1505
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
1481
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api.md#24h-price-change
1482
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#24hr-ticker-price-change-statistics
1506
+ * @see https://asterdex.github.io/aster-api-website/spot-v3/market-data/#24h-price-change
1507
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/market-data/#24hr-ticker-price-change-statistics
1483
1508
  * @param {string[]} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1484
1509
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1485
1510
  * @param {string} [params.subType] "linear" or "inverse"
1486
1511
  * @param {string} [params.type] 'spot', 'option', use params["subType"] for swap and future markets
1487
- * @returns {object} an array of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
1512
+ * @returns {object} an array of [ticker structures]{@link https://docs.ccxt.com/?id=ticker-structure}
1488
1513
  */
1489
1514
  async fetchTickers(symbols = undefined, params = {}) {
1490
1515
  await this.loadMarkets();
1491
1516
  symbols = this.marketSymbols(symbols, undefined, true, true, true);
1492
1517
  const market = this.getMarketFromSymbols(symbols);
1493
- let type = undefined;
1494
- [type, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
1495
- let subType = undefined;
1496
- [subType, params] = this.handleSubTypeAndParams('fetchTickers', market, params);
1518
+ let marketType = undefined;
1519
+ [marketType, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
1497
1520
  let response = undefined;
1498
- if (this.isLinear(type, subType)) {
1499
- response = await this.fapiPublicGetV1Ticker24hr(params);
1521
+ if (marketType === 'swap') {
1522
+ response = await this.fapiPublicGetV3Ticker24hr(params);
1500
1523
  }
1501
- else if (type === 'spot') {
1502
- response = await this.sapiPublicGetV1Ticker24hr(params);
1503
- }
1504
- else {
1505
- throw new errors.NotSupported(this.id + ' fetchTickers() does not support ' + type + ' markets yet');
1524
+ else if (marketType === 'spot') {
1525
+ response = await this.sapiPublicGetV3Ticker24hr(params);
1506
1526
  }
1507
1527
  //
1508
1528
  // [
@@ -1522,13 +1542,127 @@ class aster extends aster$1["default"] {
1522
1542
  // "closeTime": 1750063053754,
1523
1543
  // "firstId": 24195078,
1524
1544
  // "lastId": 24375783,
1525
- // "count": 180706
1545
+ // "count": 180706,
1546
+ // "baseAsset": "BTC", // only in SPOT
1547
+ // "quoteAsset": "USDT", // only in SPOT
1548
+ // "bidPrice": "71125.98", // only in SPOT
1549
+ // "bidQty": "0.00737", // only in SPOT
1550
+ // "askPrice": "71152.10", // only in SPOT
1551
+ // "askQty": "0.32399" // only in SPOT
1526
1552
  // }
1527
1553
  // ]
1528
1554
  //
1529
1555
  return this.parseTickers(response, symbols);
1530
1556
  }
1557
+ /**
1558
+ * @method
1559
+ * @name aster#fetchLastPrices
1560
+ * @description fetches the last price for multiple markets
1561
+ * @see https://asterdex.github.io/aster-api-website/spot-v3/market-data/#latest-price
1562
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/market-data/#symbol-price-ticker
1563
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the last prices
1564
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1565
+ * @param {string} [params.subType] "linear" or "inverse"
1566
+ * @returns {object} a dictionary of lastprices structures
1567
+ */
1568
+ async fetchLastPrices(symbols = undefined, params = {}) {
1569
+ await this.loadMarkets();
1570
+ symbols = this.marketSymbols(symbols, undefined, true, true, true);
1571
+ const market = this.getMarketFromSymbols(symbols);
1572
+ let marketType = undefined;
1573
+ [marketType, params] = this.handleMarketTypeAndParams('fetchLastPrices', market, params);
1574
+ let response = undefined;
1575
+ if (marketType === 'swap') {
1576
+ response = await this.fapiPublicGetV3TickerPrice(params);
1577
+ }
1578
+ else if (marketType === 'spot') {
1579
+ response = await this.sapiPublicGetV3TickerPrice(params);
1580
+ }
1581
+ //
1582
+ // both SPOT & SWAP has same format
1583
+ //
1584
+ // [
1585
+ // {
1586
+ // "symbol": "LTCBTC",
1587
+ // "price": "4.00000200"
1588
+ // "time": "1649666690902"
1589
+ // },
1590
+ // ...
1591
+ // ]
1592
+ //
1593
+ const results = [];
1594
+ for (let i = 0; i < response.length; i++) {
1595
+ const marketId = this.safeString(response[i], 'symbol');
1596
+ const safeMarket = this.safeMarket(marketId, undefined, undefined, marketType);
1597
+ const priceData = this.extend(this.parseLastPrice(response[i], safeMarket), params);
1598
+ results.push(priceData);
1599
+ }
1600
+ symbols = this.marketSymbols(symbols);
1601
+ return this.filterByArray(results, 'symbol', symbols);
1602
+ }
1603
+ parseLastPrice(entry, market = undefined) {
1604
+ //
1605
+ // spot & swap
1606
+ //
1607
+ // {
1608
+ // "symbol": "LTCBTC",
1609
+ // "price": "4.00000200"
1610
+ // "time": "1649666690902"
1611
+ // }
1612
+ //
1613
+ const timestamp = this.safeInteger(entry, 'time');
1614
+ return {
1615
+ 'symbol': market['symbol'],
1616
+ 'timestamp': timestamp,
1617
+ 'datetime': this.iso8601(timestamp),
1618
+ 'price': this.safeNumberOmitZero(entry, 'price'),
1619
+ 'side': undefined,
1620
+ 'info': entry,
1621
+ };
1622
+ }
1623
+ /**
1624
+ * @method
1625
+ * @name aster#fetchBidsAsks
1626
+ * @description fetches the bid and ask price and volume for multiple markets
1627
+ * @see https://asterdex.github.io/aster-api-website/spot-v3/market-data/#current-best-order
1628
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/market-data/#symbol-order-book-ticker
1629
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
1630
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1631
+ * @param {string} [params.subType] "linear" or "inverse"
1632
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/?id=ticker-structure}
1633
+ */
1634
+ async fetchBidsAsks(symbols = undefined, params = {}) {
1635
+ await this.loadMarkets();
1636
+ symbols = this.marketSymbols(symbols, undefined, true, true, true);
1637
+ const market = this.getMarketFromSymbols(symbols);
1638
+ let marketType = undefined;
1639
+ [marketType, params] = this.handleMarketTypeAndParams('fetchBidsAsks', market, params);
1640
+ let response = undefined;
1641
+ if (marketType === 'swap') {
1642
+ response = await this.fapiPublicGetV3TickerBookTicker(params);
1643
+ }
1644
+ else if (marketType === 'spot') {
1645
+ response = await this.sapiPublicGetV3TickerBookTicker(params);
1646
+ }
1647
+ //
1648
+ // SPOT & PERP have only one field difference
1649
+ //
1650
+ // [
1651
+ // {
1652
+ // "symbol": "BMTUSDT",
1653
+ // "bidPrice": "0.004000",
1654
+ // "bidQty": "1250.0",
1655
+ // "askPrice": "0.000000",
1656
+ // "askQty": "0.0",
1657
+ // "time": "1776411276072",
1658
+ // "lastUpdateId": "453174307613" // only in PERP
1659
+ // }, ...
1660
+ //
1661
+ return this.parseTickers(response, symbols);
1662
+ }
1531
1663
  parseFundingRate(contract, market = undefined) {
1664
+ //
1665
+ // fundingRate
1532
1666
  //
1533
1667
  // {
1534
1668
  // "symbol": "BTCUSDT",
@@ -1540,6 +1674,9 @@ class aster extends aster$1["default"] {
1540
1674
  // "nextFundingTime": 1750147200000,
1541
1675
  // "time": 1750146970000
1542
1676
  // }
1677
+ //
1678
+ // funding interval
1679
+ //
1543
1680
  // {
1544
1681
  // "symbol": "INJUSDT",
1545
1682
  // "interestRate": "0.00010000",
@@ -1582,10 +1719,10 @@ class aster extends aster$1["default"] {
1582
1719
  * @method
1583
1720
  * @name aster#fetchFundingRate
1584
1721
  * @description fetch the current funding rate
1585
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#mark-price
1722
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/market-data/#symbol-price-ticker
1586
1723
  * @param {string} symbol unified market symbol
1587
1724
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1588
- * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
1725
+ * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/?id=funding-rate-structure}
1589
1726
  */
1590
1727
  async fetchFundingRate(symbol, params = {}) {
1591
1728
  if (symbol === undefined) {
@@ -1596,7 +1733,7 @@ class aster extends aster$1["default"] {
1596
1733
  const request = {
1597
1734
  'symbol': market['id'],
1598
1735
  };
1599
- const response = await this.fapiPublicGetV1PremiumIndex(this.extend(request, params));
1736
+ const response = await this.fapiPublicGetV3PremiumIndex(this.extend(request, params));
1600
1737
  //
1601
1738
  // {
1602
1739
  // "symbol": "BTCUSDT",
@@ -1615,15 +1752,15 @@ class aster extends aster$1["default"] {
1615
1752
  * @method
1616
1753
  * @name aster#fetchFundingRates
1617
1754
  * @description fetch the current funding rate for multiple symbols
1618
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#24hr-ticker-price-change-statistics
1755
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/market-data/#symbol-price-ticker
1619
1756
  * @param {string[]} [symbols] list of unified market symbols
1620
1757
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1621
- * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
1758
+ * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/?id=funding-rate-structure}
1622
1759
  */
1623
1760
  async fetchFundingRates(symbols = undefined, params = {}) {
1624
1761
  await this.loadMarkets();
1625
1762
  symbols = this.marketSymbols(symbols);
1626
- const response = await this.fapiPublicGetV1PremiumIndex(this.extend(params));
1763
+ const response = await this.fapiPublicGetV3PremiumIndex(this.extend(params));
1627
1764
  //
1628
1765
  // [
1629
1766
  // {
@@ -1644,17 +1781,17 @@ class aster extends aster$1["default"] {
1644
1781
  * @method
1645
1782
  * @name aster#fetchFundingIntervals
1646
1783
  * @description fetch the funding rate interval for multiple markets
1647
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#get-funding-rate-config
1784
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/market-data/#get-funding-rate-config
1648
1785
  * @param {string[]} [symbols] list of unified market symbols
1649
1786
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1650
- * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
1787
+ * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/?id=funding-rate-structure}
1651
1788
  */
1652
1789
  async fetchFundingIntervals(symbols = undefined, params = {}) {
1653
1790
  await this.loadMarkets();
1654
1791
  if (symbols !== undefined) {
1655
1792
  symbols = this.marketSymbols(symbols);
1656
1793
  }
1657
- const response = await this.fapiPublicGetV1FundingInfo(params);
1794
+ const response = await this.fapiPublicGetV3FundingInfo(params);
1658
1795
  //
1659
1796
  // [
1660
1797
  // {
@@ -1669,64 +1806,98 @@ class aster extends aster$1["default"] {
1669
1806
  //
1670
1807
  return this.parseFundingRates(response, symbols);
1671
1808
  }
1672
- parseBalance(response) {
1673
- const result = { 'info': response };
1674
- for (let i = 0; i < response.length; i++) {
1675
- const balance = response[i];
1676
- const currencyId = this.safeString(balance, 'asset');
1677
- const code = this.safeCurrencyCode(currencyId);
1678
- const account = this.account();
1679
- account['free'] = this.safeString2(balance, 'free', 'maxWithdrawAmount');
1680
- account['used'] = this.safeString(balance, 'locked');
1681
- account['total'] = this.safeString(balance, 'walletBalance');
1682
- result[code] = account;
1809
+ /**
1810
+ * @method
1811
+ * @name aster#fetchFundingRateHistory
1812
+ * @description fetches historical funding rate prices
1813
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/market-data/#get-funding-rate-history
1814
+ * @param {string} symbol unified symbol of the market to fetch the funding rate history for
1815
+ * @param {int} [since] timestamp in ms of the earliest funding rate to fetch
1816
+ * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/?id=funding-rate-history-structure} to fetch
1817
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1818
+ * @param {int} [params.until] timestamp in ms of the latest funding rate
1819
+ * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/?id=funding-rate-history-structure}
1820
+ */
1821
+ async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1822
+ await this.loadMarkets();
1823
+ let request = {};
1824
+ let market = undefined;
1825
+ if (symbol !== undefined) {
1826
+ market = this.market(symbol);
1827
+ request['symbol'] = market['id'];
1683
1828
  }
1684
- return this.safeBalance(result);
1829
+ if (since !== undefined) {
1830
+ request['startTime'] = since;
1831
+ }
1832
+ if (limit !== undefined) {
1833
+ request['limit'] = Math.min(limit, 1000);
1834
+ }
1835
+ [request, params] = this.handleUntilOption('endTime', request, params);
1836
+ const response = await this.fapiPublicGetV3FundingRate(this.extend(request, params));
1837
+ //
1838
+ // [
1839
+ // {
1840
+ // "symbol": "BTCUSDT",
1841
+ // "fundingTime": 1747209600000,
1842
+ // "fundingRate": "0.00010000"
1843
+ // }
1844
+ // ]
1845
+ //
1846
+ return this.parseFundingRateHistories(response, market);
1847
+ }
1848
+ parseFundingRateHistory(contract, market = undefined) {
1849
+ //
1850
+ // {
1851
+ // "symbol": "BTCUSDT",
1852
+ // "fundingRate": "0.00063521",
1853
+ // "fundingTime": "1621267200000",
1854
+ // }
1855
+ //
1856
+ const timestamp = this.safeInteger(contract, 'fundingTime');
1857
+ return {
1858
+ 'info': contract,
1859
+ 'symbol': this.safeSymbol(this.safeString(contract, 'symbol'), undefined, undefined, 'swap'),
1860
+ 'fundingRate': this.safeNumber(contract, 'fundingRate'),
1861
+ 'timestamp': timestamp,
1862
+ 'datetime': this.iso8601(timestamp),
1863
+ };
1685
1864
  }
1686
1865
  /**
1687
1866
  * @method
1688
1867
  * @name aster#fetchBalance
1689
1868
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
1690
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#account-information-v4-user_data
1691
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api.md#account-information-user_data
1869
+ * @see https://asterdex.github.io/aster-api-website/spot-v3/account%26trades/#account-information-user_data
1870
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#futures-account-balance-v3-user_data
1692
1871
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1693
1872
  * @param {string} [params.subType] "linear" or "inverse"
1694
1873
  * @param {string} [params.type] 'spot', 'option', use params["subType"] for swap and future markets
1695
- * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
1874
+ * @returns {object} a [balance structure]{@link https://docs.ccxt.com/?id=balance-structure}
1696
1875
  */
1697
1876
  async fetchBalance(params = {}) {
1698
- let type = undefined;
1699
- [type, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
1700
- let subType = undefined;
1701
- [subType, params] = this.handleSubTypeAndParams('fetchBalance', undefined, params);
1877
+ await this.loadMarketsAndSignIn();
1878
+ let marketType = undefined;
1879
+ [marketType, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
1702
1880
  let response = undefined;
1703
1881
  let data = undefined;
1704
- if (this.isLinear(type, subType)) {
1705
- response = await this.fapiPrivateGetV4Account(params);
1706
- data = this.safeList(response, 'assets', []);
1882
+ if (marketType === 'swap') {
1883
+ data = await this.fapiPrivateGetV3Balance(params);
1707
1884
  //
1708
- // [
1709
- // {
1710
- // "asset": "USDT", // asset name
1711
- // "walletBalance": "23.72469206", // wallet balance
1712
- // "unrealizedProfit": "0.00000000", // unrealized profit
1713
- // "marginBalance": "23.72469206", // margin balance
1714
- // "maintMargin": "0.00000000", // maintenance margin required
1715
- // "initialMargin": "0.00000000", // total initial margin required with current mark price
1716
- // "positionInitialMargin": "0.00000000", //initial margin required for positions with current mark price
1717
- // "openOrderInitialMargin": "0.00000000", // initial margin required for open orders with current mark price
1718
- // "crossWalletBalance": "23.72469206", // crossed wallet balance
1719
- // "crossUnPnl": "0.00000000", // unrealized profit of crossed positions
1720
- // "availableBalance": "23.72469206", // available balance
1721
- // "maxWithdrawAmount": "23.72469206", // maximum amount for transfer out
1722
- // "marginAvailable": true, // whether the asset can be used as margin in Multi-Assets mode
1723
- // "updateTime": 1625474304765 // last update time
1724
- // }
1725
- // ]
1885
+ // [
1886
+ // {
1887
+ // "accountAlias": "FzXquXsRFzXqAufW",
1888
+ // "asset": "CDL",
1889
+ // "balance": "0.00000000",
1890
+ // "crossWalletBalance": "0.00000000",
1891
+ // "crossUnPnl": "0.00000000",
1892
+ // "availableBalance": "878.90500233",
1893
+ // "maxWithdrawAmount": "0.00000000",
1894
+ // "marginAvailable": true,
1895
+ // "updateTime": "0"
1896
+ // }, ...
1726
1897
  //
1727
1898
  }
1728
- else if (type === 'spot') {
1729
- response = await this.sapiPrivateGetV1Account(params);
1899
+ else if (marketType === 'spot') {
1900
+ response = await this.sapiPrivateGetV3Account(params);
1730
1901
  data = this.safeList(response, 'balances', []);
1731
1902
  //
1732
1903
  // [
@@ -1738,16 +1909,27 @@ class aster extends aster$1["default"] {
1738
1909
  // ]
1739
1910
  //
1740
1911
  }
1741
- else {
1742
- throw new errors.NotSupported(this.id + ' fetchBalance() does not support ' + type + ' markets yet');
1743
- }
1744
1912
  return this.parseBalance(data);
1745
1913
  }
1914
+ parseBalance(response) {
1915
+ const result = { 'info': response };
1916
+ for (let i = 0; i < response.length; i++) {
1917
+ const balance = response[i];
1918
+ const currencyId = this.safeString(balance, 'asset');
1919
+ const code = this.safeCurrencyCode(currencyId);
1920
+ const account = this.account();
1921
+ account['free'] = this.safeString2(balance, 'free', 'availableBalance');
1922
+ account['used'] = this.safeString(balance, 'locked');
1923
+ account['total'] = this.safeString(balance, 'balance');
1924
+ result[code] = account;
1925
+ }
1926
+ return this.safeBalance(result);
1927
+ }
1746
1928
  /**
1747
1929
  * @method
1748
1930
  * @name aster#setMarginMode
1749
1931
  * @description set margin mode to 'cross' or 'isolated'
1750
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#change-margin-type-trade
1932
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#change-margin-type-trade
1751
1933
  * @param {string} marginMode 'cross' or 'isolated'
1752
1934
  * @param {string} symbol unified market symbol
1753
1935
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1764,20 +1946,15 @@ class aster extends aster$1["default"] {
1764
1946
  if ((marginMode !== 'ISOLATED') && (marginMode !== 'CROSSED')) {
1765
1947
  throw new errors.BadRequest(this.id + ' marginMode must be either isolated or cross');
1766
1948
  }
1767
- await this.loadMarkets();
1949
+ await this.loadMarketsAndSignIn();
1768
1950
  const market = this.market(symbol);
1769
1951
  const request = {
1770
1952
  'symbol': market['id'],
1771
1953
  'marginType': marginMode,
1772
1954
  };
1773
- const response = await this.fapiPrivatePostV1MarginType(this.extend(request, params));
1955
+ const response = await this.fapiPrivatePostV3MarginType(this.extend(request, params));
1774
1956
  //
1775
- // {
1776
- // "amount": 100.0,
1777
- // "code": 200,
1778
- // "msg": "Successfully modify position margin.",
1779
- // "type": 1
1780
- // }
1957
+ // { "code": 200,"msg": "success" }
1781
1958
  //
1782
1959
  return response;
1783
1960
  }
@@ -1785,37 +1962,37 @@ class aster extends aster$1["default"] {
1785
1962
  * @method
1786
1963
  * @name aster#fetchPositionMode
1787
1964
  * @description fetchs the position mode, hedged or one way, hedged for aster is set identically for all linear markets or all inverse markets
1788
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#get-current-position-modeuser_data
1965
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#get-current-position-modeuser_data
1789
1966
  * @param {string} symbol unified symbol of the market to fetch the order book for
1790
1967
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1791
1968
  * @returns {object} an object detailing whether the market is in hedged or one-way mode
1792
1969
  */
1793
1970
  async fetchPositionMode(symbol = undefined, params = {}) {
1794
- const response = await this.fapiPrivateGetV1PositionSideDual(params);
1971
+ const response = await this.fapiPrivateGetV3PositionSideDual(params);
1795
1972
  //
1796
1973
  // {
1797
1974
  // "dualSidePosition": true // "true": Hedge Mode; "false": One-way Mode
1798
1975
  // }
1799
1976
  //
1800
- const dualSidePosition = this.safeBool(response, 'dualSidePosition');
1801
1977
  return {
1802
1978
  'info': response,
1803
- 'hedged': (dualSidePosition === true),
1979
+ 'hedged': this.safeBool(response, 'dualSidePosition'),
1804
1980
  };
1805
1981
  }
1806
1982
  /**
1807
1983
  * @method
1808
1984
  * @name aster#setPositionMode
1809
1985
  * @description set hedged to true or false for a market
1810
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#change-position-modetrade
1986
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#change-position-modetrade
1811
1987
  * @param {bool} hedged set to true to use dualSidePosition
1812
1988
  * @param {string} symbol not used by bingx setPositionMode ()
1813
1989
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1814
1990
  * @returns {object} response from the exchange
1815
1991
  */
1816
1992
  async setPositionMode(hedged, symbol = undefined, params = {}) {
1993
+ const strValue = hedged ? 'true' : 'false';
1817
1994
  const request = {
1818
- 'dualSidePosition': hedged,
1995
+ 'dualSidePosition': strValue,
1819
1996
  };
1820
1997
  //
1821
1998
  // {
@@ -1823,7 +2000,7 @@ class aster extends aster$1["default"] {
1823
2000
  // "msg": "success"
1824
2001
  // }
1825
2002
  //
1826
- return await this.fapiPrivatePostV1PositionSideDual(this.extend(request, params));
2003
+ return await this.fapiPrivatePostV3PositionSideDual(this.extend(request, params));
1827
2004
  }
1828
2005
  parseTradingFee(fee, market = undefined) {
1829
2006
  const marketId = this.safeString(fee, 'symbol');
@@ -1842,26 +2019,28 @@ class aster extends aster$1["default"] {
1842
2019
  * @method
1843
2020
  * @name aster#fetchTradingFee
1844
2021
  * @description fetch the trading fees for a market
1845
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api.md#get-symbol-fees
1846
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#user-commission-rate-user_data
2022
+ * @see https://asterdex.github.io/aster-api-website/spot-v3/market-data/#get-symbol-fees
2023
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#user-commission-rate-user_data
1847
2024
  * @param {string} symbol unified market symbol
1848
2025
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1849
- * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
2026
+ * @returns {object} a [fee structure]{@link https://docs.ccxt.com/?id=fee-structure}
1850
2027
  */
1851
2028
  async fetchTradingFee(symbol, params = {}) {
1852
- await this.loadMarkets();
2029
+ await this.loadMarketsAndSignIn();
1853
2030
  const market = this.market(symbol);
1854
2031
  const request = {
1855
2032
  'symbol': market['id'],
1856
2033
  };
1857
2034
  let response = undefined;
1858
2035
  if (market['swap']) {
1859
- response = await this.fapiPrivateGetV1CommissionRate(this.extend(request, params));
2036
+ response = await this.fapiPrivateGetV3CommissionRate(this.extend(request, params));
1860
2037
  }
1861
2038
  else {
1862
- response = await this.sapiPrivateGetV1CommissionRate(this.extend(request, params));
2039
+ response = await this.sapiPrivateGetV3CommissionRate(this.extend(request, params));
1863
2040
  }
1864
2041
  //
2042
+ // both SPOT & SWAP has same format
2043
+ //
1865
2044
  // {
1866
2045
  // "symbol": "BTCUSDT",
1867
2046
  // "makerCommissionRate": "0.0002",
@@ -1921,32 +2100,36 @@ class aster extends aster$1["default"] {
1921
2100
  // "workingType": "CONTRACT_PRICE",
1922
2101
  // "priceProtect": false
1923
2102
  // }
2103
+ //
1924
2104
  // spot
1925
- // {
1926
- // "orderId": 38,
1927
- // "symbol": "ADA25SLP25",
1928
- // "status": "FILLED",
1929
- // "clientOrderId": "afMd4GBQyHkHpGWdiy34Li",
1930
- // "price": "20",
1931
- // "avgPrice": "12.0000000000000000",
1932
- // "origQty": "10",
1933
- // "executedQty": "10",
1934
- // "cumQuote": "120",
1935
- // "timeInForce": "GTC",
1936
- // "type": "LIMIT",
1937
- // "side": "BUY",
1938
- // "stopPrice": "0",
1939
- // "origType": "LIMIT",
1940
- // "time": 1649913186270,
1941
- // "updateTime": 1649913186297
1942
- // }
2105
+ //
2106
+ // fetchOrders, fetchOpenOrders, fetchOpenOrder, fetchOrder, cancelOrder, createOrder
2107
+ //
2108
+ // {
2109
+ // "orderId": "417594542",
2110
+ // "symbol": "ETHUSDT",
2111
+ // "status": "FILLED",
2112
+ // "clientOrderId": "web_qnvMAhOJsiVbSyu0BdKG",
2113
+ // "price": "0", // value set for unfilled
2114
+ // "avgPrice": "2351.580000", // value zero for unfilled
2115
+ // "origQty": "0.0054",
2116
+ // "executedQty": "0.0054", // value zero for unfilled
2117
+ // "cumQuote": "12.69853200", // value zero for unfilled
2118
+ // "timeInForce": "GTC",
2119
+ // "type": "MARKET",
2120
+ // "side": "SELL",
2121
+ // "stopPrice": "0",
2122
+ // "origType": "MARKET",
2123
+ // "time": "1776274219582",
2124
+ // "updateTime": "1776274219609",
2125
+ // "orderListId": "-1"
2126
+ // }
1943
2127
  //
1944
2128
  const info = order;
1945
2129
  const marketId = this.safeString(order, 'symbol');
1946
2130
  market = this.safeMarket(marketId, market);
1947
2131
  const side = this.safeStringLower(order, 'side');
1948
2132
  const timestamp = this.safeInteger(order, 'time');
1949
- const lastTradeTimestamp = this.safeInteger(order, 'updateTime');
1950
2133
  const statusId = this.safeStringUpper(order, 'status');
1951
2134
  const rawType = this.safeStringUpper(order, 'type');
1952
2135
  const stopPriceString = this.safeString(order, 'stopPrice');
@@ -1958,7 +2141,7 @@ class aster extends aster$1["default"] {
1958
2141
  'symbol': this.safeSymbol(marketId, market),
1959
2142
  'timestamp': timestamp,
1960
2143
  'datetime': this.iso8601(timestamp),
1961
- 'lastTradeTimestamp': lastTradeTimestamp,
2144
+ 'lastTradeTimestamp': undefined,
1962
2145
  'lastUpdateTimestamp': this.safeInteger(order, 'updateTime'),
1963
2146
  'type': this.parseOrderType(rawType),
1964
2147
  'timeInForce': this.safeString(order, 'timeInForce'),
@@ -1981,19 +2164,19 @@ class aster extends aster$1["default"] {
1981
2164
  * @method
1982
2165
  * @name aster#fetchOrder
1983
2166
  * @description fetches information on an order made by the user
1984
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api.md#query-order-user_data
1985
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#query-order-user_data
2167
+ * @see https://asterdex.github.io/aster-api-website/spot-v3/account%26trades/#query-order-user_data
2168
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#query-order-user_data
1986
2169
  * @param {string} id the order id
1987
2170
  * @param {string} symbol unified symbol of the market the order was made in
1988
2171
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1989
2172
  * @param {string} [params.clientOrderId] a unique id for the order
1990
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2173
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
1991
2174
  */
1992
2175
  async fetchOrder(id, symbol = undefined, params = {}) {
1993
2176
  if (symbol === undefined) {
1994
2177
  throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
1995
2178
  }
1996
- await this.loadMarkets();
2179
+ await this.loadMarketsAndSignIn();
1997
2180
  const market = this.market(symbol);
1998
2181
  const request = {
1999
2182
  'symbol': market['id'],
@@ -2008,28 +2191,58 @@ class aster extends aster$1["default"] {
2008
2191
  }
2009
2192
  let response = undefined;
2010
2193
  if (market['swap']) {
2011
- response = await this.fapiPrivateGetV1Order(this.extend(request, params));
2194
+ response = await this.fapiPrivateGetV3Order(this.extend(request, params));
2012
2195
  }
2013
2196
  else {
2014
- response = await this.sapiPrivateGetV1Order(this.extend(request, params));
2197
+ response = await this.sapiPrivateGetV3Order(this.extend(request, params));
2015
2198
  }
2199
+ //
2200
+ // SPOT & SWAP has similar formats
2201
+ //
2202
+ // {
2203
+ // "orderId": "17338441758",
2204
+ // "symbol": "ETHUSDT",
2205
+ // "status": "FILLED",
2206
+ // "clientOrderId": "727Wt3TIUgkUCxXp20E543",
2207
+ // "price": "0",
2208
+ // "avgPrice": "2304.56000",
2209
+ // "origQty": "0.010",
2210
+ // "executedQty": "0.010",
2211
+ // "cumQuote": "23.04560",
2212
+ // "timeInForce": "GTC",
2213
+ // "type": "MARKET",
2214
+ // "side": "BUY",
2215
+ // "stopPrice": "0",
2216
+ // "origType": "MARKET",
2217
+ // "time": "1776800300736",
2218
+ // "updateTime": "1776800300700",
2219
+ // "orderListId": "-1" // only in SPOT
2220
+ // "positionSide": "BOTH", // only in SWAP
2221
+ // "reduceOnly": false, // only in SWAP
2222
+ // "closePosition": false, // only in SWAP
2223
+ // "workingType": "CONTRACT_PRICE", // only in SWAP
2224
+ // "priceProtect": false, // only in SWAP
2225
+ // "newChainData": { "hash": "0x46aed5...67bdbec8ba" } // only in SWAP
2226
+ // }
2227
+ //
2016
2228
  return this.parseOrder(response, market);
2017
2229
  }
2018
2230
  /**
2019
2231
  * @method
2020
2232
  * @name aster#fetchOpenOrder
2021
2233
  * @description fetch an open order by the id
2022
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#query-current-open-order-user_data
2234
+ * @see https://asterdex.github.io/aster-api-website/spot-v3/account%26trades/#query-current-open-order-user_data
2235
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#query-current-open-order-user_data
2023
2236
  * @param {string} id order id
2024
2237
  * @param {string} symbol unified market symbol
2025
2238
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2026
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2239
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
2027
2240
  */
2028
2241
  async fetchOpenOrder(id, symbol = undefined, params = {}) {
2029
2242
  if (symbol === undefined) {
2030
2243
  throw new errors.ArgumentsRequired(this.id + ' fetchOpenOrder() requires a symbol argument');
2031
2244
  }
2032
- await this.loadMarkets();
2245
+ await this.loadMarketsAndSignIn();
2033
2246
  const market = this.market(symbol);
2034
2247
  const request = {
2035
2248
  'symbol': market['id'],
@@ -2042,114 +2255,184 @@ class aster extends aster$1["default"] {
2042
2255
  else {
2043
2256
  request['orderId'] = id;
2044
2257
  }
2045
- const response = await this.fapiPrivateGetV1OpenOrder(this.extend(request, params));
2258
+ let response = undefined;
2259
+ if (market['spot']) {
2260
+ response = await this.sapiPrivateGetV3OpenOrder(this.extend(request, params));
2261
+ }
2262
+ else {
2263
+ response = await this.fapiPrivateGetV3OpenOrder(this.extend(request, params));
2264
+ }
2265
+ //
2266
+ // SPOT & SWAP has similar formats
2267
+ //
2268
+ // {
2269
+ // "orderId": "17338441758",
2270
+ // "symbol": "ETHUSDT",
2271
+ // "status": "FILLED",
2272
+ // "clientOrderId": "727Wt3TIUgkUCxXp20E543",
2273
+ // "price": "0",
2274
+ // "avgPrice": "2304.56000",
2275
+ // "origQty": "0.010",
2276
+ // "executedQty": "0.010",
2277
+ // "cumQuote": "23.04560",
2278
+ // "timeInForce": "GTC",
2279
+ // "type": "MARKET",
2280
+ // "side": "BUY",
2281
+ // "stopPrice": "0",
2282
+ // "origType": "MARKET",
2283
+ // "time": "1776800300736",
2284
+ // "updateTime": "1776800300700",
2285
+ // "orderListId": "-1" // only in SPOT
2286
+ // "positionSide": "BOTH", // only in SWAP
2287
+ // "reduceOnly": false, // only in SWAP
2288
+ // "closePosition": false, // only in SWAP
2289
+ // "workingType": "CONTRACT_PRICE", // only in SWAP
2290
+ // "priceProtect": false, // only in SWAP
2291
+ // "newChainData": { "hash": "0x46aed5...67bdbec8ba" } // only in SWAP
2292
+ // }
2293
+ //
2046
2294
  return this.parseOrder(response, market);
2047
2295
  }
2048
2296
  /**
2049
2297
  * @method
2050
2298
  * @name aster#fetchOrders
2051
2299
  * @description fetches information on multiple orders made by the user
2052
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api.md#query-all-orders-user_data
2053
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#all-orders-user_data
2300
+ * @see https://asterdex.github.io/aster-api-website/spot-v3/account%26trades/#query-all-orders-user_data
2301
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#all-orders-user_data
2054
2302
  * @param {string} symbol unified market symbol of the market orders were made in
2055
2303
  * @param {int} [since] the earliest time in ms to fetch orders for
2056
2304
  * @param {int} [limit] the maximum number of order structures to retrieve
2057
2305
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2058
2306
  * @param {int} [params.until] the latest time in ms to fetch orders for
2059
- * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
2307
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/?id=order-structure}
2060
2308
  */
2061
2309
  async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
2062
- await this.loadMarkets();
2063
2310
  if (symbol === undefined) {
2064
2311
  throw new errors.ArgumentsRequired(this.id + ' fetchOrders() requires a symbol argument');
2065
2312
  }
2313
+ await this.loadMarketsAndSignIn();
2066
2314
  const market = this.market(symbol);
2067
2315
  let request = {
2068
2316
  'symbol': market['id'],
2069
2317
  };
2318
+ if (limit !== undefined) {
2319
+ request['limit'] = Math.min(limit, 1000);
2320
+ }
2070
2321
  if (since !== undefined) {
2071
2322
  request['startTime'] = since;
2072
2323
  }
2073
- if (limit !== undefined) {
2074
- if (limit > 1000) {
2075
- limit = 1000; // Default 500; max 1000
2076
- }
2077
- request['limit'] = limit;
2078
- }
2079
2324
  [request, params] = this.handleUntilOption('endTime', request, params);
2080
2325
  let response = undefined;
2081
2326
  if (market['swap']) {
2082
- response = await this.fapiPrivateGetV1AllOrders(this.extend(request, params));
2327
+ response = await this.fapiPrivateGetV3AllOrders(this.extend(request, params));
2083
2328
  }
2084
2329
  else {
2085
- response = await this.sapiPrivateGetV1AllOrders(this.extend(request, params));
2330
+ response = await this.sapiPrivateGetV3AllOrders(this.extend(request, params));
2086
2331
  }
2332
+ //
2333
+ // SPOT & SWAP has similar responses
2334
+ //
2335
+ // [
2336
+ // {
2337
+ // "orderId": "417594542",
2338
+ // "symbol": "ETHUSDT",
2339
+ // "status": "FILLED",
2340
+ // "clientOrderId": "web_qnvMAhOJsiVbSyu0BdKG",
2341
+ // "price": "0", // value set for unfilled
2342
+ // "avgPrice": "2351.580000", // value zero for unfilled
2343
+ // "origQty": "0.0054",
2344
+ // "executedQty": "0.0054", // value zero for unfilled
2345
+ // "cumQuote": "12.69853200", // value zero for unfilled
2346
+ // "timeInForce": "GTC",
2347
+ // "type": "MARKET",
2348
+ // "side": "SELL",
2349
+ // "stopPrice": "0",
2350
+ // "origType": "MARKET",
2351
+ // "time": "1776274219582",
2352
+ // "updateTime": "1776274219609",
2353
+ // "orderListId": "-1", // only in SPOT
2354
+ // "reduceOnly": false, // only in PERP
2355
+ // "closePosition": false, // only in PERP
2356
+ // "positionSide": "BOTH", // only in PERP
2357
+ // "workingType": "CONTRACT_PRICE", // only in PERP
2358
+ // "priceProtect": false, // only in PERP
2359
+ // "newChainData": { "hash": "0xe17d3d5b...dbca8b01" } // only in PERP
2360
+ // }, ...
2361
+ //
2087
2362
  return this.parseOrders(response, market, since, limit);
2088
2363
  }
2089
2364
  /**
2090
2365
  * @method
2091
2366
  * @name aster#fetchOpenOrders
2092
2367
  * @description fetch all unfilled currently open orders
2093
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api.md#current-open-orders-user_data
2094
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#current-all-open-orders-user_data
2368
+ * @see https://asterdex.github.io/aster-api-website/spot-v3/account%26trades/#current-open-orders-user_data
2369
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#current-all-open-orders-user_data
2095
2370
  * @param {string} symbol unified market symbol
2096
2371
  * @param {int} [since] the earliest time in ms to fetch open orders for
2097
2372
  * @param {int} [limit] the maximum number of open orders structures to retrieve
2098
2373
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2099
2374
  * @param {string} [params.subType] "linear" or "inverse"
2100
2375
  * @param {string} [params.type] 'spot', 'option', use params["subType"] for swap and future markets
2101
- * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
2376
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/?id=order-structure}
2102
2377
  */
2103
2378
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
2104
- await this.loadMarkets();
2379
+ await this.loadMarketsAndSignIn();
2105
2380
  const request = {};
2106
2381
  let market = undefined;
2107
- let type = undefined;
2108
- let subType = undefined;
2109
- [subType, params] = this.handleSubTypeAndParams('fetchOpenOrders', market, params);
2382
+ let marketType = undefined;
2110
2383
  if (symbol !== undefined) {
2111
2384
  market = this.market(symbol);
2112
2385
  request['symbol'] = market['id'];
2113
2386
  }
2114
- [type, params] = this.handleMarketTypeAndParams('fetchOpenOrders', market, params);
2115
- let response = undefined;
2116
- if (this.isLinear(type, subType)) {
2117
- response = await this.fapiPrivateGetV1OpenOrders(this.extend(request, params));
2118
- }
2119
- else if (type === 'spot') {
2120
- response = await this.sapiPrivateGetV1OpenOrders(this.extend(request, params));
2387
+ if (symbol === undefined) {
2388
+ if (this.options['fetchOpenOrders']['warnIfNoSymbol']) {
2389
+ throw new errors.ExchangeError(this.id + ' fetchOpenOrders(): WARNING - this method without providing "symbol" argument uses 40 times more rate-limit quota. If you acknowledge this warning, set ' + this.id + '.options["fetchOpenOrders"]["warnIfNoSymbol"] = false to suppress this warning message.');
2390
+ }
2121
2391
  }
2122
2392
  else {
2123
- throw new errors.NotSupported(this.id + ' fetchOpenOrders() does not support ' + type + ' markets yet');
2393
+ market = this.market(symbol);
2394
+ request['symbol'] = market['id'];
2395
+ }
2396
+ [marketType, params] = this.handleMarketTypeAndParams('fetchOpenOrders', market, params);
2397
+ let subType = undefined;
2398
+ [subType, params] = this.handleSubTypeAndParams('fetchOpenOrders', market, params);
2399
+ let response = undefined;
2400
+ if (this.isLinear(marketType, subType)) {
2401
+ response = await this.fapiPrivateGetV3OpenOrders(this.extend(request, params));
2402
+ }
2403
+ else if (marketType === 'spot') {
2404
+ response = await this.sapiPrivateGetV3OpenOrders(this.extend(request, params));
2124
2405
  }
2125
2406
  //
2126
- // [
2127
- // {
2128
- // "avgPrice": "0.00000",
2129
- // "clientOrderId": "abc",
2130
- // "cumQuote": "0",
2131
- // "executedQty": "0",
2132
- // "orderId": 1917641,
2133
- // "origQty": "0.40",
2134
- // "origType": "TRAILING_STOP_MARKET",
2135
- // "price": "0",
2136
- // "reduceOnly": false,
2137
- // "side": "BUY",
2138
- // "positionSide": "SHORT",
2139
- // "status": "NEW",
2140
- // "stopPrice": "9300",
2141
- // "closePosition": false,
2142
- // "symbol": "BTCUSDT",
2143
- // "time": 1579276756075,
2144
- // "timeInForce": "GTC",
2145
- // "type": "TRAILING_STOP_MARKET",
2146
- // "activatePrice": "9020",
2147
- // "priceRate": "0.3",
2148
- // "updateTime": 1579276756075,
2149
- // "workingType": "CONTRACT_PRICE",
2150
- // "priceProtect": false
2151
- // }
2152
- // ]
2407
+ // SPOT & SWAP has similar responses
2408
+ //
2409
+ // [
2410
+ // {
2411
+ // "orderId": "17338239315",
2412
+ // "symbol": "ETHUSDT",
2413
+ // "status": "NEW",
2414
+ // "clientOrderId": "web_AD_mbhgla7k15gptmwyr_x",
2415
+ // "price": "2216.62",
2416
+ // "avgPrice": "0",
2417
+ // "origQty": "0.012",
2418
+ // "executedQty": "0",
2419
+ // "cumQuote": "0",
2420
+ // "timeInForce": "GTC",
2421
+ // "type": "LIMIT",
2422
+ // "side": "BUY",
2423
+ // "stopPrice": "0",
2424
+ // "origType": "LIMIT",
2425
+ // "time": "1776798208476",
2426
+ // "updateTime": "1776798208450",
2427
+ // "orderListId": "-1" // only in SPOT
2428
+ // "reduceOnly": false, // only in PERP
2429
+ // "closePosition": false, // only in PERP
2430
+ // "positionSide": "BOTH", // only in PERP
2431
+ // "workingType": "CONTRACT_PRICE", // only in PERP
2432
+ // "priceProtect": false, // only in PERP
2433
+ // "newChainData": { "hash": "0xf8a496....a7fd5" } // only in PERP
2434
+ // }
2435
+ // ]
2153
2436
  //
2154
2437
  return this.parseOrders(response, market, since, limit);
2155
2438
  }
@@ -2157,8 +2440,8 @@ class aster extends aster$1["default"] {
2157
2440
  * @method
2158
2441
  * @name aster#createOrder
2159
2442
  * @description create a trade order
2160
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api.md#place-order-trade
2161
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#new-order--trade
2443
+ * @see https://asterdex.github.io/aster-api-website/spot-v3/account%26trades/#place-order-trade
2444
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#new-order-trade
2162
2445
  * @param {string} symbol unified symbol of the market to create an order in
2163
2446
  * @param {string} type 'market' or 'limit' or 'STOP' or 'STOP_MARKET' or 'TAKE_PROFIT' or 'TAKE_PROFIT_MARKET' or 'TRAILING_STOP_MARKET'
2164
2447
  * @param {string} side 'buy' or 'sell'
@@ -2173,39 +2456,62 @@ class aster extends aster$1["default"] {
2173
2456
  * @param {float} [params.triggerPrice] the price that a trigger order is triggered at
2174
2457
  * @param {float} [params.stopLossPrice] the price that a stop loss order is triggered at
2175
2458
  * @param {float} [params.takeProfitPrice] the price that a take profit order is triggered at
2176
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2459
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
2177
2460
  */
2178
2461
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
2179
- await this.loadMarkets();
2462
+ await this.loadMarketsAndSignIn();
2180
2463
  const market = this.market(symbol);
2181
- const test = this.safeBool(params, 'test', false);
2182
- params = this.omit(params, 'test');
2183
2464
  const request = this.createOrderRequest(symbol, type, side, amount, price, params);
2184
2465
  let response = undefined;
2185
2466
  if (market['swap']) {
2186
- if (test) {
2187
- response = await this.fapiPrivatePostV1OrderTest(request);
2188
- }
2189
- else {
2190
- response = await this.fapiPrivatePostV1Order(request);
2191
- }
2467
+ response = await this.fapiPrivatePostV3Order(request);
2192
2468
  }
2193
2469
  else {
2194
- response = await this.sapiPrivatePostV1Order(request);
2470
+ response = await this.sapiPrivatePostV3Order(request);
2195
2471
  }
2472
+ //
2473
+ // SPOT & SWAP has similar responses
2474
+ //
2475
+ // {
2476
+ // "orderId": "17338441758",
2477
+ // "symbol": "ETHUSDT",
2478
+ // "status": "NEW",
2479
+ // "clientOrderId": "727Wt3TIUgkUCxXp20E543",
2480
+ // "price": "0",
2481
+ // "avgPrice": "0.00000",
2482
+ // "origQty": "0.010",
2483
+ // "executedQty": "0",
2484
+ // "cumQty": "0",
2485
+ // "cumQuote": "0",
2486
+ // "timeInForce": "GTC",
2487
+ // "type": "MARKET",
2488
+ // "side": "BUY",
2489
+ // "stopPrice": "0",
2490
+ // "origType": "MARKET",
2491
+ // "time": "1776800300700",
2492
+ // "updateTime": "1776800300700",
2493
+ // "orderListId": "-1", // only in SPOT
2494
+ // "workingType": "CONTRACT_PRICE", // only in PERP
2495
+ // "positionSide": "BOTH", // only in PERP
2496
+ // "reduceOnly": false, // only in PERP
2497
+ // "closePosition": false, // only in PERP
2498
+ // "priceProtect": false, // only in PERP
2499
+ // "newChainData": { "hash": "0x46ae....c8ba" } // only in PERP
2500
+ // }
2501
+ //
2196
2502
  return this.parseOrder(response, market);
2197
2503
  }
2198
2504
  /**
2199
2505
  * @method
2200
2506
  * @name aster#createOrders
2201
2507
  * @description create a list of trade orders
2202
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#place-multiple-orders--trade
2508
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#new-order-trade
2203
2509
  * @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
2204
2510
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2205
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2511
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
2206
2512
  */
2207
2513
  async createOrders(orders, params = {}) {
2208
- await this.loadMarkets();
2514
+ await this.loadMarketsAndSignIn();
2209
2515
  const ordersRequests = [];
2210
2516
  let orderSymbols = [];
2211
2517
  if (orders.length > 5) {
@@ -2214,6 +2520,8 @@ class aster extends aster$1["default"] {
2214
2520
  for (let i = 0; i < orders.length; i++) {
2215
2521
  const rawOrder = orders[i];
2216
2522
  const marketId = this.safeString(rawOrder, 'symbol');
2523
+ const currentMarket = this.market(marketId);
2524
+ orderSymbols.push(currentMarket['symbol']);
2217
2525
  const type = this.safeString(rawOrder, 'type');
2218
2526
  const side = this.safeString(rawOrder, 'side');
2219
2527
  const amount = this.safeValue(rawOrder, 'amount');
@@ -2230,7 +2538,37 @@ class aster extends aster$1["default"] {
2230
2538
  const request = {
2231
2539
  'batchOrders': ordersRequests,
2232
2540
  };
2233
- const response = await this.fapiPrivatePostV1BatchOrders(this.extend(request, params));
2541
+ const response = await this.fapiPrivatePostV3BatchOrders(this.extend(request, params));
2542
+ //
2543
+ // [
2544
+ // {
2545
+ // "orderId": 17338699853,
2546
+ // "symbol": "ETHUSDT",
2547
+ // "status": "NEW",
2548
+ // "clientOrderId": "NxMWPvOEyiF6TWh5UB8BQf0",
2549
+ // "price": "0",
2550
+ // "avgPrice": "0.00000",
2551
+ // "origQty": "0.010",
2552
+ // "executedQty": "0",
2553
+ // "cumQty": "0",
2554
+ // "cumQuote": "0",
2555
+ // "timeInForce": "GTC",
2556
+ // "type": "MARKET",
2557
+ // "reduceOnly": false,
2558
+ // "closePosition": false,
2559
+ // "side": "BUY",
2560
+ // "positionSide": "BOTH",
2561
+ // "stopPrice": "0",
2562
+ // "workingType": "CONTRACT_PRICE",
2563
+ // "priceProtect": false,
2564
+ // "origType": "MARKET",
2565
+ // "updateTime": 1776802276050,
2566
+ // "newChainData": {
2567
+ // "hash": "0x5e569d9794cf726f72c2d000d401d20315e78e4df7b58023a489864624527dfe"
2568
+ // }
2569
+ // }
2570
+ // ]
2571
+ //
2234
2572
  return this.parseOrders(response);
2235
2573
  }
2236
2574
  createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
@@ -2405,35 +2743,41 @@ class aster extends aster$1["default"] {
2405
2743
  request['timeInForce'] = this.safeString(this.options, 'defaultTimeInForce'); // 'GTC' = Good To Cancel (default), 'IOC' = Immediate Or Cancel
2406
2744
  }
2407
2745
  const requestParams = this.omit(params, ['newClientOrderId', 'clientOrderId', 'stopPrice', 'triggerPrice', 'trailingTriggerPrice', 'trailingPercent', 'trailingDelta', 'stopPrice', 'stopLossPrice', 'takeProfitPrice']);
2746
+ if (this.safeBool(this.options, 'builderFee') && market['swap']) {
2747
+ request['builder'] = this.safeString(this.options, 'builder');
2748
+ request['feeRate'] = this.safeString(this.options, 'builderRate');
2749
+ }
2408
2750
  return this.extend(request, requestParams);
2409
2751
  }
2410
2752
  /**
2411
2753
  * @method
2412
2754
  * @name aster#cancelAllOrders
2413
2755
  * @description cancel all open orders in a market
2414
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api.md#cancel-all-open-orders-trade
2415
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#cancel-all-open-orders-trade
2756
+ * @see https://asterdex.github.io/aster-api-website/spot-v3/account%26trades/#cancel-all-open-orders-trade
2757
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#current-all-open-orders-user_data
2416
2758
  * @param {string} symbol unified market symbol of the market to cancel orders in
2417
2759
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2418
- * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
2760
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/?id=order-structure}
2419
2761
  */
2420
2762
  async cancelAllOrders(symbol = undefined, params = {}) {
2421
2763
  if (symbol === undefined) {
2422
2764
  throw new errors.ArgumentsRequired(this.id + ' cancelAllOrders() requires a symbol argument');
2423
2765
  }
2424
- await this.loadMarkets();
2766
+ await this.loadMarketsAndSignIn();
2425
2767
  const market = this.market(symbol);
2426
2768
  const request = {
2427
2769
  'symbol': market['id'],
2428
2770
  };
2429
2771
  let response = undefined;
2430
2772
  if (market['swap']) {
2431
- response = await this.fapiPrivateDeleteV1AllOpenOrders(this.extend(request, params));
2773
+ response = await this.fapiPrivateDeleteV3AllOpenOrders(this.extend(request, params));
2432
2774
  }
2433
2775
  else {
2434
- response = await this.sapiPrivateDeleteV1AllOpenOrders(this.extend(request, params));
2776
+ response = await this.sapiPrivateDeleteV3AllOpenOrders(this.extend(request, params));
2435
2777
  }
2436
2778
  //
2779
+ // SPOT & SWAP has same response
2780
+ //
2437
2781
  // {
2438
2782
  // "code": "200",
2439
2783
  // "msg": "The operation of cancel all open order is done."
@@ -2449,36 +2793,36 @@ class aster extends aster$1["default"] {
2449
2793
  * @method
2450
2794
  * @name aster#cancelOrder
2451
2795
  * @description cancels an open order
2452
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api.md#cancel-order-trade
2453
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#cancel-order-trade
2796
+ * @see https://asterdex.github.io/aster-api-website/spot-v3/account%26trades/#cancel-order-trade
2797
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#cancel-order-trade
2454
2798
  * @param {string} id order id
2455
2799
  * @param {string} symbol unified symbol of the market the order was made in
2456
2800
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2457
- * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2801
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/?id=order-structure}
2458
2802
  */
2459
2803
  async cancelOrder(id, symbol = undefined, params = {}) {
2460
2804
  if (symbol === undefined) {
2461
2805
  throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
2462
2806
  }
2463
- await this.loadMarkets();
2807
+ await this.loadMarketsAndSignIn();
2464
2808
  const market = this.market(symbol);
2465
2809
  const request = {
2466
2810
  'symbol': market['id'],
2467
2811
  };
2468
- const clientOrderId = this.safeStringN(params, ['origClientOrderId', 'clientOrderId', 'newClientStrategyId']);
2812
+ const clientOrderId = this.safeStringN(params, ['origClientOrderId', 'clientOrderId']);
2469
2813
  if (clientOrderId !== undefined) {
2470
2814
  request['origClientOrderId'] = clientOrderId;
2471
2815
  }
2472
2816
  else {
2473
2817
  request['orderId'] = id;
2474
2818
  }
2475
- params = this.omit(params, ['origClientOrderId', 'clientOrderId', 'newClientStrategyId']);
2819
+ params = this.omit(params, ['origClientOrderId', 'clientOrderId']);
2476
2820
  let response = undefined;
2477
2821
  if (market['swap']) {
2478
- response = await this.fapiPrivateDeleteV1Order(this.extend(request, params));
2822
+ response = await this.fapiPrivateDeleteV3Order(this.extend(request, params));
2479
2823
  }
2480
2824
  else {
2481
- response = await this.sapiPrivateDeleteV1Order(this.extend(request, params));
2825
+ response = await this.sapiPrivateDeleteV3Order(this.extend(request, params));
2482
2826
  }
2483
2827
  return this.parseOrder(response, market);
2484
2828
  }
@@ -2486,7 +2830,8 @@ class aster extends aster$1["default"] {
2486
2830
  * @method
2487
2831
  * @name aster#cancelOrders
2488
2832
  * @description cancel multiple orders
2489
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#cancel-multiple-orders-trade
2833
+ * @see https://asterdex.github.io/aster-api-website/spot-v3/account%26trades/#cancel-all-open-orders-trade
2834
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#cancel-multiple-orders-trade
2490
2835
  * @param {string[]} ids order ids
2491
2836
  * @param {string} [symbol] unified market symbol
2492
2837
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -2494,17 +2839,14 @@ class aster extends aster$1["default"] {
2494
2839
  * EXCHANGE SPECIFIC PARAMETERS
2495
2840
  * @param {string[]} [params.origClientOrderIdList] max length 10 e.g. ["my_id_1","my_id_2"], encode the double quotes. No space after comma
2496
2841
  * @param {int[]} [params.recvWindow]
2497
- * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
2842
+ * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/?id=order-structure}
2498
2843
  */
2499
2844
  async cancelOrders(ids, symbol = undefined, params = {}) {
2500
2845
  if (symbol === undefined) {
2501
2846
  throw new errors.ArgumentsRequired(this.id + ' cancelOrders() requires a symbol argument');
2502
2847
  }
2503
- await this.loadMarkets();
2848
+ await this.loadMarketsAndSignIn();
2504
2849
  const market = this.market(symbol);
2505
- if (market['spot']) {
2506
- throw new errors.NotSupported(this.id + ' cancelOrders() does not support ' + market['type'] + ' orders');
2507
- }
2508
2850
  const request = {
2509
2851
  'symbol': market['id'],
2510
2852
  };
@@ -2515,46 +2857,55 @@ class aster extends aster$1["default"] {
2515
2857
  else {
2516
2858
  request['orderIdList'] = ids;
2517
2859
  }
2518
- const response = await this.fapiPrivateDeleteV1BatchOrders(this.extend(request, params));
2519
- //
2520
- // [
2521
- // {
2522
- // "clientOrderId": "myOrder1",
2523
- // "cumQty": "0",
2524
- // "cumQuote": "0",
2525
- // "executedQty": "0",
2526
- // "orderId": 283194212,
2527
- // "origQty": "11",
2528
- // "origType": "TRAILING_STOP_MARKET",
2529
- // "price": "0",
2530
- // "reduceOnly": false,
2531
- // "side": "BUY",
2532
- // "positionSide": "SHORT",
2533
- // "status": "CANCELED",
2534
- // "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET
2535
- // "closePosition": false, // if Close-All
2536
- // "symbol": "BTCUSDT",
2537
- // "timeInForce": "GTC",
2538
- // "type": "TRAILING_STOP_MARKET",
2539
- // "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order
2540
- // "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order
2541
- // "updateTime": 1571110484038,
2542
- // "workingType": "CONTRACT_PRICE",
2543
- // "priceProtect": false, // if conditional order trigger is protected
2544
- // },
2545
- // {
2546
- // "code": -2011,
2547
- // "msg": "Unknown order sent."
2548
- // }
2549
- // ]
2550
- //
2860
+ let response = undefined;
2861
+ if (market['swap']) {
2862
+ response = await this.fapiPrivateDeleteV3BatchOrders(this.extend(request, params));
2863
+ //
2864
+ // [
2865
+ // {
2866
+ // "clientOrderId": "myOrder1",
2867
+ // "cumQty": "0",
2868
+ // "cumQuote": "0",
2869
+ // "executedQty": "0",
2870
+ // "orderId": 283194212,
2871
+ // "origQty": "11",
2872
+ // "origType": "TRAILING_STOP_MARKET",
2873
+ // "price": "0",
2874
+ // "reduceOnly": false,
2875
+ // "side": "BUY",
2876
+ // "positionSide": "SHORT",
2877
+ // "status": "CANCELED",
2878
+ // "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET
2879
+ // "closePosition": false, // if Close-All
2880
+ // "symbol": "BTCUSDT",
2881
+ // "timeInForce": "GTC",
2882
+ // "type": "TRAILING_STOP_MARKET",
2883
+ // "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order
2884
+ // "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order
2885
+ // "updateTime": 1571110484038,
2886
+ // "workingType": "CONTRACT_PRICE",
2887
+ // "priceProtect": false, // if conditional order trigger is protected
2888
+ // },
2889
+ // {
2890
+ // "code": -2011,
2891
+ // "msg": "Unknown order sent."
2892
+ // }
2893
+ // ]
2894
+ //
2895
+ }
2896
+ else {
2897
+ response = await this.sapiPrivateDeleteV3AllOpenOrders(this.extend(request, params));
2898
+ //
2899
+ // {"code": 200,"msg": "The operation of cancel all open order is done."}
2900
+ //
2901
+ }
2551
2902
  return this.parseOrders(response, market);
2552
2903
  }
2553
2904
  /**
2554
2905
  * @method
2555
2906
  * @name aster#setLeverage
2556
2907
  * @description set the level of leverage for a market
2557
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#change-initial-leverage-trade
2908
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#change-initial-leverage-trade
2558
2909
  * @param {float} leverage the rate of leverage
2559
2910
  * @param {string} symbol unified market symbol
2560
2911
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -2567,13 +2918,13 @@ class aster extends aster$1["default"] {
2567
2918
  if ((leverage < 1) || (leverage > 125)) {
2568
2919
  throw new errors.BadRequest(this.id + ' leverage should be between 1 and 125');
2569
2920
  }
2570
- await this.loadMarkets();
2921
+ await this.loadMarketsAndSignIn();
2571
2922
  const market = this.market(symbol);
2572
2923
  const request = {
2573
2924
  'symbol': market['id'],
2574
2925
  'leverage': leverage,
2575
2926
  };
2576
- const response = await this.fapiPrivatePostV1Leverage(this.extend(request, params));
2927
+ const response = await this.fapiPrivatePostV3Leverage(this.extend(request, params));
2577
2928
  //
2578
2929
  // {
2579
2930
  // "leverage": 21,
@@ -2587,14 +2938,14 @@ class aster extends aster$1["default"] {
2587
2938
  * @method
2588
2939
  * @name aster#fetchLeverages
2589
2940
  * @description fetch the set leverage for all markets
2590
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#position-information-v2-user_data
2941
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#position-information-v3-user_data
2591
2942
  * @param {string[]} [symbols] a list of unified market symbols
2592
2943
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2593
- * @returns {object} a list of [leverage structures]{@link https://docs.ccxt.com/#/?id=leverage-structure}
2944
+ * @returns {object} a list of [leverage structures]{@link https://docs.ccxt.com/?id=leverage-structure}
2594
2945
  */
2595
2946
  async fetchLeverages(symbols = undefined, params = {}) {
2596
- await this.loadMarkets();
2597
- const response = await this.fapiPrivateGetV2PositionRisk(params);
2947
+ await this.loadMarketsAndSignIn();
2948
+ const response = await this.fapiPrivateGetV3PositionRisk(params);
2598
2949
  //
2599
2950
  // [
2600
2951
  // {
@@ -2666,14 +3017,14 @@ class aster extends aster$1["default"] {
2666
3017
  * @method
2667
3018
  * @name aster#fetchMarginModes
2668
3019
  * @description fetches margin mode of the user
2669
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#position-information-v2-user_data
3020
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#position-information-v3-user_data
2670
3021
  * @param {string[]} symbols unified market symbols
2671
3022
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2672
- * @returns {object} a list of [margin mode structures]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
3023
+ * @returns {object} a list of [margin mode structures]{@link https://docs.ccxt.com/?id=margin-mode-structure}
2673
3024
  */
2674
3025
  async fetchMarginModes(symbols = undefined, params = {}) {
2675
- await this.loadMarkets();
2676
- const response = await this.fapiPrivateGetV2PositionRisk(params);
3026
+ await this.loadMarketsAndSignIn();
3027
+ const response = await this.fapiPrivateGetV3PositionRisk(params);
2677
3028
  //
2678
3029
  //
2679
3030
  // [
@@ -2731,20 +3082,20 @@ class aster extends aster$1["default"] {
2731
3082
  * @method
2732
3083
  * @name aster#fetchMarginAdjustmentHistory
2733
3084
  * @description fetches the history of margin added or reduced from contract isolated positions
2734
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#get-position-margin-change-history-trade
3085
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#get-position-margin-change-history-trade
2735
3086
  * @param {string} symbol unified market symbol
2736
3087
  * @param {string} [type] "add" or "reduce"
2737
3088
  * @param {int} [since] timestamp in ms of the earliest change to fetch
2738
3089
  * @param {int} [limit] the maximum amount of changes to fetch
2739
3090
  * @param {object} params extra parameters specific to the exchange api endpoint
2740
3091
  * @param {int} [params.until] timestamp in ms of the latest change to fetch
2741
- * @returns {object[]} a list of [margin structures]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
3092
+ * @returns {object[]} a list of [margin structures]{@link https://docs.ccxt.com/?id=margin-loan-structure}
2742
3093
  */
2743
3094
  async fetchMarginAdjustmentHistory(symbol = undefined, type = undefined, since = undefined, limit = undefined, params = {}) {
2744
- await this.loadMarkets();
2745
3095
  if (symbol === undefined) {
2746
3096
  throw new errors.ArgumentsRequired(this.id + ' fetchMarginAdjustmentHistory () requires a symbol argument');
2747
3097
  }
3098
+ await this.loadMarketsAndSignIn();
2748
3099
  const market = this.market(symbol);
2749
3100
  const until = this.safeInteger(params, 'until');
2750
3101
  params = this.omit(params, 'until');
@@ -2754,16 +3105,16 @@ class aster extends aster$1["default"] {
2754
3105
  if (type !== undefined) {
2755
3106
  request['type'] = (type === 'add') ? 1 : 2;
2756
3107
  }
3108
+ if (limit !== undefined) {
3109
+ request['limit'] = Math.min(limit, 1000);
3110
+ }
2757
3111
  if (since !== undefined) {
2758
3112
  request['startTime'] = since;
2759
3113
  }
2760
- if (limit !== undefined) {
2761
- request['limit'] = limit;
2762
- }
2763
3114
  if (until !== undefined) {
2764
3115
  request['endTime'] = until;
2765
3116
  }
2766
- const response = await this.fapiPrivateGetV1PositionMarginHistory(this.extend(request, params));
3117
+ const response = await this.fapiPrivateGetV3PositionMarginHistory(this.extend(request, params));
2767
3118
  //
2768
3119
  // [
2769
3120
  // {
@@ -2818,7 +3169,7 @@ class aster extends aster$1["default"] {
2818
3169
  };
2819
3170
  }
2820
3171
  async modifyMarginHelper(symbol, amount, addOrReduce, params = {}) {
2821
- await this.loadMarkets();
3172
+ await this.loadMarketsAndSignIn();
2822
3173
  const market = this.market(symbol);
2823
3174
  amount = this.amountToPrecision(symbol, amount);
2824
3175
  const request = {
@@ -2827,7 +3178,7 @@ class aster extends aster$1["default"] {
2827
3178
  'amount': amount,
2828
3179
  };
2829
3180
  const code = market['quote'];
2830
- const response = await this.fapiPrivatePostV1PositionMargin(this.extend(request, params));
3181
+ const response = await this.fapiPrivatePostV3PositionMargin(this.extend(request, params));
2831
3182
  //
2832
3183
  // {
2833
3184
  // "amount": 100.0,
@@ -2836,19 +3187,17 @@ class aster extends aster$1["default"] {
2836
3187
  // "type": 1
2837
3188
  // }
2838
3189
  //
2839
- return this.extend(this.parseMarginModification(response, market), {
2840
- 'code': code,
2841
- });
3190
+ return this.extend(this.parseMarginModification(response, market), { 'code': code });
2842
3191
  }
2843
3192
  /**
2844
3193
  * @method
2845
3194
  * @name aster#reduceMargin
2846
3195
  * @description remove margin from a position
2847
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#modify-isolated-position-margin-trade
3196
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#modify-isolated-position-margin-trade
2848
3197
  * @param {string} symbol unified market symbol
2849
3198
  * @param {float} amount the amount of margin to remove
2850
3199
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2851
- * @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=reduce-margin-structure}
3200
+ * @returns {object} a [margin structure]{@link https://docs.ccxt.com/?id=reduce-margin-structure}
2852
3201
  */
2853
3202
  async reduceMargin(symbol, amount, params = {}) {
2854
3203
  return await this.modifyMarginHelper(symbol, amount, 2, params);
@@ -2857,11 +3206,11 @@ class aster extends aster$1["default"] {
2857
3206
  * @method
2858
3207
  * @name aster#addMargin
2859
3208
  * @description add margin
2860
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#modify-isolated-position-margin-trade
3209
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#modify-isolated-position-margin-trade
2861
3210
  * @param {string} symbol unified market symbol
2862
3211
  * @param {float} amount amount of margin to add
2863
3212
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2864
- * @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=add-margin-structure}
3213
+ * @returns {object} a [margin structure]{@link https://docs.ccxt.com/?id=add-margin-structure}
2865
3214
  */
2866
3215
  async addMargin(symbol, amount, params = {}) {
2867
3216
  return await this.modifyMarginHelper(symbol, amount, 1, params);
@@ -2896,7 +3245,7 @@ class aster extends aster$1["default"] {
2896
3245
  * @method
2897
3246
  * @name aster#fetchFundingHistory
2898
3247
  * @description fetch the history of funding payments paid and received on this account
2899
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#get-income-historyuser_data
3248
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#get-income-historyuser_data
2900
3249
  * @param {string} symbol unified market symbol
2901
3250
  * @param {int} [since] the earliest time in ms to fetch funding history for
2902
3251
  * @param {int} [limit] the maximum number of funding history structures to retrieve
@@ -2904,10 +3253,10 @@ class aster extends aster$1["default"] {
2904
3253
  * @param {int} [params.until] timestamp in ms of the latest funding history entry
2905
3254
  * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch the funding history for a portfolio margin account
2906
3255
  * @param {string} [params.subType] "linear" or "inverse"
2907
- * @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
3256
+ * @returns {object} a [funding history structure]{@link https://docs.ccxt.com/?id=funding-history-structure}
2908
3257
  */
2909
3258
  async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
2910
- await this.loadMarkets();
3259
+ await this.loadMarketsAndSignIn();
2911
3260
  let market = undefined;
2912
3261
  let request = {
2913
3262
  'incomeType': 'FUNDING_FEE', // "TRANSFER","WELCOME_BONUS", "REALIZED_PNL","FUNDING_FEE", "COMMISSION", "INSURANCE_CLEAR", and "MARKET_MERCHANT_RETURN_REWARD"
@@ -2923,7 +3272,7 @@ class aster extends aster$1["default"] {
2923
3272
  if (limit !== undefined) {
2924
3273
  request['limit'] = Math.min(limit, 1000); // max 1000
2925
3274
  }
2926
- const response = await this.fapiPrivateGetV1Income(this.extend(request, params));
3275
+ const response = await this.fapiPrivateGetV3Income(this.extend(request, params));
2927
3276
  return this.parseIncomes(response, market, since, limit);
2928
3277
  }
2929
3278
  parseLedgerEntry(item, currency = undefined) {
@@ -2987,16 +3336,16 @@ class aster extends aster$1["default"] {
2987
3336
  * @method
2988
3337
  * @name aster#fetchLedger
2989
3338
  * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
2990
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#get-income-historyuser_data
3339
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#get-income-historyuser_data
2991
3340
  * @param {string} [code] unified currency code
2992
3341
  * @param {int} [since] timestamp in ms of the earliest ledger entry
2993
3342
  * @param {int} [limit] max number of ledger entries to return
2994
3343
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2995
3344
  * @param {int} [params.until] timestamp in ms of the latest ledger entry
2996
- * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger}
3345
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/?id=ledger}
2997
3346
  */
2998
3347
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
2999
- await this.loadMarkets();
3348
+ await this.loadMarketsAndSignIn();
3000
3349
  let currency = undefined;
3001
3350
  if (code !== undefined) {
3002
3351
  currency = this.currency(code);
@@ -3013,7 +3362,7 @@ class aster extends aster$1["default"] {
3013
3362
  params = this.omit(params, 'until');
3014
3363
  request['endTime'] = until;
3015
3364
  }
3016
- const response = await this.fapiPrivateGetV1Income(this.extend(request, params));
3365
+ const response = await this.fapiPrivateGetV3Income(this.extend(request, params));
3017
3366
  //
3018
3367
  // [
3019
3368
  // {
@@ -3209,7 +3558,7 @@ class aster extends aster$1["default"] {
3209
3558
  * @method
3210
3559
  * @name aster#fetchPositionsRisk
3211
3560
  * @description fetch positions risk
3212
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#position-information-v2-user_data
3561
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#position-information-v3-user_data
3213
3562
  * @param {string[]|undefined} symbols list of unified market symbols
3214
3563
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3215
3564
  * @returns {object} data on the positions risk
@@ -3220,10 +3569,10 @@ class aster extends aster$1["default"] {
3220
3569
  throw new errors.ArgumentsRequired(this.id + ' fetchPositionsRisk() requires an array argument for symbols');
3221
3570
  }
3222
3571
  }
3223
- await this.loadMarkets();
3572
+ await this.loadMarketsAndSignIn();
3224
3573
  await this.loadLeverageBrackets(false, params);
3225
3574
  const request = {};
3226
- const response = await this.fapiPrivateGetV2PositionRisk(this.extend(request, params));
3575
+ const response = await this.fapiPrivateGetV3PositionRisk(this.extend(request, params));
3227
3576
  //
3228
3577
  // [
3229
3578
  // {
@@ -3258,11 +3607,11 @@ class aster extends aster$1["default"] {
3258
3607
  * @method
3259
3608
  * @name aster#fetchPositions
3260
3609
  * @description fetch all open positions
3261
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#position-information-v2-user_data
3610
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#position-information-v3-user_data
3262
3611
  * @param {string[]} [symbols] list of unified market symbols
3263
3612
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3264
3613
  * @param {string} [params.method] method name to call, "positionRisk", "account" or "option", default is "positionRisk"
3265
- * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
3614
+ * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/?id=position-structure}
3266
3615
  */
3267
3616
  async fetchPositions(symbols = undefined, params = {}) {
3268
3617
  let defaultMethod = undefined;
@@ -3495,7 +3844,7 @@ class aster extends aster$1["default"] {
3495
3844
  * @name aster#fetchAccountPositions
3496
3845
  * @ignore
3497
3846
  * @description fetch account positions
3498
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#position-information-v2-user_data
3847
+ https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#position-information-v3-user_data
3499
3848
  * @param {string[]} [symbols] list of unified market symbols
3500
3849
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3501
3850
  * @returns {object} data on account positions
@@ -3506,7 +3855,7 @@ class aster extends aster$1["default"] {
3506
3855
  throw new errors.ArgumentsRequired(this.id + ' fetchPositions() requires an array argument for symbols');
3507
3856
  }
3508
3857
  }
3509
- await this.loadMarkets();
3858
+ await this.loadMarketsAndSignIn();
3510
3859
  await this.loadLeverageBrackets(false, params);
3511
3860
  const response = await this.fapiPrivateGetV4Account(params);
3512
3861
  let filterClosed = undefined;
@@ -3516,12 +3865,35 @@ class aster extends aster$1["default"] {
3516
3865
  return this.filterByArrayPositions(result, 'symbol', symbols, false);
3517
3866
  }
3518
3867
  async loadLeverageBrackets(reload = false, params = {}) {
3519
- await this.loadMarkets();
3868
+ await this.loadMarketsAndSignIn();
3520
3869
  // by default cache the leverage bracket
3521
3870
  // it contains useful stuff like the maintenance margin and initial margin for positions
3522
3871
  const leverageBrackets = this.safeDict(this.options, 'leverageBrackets');
3523
3872
  if ((leverageBrackets === undefined) || (reload)) {
3524
- const response = await this.fapiPrivateGetV1LeverageBracket(params);
3873
+ const response = await this.fapiPrivateGetV3LeverageBracket(params);
3874
+ //
3875
+ // [
3876
+ // {
3877
+ // "symbol": "TRUTHUSDT",
3878
+ // "brackets": [
3879
+ // {
3880
+ // "bracket": "1",
3881
+ // "initialLeverage": "50",
3882
+ // "notionalCap": "5000",
3883
+ // "notionalFloor": "0",
3884
+ // "maintMarginRatio": "0.01",
3885
+ // "cum": "0.0"
3886
+ // },
3887
+ // {
3888
+ // "bracket": "2",
3889
+ // "initialLeverage": "20",
3890
+ // "notionalCap": "10000",
3891
+ // "notionalFloor": "5000",
3892
+ // "maintMarginRatio": "0.025",
3893
+ // "cum": "75.0"
3894
+ // },
3895
+ // ...
3896
+ //
3525
3897
  this.options['leverageBrackets'] = this.createSafeDictionary();
3526
3898
  for (let i = 0; i < response.length; i++) {
3527
3899
  const entry = response[i];
@@ -3547,12 +3919,11 @@ class aster extends aster$1["default"] {
3547
3919
  return this.signHash(this.keccakMessage(message), privateKey.slice(-64));
3548
3920
  }
3549
3921
  signWithdrawPayload(withdrawPayload, network) {
3550
- const zeroAddress = this.safeString(this.options, 'zeroAddress');
3551
3922
  const chainId = this.safeInteger(withdrawPayload, 'chainId');
3552
3923
  const domain = {
3553
3924
  'chainId': chainId,
3554
3925
  'name': 'Aster',
3555
- 'verifyingContract': zeroAddress,
3926
+ 'verifyingContract': this.safeString(this.options, 'zeroAddress'),
3556
3927
  'version': '1',
3557
3928
  };
3558
3929
  const messageTypes = {
@@ -3567,17 +3938,17 @@ class aster extends aster$1["default"] {
3567
3938
  { 'name': 'aster chain', 'type': 'string' },
3568
3939
  ],
3569
3940
  };
3570
- const withdraw = {
3941
+ const request = {
3571
3942
  'type': 'Withdraw',
3572
3943
  'destination': this.safeString(withdrawPayload, 'receiver'),
3573
3944
  'destination Chain': network,
3574
3945
  'token': this.safeString(withdrawPayload, 'asset'),
3575
3946
  'amount': this.safeString(withdrawPayload, 'amount'),
3576
3947
  'fee': this.safeString(withdrawPayload, 'fee'),
3577
- 'nonce': this.safeInteger(withdrawPayload, 'nonce'),
3948
+ 'nonce': this.safeInteger(withdrawPayload, 'userNonce'),
3578
3949
  'aster chain': 'Mainnet',
3579
3950
  };
3580
- const msg = this.ethEncodeStructuredData(domain, messageTypes, withdraw);
3951
+ const msg = this.ethEncodeStructuredData(domain, messageTypes, request);
3581
3952
  const signature = this.signMessage(msg, this.privateKey);
3582
3953
  return signature;
3583
3954
  }
@@ -3585,23 +3956,26 @@ class aster extends aster$1["default"] {
3585
3956
  * @method
3586
3957
  * @name aster#withdraw
3587
3958
  * @description make a withdrawal
3588
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api.md#withdraw-user_data
3959
+ * @see https://asterdex.github.io/aster-api-website/spot-v3/account%26trades/#withdraw-user_data
3960
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/deposit%26withdrawal/#withdraw-by-fapiv3-evm-futures
3961
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/deposit%26withdrawal/#withdraw-by-fapiv3-evm-spot
3589
3962
  * @param {string} code unified currency code
3590
3963
  * @param {float} amount the amount to withdraw
3591
3964
  * @param {string} address the address to withdraw to
3592
3965
  * @param {string} tag
3593
3966
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3594
- * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
3967
+ * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/?id=transaction-structure}
3595
3968
  */
3596
3969
  async withdraw(code, amount, address, tag = undefined, params = {}) {
3597
3970
  [tag, params] = this.handleWithdrawTagAndParams(tag, params);
3598
3971
  this.checkAddress(address);
3599
- await this.loadMarkets();
3972
+ await this.loadMarketsAndSignIn();
3600
3973
  const currency = this.currency(code);
3974
+ const nonce = this.milliseconds() * 1000;
3601
3975
  const request = {
3602
3976
  'asset': currency['id'],
3603
3977
  'receiver': address,
3604
- 'nonce': this.milliseconds() * 1000,
3978
+ 'userNonce': nonce.toString(),
3605
3979
  };
3606
3980
  let chainId = this.safeInteger(params, 'chainId');
3607
3981
  // TODO: check how ARBI signature would work
@@ -3624,23 +3998,32 @@ class aster extends aster$1["default"] {
3624
3998
  params = this.omit(params, ['chainId', 'network', 'fee']);
3625
3999
  request['amount'] = this.currencyToPrecision(code, amount, network);
3626
4000
  request['userSignature'] = this.signWithdrawPayload(request, network);
3627
- const response = await this.sapiPrivatePostV1AsterUserWithdraw(this.extend(request, params));
4001
+ const response = await this.sapiPrivatePostV3AsterUserWithdraw(this.extend(request, params));
4002
+ //
4003
+ // {
4004
+ // "withdrawId": "1097219372504338432",
4005
+ // "hash": "0x9e6baa3eb75d92a1164eef51a0cc97b9591930518ba3e8e5ab40ce524ba4e463"
4006
+ // }
4007
+ //
4008
+ return this.parseTransaction(response, currency);
4009
+ }
4010
+ parseTransaction(transaction, currency = undefined) {
3628
4011
  return {
3629
- 'info': response,
3630
- 'id': this.safeString(response, 'withdrawId'),
3631
- 'txid': this.safeString(response, 'hash'),
4012
+ 'info': transaction,
4013
+ 'id': this.safeString(transaction, 'withdrawId'),
4014
+ 'txid': this.safeString(transaction, 'hash'),
3632
4015
  'timestamp': undefined,
3633
4016
  'datetime': undefined,
3634
- 'network': network,
3635
- 'address': address,
3636
- 'addressTo': address,
4017
+ 'network': undefined,
4018
+ 'address': undefined,
4019
+ 'addressTo': undefined,
3637
4020
  'addressFrom': undefined,
3638
- 'tag': tag,
3639
- 'tagTo': tag,
4021
+ 'tag': undefined,
4022
+ 'tagTo': undefined,
3640
4023
  'tagFrom': undefined,
3641
4024
  'type': 'withdrawal',
3642
- 'amount': amount,
3643
- 'currency': code,
4025
+ 'amount': undefined,
4026
+ 'currency': undefined,
3644
4027
  'status': undefined,
3645
4028
  'updated': undefined,
3646
4029
  'internal': undefined,
@@ -3652,17 +4035,17 @@ class aster extends aster$1["default"] {
3652
4035
  * @method
3653
4036
  * @name aster#transfer
3654
4037
  * @description transfer currency internally between wallets on the same account
3655
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-spot-api.md#transfer-asset-to-other-address-trade
3656
- * @see https://github.com/asterdex/api-docs/blob/master/aster-finance-futures-api.md#transfer-between-futures-and-spot-user_data
4038
+ * @see https://asterdex.github.io/aster-api-website/spot-v3/account%26trades/#perp-spot-transfer-trade
4039
+ * @see https://asterdex.github.io/aster-api-website/futures-v3/account%26trades/#transfer-between-futures-and-spot-transfer
3657
4040
  * @param {string} code unified currency code
3658
4041
  * @param {float} amount amount to transfer
3659
4042
  * @param {string} fromAccount account to transfer from
3660
4043
  * @param {string} toAccount account to transfer to
3661
4044
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3662
- * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
4045
+ * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/?id=transfer-structure}
3663
4046
  */
3664
4047
  async transfer(code, amount, fromAccount, toAccount, params = {}) {
3665
- await this.loadMarkets();
4048
+ await this.loadMarketsAndSignIn();
3666
4049
  const currency = this.currency(code);
3667
4050
  const request = {
3668
4051
  'asset': currency['id'],
@@ -3683,47 +4066,36 @@ class aster extends aster$1["default"] {
3683
4066
  else if (fromId === 'FUTURE' && toId === 'SPOT') {
3684
4067
  type = 'FUTURE_SPOT';
3685
4068
  }
3686
- let response = undefined;
3687
- if (type !== undefined) {
3688
- const defaultClientTranId = this.numberToString(this.milliseconds());
3689
- const clientTranId = this.safeString(params, 'clientTranId', defaultClientTranId);
3690
- request['kindType'] = type;
3691
- request['clientTranId'] = clientTranId;
3692
- response = await this.fapiPrivatePostV1AssetWalletTransfer(this.extend(request, params));
3693
- }
3694
- else {
3695
- // transfer asset to other address
3696
- request['toAddress'] = toAccount;
3697
- response = await this.sapiPrivatePostV1AssetSendToAddress(this.extend(request, params));
4069
+ if (type === undefined) {
4070
+ throw new errors.ArgumentsRequired(this.id + ' transfer() requires fromAccount and toAccount parameters to be either SPOT or FUTURE');
3698
4071
  }
3699
- //
3700
- // {
3701
- // "tranId":13526853623,
3702
- // "status": "SUCCESS"
3703
- // }
3704
- //
4072
+ let response = undefined;
4073
+ const defaultClientTranId = this.numberToString(this.milliseconds());
4074
+ const clientTranId = this.safeString(params, 'clientTranId', defaultClientTranId);
4075
+ request['kindType'] = type;
4076
+ request['clientTranId'] = clientTranId;
4077
+ response = await this.sapiPrivatePostV3AssetWalletTransfer(this.extend(request, params));
4078
+ return this.parseTransfer(response, currency);
4079
+ }
4080
+ parseTransfer(transfer, currency = undefined) {
4081
+ const currencyId = this.safeString(transfer, 'code');
3705
4082
  return {
3706
- 'info': response,
3707
- 'id': this.safeString(response, 'tranId'),
3708
- 'txid': undefined,
4083
+ 'info': transfer,
4084
+ 'id': this.safeString(transfer, 'tranId'),
3709
4085
  'timestamp': undefined,
3710
4086
  'datetime': undefined,
3711
- 'network': undefined,
3712
- 'address': undefined,
3713
- 'addressTo': fromAccount,
3714
- 'addressFrom': toAccount,
3715
- 'tag': undefined,
3716
- 'tagTo': undefined,
3717
- 'tagFrom': undefined,
3718
- 'type': 'transfer',
3719
- 'amount': amount,
3720
- 'currency': code,
3721
- 'status': undefined,
3722
- 'updated': undefined,
3723
- 'internal': undefined,
3724
- 'comment': undefined,
3725
- 'fee': undefined,
4087
+ 'currency': this.safeCurrencyCode(currencyId, currency),
4088
+ 'amount': undefined,
4089
+ 'fromAccount': undefined,
4090
+ 'toAccount': undefined,
4091
+ 'status': this.parseTransferStatus(this.safeString(transfer, 'status')),
4092
+ };
4093
+ }
4094
+ parseTransferStatus(status) {
4095
+ const statuses = {
4096
+ 'SUCCESS': 'ok',
3726
4097
  };
4098
+ return this.safeString(statuses, status, status);
3727
4099
  }
3728
4100
  hashMessage(binaryMessage) {
3729
4101
  // const binaryMessage = this.encode (message);
@@ -3750,78 +4122,174 @@ class aster extends aster$1["default"] {
3750
4122
  }
3751
4123
  else if (api === 'fapiPrivate' || api === 'sapiPrivate') {
3752
4124
  this.checkRequiredCredentials();
3753
- headers = {
3754
- 'X-MBX-APIKEY': this.apiKey,
4125
+ const nonce = this.milliseconds() * 1000;
4126
+ // Sign using EIP-712 typed data per the AsterSignTransaction spec
4127
+ const zeroAddress = this.safeString(this.options, 'zeroAddress', '0x0000000000000000000000000000000000000000');
4128
+ const v3ChainId = this.safeInteger(this.options, 'v3ChainId', 1666);
4129
+ const signerAddress = this.safeString(this.options, 'signerAddress');
4130
+ if (signerAddress === undefined) {
4131
+ throw new errors.ArgumentsRequired(this.id + ' requires signerAddress in options when use v3 api');
4132
+ }
4133
+ const domain = {
4134
+ 'name': 'AsterSignTransaction',
4135
+ 'version': '1',
4136
+ 'chainId': v3ChainId,
4137
+ 'verifyingContract': zeroAddress,
3755
4138
  };
3756
- const timestamp = this.milliseconds();
3757
- // Nonce is in microseconds
3758
- const nonce = this.microseconds();
3759
- const defaultRecvWindow = this.safeInteger(this.options, 'recvWindow');
3760
- let extendedParams = this.extend({
3761
- 'timestamp': timestamp,
4139
+ let messageTypes = {
4140
+ 'Message': [
4141
+ { 'name': 'msg', 'type': 'string' },
4142
+ ],
4143
+ };
4144
+ // Build v3 params: original endpoint params + nonce (macroseconds) + user + signer
4145
+ // Note: timestamp and recvWindow are not used for v3; nonce replaces timestamp
4146
+ const finalParams = this.extend({
4147
+ 'nonce': nonce.toString(),
4148
+ 'user': this.walletAddress,
4149
+ 'signer': signerAddress,
3762
4150
  }, params);
3763
- if (defaultRecvWindow !== undefined) {
3764
- extendedParams['recvWindow'] = defaultRecvWindow;
3765
- }
3766
- const recvWindow = this.safeInteger(params, 'recvWindow');
3767
- if (recvWindow !== undefined) {
3768
- extendedParams['recvWindow'] = recvWindow;
3769
- }
3770
- let query = undefined;
3771
- if ((method === 'DELETE') && (path === 'v1/batchOrders')) {
3772
- const orderidlist = this.safeList(extendedParams, 'orderIdList', []);
3773
- const origclientorderidlist = this.safeList(extendedParams, 'origClientOrderIdList', []);
3774
- extendedParams = this.omit(extendedParams, ['orderIdList', 'origClientOrderIdList']);
3775
- query = this.rawencode(extendedParams);
3776
- const orderidlistLength = orderidlist.length;
3777
- const origclientorderidlistLength = origclientorderidlist.length;
3778
- if (orderidlistLength > 0) {
3779
- query = query + '&' + 'orderidlist=%5B' + orderidlist.join('%2C') + '%5D';
3780
- }
3781
- if (origclientorderidlistLength > 0) {
3782
- query = query + '&' + 'origclientorderidlist=%5B' + origclientorderidlist.join('%2C') + '%5D';
3783
- }
3784
- }
3785
- else {
3786
- query = this.rawencode(extendedParams);
3787
- }
3788
- let signature = '';
3789
- if (path.indexOf('v3') >= 0) {
3790
- const signerAddress = this.options['signerAddress'];
3791
- if (signerAddress === undefined) {
3792
- throw new errors.ArgumentsRequired(this.id + ' requires signerAddress in options when use v3 api');
3793
- }
3794
- // the keys order matter
3795
- const keys = Object.keys(extendedParams);
3796
- const sortedKeys = this.sort(keys);
3797
- const signingPayload = {};
3798
- for (let i = 0; i < sortedKeys.length; i++) {
3799
- const key = sortedKeys[i];
3800
- signingPayload[key] = extendedParams[key].toString();
3801
- }
3802
- const signingHash = this.hashMessage(this.hash(this.ethAbiEncode([
3803
- 'string', 'address', 'address', 'uint256',
3804
- ], [this.json(signingPayload), this.walletAddress, signerAddress, nonce]), sha3.keccak_256, 'binary'));
3805
- signature = this.signHash(signingHash, this.privateKey);
3806
- extendedParams['user'] = this.walletAddress;
3807
- extendedParams['signer'] = signerAddress;
3808
- extendedParams['nonce'] = nonce;
3809
- query = this.rawencode(extendedParams);
4151
+ let paramString = undefined;
4152
+ let paramsToEncode = undefined;
4153
+ const isApproveBuilder = (path.indexOf('/approveBuilder') >= 0);
4154
+ if (isApproveBuilder) {
4155
+ // domain['name'] = 'Aster';
4156
+ messageTypes = {
4157
+ 'ApproveBuilder': [
4158
+ { 'name': 'Builder', 'type': 'string' },
4159
+ { 'name': 'MaxFeeRate', 'type': 'string' },
4160
+ { 'name': 'BuilderName', 'type': 'string' },
4161
+ { 'name': 'AsterChain', 'type': 'string' },
4162
+ { 'name': 'User', 'type': 'string' },
4163
+ { 'name': 'Nonce', 'type': 'uint256' },
4164
+ ],
4165
+ };
4166
+ delete finalParams['signer']; // signer is not needed for approveBuilder endpoint
4167
+ paramString = this.encodeValuesWithJson(finalParams);
4168
+ paramsToEncode = this.capitalizeKeys(finalParams);
3810
4169
  }
3811
4170
  else {
3812
- signature = this.hmac(this.encode(query), this.encode(this.secret), sha256.sha256);
4171
+ paramString = this.encodeValuesWithJson(finalParams);
4172
+ paramsToEncode = { 'msg': paramString };
3813
4173
  }
3814
- query += '&' + 'signature=' + signature;
4174
+ const encodedMessage = this.ethEncodeStructuredData(domain, messageTypes, paramsToEncode);
4175
+ const signature = this.signMessage(encodedMessage, this.privateKey);
4176
+ const queryString = paramString + '&' + 'signature=' + signature;
3815
4177
  if (method === 'GET') {
3816
- url += '?' + query;
4178
+ url += '?' + queryString;
3817
4179
  }
3818
4180
  else {
3819
- body = query;
4181
+ headers = {};
3820
4182
  headers['Content-Type'] = 'application/x-www-form-urlencoded';
4183
+ body = queryString;
3821
4184
  }
3822
4185
  }
3823
4186
  return { 'url': url, 'method': method, 'body': body, 'headers': headers };
3824
4187
  }
4188
+ encodeValuesWithJson(values) {
4189
+ let encodedString = '';
4190
+ const keys = Object.keys(values);
4191
+ for (let i = 0; i < keys.length; i++) {
4192
+ const key = keys[i];
4193
+ const value = values[key];
4194
+ const isObj = Array.isArray(value) || this.isDictionary(value);
4195
+ const valueJsonified = isObj ? this.json(value) : value.toString();
4196
+ const encoded = this.encodeURIComponent(valueJsonified);
4197
+ encodedString += key + '=' + encoded + '&';
4198
+ }
4199
+ return encodedString.slice(0, -1);
4200
+ }
4201
+ capitalizeKeys(dict) {
4202
+ const capitalized = {};
4203
+ const keys = Object.keys(dict);
4204
+ for (let i = 0; i < keys.length; i++) {
4205
+ const key = keys[i];
4206
+ const value = dict[key];
4207
+ const capitalizedKey = this.capitalize(key);
4208
+ capitalized[capitalizedKey] = value;
4209
+ }
4210
+ return capitalized;
4211
+ }
4212
+ async loadMarketsAndSignIn() {
4213
+ await Promise.all([this.loadMarkets(), this.signIn()]);
4214
+ }
4215
+ /**
4216
+ * @method
4217
+ * @name aster#signIn
4218
+ * @description sign in, must be called prior to using other authenticated methods
4219
+ * @see https://asterdex.github.io/aster-api-website/asterCode/integration-flow/
4220
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4221
+ * @returns response from exchange
4222
+ */
4223
+ async signIn(params = {}) {
4224
+ if (this.isEmptyString(this.privateKey)) {
4225
+ if (!this.isEmptyString(this.apiKey) || !this.isEmptyString(this.secret)) {
4226
+ throw new errors.NotSupported(this.id + 'after the latest upgrade (v4.5.52), CCXT now expects the l1 private key to be provided in the credentials.');
4227
+ }
4228
+ return false;
4229
+ }
4230
+ if (this.privateKey.length > 66) {
4231
+ throw new errors.NotSupported(this.id + ' after the latest update (v4.5.52), CCXT now expects the l1 private key to be provided in the credentials.');
4232
+ }
4233
+ await this.initializeClient(params);
4234
+ return true;
4235
+ }
4236
+ async initializeClient(params = {}) {
4237
+ const builderFee = this.safeBool(params, 'builderFee', this.safeBool(this.options, 'builderFee', true)); // we shouldn't omit here
4238
+ if (!builderFee) {
4239
+ return false; // skip if builder fee is not enabled
4240
+ }
4241
+ const approvedBuilderFee = this.safeBool(this.options, 'approvedBuilderFee', false);
4242
+ if (approvedBuilderFee) {
4243
+ return true; // skip if builder fee is already approved
4244
+ }
4245
+ const result = await this.fapiPrivateGetV3Builder();
4246
+ //
4247
+ // [
4248
+ // {
4249
+ // "userAddress": "0x35a5B33Be664B09F78b5089eb6185f71c8a7f11f",
4250
+ // "builderAddress": "0x1F5877C19e3777Cfd15F9d57253eA4aA5254Ec39",
4251
+ // "maxFeeRate": "0.001",
4252
+ // "builderName": "ccxt"
4253
+ // }
4254
+ // ]
4255
+ //
4256
+ const approvedBuilders = result;
4257
+ const length = approvedBuilders.length;
4258
+ let found = false;
4259
+ for (let i = 0; i < length; i++) {
4260
+ const builderInfo = this.safeDict(approvedBuilders, i, {});
4261
+ const builderAccountId = this.safeString(builderInfo, 'builderAddress');
4262
+ if (builderAccountId === this.safeString(this.options, 'builder')) {
4263
+ found = true;
4264
+ break;
4265
+ }
4266
+ }
4267
+ if (!found) {
4268
+ this.options['approvedBuilderFee'] = true;
4269
+ try {
4270
+ const request = {
4271
+ 'builder': this.safeString(this.options, 'builder'),
4272
+ 'builderName': this.safeString(this.options, 'builderName', 'ccxt'),
4273
+ 'maxFeeRate': this.safeString(this.options, 'builderRate'),
4274
+ 'signatureChainId': this.safeInteger(this.options, 'v3ChainId', 1666),
4275
+ 'asterChain': 'Mainnet',
4276
+ };
4277
+ const authResponse = await this.fapiPrivatePostV3ApproveBuilder(this.extend(request, params));
4278
+ //
4279
+ // {"code": 200,"msg": "success"}
4280
+ //
4281
+ const codeRes = this.safeInteger(authResponse, 'code');
4282
+ if (codeRes !== 200) {
4283
+ throw new errors.ExchangeError('Builder authorization failed, ' + this.json(authResponse));
4284
+ }
4285
+ }
4286
+ catch (e) {
4287
+ this.options['approvedBuilderFee'] = false;
4288
+ this.options['builderFee'] = false; // disable if err
4289
+ }
4290
+ }
4291
+ return undefined; // just c#
4292
+ }
3825
4293
  handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
3826
4294
  if (response === undefined) {
3827
4295
  return undefined; // fallback to default error handler