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