ccxt 4.5.22 → 4.5.24

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 (992) hide show
  1. package/README.md +7 -6
  2. package/dist/ccxt.browser.min.js +2 -2
  3. package/dist/cjs/ccxt.js +6 -1
  4. package/dist/cjs/src/abstract/alpaca.js +1 -1
  5. package/dist/cjs/src/abstract/apex.js +1 -1
  6. package/dist/cjs/src/abstract/arkham.js +1 -1
  7. package/dist/cjs/src/abstract/ascendex.js +1 -1
  8. package/dist/cjs/src/abstract/backpack.js +1 -1
  9. package/dist/cjs/src/abstract/bigone.js +1 -1
  10. package/dist/cjs/src/abstract/binance.js +1 -1
  11. package/dist/cjs/src/abstract/bingx.js +1 -1
  12. package/dist/cjs/src/abstract/bit2c.js +1 -1
  13. package/dist/cjs/src/abstract/bitbank.js +1 -1
  14. package/dist/cjs/src/abstract/bitbns.js +1 -1
  15. package/dist/cjs/src/abstract/bitfinex.js +1 -1
  16. package/dist/cjs/src/abstract/bitflyer.js +1 -1
  17. package/dist/cjs/src/abstract/bitget.js +1 -1
  18. package/dist/cjs/src/abstract/bithumb.js +1 -1
  19. package/dist/cjs/src/abstract/bitmart.js +1 -1
  20. package/dist/cjs/src/abstract/bitmex.js +1 -1
  21. package/dist/cjs/src/abstract/bitopro.js +1 -1
  22. package/dist/cjs/src/abstract/bitrue.js +1 -1
  23. package/dist/cjs/src/abstract/bitso.js +1 -1
  24. package/dist/cjs/src/abstract/bitstamp.js +1 -1
  25. package/dist/cjs/src/abstract/bitteam.js +1 -1
  26. package/dist/cjs/src/abstract/bittrade.js +1 -1
  27. package/dist/cjs/src/abstract/bitvavo.js +1 -1
  28. package/dist/cjs/src/abstract/blockchaincom.js +1 -1
  29. package/dist/cjs/src/abstract/blofin.js +1 -1
  30. package/dist/cjs/src/abstract/btcalpha.js +1 -1
  31. package/dist/cjs/src/abstract/btcbox.js +1 -1
  32. package/dist/cjs/src/abstract/btcmarkets.js +1 -1
  33. package/dist/cjs/src/abstract/btcturk.js +1 -1
  34. package/dist/cjs/src/abstract/bullish.js +11 -0
  35. package/dist/cjs/src/abstract/bybit.js +1 -1
  36. package/dist/cjs/src/abstract/cex.js +1 -1
  37. package/dist/cjs/src/abstract/coinbase.js +1 -1
  38. package/dist/cjs/src/abstract/coinbaseexchange.js +1 -1
  39. package/dist/cjs/src/abstract/coinbaseinternational.js +1 -1
  40. package/dist/cjs/src/abstract/coincatch.js +1 -1
  41. package/dist/cjs/src/abstract/coincheck.js +1 -1
  42. package/dist/cjs/src/abstract/coinex.js +1 -1
  43. package/dist/cjs/src/abstract/coinmate.js +1 -1
  44. package/dist/cjs/src/abstract/coinmetro.js +1 -1
  45. package/dist/cjs/src/abstract/coinone.js +1 -1
  46. package/dist/cjs/src/abstract/coinsph.js +1 -1
  47. package/dist/cjs/src/abstract/coinspot.js +1 -1
  48. package/dist/cjs/src/abstract/cryptocom.js +1 -1
  49. package/dist/cjs/src/abstract/cryptomus.js +1 -1
  50. package/dist/cjs/src/abstract/deepcoin.js +1 -1
  51. package/dist/cjs/src/abstract/defx.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/hashkey.js +1 -1
  62. package/dist/cjs/src/abstract/hibachi.js +1 -1
  63. package/dist/cjs/src/abstract/hitbtc.js +1 -1
  64. package/dist/cjs/src/abstract/hollaex.js +1 -1
  65. package/dist/cjs/src/abstract/htx.js +1 -1
  66. package/dist/cjs/src/abstract/hyperliquid.js +1 -1
  67. package/dist/cjs/src/abstract/independentreserve.js +1 -1
  68. package/dist/cjs/src/abstract/indodax.js +1 -1
  69. package/dist/cjs/src/abstract/kraken.js +1 -1
  70. package/dist/cjs/src/abstract/krakenfutures.js +1 -1
  71. package/dist/cjs/src/abstract/kucoin.js +1 -1
  72. package/dist/cjs/src/abstract/kucoinfutures.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/luno.js +1 -1
  76. package/dist/cjs/src/abstract/mercado.js +1 -1
  77. package/dist/cjs/src/abstract/mexc.js +1 -1
  78. package/dist/cjs/src/abstract/modetrade.js +1 -1
  79. package/dist/cjs/src/abstract/ndax.js +1 -1
  80. package/dist/cjs/src/abstract/novadax.js +1 -1
  81. package/dist/cjs/src/abstract/oceanex.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/paradex.js +1 -1
  87. package/dist/cjs/src/abstract/paymium.js +1 -1
  88. package/dist/cjs/src/abstract/phemex.js +1 -1
  89. package/dist/cjs/src/abstract/poloniex.js +1 -1
  90. package/dist/cjs/src/abstract/probit.js +1 -1
  91. package/dist/cjs/src/abstract/timex.js +1 -1
  92. package/dist/cjs/src/abstract/tokocrypto.js +1 -1
  93. package/dist/cjs/src/abstract/toobit.js +1 -1
  94. package/dist/cjs/src/abstract/upbit.js +1 -1
  95. package/dist/cjs/src/abstract/wavesexchange.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/zonda.js +1 -1
  103. package/dist/cjs/src/alpaca.js +1 -1
  104. package/dist/cjs/src/apex.js +1 -1
  105. package/dist/cjs/src/arkham.js +1 -1
  106. package/dist/cjs/src/ascendex.js +1 -1
  107. package/dist/cjs/src/backpack.js +1 -1
  108. package/dist/cjs/src/base/Exchange.js +5 -6
  109. package/dist/cjs/src/base/Precise.js +6 -0
  110. package/dist/cjs/src/base/errors.js +6 -0
  111. package/dist/cjs/src/base/functions/crypto.js +1 -1
  112. package/dist/cjs/src/base/functions/encode.js +1 -1
  113. package/dist/cjs/src/base/functions/misc.js +1 -0
  114. package/dist/cjs/src/base/functions/number.js +6 -0
  115. package/dist/cjs/src/base/functions/platform.js +6 -0
  116. package/dist/cjs/src/base/functions/rsa.js +1 -0
  117. package/dist/cjs/src/base/functions/string.js +6 -0
  118. package/dist/cjs/src/base/functions/throttle.js +1 -1
  119. package/dist/cjs/src/base/functions/time.js +6 -0
  120. package/dist/cjs/src/base/functions/totp.js +1 -0
  121. package/dist/cjs/src/base/functions/type.js +6 -0
  122. package/dist/cjs/src/base/functions.js +1 -1
  123. package/dist/cjs/src/base/ws/Cache.js +6 -0
  124. package/dist/cjs/src/base/ws/Client.js +1 -0
  125. package/dist/cjs/src/base/ws/Future.js +1 -1
  126. package/dist/cjs/src/base/ws/OrderBook.js +1 -1
  127. package/dist/cjs/src/base/ws/OrderBookSide.js +6 -0
  128. package/dist/cjs/src/base/ws/WsClient.js +16 -1
  129. package/dist/cjs/src/bequant.js +1 -1
  130. package/dist/cjs/src/bigone.js +1 -1
  131. package/dist/cjs/src/binance.js +162 -39
  132. package/dist/cjs/src/binancecoinm.js +1 -1
  133. package/dist/cjs/src/binanceus.js +1 -1
  134. package/dist/cjs/src/binanceusdm.js +1 -1
  135. package/dist/cjs/src/bingx.js +3 -2
  136. package/dist/cjs/src/bit2c.js +1 -1
  137. package/dist/cjs/src/bitbank.js +1 -1
  138. package/dist/cjs/src/bitbns.js +1 -1
  139. package/dist/cjs/src/bitfinex.js +1 -1
  140. package/dist/cjs/src/bitflyer.js +1 -1
  141. package/dist/cjs/src/bitget.js +1 -1
  142. package/dist/cjs/src/bithumb.js +1 -1
  143. package/dist/cjs/src/bitmart.js +2 -1
  144. package/dist/cjs/src/bitmex.js +1 -1
  145. package/dist/cjs/src/bitopro.js +1 -1
  146. package/dist/cjs/src/bitrue.js +1 -1
  147. package/dist/cjs/src/bitso.js +1 -1
  148. package/dist/cjs/src/bitstamp.js +1 -1
  149. package/dist/cjs/src/bitteam.js +1 -1
  150. package/dist/cjs/src/bittrade.js +1 -1
  151. package/dist/cjs/src/blockchaincom.js +1 -1
  152. package/dist/cjs/src/blofin.js +1 -1
  153. package/dist/cjs/src/btcalpha.js +1 -1
  154. package/dist/cjs/src/btcbox.js +1 -1
  155. package/dist/cjs/src/btcmarkets.js +1 -1
  156. package/dist/cjs/src/btcturk.js +1 -1
  157. package/dist/cjs/src/bullish.js +2919 -0
  158. package/dist/cjs/src/bybit.js +65 -38
  159. package/dist/cjs/src/cex.js +1 -1
  160. package/dist/cjs/src/coinbaseadvanced.js +1 -1
  161. package/dist/cjs/src/coincatch.js +1 -1
  162. package/dist/cjs/src/coincheck.js +1 -1
  163. package/dist/cjs/src/coinex.js +1 -1
  164. package/dist/cjs/src/coinmate.js +1 -1
  165. package/dist/cjs/src/coinmetro.js +1 -1
  166. package/dist/cjs/src/coinone.js +1 -1
  167. package/dist/cjs/src/coinsph.js +1 -0
  168. package/dist/cjs/src/coinspot.js +1 -1
  169. package/dist/cjs/src/cryptocom.js +1 -1
  170. package/dist/cjs/src/cryptomus.js +1 -1
  171. package/dist/cjs/src/deepcoin.js +2 -2
  172. package/dist/cjs/src/defx.js +1 -1
  173. package/dist/cjs/src/delta.js +1 -1
  174. package/dist/cjs/src/deribit.js +1 -1
  175. package/dist/cjs/src/derive.js +1 -1
  176. package/dist/cjs/src/digifinex.js +1 -1
  177. package/dist/cjs/src/dydx.js +1 -1
  178. package/dist/cjs/src/exmo.js +1 -1
  179. package/dist/cjs/src/fmfwio.js +1 -1
  180. package/dist/cjs/src/foxbit.js +1 -1
  181. package/dist/cjs/src/gate.js +3 -3
  182. package/dist/cjs/src/gateio.js +1 -1
  183. package/dist/cjs/src/gemini.js +1 -1
  184. package/dist/cjs/src/hashkey.js +1 -1
  185. package/dist/cjs/src/hibachi.js +1 -1
  186. package/dist/cjs/src/hitbtc.js +1 -0
  187. package/dist/cjs/src/hollaex.js +1 -1
  188. package/dist/cjs/src/htx.js +5 -2
  189. package/dist/cjs/src/huobi.js +1 -1
  190. package/dist/cjs/src/hyperliquid.js +119 -15
  191. package/dist/cjs/src/independentreserve.js +1 -1
  192. package/dist/cjs/src/indodax.js +1 -1
  193. package/dist/cjs/src/kraken.js +1 -1
  194. package/dist/cjs/src/krakenfutures.js +1 -1
  195. package/dist/cjs/src/kucoin.js +23 -4
  196. package/dist/cjs/src/kucoinfutures.js +1 -1
  197. package/dist/cjs/src/latoken.js +1 -1
  198. package/dist/cjs/src/lbank.js +1 -1
  199. package/dist/cjs/src/luno.js +1 -1
  200. package/dist/cjs/src/mercado.js +1 -1
  201. package/dist/cjs/src/mexc.js +8 -1
  202. package/dist/cjs/src/modetrade.js +1 -1
  203. package/dist/cjs/src/myokx.js +1 -1
  204. package/dist/cjs/src/ndax.js +1 -1
  205. package/dist/cjs/src/novadax.js +1 -1
  206. package/dist/cjs/src/oceanex.js +1 -1
  207. package/dist/cjs/src/okx.js +118 -64
  208. package/dist/cjs/src/okxus.js +1 -1
  209. package/dist/cjs/src/onetrading.js +1 -1
  210. package/dist/cjs/src/oxfun.js +1 -1
  211. package/dist/cjs/src/p2b.js +1 -1
  212. package/dist/cjs/src/paradex.js +79 -4
  213. package/dist/cjs/src/paymium.js +1 -1
  214. package/dist/cjs/src/poloniex.js +1 -1
  215. package/dist/cjs/src/pro/alpaca.js +1 -1
  216. package/dist/cjs/src/pro/apex.js +1 -1
  217. package/dist/cjs/src/pro/arkham.js +1 -1
  218. package/dist/cjs/src/pro/ascendex.js +1 -1
  219. package/dist/cjs/src/pro/backpack.js +1 -1
  220. package/dist/cjs/src/pro/bequant.js +1 -1
  221. package/dist/cjs/src/pro/binance.js +131 -29
  222. package/dist/cjs/src/pro/binancecoinm.js +1 -1
  223. package/dist/cjs/src/pro/binanceus.js +1 -1
  224. package/dist/cjs/src/pro/binanceusdm.js +1 -1
  225. package/dist/cjs/src/pro/bingx.js +1 -1
  226. package/dist/cjs/src/pro/bitfinex.js +1 -1
  227. package/dist/cjs/src/pro/bitget.js +1 -1
  228. package/dist/cjs/src/pro/bithumb.js +1 -1
  229. package/dist/cjs/src/pro/bitmart.js +1 -1
  230. package/dist/cjs/src/pro/bitmex.js +1 -1
  231. package/dist/cjs/src/pro/bitrue.js +1 -1
  232. package/dist/cjs/src/pro/bitstamp.js +1 -1
  233. package/dist/cjs/src/pro/bitvavo.js +1 -1
  234. package/dist/cjs/src/pro/blockchaincom.js +1 -1
  235. package/dist/cjs/src/pro/blofin.js +1 -1
  236. package/dist/cjs/src/pro/bullish.js +781 -0
  237. package/dist/cjs/src/pro/bybit.js +1 -1
  238. package/dist/cjs/src/pro/cex.js +1 -1
  239. package/dist/cjs/src/pro/coinbase.js +3 -3
  240. package/dist/cjs/src/pro/coinbaseadvanced.js +1 -1
  241. package/dist/cjs/src/pro/coinbaseexchange.js +1 -1
  242. package/dist/cjs/src/pro/coinbaseinternational.js +1 -1
  243. package/dist/cjs/src/pro/coincatch.js +1 -1
  244. package/dist/cjs/src/pro/coincheck.js +1 -1
  245. package/dist/cjs/src/pro/coinex.js +1 -1
  246. package/dist/cjs/src/pro/coinone.js +1 -1
  247. package/dist/cjs/src/pro/cryptocom.js +1 -1
  248. package/dist/cjs/src/pro/deepcoin.js +1 -1
  249. package/dist/cjs/src/pro/defx.js +1 -1
  250. package/dist/cjs/src/pro/deribit.js +1 -1
  251. package/dist/cjs/src/pro/dydx.js +1 -1
  252. package/dist/cjs/src/pro/exmo.js +1 -1
  253. package/dist/cjs/src/pro/gate.js +1 -1
  254. package/dist/cjs/src/pro/gateio.js +1 -1
  255. package/dist/cjs/src/pro/gemini.js +1 -1
  256. package/dist/cjs/src/pro/hashkey.js +1 -1
  257. package/dist/cjs/src/pro/hitbtc.js +1 -1
  258. package/dist/cjs/src/pro/hollaex.js +1 -1
  259. package/dist/cjs/src/pro/htx.js +1 -1
  260. package/dist/cjs/src/pro/huobi.js +1 -1
  261. package/dist/cjs/src/pro/hyperliquid.js +76 -16
  262. package/dist/cjs/src/pro/independentreserve.js +1 -1
  263. package/dist/cjs/src/pro/kraken.js +1 -1
  264. package/dist/cjs/src/pro/krakenfutures.js +1 -1
  265. package/dist/cjs/src/pro/kucoin.js +1 -1
  266. package/dist/cjs/src/pro/kucoinfutures.js +1 -1
  267. package/dist/cjs/src/pro/lbank.js +1 -0
  268. package/dist/cjs/src/pro/luno.js +1 -1
  269. package/dist/cjs/src/pro/mexc.js +1 -1
  270. package/dist/cjs/src/pro/myokx.js +1 -1
  271. package/dist/cjs/src/pro/ndax.js +1 -1
  272. package/dist/cjs/src/pro/okx.js +1 -1
  273. package/dist/cjs/src/pro/okxus.js +1 -1
  274. package/dist/cjs/src/pro/onetrading.js +1 -1
  275. package/dist/cjs/src/pro/oxfun.js +1 -1
  276. package/dist/cjs/src/pro/p2b.js +1 -1
  277. package/dist/cjs/src/pro/paradex.js +1 -1
  278. package/dist/cjs/src/pro/phemex.js +1 -1
  279. package/dist/cjs/src/pro/poloniex.js +1 -1
  280. package/dist/cjs/src/pro/probit.js +1 -1
  281. package/dist/cjs/src/pro/toobit.js +1 -1
  282. package/dist/cjs/src/pro/upbit.js +29 -83
  283. package/dist/cjs/src/pro/whitebit.js +1 -1
  284. package/dist/cjs/src/pro/xt.js +1 -1
  285. package/dist/cjs/src/probit.js +1 -1
  286. package/dist/cjs/src/protobuf/mexc/compiled.cjs.js +0 -1
  287. package/dist/cjs/src/static_dependencies/dydx-v4-client/cosmos/base/v1beta1/coin.js +1 -0
  288. package/dist/cjs/src/static_dependencies/dydx-v4-client/cosmos/crypto/multisig/v1beta1/multisig.js +1 -0
  289. package/dist/cjs/src/static_dependencies/dydx-v4-client/cosmos/crypto/secp256k1/keys.js +1 -0
  290. package/dist/cjs/src/static_dependencies/dydx-v4-client/cosmos/tx/signing/v1beta1/signing.js +1 -0
  291. package/dist/cjs/src/static_dependencies/dydx-v4-client/cosmos/tx/v1beta1/tx.js +1 -0
  292. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/accountplus/tx.js +1 -0
  293. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/clob_pair.js +1 -0
  294. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/order.js +1 -0
  295. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/order_removals.js +1 -0
  296. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/tx.js +1 -0
  297. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/sending/transfer.js +1 -0
  298. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/sending/tx.js +1 -0
  299. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/subaccounts/subaccount.js +1 -0
  300. package/dist/cjs/src/static_dependencies/dydx-v4-client/google/protobuf/any.js +1 -0
  301. package/dist/cjs/src/static_dependencies/dydx-v4-client/helpers.js +6 -0
  302. package/dist/cjs/src/static_dependencies/dydx-v4-client/onboarding.js +1 -0
  303. package/dist/cjs/src/static_dependencies/dydx-v4-client/registry.js +1 -0
  304. package/dist/cjs/src/static_dependencies/ethers/abi-coder.js +6 -0
  305. package/dist/cjs/src/static_dependencies/ethers/address/address.js +1 -1
  306. package/dist/cjs/src/static_dependencies/ethers/coders/abstract-coder.js +6 -0
  307. package/dist/cjs/src/static_dependencies/ethers/coders/address.js +1 -0
  308. package/dist/cjs/src/static_dependencies/ethers/coders/anonymous.js +1 -0
  309. package/dist/cjs/src/static_dependencies/ethers/coders/array.js +1 -0
  310. package/dist/cjs/src/static_dependencies/ethers/coders/boolean.js +1 -0
  311. package/dist/cjs/src/static_dependencies/ethers/coders/bytes.js +1 -0
  312. package/dist/cjs/src/static_dependencies/ethers/coders/fixed-bytes.js +1 -0
  313. package/dist/cjs/src/static_dependencies/ethers/coders/null.js +1 -0
  314. package/dist/cjs/src/static_dependencies/ethers/coders/number.js +1 -0
  315. package/dist/cjs/src/static_dependencies/ethers/coders/string.js +1 -0
  316. package/dist/cjs/src/static_dependencies/ethers/coders/tuple.js +1 -0
  317. package/dist/cjs/src/static_dependencies/ethers/fragments.js +6 -0
  318. package/dist/cjs/src/static_dependencies/ethers/hash/typed-data.js +6 -0
  319. package/dist/cjs/src/static_dependencies/ethers/index.js +1 -10
  320. package/dist/cjs/src/static_dependencies/ethers/interface.js +6 -0
  321. package/dist/cjs/src/static_dependencies/ethers/typed.js +6 -0
  322. package/dist/cjs/src/static_dependencies/ethers/utils/base58.js +1 -13
  323. package/dist/cjs/src/static_dependencies/ethers/utils/data.js +1 -6
  324. package/dist/cjs/src/static_dependencies/ethers/utils/errors.js +1 -9
  325. package/dist/cjs/src/static_dependencies/ethers/utils/events.js +6 -0
  326. package/dist/cjs/src/static_dependencies/ethers/utils/fixednumber.js +6 -0
  327. package/dist/cjs/src/static_dependencies/ethers/utils/index.js +1 -7
  328. package/dist/cjs/src/static_dependencies/ethers/utils/maths.js +1 -5
  329. package/dist/cjs/src/static_dependencies/ethers/utils/properties.js +6 -0
  330. package/dist/cjs/src/static_dependencies/ethers/utils/utf8.js +1 -8
  331. package/dist/cjs/src/static_dependencies/fflake/browser.js +1 -1
  332. package/dist/cjs/src/static_dependencies/jsencrypt/JSEncrypt.js +1 -0
  333. package/dist/cjs/src/static_dependencies/jsencrypt/JSEncryptRSAKey.js +1 -0
  334. package/dist/cjs/src/static_dependencies/jsencrypt/lib/asn1js/asn1.js +1 -1
  335. package/dist/cjs/src/static_dependencies/jsencrypt/lib/asn1js/base64.js +6 -0
  336. package/dist/cjs/src/static_dependencies/jsencrypt/lib/asn1js/hex.js +6 -0
  337. package/dist/cjs/src/static_dependencies/jsencrypt/lib/asn1js/int10.js +6 -0
  338. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/base64.js +1 -0
  339. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.js +1 -1
  340. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/prng4.js +6 -0
  341. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/rng.js +1 -1
  342. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/rsa.js +1 -1
  343. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsbn/util.js +6 -0
  344. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +1 -1
  345. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsrsasign/yahoo.js +6 -0
  346. package/dist/cjs/src/static_dependencies/messagepack/msgpack.js +6 -0
  347. package/dist/cjs/src/static_dependencies/noble-curves/_shortw_utils.js +1 -1
  348. package/dist/cjs/src/static_dependencies/noble-curves/abstract/curve.js +1 -1
  349. package/dist/cjs/src/static_dependencies/noble-curves/abstract/edwards.js +1 -1
  350. package/dist/cjs/src/static_dependencies/noble-curves/abstract/hash-to-curve.js +1 -0
  351. package/dist/cjs/src/static_dependencies/noble-curves/abstract/modular.js +1 -1
  352. package/dist/cjs/src/static_dependencies/noble-curves/abstract/montgomery.js +1 -1
  353. package/dist/cjs/src/static_dependencies/noble-curves/abstract/poseidon.js +1 -1
  354. package/dist/cjs/src/static_dependencies/noble-curves/abstract/utils.js +6 -0
  355. package/dist/cjs/src/static_dependencies/noble-curves/abstract/weierstrass.js +1 -1
  356. package/dist/cjs/src/static_dependencies/noble-curves/ed25519.js +1 -1
  357. package/dist/cjs/src/static_dependencies/noble-curves/p256.js +1 -1
  358. package/dist/cjs/src/static_dependencies/noble-curves/secp256k1.js +1 -1
  359. package/dist/cjs/src/static_dependencies/noble-hashes/_assert.js +6 -0
  360. package/dist/cjs/src/static_dependencies/noble-hashes/_sha2.js +1 -0
  361. package/dist/cjs/src/static_dependencies/noble-hashes/_u64.js +6 -0
  362. package/dist/cjs/src/static_dependencies/noble-hashes/crypto.js +6 -0
  363. package/dist/cjs/src/static_dependencies/noble-hashes/hmac.js +1 -0
  364. package/dist/cjs/src/static_dependencies/noble-hashes/md5.js +1 -0
  365. package/dist/cjs/src/static_dependencies/noble-hashes/pbkdf2.js +1 -0
  366. package/dist/cjs/src/static_dependencies/noble-hashes/ripemd160.js +1 -0
  367. package/dist/cjs/src/static_dependencies/noble-hashes/sha1.js +1 -0
  368. package/dist/cjs/src/static_dependencies/noble-hashes/sha256.js +1 -0
  369. package/dist/cjs/src/static_dependencies/noble-hashes/sha3.js +1 -0
  370. package/dist/cjs/src/static_dependencies/noble-hashes/sha512.js +1 -0
  371. package/dist/cjs/src/static_dependencies/noble-hashes/utils.js +1 -1
  372. package/dist/cjs/src/static_dependencies/node-fetch/body.js +1 -5
  373. package/dist/cjs/src/static_dependencies/node-fetch/errors/abort-error.js +1 -0
  374. package/dist/cjs/src/static_dependencies/node-fetch/errors/base.js +6 -0
  375. package/dist/cjs/src/static_dependencies/node-fetch/errors/fetch-error.js +1 -0
  376. package/dist/cjs/src/static_dependencies/node-fetch/headers.js +1 -5
  377. package/dist/cjs/src/static_dependencies/node-fetch/index.js +1 -7
  378. package/dist/cjs/src/static_dependencies/node-fetch/request.js +1 -7
  379. package/dist/cjs/src/static_dependencies/node-fetch/response.js +1 -5
  380. package/dist/cjs/src/static_dependencies/node-fetch/utils/get-search.js +6 -0
  381. package/dist/cjs/src/static_dependencies/node-fetch/utils/is-redirect.js +6 -0
  382. package/dist/cjs/src/static_dependencies/node-fetch/utils/is.js +6 -0
  383. package/dist/cjs/src/static_dependencies/node-fetch/utils/referrer.js +1 -0
  384. package/dist/cjs/src/static_dependencies/proxies/agent-base/index.js +1 -0
  385. package/dist/cjs/src/static_dependencies/proxies/http-proxy-agent/index.js +1 -0
  386. package/dist/cjs/src/static_dependencies/proxies/https-proxy-agent/index.js +1 -0
  387. package/dist/cjs/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.js +6 -0
  388. package/dist/cjs/src/static_dependencies/qs/formats.js +6 -0
  389. package/dist/cjs/src/static_dependencies/qs/index.js +1 -0
  390. package/dist/cjs/src/static_dependencies/qs/parse.js +1 -0
  391. package/dist/cjs/src/static_dependencies/qs/stringify.js +1 -0
  392. package/dist/cjs/src/static_dependencies/qs/utils.js +6 -0
  393. package/dist/cjs/src/static_dependencies/scure-base/index.js +6 -0
  394. package/dist/cjs/src/static_dependencies/scure-bip32/index.js +1 -19
  395. package/dist/cjs/src/static_dependencies/scure-bip39/index.js +1 -1
  396. package/dist/cjs/src/static_dependencies/scure-bip39/wordlists/english.js +6 -0
  397. package/dist/cjs/src/static_dependencies/scure-starknet/index.js +1 -1
  398. package/dist/cjs/src/static_dependencies/starknet/constants.js +1 -1
  399. package/dist/cjs/src/static_dependencies/starknet/types/calldata.js +6 -0
  400. package/dist/cjs/src/static_dependencies/starknet/types/lib/contract/abi.js +6 -0
  401. package/dist/cjs/src/static_dependencies/starknet/types/lib/contract/index.js +6 -0
  402. package/dist/cjs/src/static_dependencies/starknet/types/lib/index.js +6 -0
  403. package/dist/cjs/src/static_dependencies/starknet/types/typedData.js +6 -0
  404. package/dist/cjs/src/static_dependencies/starknet/utils/assert.js +6 -0
  405. package/dist/cjs/src/static_dependencies/starknet/utils/cairoDataTypes/felt.js +1 -1
  406. package/dist/cjs/src/static_dependencies/starknet/utils/cairoDataTypes/uint256.js +1 -1
  407. package/dist/cjs/src/static_dependencies/starknet/utils/cairoDataTypes/uint512.js +1 -1
  408. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/byteArray.js +1 -0
  409. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/cairo.js +1 -0
  410. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/enum/CairoCustomEnum.js +6 -0
  411. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/enum/CairoOption.js +6 -0
  412. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/enum/CairoResult.js +6 -0
  413. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/formatter.js +1 -0
  414. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/index.js +1 -1
  415. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/parser/index.js +1 -0
  416. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/parser/parser-0-1.1.0.js +1 -0
  417. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/parser/parser-2.0.0.js +6 -0
  418. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/propertyOrder.js +1 -0
  419. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/requestParser.js +1 -0
  420. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/responseParser.js +1 -0
  421. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/tuple.js +1 -1
  422. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/validate.js +1 -4
  423. package/dist/cjs/src/static_dependencies/starknet/utils/encode.js +1 -0
  424. package/dist/cjs/src/static_dependencies/starknet/utils/hash/classHash.js +1 -3
  425. package/dist/cjs/src/static_dependencies/starknet/utils/merkle.js +1 -0
  426. package/dist/cjs/src/static_dependencies/starknet/utils/num.js +1 -0
  427. package/dist/cjs/src/static_dependencies/starknet/utils/selector.js +1 -0
  428. package/dist/cjs/src/static_dependencies/starknet/utils/shortString.js +1 -0
  429. package/dist/cjs/src/static_dependencies/starknet/utils/typedData.js +1 -1
  430. package/dist/cjs/src/static_dependencies/watchable/src/unpromise.js +6 -0
  431. package/dist/cjs/src/static_dependencies/zklink/zklink-sdk-web.js +6 -0
  432. package/dist/cjs/src/timex.js +1 -0
  433. package/dist/cjs/src/tokocrypto.js +1 -1
  434. package/dist/cjs/src/toobit.js +1 -1
  435. package/dist/cjs/src/upbit.js +1 -1
  436. package/dist/cjs/src/wavesexchange.js +1 -1
  437. package/dist/cjs/src/whitebit.js +1 -1
  438. package/dist/cjs/src/woo.js +1 -1
  439. package/dist/cjs/src/woofipro.js +1 -1
  440. package/dist/cjs/src/xt.js +1 -1
  441. package/dist/cjs/src/yobit.js +1 -1
  442. package/dist/cjs/src/zaif.js +1 -1
  443. package/dist/cjs/src/zonda.js +1 -1
  444. package/js/ccxt.d.ts +8 -2
  445. package/js/ccxt.js +12 -2
  446. package/js/src/abstract/alpaca.js +6 -0
  447. package/js/src/abstract/apex.js +6 -0
  448. package/js/src/abstract/arkham.js +6 -0
  449. package/js/src/abstract/ascendex.js +6 -0
  450. package/js/src/abstract/backpack.js +6 -0
  451. package/js/src/abstract/bequant.js +6 -0
  452. package/js/src/abstract/bigone.js +6 -0
  453. package/js/src/abstract/binance.d.ts +1 -0
  454. package/js/src/abstract/binance.js +6 -0
  455. package/js/src/abstract/binancecoinm.d.ts +1 -0
  456. package/js/src/abstract/binancecoinm.js +6 -0
  457. package/js/src/abstract/binanceus.d.ts +1 -0
  458. package/js/src/abstract/binanceus.js +6 -0
  459. package/js/src/abstract/binanceusdm.d.ts +1 -0
  460. package/js/src/abstract/binanceusdm.js +6 -0
  461. package/js/src/abstract/bingx.d.ts +1 -0
  462. package/js/src/abstract/bingx.js +6 -0
  463. package/js/src/abstract/bit2c.js +6 -0
  464. package/js/src/abstract/bitbank.js +6 -0
  465. package/js/src/abstract/bitbns.js +6 -0
  466. package/js/src/abstract/bitfinex.js +6 -0
  467. package/js/src/abstract/bitflyer.js +6 -0
  468. package/js/src/abstract/bitget.js +6 -0
  469. package/js/src/abstract/bithumb.js +6 -0
  470. package/js/src/abstract/bitmart.js +6 -0
  471. package/js/src/abstract/bitmex.js +6 -0
  472. package/js/src/abstract/bitopro.js +6 -0
  473. package/js/src/abstract/bitrue.js +6 -0
  474. package/js/src/abstract/bitso.js +6 -0
  475. package/js/src/abstract/bitstamp.js +6 -0
  476. package/js/src/abstract/bitteam.js +6 -0
  477. package/js/src/abstract/bittrade.js +6 -0
  478. package/js/src/abstract/bitvavo.js +6 -0
  479. package/js/src/abstract/blockchaincom.js +6 -0
  480. package/js/src/abstract/blofin.js +6 -0
  481. package/js/src/abstract/btcalpha.js +6 -0
  482. package/js/src/abstract/btcbox.js +6 -0
  483. package/js/src/abstract/btcmarkets.js +6 -0
  484. package/js/src/abstract/btcturk.js +6 -0
  485. package/js/src/abstract/bullish.d.ts +65 -0
  486. package/js/src/abstract/bullish.js +11 -0
  487. package/js/src/abstract/bybit.d.ts +27 -0
  488. package/js/src/abstract/bybit.js +6 -0
  489. package/js/src/abstract/cex.js +6 -0
  490. package/js/src/abstract/coinbase.js +6 -0
  491. package/js/src/abstract/coinbaseadvanced.js +6 -0
  492. package/js/src/abstract/coinbaseexchange.js +6 -0
  493. package/js/src/abstract/coinbaseinternational.js +6 -0
  494. package/js/src/abstract/coincatch.js +6 -0
  495. package/js/src/abstract/coincheck.js +6 -0
  496. package/js/src/abstract/coinex.js +6 -0
  497. package/js/src/abstract/coinmate.js +6 -0
  498. package/js/src/abstract/coinmetro.js +6 -0
  499. package/js/src/abstract/coinone.js +6 -0
  500. package/js/src/abstract/coinsph.js +6 -0
  501. package/js/src/abstract/coinspot.js +6 -0
  502. package/js/src/abstract/cryptocom.js +6 -0
  503. package/js/src/abstract/cryptomus.js +6 -0
  504. package/js/src/abstract/deepcoin.js +6 -0
  505. package/js/src/abstract/defx.js +6 -0
  506. package/js/src/abstract/delta.js +6 -0
  507. package/js/src/abstract/deribit.js +6 -0
  508. package/js/src/abstract/derive.js +6 -0
  509. package/js/src/abstract/digifinex.js +6 -0
  510. package/js/src/abstract/dydx.js +6 -0
  511. package/js/src/abstract/exmo.js +6 -0
  512. package/js/src/abstract/fmfwio.js +6 -0
  513. package/js/src/abstract/foxbit.js +6 -0
  514. package/js/src/abstract/gate.js +6 -0
  515. package/js/src/abstract/gateio.js +6 -0
  516. package/js/src/abstract/gemini.js +6 -0
  517. package/js/src/abstract/hashkey.js +6 -0
  518. package/js/src/abstract/hibachi.js +6 -0
  519. package/js/src/abstract/hitbtc.js +6 -0
  520. package/js/src/abstract/hollaex.js +6 -0
  521. package/js/src/abstract/htx.js +6 -0
  522. package/js/src/abstract/huobi.js +6 -0
  523. package/js/src/abstract/hyperliquid.js +6 -0
  524. package/js/src/abstract/independentreserve.js +6 -0
  525. package/js/src/abstract/indodax.js +6 -0
  526. package/js/src/abstract/kraken.js +6 -0
  527. package/js/src/abstract/krakenfutures.js +6 -0
  528. package/js/src/abstract/kucoin.d.ts +15 -0
  529. package/js/src/abstract/kucoin.js +6 -0
  530. package/js/src/abstract/kucoinfutures.d.ts +15 -0
  531. package/js/src/abstract/kucoinfutures.js +6 -0
  532. package/js/src/abstract/latoken.js +6 -0
  533. package/js/src/abstract/lbank.js +6 -0
  534. package/js/src/abstract/luno.js +6 -0
  535. package/js/src/abstract/mercado.js +6 -0
  536. package/js/src/abstract/mexc.d.ts +7 -0
  537. package/js/src/abstract/mexc.js +6 -0
  538. package/js/src/abstract/modetrade.js +6 -0
  539. package/js/src/abstract/myokx.d.ts +90 -39
  540. package/js/src/abstract/myokx.js +6 -0
  541. package/js/src/abstract/ndax.js +6 -0
  542. package/js/src/abstract/novadax.js +6 -0
  543. package/js/src/abstract/oceanex.js +6 -0
  544. package/js/src/abstract/okx.d.ts +90 -39
  545. package/js/src/abstract/okx.js +6 -0
  546. package/js/src/abstract/okxus.d.ts +90 -39
  547. package/js/src/abstract/okxus.js +6 -0
  548. package/js/src/abstract/onetrading.js +6 -0
  549. package/js/src/abstract/oxfun.js +6 -0
  550. package/js/src/abstract/p2b.js +6 -0
  551. package/js/src/abstract/paradex.js +6 -0
  552. package/js/src/abstract/paymium.js +6 -0
  553. package/js/src/abstract/phemex.js +6 -0
  554. package/js/src/abstract/poloniex.js +6 -0
  555. package/js/src/abstract/probit.js +6 -0
  556. package/js/src/abstract/timex.js +6 -0
  557. package/js/src/abstract/tokocrypto.js +6 -0
  558. package/js/src/abstract/toobit.js +6 -0
  559. package/js/src/abstract/upbit.js +6 -0
  560. package/js/src/abstract/wavesexchange.js +6 -0
  561. package/js/src/abstract/whitebit.js +6 -0
  562. package/js/src/abstract/woo.js +6 -0
  563. package/js/src/abstract/woofipro.js +6 -0
  564. package/js/src/abstract/xt.js +6 -0
  565. package/js/src/abstract/yobit.js +6 -0
  566. package/js/src/abstract/zaif.js +6 -0
  567. package/js/src/abstract/zonda.js +6 -0
  568. package/js/src/alpaca.js +6 -0
  569. package/js/src/apex.js +6 -0
  570. package/js/src/arkham.js +6 -0
  571. package/js/src/ascendex.js +6 -0
  572. package/js/src/backpack.js +6 -0
  573. package/js/src/base/Exchange.d.ts +2 -2
  574. package/js/src/base/Exchange.js +11 -6
  575. package/js/src/base/Precise.js +6 -0
  576. package/js/src/base/errorHierarchy.js +6 -0
  577. package/js/src/base/errors.js +6 -0
  578. package/js/src/base/functions/crypto.js +6 -0
  579. package/js/src/base/functions/encode.js +6 -0
  580. package/js/src/base/functions/generic.js +6 -0
  581. package/js/src/base/functions/misc.js +6 -0
  582. package/js/src/base/functions/number.js +6 -0
  583. package/js/src/base/functions/platform.js +6 -0
  584. package/js/src/base/functions/rsa.js +6 -0
  585. package/js/src/base/functions/string.js +6 -0
  586. package/js/src/base/functions/throttle.js +6 -0
  587. package/js/src/base/functions/time.js +6 -0
  588. package/js/src/base/functions/totp.js +6 -0
  589. package/js/src/base/functions/type.js +6 -0
  590. package/js/src/base/functions.js +6 -0
  591. package/js/src/base/types.js +6 -0
  592. package/js/src/base/ws/Cache.js +6 -0
  593. package/js/src/base/ws/Client.d.ts +1 -0
  594. package/js/src/base/ws/Client.js +6 -0
  595. package/js/src/base/ws/Future.js +6 -0
  596. package/js/src/base/ws/OrderBook.js +6 -0
  597. package/js/src/base/ws/OrderBookSide.js +6 -0
  598. package/js/src/base/ws/WsClient.js +21 -0
  599. package/js/src/base/ws/functions.js +6 -0
  600. package/js/src/bequant.js +6 -0
  601. package/js/src/bigone.js +6 -0
  602. package/js/src/binance.d.ts +15 -33
  603. package/js/src/binance.js +167 -38
  604. package/js/src/binancecoinm.js +6 -0
  605. package/js/src/binanceus.js +6 -0
  606. package/js/src/binanceusdm.js +6 -0
  607. package/js/src/bingx.js +8 -1
  608. package/js/src/bit2c.js +6 -0
  609. package/js/src/bitbank.js +6 -0
  610. package/js/src/bitbns.js +6 -0
  611. package/js/src/bitfinex.js +6 -0
  612. package/js/src/bitflyer.js +6 -0
  613. package/js/src/bitget.js +6 -0
  614. package/js/src/bithumb.js +6 -0
  615. package/js/src/bitmart.js +7 -0
  616. package/js/src/bitmex.js +6 -0
  617. package/js/src/bitopro.js +6 -0
  618. package/js/src/bitrue.js +6 -0
  619. package/js/src/bitso.js +6 -0
  620. package/js/src/bitstamp.js +6 -0
  621. package/js/src/bitteam.js +6 -0
  622. package/js/src/bittrade.js +6 -0
  623. package/js/src/bitvavo.js +6 -0
  624. package/js/src/blockchaincom.js +6 -0
  625. package/js/src/blofin.js +6 -0
  626. package/js/src/btcalpha.js +6 -0
  627. package/js/src/btcbox.js +6 -0
  628. package/js/src/btcmarkets.js +6 -0
  629. package/js/src/btcturk.js +6 -0
  630. package/js/src/bullish.d.ts +446 -0
  631. package/js/src/bullish.js +2918 -0
  632. package/js/src/bybit.js +70 -37
  633. package/js/src/cex.js +6 -0
  634. package/js/src/coinbase.js +6 -0
  635. package/js/src/coinbaseadvanced.js +6 -0
  636. package/js/src/coinbaseexchange.js +6 -0
  637. package/js/src/coinbaseinternational.js +6 -0
  638. package/js/src/coincatch.js +6 -0
  639. package/js/src/coincheck.js +6 -0
  640. package/js/src/coinex.js +6 -0
  641. package/js/src/coinmate.js +6 -0
  642. package/js/src/coinmetro.js +6 -0
  643. package/js/src/coinone.js +6 -0
  644. package/js/src/coinsph.js +6 -0
  645. package/js/src/coinspot.js +6 -0
  646. package/js/src/cryptocom.js +6 -0
  647. package/js/src/cryptomus.js +6 -0
  648. package/js/src/deepcoin.js +7 -1
  649. package/js/src/defx.js +6 -0
  650. package/js/src/delta.js +6 -0
  651. package/js/src/deribit.js +6 -0
  652. package/js/src/derive.js +6 -0
  653. package/js/src/digifinex.js +6 -0
  654. package/js/src/dydx.js +6 -0
  655. package/js/src/exmo.js +6 -0
  656. package/js/src/fmfwio.js +6 -0
  657. package/js/src/foxbit.js +6 -0
  658. package/js/src/gate.js +8 -2
  659. package/js/src/gateio.js +6 -0
  660. package/js/src/gemini.js +6 -0
  661. package/js/src/hashkey.js +6 -0
  662. package/js/src/hibachi.js +6 -0
  663. package/js/src/hitbtc.js +6 -0
  664. package/js/src/hollaex.js +6 -0
  665. package/js/src/htx.js +10 -1
  666. package/js/src/huobi.js +6 -0
  667. package/js/src/hyperliquid.d.ts +24 -0
  668. package/js/src/hyperliquid.js +124 -14
  669. package/js/src/independentreserve.js +6 -0
  670. package/js/src/indodax.js +6 -0
  671. package/js/src/kraken.js +6 -0
  672. package/js/src/krakenfutures.js +6 -0
  673. package/js/src/kucoin.js +28 -3
  674. package/js/src/kucoinfutures.js +6 -0
  675. package/js/src/latoken.js +6 -0
  676. package/js/src/lbank.js +6 -0
  677. package/js/src/luno.js +6 -0
  678. package/js/src/mercado.js +6 -0
  679. package/js/src/mexc.js +13 -0
  680. package/js/src/modetrade.js +6 -0
  681. package/js/src/myokx.js +6 -0
  682. package/js/src/ndax.js +6 -0
  683. package/js/src/novadax.js +6 -0
  684. package/js/src/oceanex.js +6 -0
  685. package/js/src/okx.js +123 -63
  686. package/js/src/okxus.js +6 -0
  687. package/js/src/onetrading.js +6 -0
  688. package/js/src/oxfun.js +6 -0
  689. package/js/src/p2b.js +6 -0
  690. package/js/src/paradex.d.ts +15 -1
  691. package/js/src/paradex.js +84 -3
  692. package/js/src/paymium.js +6 -0
  693. package/js/src/phemex.js +6 -0
  694. package/js/src/poloniex.js +6 -0
  695. package/js/src/pro/alpaca.js +6 -0
  696. package/js/src/pro/apex.js +6 -0
  697. package/js/src/pro/arkham.js +6 -0
  698. package/js/src/pro/ascendex.js +6 -0
  699. package/js/src/pro/backpack.js +6 -0
  700. package/js/src/pro/bequant.js +6 -0
  701. package/js/src/pro/binance.d.ts +7 -0
  702. package/js/src/pro/binance.js +137 -29
  703. package/js/src/pro/binancecoinm.js +6 -0
  704. package/js/src/pro/binanceus.js +6 -0
  705. package/js/src/pro/binanceusdm.js +6 -0
  706. package/js/src/pro/bingx.js +6 -0
  707. package/js/src/pro/bitfinex.js +6 -0
  708. package/js/src/pro/bitget.js +6 -0
  709. package/js/src/pro/bithumb.js +6 -0
  710. package/js/src/pro/bitmart.js +6 -0
  711. package/js/src/pro/bitmex.js +6 -0
  712. package/js/src/pro/bitopro.js +6 -0
  713. package/js/src/pro/bitrue.js +6 -0
  714. package/js/src/pro/bitstamp.js +6 -0
  715. package/js/src/pro/bittrade.js +6 -0
  716. package/js/src/pro/bitvavo.js +6 -0
  717. package/js/src/pro/blockchaincom.js +6 -0
  718. package/js/src/pro/blofin.js +6 -0
  719. package/js/src/pro/bullish.d.ts +108 -0
  720. package/js/src/pro/bullish.js +780 -0
  721. package/js/src/pro/bybit.js +6 -0
  722. package/js/src/pro/cex.js +6 -0
  723. package/js/src/pro/coinbase.js +8 -2
  724. package/js/src/pro/coinbaseadvanced.js +6 -0
  725. package/js/src/pro/coinbaseexchange.js +6 -0
  726. package/js/src/pro/coinbaseinternational.js +6 -0
  727. package/js/src/pro/coincatch.js +6 -0
  728. package/js/src/pro/coincheck.js +6 -0
  729. package/js/src/pro/coinex.js +6 -0
  730. package/js/src/pro/coinone.js +6 -0
  731. package/js/src/pro/cryptocom.js +6 -0
  732. package/js/src/pro/deepcoin.js +6 -0
  733. package/js/src/pro/defx.js +6 -0
  734. package/js/src/pro/deribit.js +6 -0
  735. package/js/src/pro/derive.js +6 -0
  736. package/js/src/pro/dydx.js +6 -0
  737. package/js/src/pro/exmo.js +6 -0
  738. package/js/src/pro/gate.js +6 -0
  739. package/js/src/pro/gateio.js +6 -0
  740. package/js/src/pro/gemini.js +6 -0
  741. package/js/src/pro/hashkey.js +6 -0
  742. package/js/src/pro/hitbtc.js +6 -0
  743. package/js/src/pro/hollaex.js +6 -0
  744. package/js/src/pro/htx.js +6 -0
  745. package/js/src/pro/huobi.js +6 -0
  746. package/js/src/pro/hyperliquid.d.ts +13 -1
  747. package/js/src/pro/hyperliquid.js +81 -15
  748. package/js/src/pro/independentreserve.js +6 -0
  749. package/js/src/pro/kraken.js +6 -0
  750. package/js/src/pro/krakenfutures.js +6 -0
  751. package/js/src/pro/kucoin.js +6 -0
  752. package/js/src/pro/kucoinfutures.js +6 -0
  753. package/js/src/pro/lbank.js +6 -0
  754. package/js/src/pro/luno.js +6 -0
  755. package/js/src/pro/mexc.js +6 -0
  756. package/js/src/pro/modetrade.js +6 -0
  757. package/js/src/pro/myokx.js +6 -0
  758. package/js/src/pro/ndax.js +6 -0
  759. package/js/src/pro/okx.js +6 -0
  760. package/js/src/pro/okxus.js +6 -0
  761. package/js/src/pro/onetrading.js +6 -0
  762. package/js/src/pro/oxfun.js +6 -0
  763. package/js/src/pro/p2b.js +6 -0
  764. package/js/src/pro/paradex.js +6 -0
  765. package/js/src/pro/phemex.js +6 -0
  766. package/js/src/pro/poloniex.js +6 -0
  767. package/js/src/pro/probit.js +6 -0
  768. package/js/src/pro/toobit.js +6 -0
  769. package/js/src/pro/upbit.d.ts +0 -1
  770. package/js/src/pro/upbit.js +34 -82
  771. package/js/src/pro/whitebit.js +6 -0
  772. package/js/src/pro/woo.js +6 -0
  773. package/js/src/pro/woofipro.js +6 -0
  774. package/js/src/pro/xt.js +6 -0
  775. package/js/src/probit.js +6 -0
  776. package/js/src/protobuf/mexc/compiled.cjs +6 -0
  777. package/js/src/static_dependencies/dydx-v4-client/cosmos/base/v1beta1/coin.js +6 -0
  778. package/js/src/static_dependencies/dydx-v4-client/cosmos/crypto/multisig/keys.js +6 -0
  779. package/js/src/static_dependencies/dydx-v4-client/cosmos/crypto/multisig/v1beta1/multisig.js +6 -0
  780. package/js/src/static_dependencies/dydx-v4-client/cosmos/crypto/secp256k1/keys.js +6 -0
  781. package/js/src/static_dependencies/dydx-v4-client/cosmos/tx/signing/v1beta1/signing.js +6 -0
  782. package/js/src/static_dependencies/dydx-v4-client/cosmos/tx/v1beta1/tx.js +6 -0
  783. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/accountplus/tx.js +6 -0
  784. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/block_rate_limit_config.js +6 -0
  785. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/clob_pair.js +6 -0
  786. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/equity_tier_limit_config.js +6 -0
  787. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/finalize_block.js +6 -0
  788. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/liquidations.js +6 -0
  789. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/liquidations_config.js +6 -0
  790. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/matches.js +6 -0
  791. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/order.js +6 -0
  792. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/order_removals.js +6 -0
  793. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/tx.js +6 -0
  794. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/sending/transfer.js +6 -0
  795. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/sending/tx.js +6 -0
  796. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/subaccounts/asset_position.js +6 -0
  797. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/subaccounts/perpetual_position.js +6 -0
  798. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/subaccounts/subaccount.js +6 -0
  799. package/js/src/static_dependencies/dydx-v4-client/google/protobuf/any.js +6 -0
  800. package/js/src/static_dependencies/dydx-v4-client/helpers.js +6 -0
  801. package/js/src/static_dependencies/dydx-v4-client/long/index.cjs +6 -0
  802. package/js/src/static_dependencies/dydx-v4-client/onboarding.js +6 -0
  803. package/js/src/static_dependencies/dydx-v4-client/registry.js +6 -0
  804. package/js/src/static_dependencies/ethers/abi-coder.js +6 -0
  805. package/js/src/static_dependencies/ethers/address/address.js +6 -0
  806. package/js/src/static_dependencies/ethers/address/checks.js +6 -0
  807. package/js/src/static_dependencies/ethers/address/contract-address.js +6 -0
  808. package/js/src/static_dependencies/ethers/address/index.js +6 -0
  809. package/js/src/static_dependencies/ethers/bytes32.js +6 -0
  810. package/js/src/static_dependencies/ethers/coders/abstract-coder.js +6 -0
  811. package/js/src/static_dependencies/ethers/coders/address.js +6 -0
  812. package/js/src/static_dependencies/ethers/coders/anonymous.js +6 -0
  813. package/js/src/static_dependencies/ethers/coders/array.js +6 -0
  814. package/js/src/static_dependencies/ethers/coders/boolean.js +6 -0
  815. package/js/src/static_dependencies/ethers/coders/bytes.js +6 -0
  816. package/js/src/static_dependencies/ethers/coders/fixed-bytes.js +6 -0
  817. package/js/src/static_dependencies/ethers/coders/null.js +6 -0
  818. package/js/src/static_dependencies/ethers/coders/number.js +6 -0
  819. package/js/src/static_dependencies/ethers/coders/string.js +6 -0
  820. package/js/src/static_dependencies/ethers/coders/tuple.js +6 -0
  821. package/js/src/static_dependencies/ethers/fragments.js +6 -0
  822. package/js/src/static_dependencies/ethers/hash/index.js +6 -0
  823. package/js/src/static_dependencies/ethers/hash/solidity.js +6 -0
  824. package/js/src/static_dependencies/ethers/hash/typed-data.js +6 -0
  825. package/js/src/static_dependencies/ethers/index.js +6 -0
  826. package/js/src/static_dependencies/ethers/interface.js +6 -0
  827. package/js/src/static_dependencies/ethers/typed.js +6 -0
  828. package/js/src/static_dependencies/ethers/utils/base58.js +6 -0
  829. package/js/src/static_dependencies/ethers/utils/base64-browser.js +6 -0
  830. package/js/src/static_dependencies/ethers/utils/base64.js +6 -0
  831. package/js/src/static_dependencies/ethers/utils/data.js +6 -0
  832. package/js/src/static_dependencies/ethers/utils/errors.js +6 -0
  833. package/js/src/static_dependencies/ethers/utils/events.js +6 -0
  834. package/js/src/static_dependencies/ethers/utils/fixednumber.js +6 -0
  835. package/js/src/static_dependencies/ethers/utils/index.js +6 -0
  836. package/js/src/static_dependencies/ethers/utils/maths.js +6 -0
  837. package/js/src/static_dependencies/ethers/utils/properties.js +6 -0
  838. package/js/src/static_dependencies/ethers/utils/rlp-decode.js +6 -0
  839. package/js/src/static_dependencies/ethers/utils/rlp-encode.js +6 -0
  840. package/js/src/static_dependencies/ethers/utils/rlp.js +6 -0
  841. package/js/src/static_dependencies/ethers/utils/units.js +6 -0
  842. package/js/src/static_dependencies/ethers/utils/utf8.js +6 -0
  843. package/js/src/static_dependencies/ethers/utils/uuid.js +6 -0
  844. package/js/src/static_dependencies/fflake/browser.js +6 -0
  845. package/js/src/static_dependencies/jsencrypt/JSEncrypt.js +6 -0
  846. package/js/src/static_dependencies/jsencrypt/JSEncryptRSAKey.js +6 -0
  847. package/js/src/static_dependencies/jsencrypt/index.js +6 -0
  848. package/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.js +6 -0
  849. package/js/src/static_dependencies/jsencrypt/lib/asn1js/base64.js +6 -0
  850. package/js/src/static_dependencies/jsencrypt/lib/asn1js/hex.js +6 -0
  851. package/js/src/static_dependencies/jsencrypt/lib/asn1js/int10.js +6 -0
  852. package/js/src/static_dependencies/jsencrypt/lib/asn1js/oids.js +6 -0
  853. package/js/src/static_dependencies/jsencrypt/lib/jsbn/base64.js +6 -0
  854. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.js +6 -0
  855. package/js/src/static_dependencies/jsencrypt/lib/jsbn/prng4.js +6 -0
  856. package/js/src/static_dependencies/jsencrypt/lib/jsbn/rng.js +6 -0
  857. package/js/src/static_dependencies/jsencrypt/lib/jsbn/rsa.js +6 -0
  858. package/js/src/static_dependencies/jsencrypt/lib/jsbn/util.js +6 -0
  859. package/js/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +6 -0
  860. package/js/src/static_dependencies/jsencrypt/lib/jsrsasign/yahoo.js +6 -0
  861. package/js/src/static_dependencies/messagepack/msgpack.js +6 -0
  862. package/js/src/static_dependencies/noble-curves/_shortw_utils.js +6 -0
  863. package/js/src/static_dependencies/noble-curves/abstract/curve.js +6 -0
  864. package/js/src/static_dependencies/noble-curves/abstract/edwards.js +6 -0
  865. package/js/src/static_dependencies/noble-curves/abstract/hash-to-curve.js +6 -0
  866. package/js/src/static_dependencies/noble-curves/abstract/modular.js +6 -0
  867. package/js/src/static_dependencies/noble-curves/abstract/montgomery.js +6 -0
  868. package/js/src/static_dependencies/noble-curves/abstract/poseidon.js +6 -0
  869. package/js/src/static_dependencies/noble-curves/abstract/utils.js +6 -0
  870. package/js/src/static_dependencies/noble-curves/abstract/weierstrass.js +6 -0
  871. package/js/src/static_dependencies/noble-curves/bn.js +6 -0
  872. package/js/src/static_dependencies/noble-curves/ed25519.js +6 -0
  873. package/js/src/static_dependencies/noble-curves/ed448.js +6 -0
  874. package/js/src/static_dependencies/noble-curves/index.js +6 -0
  875. package/js/src/static_dependencies/noble-curves/jubjub.js +6 -0
  876. package/js/src/static_dependencies/noble-curves/p256.js +6 -0
  877. package/js/src/static_dependencies/noble-curves/p384.js +6 -0
  878. package/js/src/static_dependencies/noble-curves/p521.js +6 -0
  879. package/js/src/static_dependencies/noble-curves/pasta.js +6 -0
  880. package/js/src/static_dependencies/noble-curves/secp256k1.js +6 -0
  881. package/js/src/static_dependencies/noble-hashes/_assert.js +6 -0
  882. package/js/src/static_dependencies/noble-hashes/_blake2.js +6 -0
  883. package/js/src/static_dependencies/noble-hashes/_sha2.js +6 -0
  884. package/js/src/static_dependencies/noble-hashes/_u64.js +6 -0
  885. package/js/src/static_dependencies/noble-hashes/argon2.js +6 -0
  886. package/js/src/static_dependencies/noble-hashes/blake2b.js +6 -0
  887. package/js/src/static_dependencies/noble-hashes/blake2s.js +6 -0
  888. package/js/src/static_dependencies/noble-hashes/blake3.js +6 -0
  889. package/js/src/static_dependencies/noble-hashes/crypto.js +6 -0
  890. package/js/src/static_dependencies/noble-hashes/cryptoNode.js +6 -0
  891. package/js/src/static_dependencies/noble-hashes/eskdf.js +6 -0
  892. package/js/src/static_dependencies/noble-hashes/hkdf.js +6 -0
  893. package/js/src/static_dependencies/noble-hashes/hmac.js +6 -0
  894. package/js/src/static_dependencies/noble-hashes/index.js +6 -0
  895. package/js/src/static_dependencies/noble-hashes/md5.js +6 -0
  896. package/js/src/static_dependencies/noble-hashes/pbkdf2.js +6 -0
  897. package/js/src/static_dependencies/noble-hashes/ripemd160.js +6 -0
  898. package/js/src/static_dependencies/noble-hashes/scrypt.js +6 -0
  899. package/js/src/static_dependencies/noble-hashes/sha1.js +6 -0
  900. package/js/src/static_dependencies/noble-hashes/sha256.js +6 -0
  901. package/js/src/static_dependencies/noble-hashes/sha3-addons.js +6 -0
  902. package/js/src/static_dependencies/noble-hashes/sha3.js +6 -0
  903. package/js/src/static_dependencies/noble-hashes/sha512.js +6 -0
  904. package/js/src/static_dependencies/noble-hashes/utils.js +6 -0
  905. package/js/src/static_dependencies/node-fetch/body.js +6 -0
  906. package/js/src/static_dependencies/node-fetch/errors/abort-error.js +6 -0
  907. package/js/src/static_dependencies/node-fetch/errors/base.js +6 -0
  908. package/js/src/static_dependencies/node-fetch/errors/fetch-error.js +6 -0
  909. package/js/src/static_dependencies/node-fetch/headers.js +6 -0
  910. package/js/src/static_dependencies/node-fetch/index.js +6 -0
  911. package/js/src/static_dependencies/node-fetch/request.js +6 -0
  912. package/js/src/static_dependencies/node-fetch/response.js +6 -0
  913. package/js/src/static_dependencies/node-fetch/utils/get-search.js +6 -0
  914. package/js/src/static_dependencies/node-fetch/utils/is-redirect.js +6 -0
  915. package/js/src/static_dependencies/node-fetch/utils/is.js +6 -0
  916. package/js/src/static_dependencies/node-fetch/utils/referrer.js +6 -0
  917. package/js/src/static_dependencies/proxies/agent-base/helpers.js +6 -0
  918. package/js/src/static_dependencies/proxies/agent-base/index.js +6 -0
  919. package/js/src/static_dependencies/proxies/http-proxy-agent/index.js +6 -0
  920. package/js/src/static_dependencies/proxies/https-proxy-agent/index.js +6 -0
  921. package/js/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.js +6 -0
  922. package/js/src/static_dependencies/qs/formats.js +6 -0
  923. package/js/src/static_dependencies/qs/index.js +6 -0
  924. package/js/src/static_dependencies/qs/parse.js +6 -0
  925. package/js/src/static_dependencies/qs/stringify.js +6 -0
  926. package/js/src/static_dependencies/qs/utils.js +6 -0
  927. package/js/src/static_dependencies/scure-base/index.js +6 -0
  928. package/js/src/static_dependencies/scure-bip32/index.js +6 -0
  929. package/js/src/static_dependencies/scure-bip39/index.js +6 -0
  930. package/js/src/static_dependencies/scure-bip39/wordlists/english.js +6 -0
  931. package/js/src/static_dependencies/scure-starknet/index.js +6 -0
  932. package/js/src/static_dependencies/starknet/constants.js +6 -0
  933. package/js/src/static_dependencies/starknet/index.js +6 -0
  934. package/js/src/static_dependencies/starknet/types/cairoEnum.js +6 -0
  935. package/js/src/static_dependencies/starknet/types/calldata.js +6 -0
  936. package/js/src/static_dependencies/starknet/types/index.js +6 -0
  937. package/js/src/static_dependencies/starknet/types/lib/contract/abi.js +6 -0
  938. package/js/src/static_dependencies/starknet/types/lib/contract/index.js +6 -0
  939. package/js/src/static_dependencies/starknet/types/lib/contract/legacy.js +6 -0
  940. package/js/src/static_dependencies/starknet/types/lib/contract/sierra.js +6 -0
  941. package/js/src/static_dependencies/starknet/types/lib/index.js +6 -0
  942. package/js/src/static_dependencies/starknet/types/typedData.js +6 -0
  943. package/js/src/static_dependencies/starknet/utils/address.js +6 -0
  944. package/js/src/static_dependencies/starknet/utils/assert.js +6 -0
  945. package/js/src/static_dependencies/starknet/utils/cairoDataTypes/felt.js +6 -0
  946. package/js/src/static_dependencies/starknet/utils/cairoDataTypes/uint256.js +6 -0
  947. package/js/src/static_dependencies/starknet/utils/cairoDataTypes/uint512.js +6 -0
  948. package/js/src/static_dependencies/starknet/utils/calldata/byteArray.js +6 -0
  949. package/js/src/static_dependencies/starknet/utils/calldata/cairo.js +6 -0
  950. package/js/src/static_dependencies/starknet/utils/calldata/enum/CairoCustomEnum.js +6 -0
  951. package/js/src/static_dependencies/starknet/utils/calldata/enum/CairoOption.js +6 -0
  952. package/js/src/static_dependencies/starknet/utils/calldata/enum/CairoResult.js +6 -0
  953. package/js/src/static_dependencies/starknet/utils/calldata/enum/index.js +6 -0
  954. package/js/src/static_dependencies/starknet/utils/calldata/formatter.js +6 -0
  955. package/js/src/static_dependencies/starknet/utils/calldata/index.js +6 -0
  956. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.js +6 -0
  957. package/js/src/static_dependencies/starknet/utils/calldata/parser/interface.js +6 -0
  958. package/js/src/static_dependencies/starknet/utils/calldata/parser/parser-0-1.1.0.js +6 -0
  959. package/js/src/static_dependencies/starknet/utils/calldata/parser/parser-2.0.0.js +6 -0
  960. package/js/src/static_dependencies/starknet/utils/calldata/propertyOrder.js +6 -0
  961. package/js/src/static_dependencies/starknet/utils/calldata/requestParser.js +6 -0
  962. package/js/src/static_dependencies/starknet/utils/calldata/responseParser.js +6 -0
  963. package/js/src/static_dependencies/starknet/utils/calldata/tuple.js +6 -0
  964. package/js/src/static_dependencies/starknet/utils/calldata/validate.js +6 -0
  965. package/js/src/static_dependencies/starknet/utils/encode.js +6 -0
  966. package/js/src/static_dependencies/starknet/utils/hash/classHash.js +6 -0
  967. package/js/src/static_dependencies/starknet/utils/hash/index.js +6 -0
  968. package/js/src/static_dependencies/starknet/utils/merkle.js +6 -0
  969. package/js/src/static_dependencies/starknet/utils/num.js +6 -0
  970. package/js/src/static_dependencies/starknet/utils/selector.js +6 -0
  971. package/js/src/static_dependencies/starknet/utils/shortString.js +6 -0
  972. package/js/src/static_dependencies/starknet/utils/starknetId.js +6 -0
  973. package/js/src/static_dependencies/starknet/utils/typedData.js +6 -0
  974. package/js/src/static_dependencies/starknet/utils/uint256.js +6 -0
  975. package/js/src/static_dependencies/starknet/utils/url.js +6 -0
  976. package/js/src/static_dependencies/watchable/src/index.js +6 -0
  977. package/js/src/static_dependencies/watchable/src/types.js +6 -0
  978. package/js/src/static_dependencies/watchable/src/unpromise.js +6 -0
  979. package/js/src/static_dependencies/zklink/zklink-sdk-web.js +6 -0
  980. package/js/src/timex.js +6 -0
  981. package/js/src/tokocrypto.js +6 -0
  982. package/js/src/toobit.js +6 -0
  983. package/js/src/upbit.js +6 -0
  984. package/js/src/wavesexchange.js +6 -0
  985. package/js/src/whitebit.js +6 -0
  986. package/js/src/woo.js +6 -0
  987. package/js/src/woofipro.js +6 -0
  988. package/js/src/xt.js +6 -0
  989. package/js/src/yobit.js +6 -0
  990. package/js/src/zaif.js +6 -0
  991. package/js/src/zonda.js +6 -0
  992. package/package.json +2 -2
@@ -0,0 +1,2919 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var bullish$1 = require('./abstract/bullish.js');
6
+ var errors = require('./base/errors.js');
7
+ var number = require('./base/functions/number.js');
8
+ var sha256 = require('./static_dependencies/noble-hashes/sha256.js');
9
+
10
+ // ----------------------------------------------------------------------------
11
+ // ---------------------------------------------------------------------------
12
+ /**
13
+ * @class bullish
14
+ * @augments Exchange
15
+ */
16
+ class bullish extends bullish$1["default"] {
17
+ describe() {
18
+ return this.deepExtend(super.describe(), {
19
+ 'id': 'bullish',
20
+ 'name': 'Bullish',
21
+ 'countries': ['DE'],
22
+ 'version': 'v3',
23
+ 'rateLimit': 20,
24
+ 'pro': true,
25
+ 'has': {
26
+ 'CORS': undefined,
27
+ 'spot': true,
28
+ 'margin': false,
29
+ 'swap': false,
30
+ 'future': false,
31
+ 'option': false,
32
+ 'addMargin': false,
33
+ 'borrowMargin': false,
34
+ 'cancelAllOrders': true,
35
+ 'cancelOrder': true,
36
+ 'cancelOrders': false,
37
+ 'createDepositAddress': false,
38
+ 'createLimitBuyOrder': true,
39
+ 'createLimitOrder': true,
40
+ 'createLimitSellOrder': true,
41
+ 'createMarketBuyOrder': true,
42
+ 'createMarketOrder': true,
43
+ 'createMarketSellOrder': true,
44
+ 'createOrder': true,
45
+ 'createPostOnlyOrder': true,
46
+ 'createTriggerOrder': true,
47
+ 'deposit': false,
48
+ 'editOrder': true,
49
+ 'fetchAccounts': true,
50
+ 'fetchBalance': true,
51
+ 'fetchBidsAsks': false,
52
+ 'fetchBorrowInterest': false,
53
+ 'fetchBorrowRateHistories': false,
54
+ 'fetchBorrowRateHistory': true,
55
+ 'fetchCanceledAndClosedOrders': true,
56
+ 'fetchCanceledOrders': true,
57
+ 'fetchClosedOrder': false,
58
+ 'fetchClosedOrders': true,
59
+ 'fetchCrossBorrowRate': false,
60
+ 'fetchCrossBorrowRates': false,
61
+ 'fetchCurrencies': true,
62
+ 'fetchDeposit': false,
63
+ 'fetchDepositAddress': true,
64
+ 'fetchDepositAddresses': false,
65
+ 'fetchDepositAddressesByNetwork': false,
66
+ 'fetchDeposits': false,
67
+ 'fetchDepositsWithdrawals': true,
68
+ 'fetchDepositWithdrawFee': false,
69
+ 'fetchDepositWithdrawFees': false,
70
+ 'fetchFundingHistory': false,
71
+ 'fetchFundingRate': false,
72
+ 'fetchFundingRateHistory': true,
73
+ 'fetchFundingRates': false,
74
+ 'fetchIndexOHLCV': false,
75
+ 'fetchIsolatedBorrowRate': false,
76
+ 'fetchIsolatedBorrowRates': false,
77
+ 'fetchL3OrderBook': false,
78
+ 'fetchLedger': false,
79
+ 'fetchLeverage': false,
80
+ 'fetchLeverageTiers': false,
81
+ 'fetchMarketLeverageTiers': false,
82
+ 'fetchMarkets': true,
83
+ 'fetchMarkOHLCV': false,
84
+ 'fetchMyTrades': true,
85
+ 'fetchOHLCV': true,
86
+ 'fetchOpenInterestHistory': false,
87
+ 'fetchOpenOrder': false,
88
+ 'fetchOpenOrders': true,
89
+ 'fetchOrder': true,
90
+ 'fetchOrderBook': true,
91
+ 'fetchOrderBooks': false,
92
+ 'fetchOrders': true,
93
+ 'fetchOrderTrades': true,
94
+ 'fetchPosition': false,
95
+ 'fetchPositionHistory': false,
96
+ 'fetchPositionMode': false,
97
+ 'fetchPositions': true,
98
+ 'fetchPositionsForSymbol': false,
99
+ 'fetchPositionsHistory': false,
100
+ 'fetchPositionsRisk': false,
101
+ 'fetchPremiumIndexOHLCV': false,
102
+ 'fetchStatus': false,
103
+ 'fetchTicker': true,
104
+ 'fetchTickers': false,
105
+ 'fetchTime': true,
106
+ 'fetchTrades': true,
107
+ 'fetchTradingFee': false,
108
+ 'fetchTradingFees': false,
109
+ 'fetchTradingLimits': false,
110
+ 'fetchTransactionFee': false,
111
+ 'fetchTransactionFees': false,
112
+ 'fetchTransactions': false,
113
+ 'fetchTransfers': true,
114
+ 'fetchWithdrawal': false,
115
+ 'fetchWithdrawals': false,
116
+ 'fetchWithdrawalWhitelist': false,
117
+ 'reduceMargin': false,
118
+ 'repayMargin': false,
119
+ 'setLeverage': false,
120
+ 'setMargin': false,
121
+ 'setMarginMode': false,
122
+ 'setPositionMode': false,
123
+ 'signIn': true,
124
+ 'transfer': true,
125
+ 'withdraw': true,
126
+ 'ws': true,
127
+ },
128
+ 'timeframes': {
129
+ '1m': '1m',
130
+ '5m': '5m',
131
+ '30m': '30m',
132
+ '1h': '1h',
133
+ '6h': '6h',
134
+ '12h': '12h',
135
+ '1d': '1d',
136
+ },
137
+ 'urls': {
138
+ 'logo': 'https://github.com/user-attachments/assets/68f0686b-84f0-4da9-a751-f7089af3a9ed',
139
+ 'api': {
140
+ 'public': 'https://api.exchange.bullish.com/trading-api',
141
+ 'private': 'https://api.exchange.bullish.com/trading-api',
142
+ },
143
+ 'test': {
144
+ 'public': 'https://api.simnext.bullish-test.com/trading-api',
145
+ 'private': 'https://api.simnext.bullish-test.com/trading-api',
146
+ },
147
+ 'www': 'https://bullish.com/',
148
+ 'referral': '',
149
+ 'doc': [
150
+ 'https://api.exchange.bullish.com/docs/api/rest/',
151
+ ],
152
+ },
153
+ 'api': {
154
+ 'public': {
155
+ 'get': {
156
+ 'v1/nonce': 1,
157
+ 'v1/time': 1,
158
+ 'v1/assets': 1,
159
+ 'v1/assets/{symbol}': 1,
160
+ 'v1/markets': 1,
161
+ 'v1/markets/{symbol}': 1,
162
+ 'v1/history/markets/{symbol}': 1,
163
+ 'v1/markets/{symbol}/orderbook/hybrid': 1,
164
+ 'v1/markets/{symbol}/trades': 1,
165
+ 'v1/markets/{symbol}/tick': 1,
166
+ 'v1/markets/{symbol}/candle': 1,
167
+ 'v1/history/markets/{symbol}/trades': 1,
168
+ 'v1/history/markets/{symbol}/funding-rate': 1,
169
+ 'v1/index-prices': 1,
170
+ 'v1/index-prices/{assetSymbol}': 1,
171
+ 'v1/expiry-prices/{symbol}': 1,
172
+ 'v1/option-ladder': 1,
173
+ 'v1/option-ladder/{symbol}': 1,
174
+ },
175
+ },
176
+ 'private': {
177
+ 'get': {
178
+ 'v2/orders': 1,
179
+ 'v2/history/orders': 1,
180
+ 'v2/orders/{orderId}': 1,
181
+ 'v2/amm-instructions': 1,
182
+ 'v2/amm-instructions/{instructionId}': 1,
183
+ 'v1/wallets/transactions': 1,
184
+ 'v1/wallets/limits/{symbol}': 1,
185
+ 'v1/wallets/deposit-instructions/crypto/{symbol}': 1,
186
+ 'v1/wallets/withdrawal-instructions/crypto/{symbol}': 1,
187
+ 'v1/wallets/deposit-instructions/fiat/{symbol}': 1,
188
+ 'v1/wallets/withdrawal-instructions/fiat/{symbol}': 1,
189
+ 'v1/wallets/self-hosted/verification-attempts': 1,
190
+ 'v1/trades': 5,
191
+ 'v1/history/trades': 5,
192
+ 'v1/trades/{tradeId}': 5,
193
+ 'v1/trades/client-order-id/{clientOrderId}': 1,
194
+ 'v1/accounts/asset': 1,
195
+ 'v1/accounts/asset/{symbol}': 1,
196
+ 'v1/users/logout': 1,
197
+ 'v1/users/hmac/login': 1,
198
+ 'v1/accounts/trading-accounts': 1,
199
+ 'v1/accounts/trading-accounts/{tradingAccountId}': 1,
200
+ 'v1/derivatives-positions': 1,
201
+ 'v1/history/derivatives-settlement': 1,
202
+ 'v1/history/transfer': 1,
203
+ 'v1/history/borrow-interest': 1,
204
+ 'v2/mmp-configuration': 1,
205
+ 'v2/otc-trades': 1,
206
+ 'v2/otc-trades/{otcTradeId}': 1,
207
+ 'v2/otc-trades/unconfirmed-trade': 1,
208
+ },
209
+ 'post': {
210
+ 'v2/orders': 5,
211
+ 'v2/command': 5,
212
+ 'v2/amm-instructions': 1,
213
+ 'v1/wallets/withdrawal': 1,
214
+ 'v2/users/login': 1,
215
+ 'v1/simulate-portfolio-margin': 1,
216
+ 'v1/wallets/self-hosted/initiate': 1,
217
+ 'v2/mmp-configuration': 1,
218
+ 'v2/otc-trades': 1,
219
+ 'v2/otc-command': 1,
220
+ },
221
+ },
222
+ },
223
+ 'fees': {
224
+ 'trading': {
225
+ 'tierBased': false,
226
+ 'percentage': true,
227
+ // todo check fees
228
+ 'taker': this.parseNumber('0.001'),
229
+ 'maker': this.parseNumber('0.001'),
230
+ },
231
+ },
232
+ 'precisionMode': number.TICK_SIZE,
233
+ // exchange-specific options
234
+ 'options': {
235
+ 'timeDifference': 0,
236
+ 'adjustForTimeDifference': false,
237
+ 'networks': {
238
+ 'BTC': 'BTC',
239
+ 'EOS': 'EOS',
240
+ 'ERC20': 'ETH',
241
+ },
242
+ 'defaultNetwork': 'ERC20',
243
+ 'defaultNetworks': {
244
+ 'USDC': 'ERC20',
245
+ },
246
+ 'tradingAccountId': undefined,
247
+ },
248
+ 'features': {
249
+ 'default': {
250
+ 'sandbox': true,
251
+ 'createOrder': {
252
+ 'marginMode': false,
253
+ 'triggerPrice': true,
254
+ 'triggerPriceType': undefined,
255
+ 'triggerDirection': false,
256
+ 'stopLossPrice': false,
257
+ 'takeProfitPrice': false,
258
+ 'attachedStopLossTakeProfit': undefined,
259
+ 'timeInForce': {
260
+ 'IOC': true,
261
+ 'FOK': true,
262
+ 'PO': true,
263
+ 'GTD': false,
264
+ },
265
+ 'hedged': false,
266
+ 'trailing': false,
267
+ 'leverage': false,
268
+ 'marketBuyByCost': false,
269
+ 'marketBuyRequiresPrice': false,
270
+ 'selfTradePrevention': false,
271
+ 'iceberg': false,
272
+ },
273
+ 'createOrders': undefined,
274
+ 'fetchMyTrades': {
275
+ 'marginMode': false,
276
+ 'limit': 100,
277
+ 'daysBack': 90,
278
+ 'symbolRequired': false,
279
+ 'untilDays': 90,
280
+ },
281
+ 'fetchOrder': {
282
+ 'marginMode': false,
283
+ 'trigger': false,
284
+ 'trailing': false,
285
+ 'symbolRequired': false,
286
+ },
287
+ 'fetchOrders': {
288
+ 'marginMode': false,
289
+ 'limit': 100,
290
+ 'daysBack': 90,
291
+ 'untilDays': 90,
292
+ 'trigger': false,
293
+ 'trailing': false,
294
+ 'symbolRequired': false,
295
+ },
296
+ 'fetchOpenOrders': {
297
+ 'marginMode': false,
298
+ 'limit': 100,
299
+ 'daysBack': 90,
300
+ 'untilDays': 90,
301
+ 'trigger': false,
302
+ 'trailing': false,
303
+ 'symbolRequired': false,
304
+ },
305
+ 'fetchCanceledAndClosedOrders': {
306
+ 'marginMode': false,
307
+ 'limit': 100,
308
+ 'daysBack': 90,
309
+ 'untilDays': 90,
310
+ 'trigger': false,
311
+ 'trailing': false,
312
+ 'symbolRequired': false,
313
+ },
314
+ 'fetchClosedOrders': {
315
+ 'marginMode': false,
316
+ 'limit': 100,
317
+ 'daysBack': 1,
318
+ 'daysBackCanceled': 1,
319
+ 'untilDays': 1,
320
+ 'trigger': false,
321
+ 'trailing': false,
322
+ 'symbolRequired': false,
323
+ },
324
+ 'fetchCanceledOrders': {
325
+ 'marginMode': false,
326
+ 'limit': 100,
327
+ 'daysBack': 1,
328
+ 'untilDays': 1,
329
+ 'trigger': false,
330
+ 'trailing': false,
331
+ 'symbolRequired': false,
332
+ },
333
+ 'fetchOHLCV': {
334
+ 'limit': 1000,
335
+ },
336
+ },
337
+ 'spot': {
338
+ 'extends': 'default',
339
+ },
340
+ 'swap': {
341
+ 'linear': {
342
+ 'extends': 'default',
343
+ },
344
+ 'inverse': undefined,
345
+ },
346
+ 'future': {
347
+ 'linear': {
348
+ 'extends': 'default',
349
+ },
350
+ 'inverse': undefined,
351
+ },
352
+ },
353
+ 'exceptions': {
354
+ 'exact': {
355
+ '1': errors.BadRequest,
356
+ '5': errors.InvalidOrder,
357
+ '6': errors.DuplicateOrderId,
358
+ '13': errors.BadRequest,
359
+ '15': errors.BadRequest,
360
+ '18': errors.BadRequest,
361
+ '1002': errors.BadRequest,
362
+ '2001': errors.BadRequest,
363
+ '2002': errors.BadRequest,
364
+ '2003': errors.BadRequest,
365
+ '2004': errors.BadRequest,
366
+ '2005': errors.ExchangeError,
367
+ '2006': errors.BadRequest,
368
+ '2007': errors.BadRequest,
369
+ '2008': errors.BadRequest,
370
+ '2009': errors.BadSymbol,
371
+ '2010': errors.AuthenticationError,
372
+ '2011': errors.AuthenticationError,
373
+ '2012': errors.BadRequest,
374
+ '2013': errors.InvalidOrder,
375
+ '2015': errors.OperationRejected,
376
+ '2016': errors.BadRequest,
377
+ '2017': errors.BadRequest,
378
+ '2018': errors.BadRequest,
379
+ '2020': errors.PermissionDenied,
380
+ '2021': errors.OperationRejected,
381
+ '2029': errors.InvalidNonce,
382
+ '2035': errors.InvalidNonce,
383
+ '3001': errors.InsufficientFunds,
384
+ '3002': errors.OrderNotFound,
385
+ '3003': errors.PermissionDenied,
386
+ '3004': errors.InsufficientFunds,
387
+ '3005': errors.InsufficientFunds,
388
+ '3006': errors.InsufficientFunds,
389
+ '3007': errors.DuplicateOrderId,
390
+ '3031': errors.BadRequest,
391
+ '3032': errors.BadRequest,
392
+ '3033': errors.PermissionDenied,
393
+ '3034': errors.RateLimitExceeded,
394
+ '3035': errors.RateLimitExceeded,
395
+ '3047': errors.OperationRejected,
396
+ '3048': errors.OperationRejected,
397
+ '3049': errors.OperationRejected,
398
+ '3051': errors.InsufficientFunds,
399
+ '3052': errors.InsufficientFunds,
400
+ '3063': errors.BadRequest,
401
+ '3064': errors.OrderNotFillable,
402
+ '3065': errors.MarketClosed,
403
+ '3066': errors.ExchangeError,
404
+ '3067': errors.MarketClosed,
405
+ '6007': errors.InvalidOrder,
406
+ '6011': errors.InvalidOrder,
407
+ '6012': errors.InvalidOrder,
408
+ '6013': errors.InvalidOrder,
409
+ '8301': errors.ExchangeError,
410
+ '8305': errors.ExchangeError,
411
+ '8306': errors.ExchangeError,
412
+ '8307': errors.ExchangeError,
413
+ '8310': errors.InvalidAddress,
414
+ '8311': errors.BadRequest,
415
+ '8313': errors.BadRequest,
416
+ '8315': errors.OperationRejected,
417
+ '8316': errors.OperationRejected,
418
+ '8317': errors.OperationRejected,
419
+ '8318': errors.NotSupported,
420
+ '8319': errors.NotSupported,
421
+ '8320': errors.InvalidAddress,
422
+ '8322': errors.BadRequest,
423
+ '8327': errors.AuthenticationError,
424
+ '8329': errors.ExchangeError,
425
+ '8331': errors.InvalidAddress,
426
+ '8332': errors.BadRequest,
427
+ '8333': errors.BadRequest,
428
+ '8334': errors.BadRequest,
429
+ '8335': errors.InvalidAddress,
430
+ '8336': errors.InvalidAddress,
431
+ '8399': errors.ExchangeError, // Unknown error
432
+ },
433
+ 'broad': {
434
+ 'HttpInvalidParameterException': errors.BadRequest,
435
+ 'UNAUTHORIZED_COMMAND': errors.AuthenticationError,
436
+ 'QUERY_FILTER_ERROR': errors.BadRequest,
437
+ 'INVALID_SYMBOL': errors.BadSymbol, // {"message":"Invalid symbol provided","errorCode":28004,"errorCodeName":"INVALID_SYMBOL"}
438
+ },
439
+ },
440
+ });
441
+ }
442
+ /**
443
+ * @method
444
+ * @name bullish#fetchTime
445
+ * @description fetches the current integer timestamp in milliseconds from the exchange server
446
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#tag--time
447
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
448
+ * @returns {int} the current integer timestamp in milliseconds from the exchange server
449
+ */
450
+ async fetchTime(params = {}) {
451
+ const response = await this.publicGetV1Time(params);
452
+ //
453
+ // {
454
+ // "datetime": "2025-05-05T20:05:50.999Z",
455
+ // "timestamp": 1746475550999
456
+ // }
457
+ //
458
+ return this.safeInteger(response, 'timestamp');
459
+ }
460
+ /**
461
+ * @method
462
+ * @name bullish#fetchCurrencies
463
+ * @description fetches all available currencies on an exchange
464
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/assets
465
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
466
+ * @returns {object} an associative dictionary of currencies
467
+ */
468
+ async fetchCurrencies(params = {}) {
469
+ const response = await this.publicGetV1Assets(params);
470
+ //
471
+ // [
472
+ // {
473
+ // "assetId": "72",
474
+ // "symbol": "BTT1M",
475
+ // "name": "BitTorrent (millions)",
476
+ // "precision": "5",
477
+ // "minBalanceInterest": "0.00000",
478
+ // "apr": "10.00",
479
+ // "minFee": "0.00000",
480
+ // "maxBorrow": "0.00000",
481
+ // "totalOfferedLoanQuantity": "0.00000",
482
+ // "loanBorrowedQuantity": "0.00000",
483
+ // "collateralBands":
484
+ // [
485
+ // {
486
+ // "collateralPercentage": "90.00",
487
+ // "bandLimitUSD": "100000.0000"
488
+ // },
489
+ // {
490
+ // "collateralPercentage": "68.00",
491
+ // "bandLimitUSD": "300000.0000"
492
+ // },
493
+ // {
494
+ // "collateralPercentage": "25.00",
495
+ // "bandLimitUSD": "600000.0000"
496
+ // }
497
+ // ],
498
+ // "underlyingAsset":
499
+ // {
500
+ // "symbol": "BTT1M",
501
+ // "assetId": "72",
502
+ // "bpmMinReturnStart": "0.9200",
503
+ // "bpmMinReturnEnd": "0.9300",
504
+ // "bpmMaxReturnStart": "1.0800",
505
+ // "bpmMaxReturnEnd": "1.0800",
506
+ // "marketRiskFloorPctStart": "2.60",
507
+ // "marketRiskFloorPctEnd": "2.50",
508
+ // "bpmTransitionDateTimeStart": "2025-05-05T08:00:00.000Z",
509
+ // "bpmTransitionDateTimeEnd": "2025-05-08T08:00:00.000Z"
510
+ // }
511
+ // }, ...
512
+ // ]
513
+ //
514
+ const result = {};
515
+ for (let i = 0; i < response.length; i++) {
516
+ const currency = response[i];
517
+ const id = this.safeString(currency, 'symbol');
518
+ const code = this.safeCurrencyCode(id);
519
+ const name = this.safeString(currency, 'name');
520
+ const precision = this.safeString(currency, 'precision');
521
+ result[code] = {
522
+ 'id': id,
523
+ 'code': code,
524
+ 'name': name,
525
+ 'active': undefined,
526
+ 'deposit': undefined,
527
+ 'withdraw': undefined,
528
+ 'fee': this.safeNumber(currency, 'minFee'),
529
+ 'precision': this.parseNumber(this.parsePrecision(precision)),
530
+ 'limits': {
531
+ 'amount': { 'min': undefined, 'max': undefined },
532
+ 'withdraw': { 'min': undefined, 'max': undefined },
533
+ },
534
+ 'networks': {},
535
+ 'type': 'crypto',
536
+ 'info': currency,
537
+ };
538
+ }
539
+ return result;
540
+ }
541
+ /**
542
+ * @method
543
+ * @name bullish#fetchMarkets
544
+ * @description retrieves data on all markets for ace
545
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/markets
546
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
547
+ * @returns {object[]} an array of objects representing market data
548
+ */
549
+ async fetchMarkets(params = {}) {
550
+ if (this.options['adjustForTimeDifference']) {
551
+ await this.loadTimeDifference();
552
+ }
553
+ const response = await this.publicGetV1Markets(params);
554
+ return this.parseMarkets(response);
555
+ }
556
+ parseMarket(market) {
557
+ //
558
+ // {
559
+ // "marketId": "20069",
560
+ // "symbol": "BTC-USDC-20250516",
561
+ // "quoteAssetId": "5",
562
+ // "baseAssetId": "1",
563
+ // "quoteSymbol": "USDC",
564
+ // "baseSymbol": "BTC",
565
+ // "quotePrecision": "4",
566
+ // "basePrecision": "8",
567
+ // "pricePrecision": "4",
568
+ // "quantityPrecision": "8",
569
+ // "costPrecision": "4",
570
+ // "minQuantityLimit": "0.00050000",
571
+ // "maxQuantityLimit": "200.00000000",
572
+ // "maxPriceLimit": null,
573
+ // "minPriceLimit": null,
574
+ // "maxCostLimit": null,
575
+ // "minCostLimit": null,
576
+ // "timeZone": "Etc/UTC",
577
+ // "tickSize": "0.1000",
578
+ // "liquidityTickSize": "100.0000",
579
+ // "liquidityPrecision": "4",
580
+ // "makerFee": "0",
581
+ // "takerFee": "2",
582
+ // "roundingCorrectionFactor": "0.00000100",
583
+ // "makerMinLiquidityAddition": "1000000",
584
+ // "orderTypes":
585
+ // [
586
+ // "LMT",
587
+ // "MKT",
588
+ // "STOP_LIMIT",
589
+ // "POST_ONLY"
590
+ // ],
591
+ // "spotTradingEnabled": true,
592
+ // "marginTradingEnabled": true,
593
+ // "marketEnabled": true,
594
+ // "createOrderEnabled": true,
595
+ // "cancelOrderEnabled": true,
596
+ // "liquidityInvestEnabled": true,
597
+ // "liquidityWithdrawEnabled": true,
598
+ // "feeTiers":
599
+ // [
600
+ // {
601
+ // "feeTierId": "1",
602
+ // "staticSpreadFee": "0.00000000",
603
+ // "isDislocationEnabled": false
604
+ // },
605
+ // {
606
+ // "feeTierId": "10",
607
+ // "staticSpreadFee": "0.00100000",
608
+ // "isDislocationEnabled": true
609
+ // },
610
+ // {
611
+ // "feeTierId": "11",
612
+ // "staticSpreadFee": "0.00150000",
613
+ // "isDislocationEnabled": false
614
+ // },
615
+ // {
616
+ // "feeTierId": "12",
617
+ // "staticSpreadFee": "0.00150000",
618
+ // "isDislocationEnabled": true
619
+ // },
620
+ // {
621
+ // "feeTierId": "13",
622
+ // "staticSpreadFee": "0.00300000",
623
+ // "isDislocationEnabled": false
624
+ // },
625
+ // {
626
+ // "feeTierId": "14",
627
+ // "staticSpreadFee": "0.00300000",
628
+ // "isDislocationEnabled": true
629
+ // },
630
+ // {
631
+ // "feeTierId": "15",
632
+ // "staticSpreadFee": "0.00500000",
633
+ // "isDislocationEnabled": false
634
+ // },
635
+ // {
636
+ // "feeTierId": "16",
637
+ // "staticSpreadFee": "0.00500000",
638
+ // "isDislocationEnabled": true
639
+ // },
640
+ // {
641
+ // "feeTierId": "17",
642
+ // "staticSpreadFee": "0.01000000",
643
+ // "isDislocationEnabled": false
644
+ // },
645
+ // {
646
+ // "feeTierId": "18",
647
+ // "staticSpreadFee": "0.01000000",
648
+ // "isDislocationEnabled": true
649
+ // },
650
+ // {
651
+ // "feeTierId": "19",
652
+ // "staticSpreadFee": "0.01500000",
653
+ // "isDislocationEnabled": false
654
+ // },
655
+ // {
656
+ // "feeTierId": "2",
657
+ // "staticSpreadFee": "0.00000000",
658
+ // "isDislocationEnabled": true
659
+ // },
660
+ // {
661
+ // "feeTierId": "20",
662
+ // "staticSpreadFee": "0.01500000",
663
+ // "isDislocationEnabled": true
664
+ // },
665
+ // {
666
+ // "feeTierId": "21",
667
+ // "staticSpreadFee": "0.02000000",
668
+ // "isDislocationEnabled": false
669
+ // },
670
+ // {
671
+ // "feeTierId": "22",
672
+ // "staticSpreadFee": "0.02000000",
673
+ // "isDislocationEnabled": true
674
+ // },
675
+ // {
676
+ // "feeTierId": "3",
677
+ // "staticSpreadFee": "0.00010000",
678
+ // "isDislocationEnabled": false
679
+ // },
680
+ // {
681
+ // "feeTierId": "4",
682
+ // "staticSpreadFee": "0.00010000",
683
+ // "isDislocationEnabled": true
684
+ // },
685
+ // {
686
+ // "feeTierId": "5",
687
+ // "staticSpreadFee": "0.00020000",
688
+ // "isDislocationEnabled": false
689
+ // },
690
+ // {
691
+ // "feeTierId": "6",
692
+ // "staticSpreadFee": "0.00020000",
693
+ // "isDislocationEnabled": true
694
+ // },
695
+ // {
696
+ // "feeTierId": "7",
697
+ // "staticSpreadFee": "0.00060000",
698
+ // "isDislocationEnabled": false
699
+ // },
700
+ // {
701
+ // "feeTierId": "8",
702
+ // "staticSpreadFee": "0.00060000",
703
+ // "isDislocationEnabled": true
704
+ // },
705
+ // {
706
+ // "feeTierId": "9",
707
+ // "staticSpreadFee": "0.00100000",
708
+ // "isDislocationEnabled": false
709
+ // }
710
+ // ],
711
+ // "marketType": "DATED_FUTURE",
712
+ // "contractMultiplier": "1",
713
+ // "settlementAssetSymbol": "USDC",
714
+ // "underlyingQuoteSymbol": "USDC",
715
+ // "underlyingBaseSymbol": "BTC",
716
+ // "openInterestLimitUSD": "100000000.0000",
717
+ // "concentrationRiskPercentage": "100.00",
718
+ // "concentrationRiskThresholdUSD": "30000000.0000",
719
+ // "expiryDatetime": "2025-05-16T08:00:00.000Z",
720
+ // "priceBuffer": "0.1",
721
+ // "feeGroupId": "4"
722
+ // }
723
+ //
724
+ // option
725
+ // {
726
+ // "marketId": "20997",
727
+ // "symbol": "BTC-USDC-20260130-160000-P",
728
+ // "quoteAssetId": "5",
729
+ // "baseAssetId": "1",
730
+ // "quoteSymbol": "USDC",
731
+ // "baseSymbol": "BTC",
732
+ // "quotePrecision": "4",
733
+ // "basePrecision": "8",
734
+ // "pricePrecision": "4",
735
+ // "quantityPrecision": "8",
736
+ // "costPrecision": "4",
737
+ // "minQuantityLimit": "0.00050000",
738
+ // "maxQuantityLimit": "200.00000000",
739
+ // "maxPriceLimit": null,
740
+ // "minPriceLimit": null,
741
+ // "maxCostLimit": null,
742
+ // "minCostLimit": null,
743
+ // "timeZone": "Etc/UTC",
744
+ // "tickSize": "10.0000",
745
+ // "makerFee": "0",
746
+ // "takerFee": "2",
747
+ // "roundingCorrectionFactor": "0.00000100",
748
+ // "makerMinLiquidityAddition": "-1",
749
+ // "orderTypes": [ "LMT", "MKT", "STOP_LIMIT", "POST_ONLY" ],
750
+ // "spotTradingEnabled": true,
751
+ // "marginTradingEnabled": true,
752
+ // "marketEnabled": true,
753
+ // "createOrderEnabled": true,
754
+ // "cancelOrderEnabled": true,
755
+ // "amendOrderEnabled": true,
756
+ // "marketType": "OPTION",
757
+ // "contractMultiplier": "1",
758
+ // "settlementAssetSymbol": "USDC",
759
+ // "underlyingQuoteSymbol": "USDC",
760
+ // "underlyingBaseSymbol": "BTC",
761
+ // "openInterestLimitUSD": "100000000.0000",
762
+ // "concentrationRiskPercentage": "100.00",
763
+ // "concentrationRiskThresholdUSD": "30000000.0000",
764
+ // "expiryDatetime": "2026-01-30T08:00:00.000Z",
765
+ // "priceBuffer": "0",
766
+ // "feeGroupId": "10",
767
+ // "optionStrikePrice": "160000.0000",
768
+ // "optionType": "PUT",
769
+ // "premiumCapRatio": "0.1000"
770
+ // }
771
+ //
772
+ const id = this.safeString(market, 'symbol');
773
+ const baseId = this.safeString(market, 'baseSymbol');
774
+ const quoteId = this.safeString(market, 'quoteSymbol');
775
+ const base = this.safeCurrencyCode(baseId);
776
+ const quote = this.safeCurrencyCode(quoteId);
777
+ let symbol = base + '/' + quote;
778
+ const basePrecision = this.safeString(market, 'basePrecision');
779
+ const quotePrecision = this.safeString(market, 'quotePrecision');
780
+ const amountPrecision = this.safeString(market, 'quantityPrecision');
781
+ const pricePrecision = this.safeString(market, 'pricePrecision');
782
+ const costPrecision = this.safeString(market, 'costPrecision');
783
+ const minQuantityLimit = this.safeString(market, 'minQuantityLimit');
784
+ const maxQuantityLimit = this.safeString(market, 'maxQuantityLimit');
785
+ const minPriceLimit = this.safeString(market, 'minPriceLimit');
786
+ const maxPriceLimit = this.safeString(market, 'maxPriceLimit');
787
+ const minCostLimit = this.safeString(market, 'minCostLimit');
788
+ const maxCostLimit = this.safeString(market, 'maxCostLimit');
789
+ const settleId = this.safeString(market, 'settlementAssetSymbol');
790
+ const settle = this.safeCurrencyCode(settleId);
791
+ const type = this.parseMarketType(this.safeString(market, 'marketType'), 'spot');
792
+ let spot = false;
793
+ let swap = false;
794
+ let future = false;
795
+ let option = false;
796
+ let contract = true;
797
+ let linear = undefined;
798
+ let inverse = undefined;
799
+ let expiryDatetime = undefined;
800
+ let contractSize = undefined;
801
+ let optionType = undefined;
802
+ let strike = undefined;
803
+ let margin = false;
804
+ if (type === 'spot') {
805
+ spot = true;
806
+ contract = false;
807
+ margin = this.safeBool(market, 'marginTradingEnabled');
808
+ }
809
+ else {
810
+ contractSize = this.safeNumber(market, 'contractMultiplier');
811
+ symbol += ':' + settle;
812
+ linear = settle === quote;
813
+ inverse = !linear;
814
+ if (type === 'swap') {
815
+ swap = true;
816
+ }
817
+ else {
818
+ expiryDatetime = this.safeString(market, 'expiryDatetime');
819
+ const idParts = id.split('-');
820
+ const datePart = this.safeString(idParts, 2);
821
+ symbol += '-' + datePart;
822
+ if (type === 'future') {
823
+ future = true;
824
+ }
825
+ else if (type === 'option') {
826
+ option = true;
827
+ optionType = this.safeStringLower(market, 'optionType');
828
+ strike = this.parseToNumeric(this.safeString(market, 'optionStrikePrice'));
829
+ symbol += '-' + this.numberToString(strike) + '-' + this.safeString(idParts, 4);
830
+ }
831
+ }
832
+ }
833
+ return this.safeMarketStructure({
834
+ 'id': id,
835
+ 'symbol': symbol,
836
+ 'base': base,
837
+ 'baseId': baseId,
838
+ 'quote': quote,
839
+ 'quoteId': quoteId,
840
+ 'settle': settle,
841
+ 'settleId': settleId,
842
+ 'type': type,
843
+ 'spot': spot,
844
+ 'margin': margin,
845
+ 'swap': swap,
846
+ 'future': future,
847
+ 'option': option,
848
+ 'contract': contract,
849
+ 'linear': linear,
850
+ 'inverse': inverse,
851
+ 'taker': this.fees['trading']['taker'],
852
+ 'maker': this.fees['trading']['maker'],
853
+ 'contractSize': contractSize,
854
+ 'expiry': this.parse8601(expiryDatetime),
855
+ 'expiryDatetime': expiryDatetime,
856
+ 'strike': strike,
857
+ 'optionType': optionType,
858
+ 'limits': {
859
+ 'amount': {
860
+ 'min': this.parseNumber(minQuantityLimit),
861
+ 'max': this.parseNumber(maxQuantityLimit),
862
+ },
863
+ 'price': {
864
+ 'min': this.parseNumber(minPriceLimit),
865
+ 'max': this.parseNumber(maxPriceLimit),
866
+ },
867
+ 'cost': {
868
+ 'min': this.parseNumber(minCostLimit),
869
+ 'max': this.parseNumber(maxCostLimit),
870
+ },
871
+ 'leverage': {
872
+ 'min': undefined,
873
+ 'max': undefined,
874
+ },
875
+ },
876
+ 'precision': {
877
+ 'amount': this.parseNumber(this.parsePrecision(amountPrecision)),
878
+ 'price': this.parseNumber(this.parsePrecision(pricePrecision)),
879
+ 'cost': this.parseNumber(this.parsePrecision(costPrecision)),
880
+ 'base': this.parseNumber(this.parsePrecision(basePrecision)),
881
+ 'quote': this.parseNumber(this.parsePrecision(quotePrecision)),
882
+ },
883
+ 'active': this.safeBool(market, 'marketEnabled'),
884
+ 'created': undefined,
885
+ 'info': market,
886
+ });
887
+ }
888
+ parseMarketType(type, defaultType = undefined) {
889
+ const types = {
890
+ 'SPOT': 'spot',
891
+ 'PERPETUAL': 'swap',
892
+ 'DATED_FUTURE': 'future',
893
+ 'OPTION': 'option',
894
+ };
895
+ return this.safeString(types, type, defaultType);
896
+ }
897
+ /**
898
+ * @method
899
+ * @name bullish#fetchOrderBook
900
+ * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
901
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/markets/-symbol-/orderbook/hybrid
902
+ * @param {string} symbol unified symbol of the market to fetch the order book for
903
+ * @param {int} [limit] the maximum amount of order book entries to return (not used by bullish)
904
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
905
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
906
+ */
907
+ async fetchOrderBook(symbol, limit = undefined, params = {}) {
908
+ await this.loadMarkets();
909
+ const market = this.market(symbol);
910
+ const request = {
911
+ 'symbol': market['id'],
912
+ };
913
+ const response = await this.publicGetV1MarketsSymbolOrderbookHybrid(this.extend(request, params));
914
+ //
915
+ // {
916
+ // "bids": [
917
+ // {
918
+ // "price": "1.00000000",
919
+ // "priceLevelQuantity": "1.00000000"
920
+ // }
921
+ // ],
922
+ // "asks": [
923
+ // {
924
+ // "price": "1.00000000",
925
+ // "priceLevelQuantity": "1.00000000"
926
+ // }
927
+ // ],
928
+ // "datetime": "2021-05-20T01:01:01.000Z",
929
+ // "timestamp": "1621490985000",
930
+ // "sequenceNumber": 999
931
+ // }
932
+ //
933
+ const timestamp = this.safeInteger(response, 'timestamp');
934
+ return this.parseOrderBook(response, symbol, timestamp, 'bids', 'asks', 'price', 'priceLevelQuantity');
935
+ }
936
+ /**
937
+ * @method
938
+ * @name bullish#fetchTrades
939
+ * @description get the list of most recent trades for a particular symbol
940
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/markets/-symbol-/trades
941
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/history/markets/-symbol-/trades
942
+ * @param {string} symbol unified symbol of the market to fetch trades for
943
+ * @param {int} [since] timestamp in ms of the earliest trade to fetch
944
+ * @param {int} [limit] the maximum amount of trades to fetch (max 100)
945
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
946
+ * @param {int} [params.until] timestamp in ms of the latest trade to fetch
947
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
948
+ * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
949
+ */
950
+ async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
951
+ await this.loadMarkets();
952
+ const maxLimit = 100;
953
+ let paginate = false;
954
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
955
+ if (paginate) {
956
+ params = this.handlePaginationParams('fetchTrades', since, params);
957
+ return await this.fetchPaginatedCallDynamic('fetchTrades', symbol, since, limit, params, maxLimit);
958
+ }
959
+ const market = this.market(symbol);
960
+ const request = {
961
+ 'symbol': market['id'],
962
+ };
963
+ params = this.handleSinceAndUntil(since, params);
964
+ if (limit !== undefined) {
965
+ request['_pageSize'] = this.getClosestLimit(limit);
966
+ }
967
+ const response = await this.publicGetV1HistoryMarketsSymbolTrades(this.extend(request, params));
968
+ //
969
+ // [
970
+ // {
971
+ // "tradeId": "100178000000367159",
972
+ // "symbol": "BTCUSDC",
973
+ // "price": "103891.8977",
974
+ // "quantity": "0.00029411",
975
+ // "quoteAmount": "30.5556",
976
+ // "side": "BUY",
977
+ // "isTaker": true,
978
+ // "createdAtTimestamp": "1747768055826",
979
+ // "createdAtDatetime": "2025-05-20T19:07:35.826Z"
980
+ // }, ...
981
+ // ]
982
+ //
983
+ return this.parseTrades(response, market, since, limit);
984
+ }
985
+ /**
986
+ * @method
987
+ * @name bullish#fetchMyTrades
988
+ * @description fetch all trades made by the user
989
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/history/trades
990
+ * @param {string} [symbol] unified market symbol
991
+ * @param {int} [since] the earliest time in ms to fetch trades for
992
+ * @param {int} [limit] the maximum number of trades structures to retrieve
993
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
994
+ * @param {int} [params.until] the latest time in ms to fetch trades for
995
+ * @param {string} [params.orderId] the order id to fetch trades for
996
+ * @param {string} [params.clientOrderId] the client order id to fetch trades for
997
+ * @param {string} [params.tradingAccountId] the trading account id to fetch trades for
998
+ * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
999
+ */
1000
+ async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1001
+ await Promise.all([this.loadMarkets(), this.handleToken()]);
1002
+ const tradingAccountId = await this.loadAccount(params);
1003
+ const request = {
1004
+ 'tradingAccountId': tradingAccountId,
1005
+ };
1006
+ let market = undefined;
1007
+ if (symbol !== undefined) {
1008
+ market = this.market(symbol);
1009
+ request['symbol'] = market['id'];
1010
+ }
1011
+ const clientOrderId = this.safeString(params, 'clientOrderId');
1012
+ let response = undefined;
1013
+ if (clientOrderId !== undefined) {
1014
+ response = await this.privateGetV1TradesClientOrderIdClientOrderId(this.extend(request, params));
1015
+ }
1016
+ else {
1017
+ let paginate = false;
1018
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
1019
+ if (paginate) {
1020
+ params = this.handlePaginationParams('fetchMyTrades', since, params);
1021
+ return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params, 100);
1022
+ }
1023
+ params = this.handleSinceAndUntil(since, params);
1024
+ if (limit !== undefined) {
1025
+ request['_pageSize'] = this.getClosestLimit(limit);
1026
+ }
1027
+ //
1028
+ // [
1029
+ // {
1030
+ // "baseFee": "0.00000000",
1031
+ // "createdAtDatetime": "2025-05-18T15:57:28.132Z",
1032
+ // "createdAtTimestamp": "1747583848132",
1033
+ // "handle": null,
1034
+ // "isTaker": true,
1035
+ // "orderId": "844242293909618689",
1036
+ // "price": "103942.7048",
1037
+ // "publishedAtTimestamp": "1747769786131",
1038
+ // "quantity": "1.00000000",
1039
+ // "quoteAmount": "103942.7048",
1040
+ // "quoteFee": "0.0000",
1041
+ // "side": "BUY",
1042
+ // "symbol": "BTCUSDC",
1043
+ // "tradeId": "100178000000288892"
1044
+ // }, ...
1045
+ // ]
1046
+ //
1047
+ response = await this.privateGetV1HistoryTrades(this.extend(request, params));
1048
+ }
1049
+ return this.parseTrades(response, market, since, limit);
1050
+ }
1051
+ /**
1052
+ * @method
1053
+ * @name bullish#fetchOrderTrades
1054
+ * @description fetch all the trades made from a single order
1055
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/history/trades
1056
+ * @param {string} id order id
1057
+ * @param {string} symbol unified market symbol
1058
+ * @param {int} [since] the earliest time in ms to fetch trades for
1059
+ * @param {int} [limit] the maximum number of trades to retrieve
1060
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1061
+ * @param {string} [params.clientOrderId] the client order id to fetch trades for
1062
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
1063
+ */
1064
+ async fetchOrderTrades(id, symbol = undefined, since = undefined, limit = undefined, params = {}) {
1065
+ await this.loadMarkets();
1066
+ const clientOrderId = this.safeString(params, 'clientOrderId');
1067
+ if (clientOrderId === undefined) {
1068
+ params = this.extend({ 'orderId': id }, params);
1069
+ }
1070
+ return await this.fetchMyTrades(symbol, since, limit, params);
1071
+ }
1072
+ parseTrade(trade, market = undefined) {
1073
+ //
1074
+ // fetchTrades
1075
+ // [
1076
+ // {
1077
+ // "tradeId": "100178000000367159",
1078
+ // "symbol": "BTCUSDC",
1079
+ // "price": "103891.8977",
1080
+ // "quantity": "0.00029411",
1081
+ // "quoteAmount": "30.5556",
1082
+ // "side": "BUY",
1083
+ // "isTaker": true,
1084
+ // "createdAtTimestamp": "1747768055826",
1085
+ // "createdAtDatetime": "2025-05-20T19:07:35.826Z"
1086
+ // }, ...
1087
+ // ]
1088
+ //
1089
+ // [
1090
+ // {
1091
+ // "tradeId": "100020000000000060",
1092
+ // "symbol": "BTCUSDC",
1093
+ // "price": "1.00000000",
1094
+ // "quantity": "1.00000000",
1095
+ // "side": "BUY",
1096
+ // "isTaker": true,
1097
+ // "createdAtDatetime": "2021-05-20T01:01:01.000Z",
1098
+ // "createdAtTimestamp": "1621490985000"
1099
+ // }
1100
+ // ]
1101
+ //
1102
+ // fetchMyTrades
1103
+ // [
1104
+ // {
1105
+ // "baseFee": "0.00000000",
1106
+ // "createdAtDatetime": "2025-05-18T15:57:28.132Z",
1107
+ // "createdAtTimestamp": "1747583848132",
1108
+ // "handle": null,
1109
+ // "isTaker": true,
1110
+ // "orderId": "844242293909618689",
1111
+ // "price": "103942.7048",
1112
+ // "publishedAtTimestamp": "1747769786131",
1113
+ // "quantity": "1.00000000",
1114
+ // "quoteAmount": "103942.7048",
1115
+ // "quoteFee": "0.0000",
1116
+ // "side": "BUY",
1117
+ // "symbol": "BTCUSDC",
1118
+ // "tradeId": "100178000000288892"
1119
+ // }, ...
1120
+ // ]
1121
+ //
1122
+ const marketId = this.safeString(trade, 'symbol');
1123
+ market = this.safeMarket(marketId, market);
1124
+ const symbol = market['symbol'];
1125
+ const timestamp = this.safeInteger(trade, 'createdAtTimestamp');
1126
+ const price = this.safeString(trade, 'price');
1127
+ const amount = this.safeString(trade, 'quantity');
1128
+ const side = this.safeStringLower(trade, 'side');
1129
+ const isTaker = this.safeBool(trade, 'isTaker');
1130
+ const currency = market['quote'];
1131
+ const code = this.safeCurrencyCode(currency);
1132
+ const feeCost = this.safeNumber(trade, 'quoteFee');
1133
+ let fee = undefined;
1134
+ if (feeCost !== undefined) {
1135
+ fee = { 'currency': code, 'cost': feeCost };
1136
+ }
1137
+ let takerOrMaker = undefined;
1138
+ if (isTaker) {
1139
+ takerOrMaker = 'taker';
1140
+ }
1141
+ else {
1142
+ takerOrMaker = 'maker';
1143
+ }
1144
+ const orderId = this.safeString(trade, 'orderId');
1145
+ return this.safeTrade({
1146
+ 'info': trade,
1147
+ 'timestamp': timestamp,
1148
+ 'datetime': this.iso8601(timestamp),
1149
+ 'symbol': symbol,
1150
+ 'id': this.safeString(trade, 'tradeId'),
1151
+ 'order': orderId,
1152
+ 'type': undefined,
1153
+ 'takerOrMaker': takerOrMaker,
1154
+ 'side': side,
1155
+ 'price': price,
1156
+ 'amount': amount,
1157
+ 'cost': undefined,
1158
+ 'fee': fee,
1159
+ }, market);
1160
+ }
1161
+ /**
1162
+ * @method
1163
+ * @name bullish#fetchTicker
1164
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
1165
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/markets/-symbol-/tick
1166
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
1167
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1168
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
1169
+ */
1170
+ async fetchTicker(symbol, params = {}) {
1171
+ await this.loadMarkets();
1172
+ const market = this.market(symbol);
1173
+ const request = {
1174
+ 'symbol': market['id'],
1175
+ };
1176
+ const response = await this.publicGetV1MarketsSymbolTick(this.extend(request, params));
1177
+ //
1178
+ // {
1179
+ // "createdAtDatetime": "2021-05-20T01:01:01.000Z",
1180
+ // "createdAtTimestamp": "1621490985000",
1181
+ // "high": "1.00000000",
1182
+ // "low": "1.00000000",
1183
+ // "bestBid": "1.00000000",
1184
+ // "bidVolume": "1.00000000",
1185
+ // "bestAsk": "1.00000000",
1186
+ // "askVolume": "1.00000000",
1187
+ // "vwap": "1.00000000",
1188
+ // "open": "1.00000000",
1189
+ // "close": "1.00000000",
1190
+ // "last": "1.00000000",
1191
+ // "change": "1.00000000",
1192
+ // "percentage": "1.00000000",
1193
+ // "average": "1.00000000",
1194
+ // "baseVolume": "1.00000000",
1195
+ // "quoteVolume": "1.00000000",
1196
+ // "bancorPrice": "1.00000000",
1197
+ // "markPrice": "19999.00",
1198
+ // "fundingRate": "0.01",
1199
+ // "openInterest": "100000.32452",
1200
+ // "lastTradeDatetime": "2021-05-20T01:01:01.000Z",
1201
+ // "lastTradeTimestamp": "1621490985000",
1202
+ // "lastTradeQuantity": "1.00000000",
1203
+ // "ammData": [
1204
+ // {
1205
+ // "feeTierId": "1",
1206
+ // "bidSpreadFee": "0.00040000",
1207
+ // "askSpreadFee": "0.00040000",
1208
+ // "baseReservesQuantity": "245.56257825",
1209
+ // "quoteReservesQuantity": "3424383.3629",
1210
+ // "currentPrice": "16856.0000"
1211
+ // }
1212
+ // ]
1213
+ // }
1214
+ //
1215
+ return this.parseTicker(response, market);
1216
+ }
1217
+ parseTicker(ticker, market = undefined) {
1218
+ //
1219
+ // {
1220
+ // "createdAtDatetime": "2021-05-20T01:01:01.000Z",
1221
+ // "createdAtTimestamp": "1621490985000",
1222
+ // "high": "1.00000000",
1223
+ // "low": "1.00000000",
1224
+ // "bestBid": "1.00000000",
1225
+ // "bidVolume": "1.00000000",
1226
+ // "bestAsk": "1.00000000",
1227
+ // "askVolume": "1.00000000",
1228
+ // "vwap": "1.00000000",
1229
+ // "open": "1.00000000",
1230
+ // "close": "1.00000000",
1231
+ // "last": "1.00000000",
1232
+ // "change": "1.00000000",
1233
+ // "percentage": "1.00000000",
1234
+ // "average": "1.00000000",
1235
+ // "baseVolume": "1.00000000",
1236
+ // "quoteVolume": "1.00000000",
1237
+ // "bancorPrice": "1.00000000",
1238
+ // "markPrice": "19999.00",
1239
+ // "fundingRate": "0.01",
1240
+ // "openInterest": "100000.32452",
1241
+ // "lastTradeDatetime": "2021-05-20T01:01:01.000Z",
1242
+ // "lastTradeTimestamp": "1621490985000",
1243
+ // "lastTradeQuantity": "1.00000000",
1244
+ // "ammData": [
1245
+ // {
1246
+ // "feeTierId": "1",
1247
+ // "bidSpreadFee": "0.00040000",
1248
+ // "askSpreadFee": "0.00040000",
1249
+ // "baseReservesQuantity": "245.56257825",
1250
+ // "quoteReservesQuantity": "3424383.3629",
1251
+ // "currentPrice": "16856.0000"
1252
+ // }
1253
+ // ]
1254
+ // }
1255
+ //
1256
+ const marketId = this.safeString(ticker, 'symbol');
1257
+ market = this.safeMarket(marketId, market);
1258
+ const timestamp = this.safeInteger(ticker, 'createdAtTimestamp');
1259
+ return this.safeTicker({
1260
+ 'symbol': market['symbol'],
1261
+ 'timestamp': timestamp,
1262
+ 'datetime': this.iso8601(timestamp),
1263
+ 'high': this.safeString(ticker, 'high'),
1264
+ 'low': this.safeString(ticker, 'low'),
1265
+ 'bid': this.safeString2(ticker, 'bid', 'bestBid'),
1266
+ 'bidVolume': this.safeString(ticker, 'bidVolume'),
1267
+ 'ask': this.safeString2(ticker, 'ask', 'bestAsk'),
1268
+ 'askVolume': this.safeString(ticker, 'askVolume'),
1269
+ 'vwap': this.safeString(ticker, 'vwap'),
1270
+ 'open': this.safeString(ticker, 'open'),
1271
+ 'close': this.safeString(ticker, 'close'),
1272
+ 'last': this.safeString(ticker, 'last'),
1273
+ 'previousClose': undefined,
1274
+ 'change': this.safeString(ticker, 'change'),
1275
+ 'percentage': this.safeString(ticker, 'percentage'),
1276
+ 'average': this.safeString(ticker, 'average'),
1277
+ 'baseVolume': this.safeString(ticker, 'baseVolume'),
1278
+ 'quoteVolume': this.safeString(ticker, 'quoteVolume'),
1279
+ 'markPrice': this.safeString(ticker, 'markPrice'),
1280
+ 'info': ticker,
1281
+ }, market);
1282
+ }
1283
+ async safeDeterministicCall(method, symbol = undefined, since = undefined, limit = undefined, timeframe = undefined, params = {}) {
1284
+ let maxRetries = undefined;
1285
+ [maxRetries, params] = this.handleOptionAndParams(params, method, 'maxRetries', 3);
1286
+ let errors$1 = 0;
1287
+ params = this.omit(params, 'until');
1288
+ // the exchange returns the most recent data, so we do not need to pass until into paginated calls
1289
+ // the correct util value will be calculated inside of the method
1290
+ while (errors$1 <= maxRetries) {
1291
+ try {
1292
+ if (timeframe && method !== 'fetchFundingRateHistory') {
1293
+ return await this[method](symbol, timeframe, since, limit, params);
1294
+ }
1295
+ else {
1296
+ return await this[method](symbol, since, limit, params);
1297
+ }
1298
+ }
1299
+ catch (e) {
1300
+ if (e instanceof errors.RateLimitExceeded) {
1301
+ throw e; // if we are rate limited, we should not retry and fail fast
1302
+ }
1303
+ errors$1 += 1;
1304
+ if (errors$1 > maxRetries) {
1305
+ throw e;
1306
+ }
1307
+ }
1308
+ }
1309
+ return [];
1310
+ }
1311
+ /**
1312
+ * @method
1313
+ * @name bullish#fetchOHLCV
1314
+ * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1315
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/markets/-symbol-/candle
1316
+ * @param {string} symbol unified symbol of the market to fetch OHLCV data for
1317
+ * @param {string} timeframe the length of time each candle represents
1318
+ * @param {int} [since] timestamp in ms of the earliest candle to fetch
1319
+ * @param {int} [limit] the maximum amount of candles to fetch (max 100)
1320
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1321
+ * @param {int} [params.until] timestamp in ms of the latest entry
1322
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
1323
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
1324
+ */
1325
+ async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
1326
+ await this.loadMarkets();
1327
+ const market = this.market(symbol);
1328
+ const maxLimit = 100;
1329
+ let paginate = false;
1330
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
1331
+ if (paginate) {
1332
+ return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, maxLimit);
1333
+ }
1334
+ let request = {
1335
+ 'symbol': market['id'],
1336
+ 'timeBucket': this.safeString(this.timeframes, timeframe, timeframe),
1337
+ '_pageSize': maxLimit,
1338
+ };
1339
+ [request, params] = this.handleUntilOption('createdAtDatetime[lte]', request, params);
1340
+ let until = this.safeInteger(request, 'createdAtDatetime[lte]');
1341
+ const duration = this.parseTimeframe(timeframe);
1342
+ const maxDelta = 1000 * duration * maxLimit;
1343
+ let startTime = since;
1344
+ // both of since and until are required
1345
+ if (startTime === undefined && until === undefined) {
1346
+ until = this.milliseconds();
1347
+ startTime = until - maxDelta;
1348
+ }
1349
+ else if (startTime === undefined) {
1350
+ startTime = until - maxDelta;
1351
+ }
1352
+ else if (until === undefined) {
1353
+ until = this.sum(startTime, maxDelta);
1354
+ }
1355
+ request['createdAtDatetime[gte]'] = this.iso8601(startTime);
1356
+ request['createdAtDatetime[lte]'] = this.iso8601(until);
1357
+ const response = await this.publicGetV1MarketsSymbolCandle(this.extend(request, params));
1358
+ //
1359
+ // [
1360
+ // {
1361
+ // "open": "100846.7490",
1362
+ // "high": "100972.4001",
1363
+ // "low": "100840.8129",
1364
+ // "close": "100972.2602",
1365
+ // "volume": "30.56064890",
1366
+ // "createdAtTimestamp": "1746720540000",
1367
+ // "createdAtDatetime": "2025-05-08T16:09:00.000Z",
1368
+ // "publishedAtTimestamp": "1746720636007"
1369
+ // }, ...
1370
+ // ]
1371
+ //
1372
+ return this.parseOHLCVs(response, market, timeframe, since, limit);
1373
+ }
1374
+ parseOHLCV(ohlcv, market = undefined) {
1375
+ return [
1376
+ this.safeInteger(ohlcv, 'createdAtTimestamp'),
1377
+ this.safeNumber(ohlcv, 'open'),
1378
+ this.safeNumber(ohlcv, 'high'),
1379
+ this.safeNumber(ohlcv, 'low'),
1380
+ this.safeNumber(ohlcv, 'close'),
1381
+ this.safeNumber(ohlcv, 'volume'),
1382
+ ];
1383
+ }
1384
+ /**
1385
+ * @method
1386
+ * @name bullish#fetchFundingRateHistory
1387
+ * @description fetches historical funding rate prices
1388
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/history/markets/-symbol-/funding-rate
1389
+ * @param {string} symbol unified symbol of the market to fetch the funding rate history for
1390
+ * @param {int} [since] not sent to exchange api, exchange api always returns the most recent data, only used to filter exchange response
1391
+ * @param {int} [limit] the maximum amount of funding rate structures to fetch
1392
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1393
+ * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
1394
+ */
1395
+ async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1396
+ if (symbol === undefined) {
1397
+ throw new errors.ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
1398
+ }
1399
+ await this.loadMarkets();
1400
+ const maxLimit = 100;
1401
+ let paginate = false;
1402
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
1403
+ if (paginate) {
1404
+ params = this.handlePaginationParams('fetchFundingRateHistory', since, params);
1405
+ return await this.fetchPaginatedCallDynamic('fetchFundingRateHistory', symbol, since, limit, params, maxLimit);
1406
+ }
1407
+ const market = this.market(symbol);
1408
+ if (!market['swap']) {
1409
+ throw new errors.BadRequest(this.id + ' fetchFundingRateHistory() supports swap markets only');
1410
+ }
1411
+ const request = {
1412
+ 'symbol': market['id'],
1413
+ };
1414
+ if (limit !== undefined) {
1415
+ request['_pageSize'] = this.getClosestLimit(limit);
1416
+ }
1417
+ params = this.handleSinceAndUntil(since, params, 'updatedAtDatetime[gte]', 'updatedAtDatetime[lte]');
1418
+ const response = await this.publicGetV1HistoryMarketsSymbolFundingRate(this.extend(request, params));
1419
+ //
1420
+ // [
1421
+ // {
1422
+ // "fundingRate": "0.00125",
1423
+ // "updatedAtDatetime": "2025-05-18T09:06:04.074Z"
1424
+ // },
1425
+ // {
1426
+ // "fundingRate": "0.00125",
1427
+ // "updatedAtDatetime": "2025-05-18T08:59:59.033Z"
1428
+ // }, ...
1429
+ // ]
1430
+ //
1431
+ const rates = [];
1432
+ const result = this.toArray(response);
1433
+ for (let i = 0; i < result.length; i++) {
1434
+ const entry = result[i];
1435
+ const datetime = this.safeString(entry, 'updatedAtDatetime');
1436
+ rates.push({
1437
+ 'info': entry,
1438
+ 'symbol': symbol,
1439
+ 'fundingRate': this.safeNumber(entry, 'fundingRate'),
1440
+ 'timestamp': this.parse8601(datetime),
1441
+ 'datetime': datetime,
1442
+ });
1443
+ }
1444
+ const sorted = this.sortBy(rates, 'timestamp');
1445
+ return this.filterBySymbolSinceLimit(sorted, market['symbol'], since, limit);
1446
+ }
1447
+ /**
1448
+ * @method
1449
+ * @name bullish#fetchOrders
1450
+ * @description fetches information on multiple orders made by the user
1451
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#tag--orders
1452
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#tag--history
1453
+ * @param {string} symbol unified market symbol of the market orders were made in
1454
+ * @param {int} [since] the earliest time in ms to fetch orders for
1455
+ * @param {int} [limit] the maximum number of order structures to retrieve (5, 25, 50, 100, default is 25)
1456
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1457
+ * @param {int} [params.until] timestamp in ms of the latest order to fetch
1458
+ * @param {string} [params.tradingAccountId] the trading account id (mandatory parameter)
1459
+ * @param {string} [params.orderId] the id of the order to fetch for
1460
+ * @param {string} [params.clientOrderId] the client id of the order to fetch for
1461
+ * @param {string} [params.status] filter by order status, 'OPEN', 'CANCELLED', 'CLOSED', 'REJECTED'
1462
+ * @param {bool} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
1463
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1464
+ */
1465
+ async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1466
+ await Promise.all([this.loadMarkets(), this.handleToken()]);
1467
+ const tradingAccountId = await this.loadAccount(params);
1468
+ const paginate = this.safeBool(params, 'paginate', false);
1469
+ if (paginate) {
1470
+ params = this.handlePaginationParams('fetchOrders', since, params);
1471
+ return await this.fetchPaginatedCallDynamic('fetchOrders', symbol, since, limit, params, 100);
1472
+ }
1473
+ let market = undefined;
1474
+ const request = {
1475
+ 'tradingAccountId': tradingAccountId,
1476
+ };
1477
+ if (symbol !== undefined) {
1478
+ market = this.market(symbol);
1479
+ request['symbol'] = market['id'];
1480
+ }
1481
+ params = this.handleSinceAndUntil(since, params);
1482
+ if (limit !== undefined) {
1483
+ request['_pageSize'] = this.getClosestLimit(limit);
1484
+ }
1485
+ let method = 'privateGetV2HistoryOrders';
1486
+ [method, params] = this.handleOptionAndParams(params, 'fetchOrders', 'method', method);
1487
+ let response = undefined;
1488
+ if (method === 'privateGetV2Orders') {
1489
+ //
1490
+ // [
1491
+ // {
1492
+ // "clientOrderId": "187",
1493
+ // "orderId": "297735387747975680",
1494
+ // "symbol": "BTCUSDC",
1495
+ // "price": "1.00000000",
1496
+ // "averageFillPrice": "1.00000000",
1497
+ // "stopPrice": "1.00000000",
1498
+ // "allowBorrow": false,
1499
+ // "quantity": "1.00000000",
1500
+ // "quantityFilled": "1.00000000",
1501
+ // "quoteAmount": "1.00000000",
1502
+ // "baseFee": "0.00100000",
1503
+ // "quoteFee": "0.0010",
1504
+ // "borrowedBaseQuantity": "1.00000000",
1505
+ // "borrowedQuoteQuantity": "1.00000000",
1506
+ // "isLiquidation": false,
1507
+ // "side": "BUY",
1508
+ // "type": "LMT",
1509
+ // "timeInForce": "GTC",
1510
+ // "status": "OPEN",
1511
+ // "statusReason": "User cancelled",
1512
+ // "statusReasonCode": "1002",
1513
+ // "createdAtDatetime": "2021-05-20T01:01:01.000Z",
1514
+ // "createdAtTimestamp": "1621490985000",
1515
+ // }
1516
+ // ]
1517
+ //
1518
+ response = await this.privateGetV2Orders(this.extend(request, params));
1519
+ }
1520
+ else if (method === 'privateGetV2HistoryOrders') {
1521
+ response = await this.privateGetV2HistoryOrders(this.extend(request, params));
1522
+ }
1523
+ else {
1524
+ throw new errors.BadRequest(this.id + ' fetchOrders() method parameter must be either "privateGetV2Orders" or "privateGetV2HistoryOrders"');
1525
+ }
1526
+ return this.parseOrders(response, market, since, limit);
1527
+ }
1528
+ handlePaginationParams(method, since = undefined, params = {}) {
1529
+ const ninetyDays = 90 * 24 * 60 * 60 * 1000;
1530
+ const now = this.milliseconds();
1531
+ const allowedSince = now - ninetyDays;
1532
+ if ((since !== undefined) && (since < allowedSince)) {
1533
+ throw new errors.BadRequest(this.id + ' ' + method + '() only allows fetching entries up to 90 days in the past');
1534
+ }
1535
+ params = this.omit(params, 'paginate');
1536
+ params = this.extend(params, { 'paginationDirection': 'backward' });
1537
+ const until = this.safeInteger(params, 'until');
1538
+ if (until === undefined) {
1539
+ params = this.extend(params, { 'until': now });
1540
+ }
1541
+ return params;
1542
+ }
1543
+ handleSinceAndUntil(since = undefined, params = {}, sinceKey = 'createdAtDatetime[gte]', untilKey = 'createdAtDatetime[lte]') {
1544
+ let until = this.safeInteger(params, 'until');
1545
+ if ((since !== undefined) || (until !== undefined)) {
1546
+ const timeDelta = 7 * 24 * 60 * 60 * 1000; // 7 days
1547
+ if (since === undefined) {
1548
+ since = until - timeDelta;
1549
+ params = this.omit(params, 'until');
1550
+ }
1551
+ else if (until === undefined) {
1552
+ until = this.sum(since, timeDelta);
1553
+ const now = this.milliseconds();
1554
+ if (until > now) {
1555
+ until = now;
1556
+ }
1557
+ }
1558
+ const sinceDate = this.iso8601(since);
1559
+ const untilDate = this.iso8601(until);
1560
+ params[sinceKey] = sinceDate;
1561
+ params[untilKey] = untilDate;
1562
+ }
1563
+ return params;
1564
+ }
1565
+ getClosestLimit(limit) {
1566
+ let pageSize = 5;
1567
+ if ((limit > 5) && (limit < 26)) {
1568
+ pageSize = 25;
1569
+ }
1570
+ else if ((limit > 25) && (limit < 51)) {
1571
+ pageSize = 50;
1572
+ }
1573
+ else if (limit > 50) {
1574
+ pageSize = 100;
1575
+ }
1576
+ return pageSize;
1577
+ }
1578
+ /**
1579
+ * @method
1580
+ * @name bullish#fetchOpenOrders
1581
+ * @description fetch all unfilled currently open orders
1582
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#tag--history
1583
+ * @param {string} symbol unified market symbol of the market orders were made in
1584
+ * @param {int} [since] the earliest time in ms to fetch orders for
1585
+ * @param {int} [limit] the maximum number of order structures to retrieve
1586
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1587
+ * @param {string} params.tradingAccountId the trading account id (mandatory parameter)
1588
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1589
+ */
1590
+ async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1591
+ const request = {
1592
+ 'status': 'OPEN',
1593
+ };
1594
+ return await this.fetchOrders(symbol, since, limit, this.extend(request, params));
1595
+ }
1596
+ /**
1597
+ * @method
1598
+ * @name bullish#fetchCanceledOrders
1599
+ * @description fetches information on multiple canceled orders made by the user
1600
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#tag--orders
1601
+ * @param {string} symbol unified market symbol of the canceled orders
1602
+ * @param {int} [since] timestamp in ms of the earliest order
1603
+ * @param {int} [limit] the max number of canceled orders to return
1604
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1605
+ * @param {string} [params.tradingAccountId] the trading account id (mandatory parameter)
1606
+ * @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1607
+ */
1608
+ async fetchCanceledOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1609
+ const request = {
1610
+ 'status': 'CANCELLED',
1611
+ 'method': 'privateGetV2Orders', // current endpoint distinquishes between CLOSED and CANCELLED orders
1612
+ };
1613
+ return await this.fetchOrders(symbol, since, limit, this.extend(request, params));
1614
+ }
1615
+ /**
1616
+ * @method
1617
+ * @name bullish#fetchClosedOrders
1618
+ * @description fetches information on multiple closed orders made by the user
1619
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#tag--orders
1620
+ * @param {string} symbol unified market symbol of the closed orders
1621
+ * @param {int} [since] timestamp in ms of the earliest order
1622
+ * @param {int} [limit] the max number of closed orders to return
1623
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1624
+ * @param {string} params.tradingAccountId the trading account id (mandatory parameter)
1625
+ * @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1626
+ */
1627
+ async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1628
+ const request = {
1629
+ 'status': 'CLOSED',
1630
+ 'method': 'privateGetV2Orders', // current endpoint distinquishes between CLOSED and CANCELLED orders
1631
+ };
1632
+ return await this.fetchOrders(symbol, since, limit, this.extend(request, params));
1633
+ }
1634
+ /**
1635
+ * @method
1636
+ * @name bullish#fetchCanceledAndClosedOrders
1637
+ * @description fetches information on multiple canceled orders made by the user
1638
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#tag--history
1639
+ * @param {string} symbol unified market symbol of the closed orders
1640
+ * @param {int} [since] timestamp in ms of the earliest order
1641
+ * @param {int} [limit] the max number of closed orders to return
1642
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1643
+ * @param {string} [params.tradingAccountId] the trading account id (mandatory parameter)
1644
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1645
+ */
1646
+ async fetchCanceledAndClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1647
+ const request = {
1648
+ 'status': 'CLOSED',
1649
+ 'method': 'privateGetV2HistoryOrders', // current endpoint returns both CLOSED and CANCELLED orders
1650
+ };
1651
+ return await this.fetchOrders(symbol, since, limit, this.extend(request, params));
1652
+ }
1653
+ /**
1654
+ * @method
1655
+ * @name bullish#fetchOrder
1656
+ * @description fetches information on an order made by the user
1657
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v2/orders/-orderId-
1658
+ * @param {string} id the order id
1659
+ * @param {string} [symbol] unified symbol of the market the order was made in
1660
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1661
+ * @param {string} [params.traidingAccountId] the trading account id (mandatory parameter)
1662
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1663
+ */
1664
+ async fetchOrder(id, symbol = undefined, params = {}) {
1665
+ await Promise.all([this.loadMarkets(), this.handleToken()]);
1666
+ const tradingAccountId = await this.loadAccount(params);
1667
+ let market = undefined;
1668
+ if (symbol !== undefined) {
1669
+ market = this.market(symbol);
1670
+ }
1671
+ const request = {
1672
+ 'orderId': id,
1673
+ 'tradingAccountId': tradingAccountId,
1674
+ };
1675
+ const response = await this.privateGetV2OrdersOrderId(this.extend(request, params));
1676
+ //
1677
+ // {
1678
+ // "clientOrderId": "187",
1679
+ // "orderId": "297735387747975680",
1680
+ // "symbol": "BTCUSDC",
1681
+ // "price": "1.00000000",
1682
+ // "averageFillPrice": "1.00000000",
1683
+ // "stopPrice": "1.00000000",
1684
+ // "allowBorrow": false,
1685
+ // "quantity": "1.00000000",
1686
+ // "quantityFilled": "1.00000000",
1687
+ // "quoteAmount": "1.00000000",
1688
+ // "baseFee": "0.00100000",
1689
+ // "quoteFee": "0.0010",
1690
+ // "borrowedBaseQuantity": "1.00000000",
1691
+ // "borrowedQuoteQuantity": "1.00000000",
1692
+ // "isLiquidation": false,
1693
+ // "side": "BUY",
1694
+ // "type": "LMT",
1695
+ // "timeInForce": "GTC",
1696
+ // "status": "OPEN",
1697
+ // "statusReason": "User cancelled",
1698
+ // "statusReasonCode": "1002",
1699
+ // "createdAtDatetime": "2021-05-20T01:01:01.000Z",
1700
+ // "createdAtTimestamp": "1621490985000",
1701
+ // }
1702
+ //
1703
+ return this.parseOrder(response, market);
1704
+ }
1705
+ /**
1706
+ * @method
1707
+ * @name bullish#createOrder
1708
+ * @description create a trade order
1709
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#post-/v2/orders
1710
+ * @param {string} symbol unified symbol of the market to create an order in
1711
+ * @param {string} type 'market' or 'limit' or 'STOP_LIMIT' or 'POST_ONLY'
1712
+ * @param {string} side 'buy' or 'sell'
1713
+ * @param {float} amount how much of currency you want to trade in units of base currency
1714
+ * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1715
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1716
+ * @param {string} [params.clientOrderId] a custom client order id
1717
+ * @param {float} [params.triggerPrice] the price at which a stop order is triggered at
1718
+ * @param {string} [params.timeInForce] the time in force for the order, either 'GTC' (Good Till Cancelled) or 'IOC' (Immediate or Cancel), default is 'GTC'
1719
+ * @param {bool} [params.allowBorrow] if true, the order will be allowed to borrow assets to fulfill the order (default is false)
1720
+ * @param {bool} [params.postOnly] if true, the order will only be posted to the order book and not executed immediately (default is false)
1721
+ * @param {string} params.traidingAccountId the trading account id (mandatory parameter)
1722
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1723
+ */
1724
+ async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
1725
+ await Promise.all([this.loadMarkets(), this.handleToken()]);
1726
+ const tradingAccountId = await this.loadAccount(params);
1727
+ const market = this.market(symbol);
1728
+ const request = {
1729
+ 'commandType': 'V3CreateOrder',
1730
+ 'symbol': market['id'],
1731
+ 'side': side.toUpperCase(),
1732
+ 'quantity': this.amountToPrecision(symbol, amount),
1733
+ 'tradingAccountId': tradingAccountId,
1734
+ };
1735
+ const isMarketOrder = ((type === 'market') || type === 'MARKET');
1736
+ let postOnly = false;
1737
+ [postOnly, params] = this.handlePostOnly(isMarketOrder, type === 'POST_ONLY', params);
1738
+ if (postOnly) {
1739
+ type = 'POST_ONLY';
1740
+ }
1741
+ let timeInForce = 'GTC'; // is mandatory
1742
+ [timeInForce, params] = this.handleOptionAndParams(params, 'createOrder', 'timeInForce', timeInForce);
1743
+ params['timeInForce'] = timeInForce.toUpperCase();
1744
+ if (!isMarketOrder) {
1745
+ request['price'] = this.priceToPrecision(symbol, price);
1746
+ }
1747
+ const triggerPrice = this.safeString(params, 'triggerPrice');
1748
+ if (triggerPrice !== undefined) {
1749
+ if (isMarketOrder) {
1750
+ throw new errors.NotSupported(this.id + ' createOrder() does not support market trigger orders');
1751
+ }
1752
+ request['stopPrice'] = this.priceToPrecision(symbol, triggerPrice);
1753
+ type = 'STOP_LIMIT';
1754
+ params = this.omit(params, 'triggerPrice');
1755
+ }
1756
+ request['type'] = type.toUpperCase();
1757
+ const response = await this.privatePostV2Orders(this.extend(request, params));
1758
+ //
1759
+ // {
1760
+ // "message": "Command acknowledged - CreateOrder",
1761
+ // "requestId": "633910976353665024",
1762
+ // "orderId": "633910775316480001",
1763
+ // "clientOrderId": "1234567"
1764
+ // }
1765
+ //
1766
+ return this.parseOrder(response, market);
1767
+ }
1768
+ /**
1769
+ * @method
1770
+ * @name bullish#editOrder
1771
+ * @description edit a trade limit order
1772
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#post-/v2/command-amend
1773
+ * @param {string} id order id
1774
+ * @param {string} [symbol] unified symbol of the market to create an order in
1775
+ * @param {string} [type] 'limit' or 'POST_ONLY'
1776
+ * @param {string} [side] not used by bullish editOrder
1777
+ * @param {float} [amount] how much of the currency you want to trade in units of the base currency
1778
+ * @param {float} [price] the price for the order, in units of the quote currency, ignored in market orders
1779
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1780
+ * @param {string} [params.traidingAccountId] the trading account id (mandatory parameter)
1781
+ * @param {bool} [params.postOnly] if true, the order will only be posted to the order book and not executed immediately (default is false)
1782
+ * @param {string} [params.clientOrderId] a unique identifier for the order, automatically generated if not sent
1783
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1784
+ */
1785
+ async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
1786
+ await Promise.all([this.loadMarkets(), this.handleToken()]);
1787
+ const tradingAccountId = await this.loadAccount(params);
1788
+ const market = this.market(symbol);
1789
+ const request = {
1790
+ 'commandType': 'V1AmendOrder',
1791
+ 'symbol': market['id'],
1792
+ 'tradingAccountId': tradingAccountId,
1793
+ };
1794
+ const clientOrderId = this.safeString(params, 'clientOrderId');
1795
+ if (clientOrderId === undefined) {
1796
+ request['orderId'] = id;
1797
+ }
1798
+ if (type !== undefined) {
1799
+ request['type'] = type.toUpperCase();
1800
+ }
1801
+ const postOnly = this.safeBool(params, 'postOnly', false);
1802
+ if (postOnly) {
1803
+ params = this.omit(params, 'postOnly');
1804
+ request['type'] = 'POST_ONLY';
1805
+ }
1806
+ if (amount !== undefined) {
1807
+ request['quantity'] = this.amountToPrecision(symbol, amount);
1808
+ }
1809
+ if (price !== undefined) {
1810
+ request['price'] = this.priceToPrecision(symbol, price);
1811
+ }
1812
+ const response = await this.privatePostV2Command(this.extend(request, params));
1813
+ return this.parseOrder(response, market);
1814
+ }
1815
+ /**
1816
+ * @method
1817
+ * @name bullish#cancelOrder
1818
+ * @description cancels an open order
1819
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#post-/v2/command-cancellations
1820
+ * @param {string} [id] order id
1821
+ * @param {string} symbol unified symbol of the market the order was made in
1822
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1823
+ * @param {string} params.commandType the command type, default is 'V3CancelOrder' (mandatory parameter)
1824
+ * @param {string} [params.traidingAccountId] the trading account id (mandatory parameter)
1825
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1826
+ */
1827
+ async cancelOrder(id, symbol = undefined, params = {}) {
1828
+ await Promise.all([this.loadMarkets(), this.handleToken()]);
1829
+ const tradingAccountId = await this.loadAccount(params);
1830
+ if (symbol === undefined) {
1831
+ throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
1832
+ }
1833
+ const market = this.market(symbol);
1834
+ const request = {
1835
+ 'symbol': market['id'],
1836
+ 'tradingAccountId': tradingAccountId,
1837
+ 'commandType': this.safeString(params, 'commandType', 'V3CancelOrder'),
1838
+ 'orderId': id,
1839
+ };
1840
+ const response = await this.privatePostV2Command(this.extend(request, params));
1841
+ //
1842
+ // {
1843
+ // "message": "Command acknowledged - CancelOrder",
1844
+ // "requestId": "844658480774644736",
1845
+ // "orderId": "297735387747975680",
1846
+ // "clientOrderId": null
1847
+ // }
1848
+ //
1849
+ return this.parseOrder(response, market);
1850
+ }
1851
+ /**
1852
+ * @method
1853
+ * @name bullish#cancelAllOrders
1854
+ * @description cancel all open orders in a market
1855
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#post-/v2/command-cancellations
1856
+ * @param {string} [symbol] alpaca cancelAllOrders cannot setting symbol, it will cancel all open orders
1857
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1858
+ * @param {string} params.traidingAccountId the trading account id (mandatory parameter)
1859
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1860
+ */
1861
+ async cancelAllOrders(symbol = undefined, params = {}) {
1862
+ await Promise.all([this.loadMarkets(), this.handleToken()]);
1863
+ const tradingAccountId = await this.loadAccount(params);
1864
+ const request = {
1865
+ 'tradingAccountId': tradingAccountId,
1866
+ };
1867
+ let market = undefined;
1868
+ if (symbol !== undefined) {
1869
+ market = this.market(symbol);
1870
+ request['symbol'] = market['id'];
1871
+ request['commandType'] = 'V1CancelAllOrdersByMarket';
1872
+ }
1873
+ else {
1874
+ request['commandType'] = 'V1CancelAllOrders';
1875
+ }
1876
+ const response = await this.privatePostV2Command(this.extend(request, params));
1877
+ //
1878
+ // {
1879
+ // "message": "Command acknowledged - CancelAllOrders",
1880
+ // "requestId": "633900538459062272"
1881
+ // }
1882
+ //
1883
+ const orders = [response];
1884
+ return this.parseOrders(orders, market);
1885
+ }
1886
+ parseOrder(order, market = undefined) {
1887
+ //
1888
+ // fetchOrders, fetchOrder
1889
+ // {
1890
+ // "clientOrderId": "187",
1891
+ // "orderId": "297735387747975680",
1892
+ // "symbol": "BTCUSDC",
1893
+ // "price": "1.00000000",
1894
+ // "averageFillPrice": "1.00000000",
1895
+ // "stopPrice": "1.00000000",
1896
+ // "allowBorrow": false,
1897
+ // "quantity": "1.00000000",
1898
+ // "quantityFilled": "1.00000000",
1899
+ // "quoteAmount": "1.00000000",
1900
+ // "baseFee": "0.00100000",
1901
+ // "quoteFee": "0.0010",
1902
+ // "borrowedBaseQuantity": "1.00000000",
1903
+ // "borrowedQuoteQuantity": "1.00000000",
1904
+ // "isLiquidation": false,
1905
+ // "side": "BUY",
1906
+ // "type": "LMT",
1907
+ // "timeInForce": "GTC",
1908
+ // "status": "OPEN",
1909
+ // "statusReason": "User cancelled",
1910
+ // "statusReasonCode": "1002",
1911
+ // "createdAtDatetime": "2021-05-20T01:01:01.000Z",
1912
+ // "createdAtTimestamp": "1621490985000",
1913
+ // }
1914
+ //
1915
+ // createOrder
1916
+ // {
1917
+ // "message": "Command acknowledged - CreateOrder",
1918
+ // "requestId": "633910976353665024",
1919
+ // "orderId": "633910775316480001",
1920
+ // "clientOrderId": "1234567"
1921
+ // }
1922
+ //
1923
+ // cancelOrder
1924
+ // {
1925
+ // "message": "Command acknowledged - CancelOrder",
1926
+ // "requestId": "633910976353665024",
1927
+ // "orderId": "633910775316480001"
1928
+ // }
1929
+ //
1930
+ // cancelAllOrders
1931
+ // {
1932
+ // "message": "Command acknowledged - CancelAllOrders",
1933
+ // "requestId": "633900538459062272"
1934
+ // }
1935
+ //
1936
+ const marketId = this.safeString(order, 'symbol');
1937
+ if (market === undefined) {
1938
+ market = this.safeMarket(marketId);
1939
+ }
1940
+ const symbol = this.safeSymbol(marketId, market);
1941
+ const id = this.safeString(order, 'orderId');
1942
+ const timestamp = this.safeInteger(order, 'createdAtTimestamp');
1943
+ const type = this.safeString(order, 'type');
1944
+ const side = this.safeStringLower(order, 'side');
1945
+ const price = this.safeString(order, 'price');
1946
+ const amount = this.safeString(order, 'quantity');
1947
+ const filled = this.safeString(order, 'quantityFilled');
1948
+ let status = this.parseOrderStatus(this.safeString(order, 'status'));
1949
+ if (status === 'closed') {
1950
+ const statusReason = this.safeString(order, 'statusReason');
1951
+ if (statusReason === 'User cancelled') {
1952
+ status = 'canceled';
1953
+ }
1954
+ }
1955
+ const timeInForce = this.safeString(order, 'timeInForce');
1956
+ const stopPrice = this.safeString(order, 'stopPrice');
1957
+ const cost = this.safeString(order, 'quoteAmount');
1958
+ const fee = {};
1959
+ const quoteFee = this.safeNumber(order, 'quoteFee');
1960
+ if (quoteFee !== undefined) {
1961
+ fee['cost'] = quoteFee;
1962
+ fee['currency'] = market['quote'];
1963
+ }
1964
+ const average = this.safeString(order, 'averageFillPrice');
1965
+ return this.safeOrder({
1966
+ 'id': id,
1967
+ 'clientOrderId': this.safeString(order, 'clientOrderId'),
1968
+ 'timestamp': timestamp,
1969
+ 'datetime': this.iso8601(timestamp),
1970
+ 'lastTradeTimestamp': undefined,
1971
+ 'status': status,
1972
+ 'symbol': symbol,
1973
+ 'type': this.parseOrderType(type),
1974
+ 'timeInForce': timeInForce,
1975
+ 'postOnly': type === 'POST_ONLY',
1976
+ 'side': side,
1977
+ 'price': price,
1978
+ 'triggerPrice': stopPrice,
1979
+ 'amount': amount,
1980
+ 'filled': filled,
1981
+ 'remaining': undefined,
1982
+ 'cost': cost,
1983
+ 'trades': undefined,
1984
+ 'fee': fee,
1985
+ 'info': order,
1986
+ 'average': average,
1987
+ }, market);
1988
+ }
1989
+ parseOrderStatus(status) {
1990
+ const statuses = {
1991
+ 'OPEN': 'open',
1992
+ 'CLOSED': 'closed',
1993
+ 'CANCELLED': 'canceled',
1994
+ 'REJECTED': 'rejected',
1995
+ };
1996
+ return this.safeString(statuses, status, status);
1997
+ }
1998
+ parseOrderType(type) {
1999
+ const types = {
2000
+ 'LMT': 'limit',
2001
+ 'MKT': 'market',
2002
+ 'POST_ONLY': 'limit',
2003
+ 'STOP_LIMIT': 'limit',
2004
+ };
2005
+ return this.safeString(types, type, type);
2006
+ }
2007
+ /**
2008
+ * @method
2009
+ * @name bullish#fetchDepositsWithdrawals
2010
+ * @description fetch history of deposits and withdrawals
2011
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/wallets/transactions
2012
+ * @param {string} [code] unified currency code for the currency of the deposit/withdrawals, default is undefined
2013
+ * @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
2014
+ * @param {int} [limit] max number of deposit/withdrawals to return, default is undefined
2015
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2016
+ * @returns {object} a list of [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
2017
+ */
2018
+ async fetchDepositsWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
2019
+ await Promise.all([this.loadMarkets(), this.handleToken()]);
2020
+ let request = {};
2021
+ [request, params] = this.handleUntilOption('createdAtDatetime[lte]', request, params);
2022
+ const until = this.safeInteger(request, 'createdAtDatetime[lte]');
2023
+ if (until !== undefined) {
2024
+ request['createdAtDatetime[lte]'] = this.iso8601(until);
2025
+ }
2026
+ if (since !== undefined) {
2027
+ request['createdAtDatetime[gte]'] = this.iso8601(since);
2028
+ }
2029
+ const response = await this.privateGetV1WalletsTransactions(this.extend(request, params));
2030
+ //
2031
+ // {
2032
+ // "data": [
2033
+ // {
2034
+ // "custodyTransactionId": "0x791fc85f16a84cbd5250d5517ecad497f564d2e5cc54d31466fe70b952fd58da",
2035
+ // "direction": "DEPOSIT",
2036
+ // "quantity": "150",
2037
+ // "symbol": "USDC",
2038
+ // "fee": "0",
2039
+ // "memo": "0x34625d5f0b6575503a0669994dea24271bfbd443",
2040
+ // "createdAtDateTime": "2025-11-04T14:31:17.000Z",
2041
+ // "updatedAtDateTime": "2025-11-04T14:44:17.500Z",
2042
+ // "status": "COMPLETE",
2043
+ // "statusReason": "OK",
2044
+ // "network": "ETH",
2045
+ // "transactionDetails": {
2046
+ // "address": "0x34625d5f0b6575503a0669994dea24271bfbd443",
2047
+ // "blockchainTxId": "0x791fc85f16a84cbd5250d5517ecad497f564d2e5cc54d31466fe70b952fd58da",
2048
+ // "swiftUetr": null,
2049
+ // "sources": [
2050
+ // {
2051
+ // "address": "0x2653435d52a5f49551ebb757f25b2c8bb954859b"
2052
+ // }
2053
+ // ]
2054
+ // }
2055
+ // }
2056
+ // ],
2057
+ // "links": {
2058
+ // "previous": null,
2059
+ // "next": null
2060
+ // },
2061
+ // "totalCount": 1
2062
+ // }
2063
+ //
2064
+ const data = this.safeList(response, 'data', []);
2065
+ let currency = undefined;
2066
+ if (code !== undefined) {
2067
+ currency = this.currency(code);
2068
+ }
2069
+ return this.parseTransactions(data, currency, since, limit);
2070
+ }
2071
+ /**
2072
+ * @method
2073
+ * @name bullish#withdraw
2074
+ * @description make a withdrawal
2075
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#post-/v1/wallets/withdrawal
2076
+ * @param {string} code unified currency code
2077
+ * @param {float} amount the amount to withdraw
2078
+ * @param {string} address the address to withdraw to
2079
+ * @param {string} [tag]
2080
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2081
+ * @param {string} params.timestamp the timestamp of the withdrawal request (mandatory)
2082
+ * @param {string} params.nonce the nonce of the withdrawal request (mandatory)
2083
+ * @param {string} params.network network for withdraw (mandatory)
2084
+ * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
2085
+ */
2086
+ async withdraw(code, amount, address, tag = undefined, params = {}) {
2087
+ await Promise.all([this.loadMarkets(), this.handleToken()]);
2088
+ // todo check this method properly
2089
+ const currency = this.currency(code);
2090
+ const request = {
2091
+ 'command': {
2092
+ 'commandType': 'V1Withdraw',
2093
+ 'destinationId': address,
2094
+ 'symbol': currency['id'],
2095
+ 'quantity': this.currencyToPrecision(code, amount),
2096
+ },
2097
+ };
2098
+ let networkCode = undefined;
2099
+ [networkCode, params] = this.handleNetworkCodeAndParams(params);
2100
+ if (networkCode !== undefined) {
2101
+ request['network'] = this.networkCodeToId(networkCode);
2102
+ }
2103
+ else {
2104
+ throw new errors.ArgumentsRequired(this.id + ' withdraw() requires a network parameter');
2105
+ }
2106
+ const response = await this.privatePostV1WalletsWithdrawal(this.extend(request, params));
2107
+ //
2108
+ // {
2109
+ // "code": "00000",
2110
+ // "msg": "success",
2111
+ // "data": {
2112
+ // "orderId":888291686266343424",
2113
+ // "clientOrderId":"123"
2114
+ // }
2115
+ // }
2116
+ //
2117
+ return this.parseTransaction(response, currency);
2118
+ }
2119
+ parseTransaction(transaction, currency = undefined) {
2120
+ //
2121
+ // {
2122
+ // "custodyTransactionId": "0x791fc85f16a84cbd5250d5517ecad497f564d2e5cc54d31466fe70b952fd58da",
2123
+ // "direction": "DEPOSIT",
2124
+ // "quantity": "150",
2125
+ // "symbol": "USDC",
2126
+ // "fee": "0",
2127
+ // "memo": "0x34625d5f0b6575503a0669994dea24271bfbd443",
2128
+ // "createdAtDateTime": "2025-11-04T14:31:17.000Z",
2129
+ // "updatedAtDateTime": "2025-11-04T14:44:17.500Z",
2130
+ // "status": "COMPLETE",
2131
+ // "statusReason": "OK",
2132
+ // "network": "ETH",
2133
+ // "transactionDetails": {
2134
+ // "address": "0x34625d5f0b6575503a0669994dea24271bfbd443",
2135
+ // "blockchainTxId": "0x791fc85f16a84cbd5250d5517ecad497f564d2e5cc54d31466fe70b952fd58da",
2136
+ // "swiftUetr": null,
2137
+ // "sources": [
2138
+ // {
2139
+ // "address": "0x2653435d52a5f49551ebb757f25b2c8bb954859b"
2140
+ // }
2141
+ // ]
2142
+ // }
2143
+ // }
2144
+ //
2145
+ const id = this.safeString(transaction, 'custodyTransactionId');
2146
+ const type = this.safeString(transaction, 'direction');
2147
+ const timestamp = this.parse8601(this.safeString(transaction, 'createdAtDateTime'));
2148
+ const updated = this.parse8601(this.safeString(transaction, 'updatedAtDateTime'));
2149
+ const network = this.safeString(transaction, 'network');
2150
+ const transactionDetails = this.safeDict(transaction, 'transactionDetails');
2151
+ const txid = this.safeString(transactionDetails, 'blockchainTxId');
2152
+ const address = this.safeString(transactionDetails, 'address');
2153
+ const amount = this.safeNumber(transaction, 'quantity');
2154
+ const currencyId = this.safeString(transaction, 'symbol');
2155
+ const code = this.safeCurrencyCode(currencyId, currency);
2156
+ const status = this.safeString(transaction, 'status');
2157
+ const sources = this.safeList(transactionDetails, 'sources', []);
2158
+ const source = this.safeDict(sources, 0, {});
2159
+ const sourceAddress = this.safeString(source, 'address');
2160
+ const fee = {
2161
+ 'currency': undefined,
2162
+ 'cost': undefined,
2163
+ 'rate': undefined,
2164
+ };
2165
+ const feeCost = this.safeNumber(transaction, 'fee');
2166
+ if (feeCost !== undefined) {
2167
+ fee['cost'] = feeCost;
2168
+ fee['currency'] = code;
2169
+ }
2170
+ return {
2171
+ 'id': id,
2172
+ 'txid': txid,
2173
+ 'timestamp': timestamp,
2174
+ 'datetime': this.iso8601(timestamp),
2175
+ 'network': this.networkIdToCode(network),
2176
+ 'addressFrom': sourceAddress,
2177
+ 'address': address,
2178
+ 'addressTo': address,
2179
+ 'amount': amount,
2180
+ 'type': this.parseTransactionType(type),
2181
+ 'currency': code,
2182
+ 'status': this.parseTransactionStatus(status),
2183
+ 'updated': updated,
2184
+ 'tagFrom': undefined,
2185
+ 'tag': undefined,
2186
+ 'tagTo': undefined,
2187
+ 'comment': undefined,
2188
+ 'internal': undefined,
2189
+ 'fee': fee,
2190
+ 'info': transaction,
2191
+ };
2192
+ }
2193
+ parseTransactionType(type) {
2194
+ const types = {
2195
+ 'DEPOSIT': 'deposit',
2196
+ 'WITHDRAW': 'withdrawal',
2197
+ };
2198
+ return this.safeString(types, type, type);
2199
+ }
2200
+ parseTransactionStatus(status) {
2201
+ const statuses = {
2202
+ 'COMPLETE': 'ok',
2203
+ 'FAILED': 'failed',
2204
+ 'PENDING': 'pending',
2205
+ 'CANCELLED': 'canceled',
2206
+ };
2207
+ return this.safeString(statuses, status, status);
2208
+ }
2209
+ async loadAccount(params = {}) {
2210
+ let tradingAccountId = undefined;
2211
+ [tradingAccountId, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'tradingAccountId');
2212
+ if (tradingAccountId === undefined) {
2213
+ const response = await this.privateGetV1AccountsTradingAccounts(params);
2214
+ for (let i = 0; i < response.length; i++) {
2215
+ const account = response[i];
2216
+ const name = this.safeString(account, 'tradingAccountName');
2217
+ if (name === 'Primary Account') {
2218
+ tradingAccountId = this.safeString(account, 'tradingAccountId');
2219
+ break;
2220
+ }
2221
+ }
2222
+ }
2223
+ if (tradingAccountId === undefined) {
2224
+ throw new errors.ArgumentsRequired(this.id + ' loadAccount() requires a tradingAccountId parameter in options["tradingAccountId"] or params["tradingAccountId"], fetchAccounts() was not able to find the Primary account');
2225
+ }
2226
+ this.options['tradingAccountId'] = tradingAccountId;
2227
+ return tradingAccountId;
2228
+ }
2229
+ /**
2230
+ * @method
2231
+ * @name bullish#fetchAccounts
2232
+ * @description fetch all the accounts associated with a profile
2233
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#tag--trading-accounts
2234
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2235
+ * @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
2236
+ */
2237
+ async fetchAccounts(params = {}) {
2238
+ await Promise.all([this.loadMarkets(), this.handleToken()]);
2239
+ const response = await this.privateGetV1AccountsTradingAccounts(params);
2240
+ //
2241
+ // [
2242
+ // {
2243
+ // "defaultedMarginUSD": "0.0000",
2244
+ // "endCustomerId": "222801149768465",
2245
+ // "fullLiquidationMarginUSD": "0.0000",
2246
+ // "initialMarginUSD": "0.0000",
2247
+ // "isBorrowing": "false",
2248
+ // "isConcentrationRiskEnabled": "true",
2249
+ // "isDefaulted": "false",
2250
+ // "isLending": "false",
2251
+ // "isPrimaryAccount": "true",
2252
+ // "liquidationMarginUSD": "0.0000",
2253
+ // "liquidityAddonUSD": "0.0000",
2254
+ // "makerFee": "0.00000000",
2255
+ // "marginProfile": {
2256
+ // "defaultedMarketRiskMultiplierPct": "50.00",
2257
+ // "fullLiquidationMarketRiskMultiplierPct": "75.00",
2258
+ // "initialMarketRiskMultiplierPct": "200.00",
2259
+ // "liquidationMarketRiskMultiplierPct": "100.00",
2260
+ // "warningMarketRiskMultiplierPct": "150.00"
2261
+ // },
2262
+ // "marketRiskUSD": "0.0000",
2263
+ // "maxInitialLeverage": "1",
2264
+ // "rateLimitToken": "7fc358f0bad4124528318ff415e24f1ad6e530321827162a5e35d8de8dcfc750",
2265
+ // "riskLimitUSD": "0.0000",
2266
+ // "takerFee": "0.00000002",
2267
+ // "totalBorrowedUSD": "0.0000",
2268
+ // "totalCollateralUSD": "0.0000",
2269
+ // "totalLiabilitiesUSD": "0.0000",
2270
+ // "tradeFeeRate": [
2271
+ // {
2272
+ // "feeGroupId": "1",
2273
+ // "makerFee": "0.00000000",
2274
+ // "takerFee": "0.00000000"
2275
+ // },
2276
+ // {
2277
+ // "feeGroupId": "2",
2278
+ // "makerFee": "0.00000000",
2279
+ // "takerFee": "0.00000000"
2280
+ // },
2281
+ // {
2282
+ // "feeGroupId": "3",
2283
+ // "makerFee": "0.00000000",
2284
+ // "takerFee": "0.00000000"
2285
+ // },
2286
+ // {
2287
+ // "feeGroupId": "4",
2288
+ // "makerFee": "0.00000000",
2289
+ // "takerFee": "0.00000000"
2290
+ // },
2291
+ // {
2292
+ // "feeGroupId": "5",
2293
+ // "makerFee": "0.00000000",
2294
+ // "takerFee": "0.00000000"
2295
+ // },
2296
+ // {
2297
+ // "feeGroupId": "6",
2298
+ // "makerFee": "0.00000000",
2299
+ // "takerFee": "0.00000000"
2300
+ // },
2301
+ // {
2302
+ // "feeGroupId": "7",
2303
+ // "makerFee": "0.00000000",
2304
+ // "takerFee": "0.00000000"
2305
+ // },
2306
+ // {
2307
+ // "feeGroupId": "8",
2308
+ // "makerFee": "0.00000000",
2309
+ // "takerFee": "0.00000000"
2310
+ // }
2311
+ // ],
2312
+ // "tradingAccountDescription": null,
2313
+ // "tradingAccountId": "111309424211255",
2314
+ // "tradingAccountName": "Primary Account",
2315
+ // "warningMarginUSD": "0.0000"
2316
+ // }
2317
+ // ]
2318
+ //
2319
+ return this.parseAccounts(response, params);
2320
+ }
2321
+ parseAccount(account) {
2322
+ return {
2323
+ 'id': this.safeString(account, 'tradingAccountId'),
2324
+ 'type': undefined,
2325
+ 'code': undefined,
2326
+ 'info': account,
2327
+ };
2328
+ }
2329
+ /**
2330
+ * @method
2331
+ * @name bullish#fetchDepositAddress
2332
+ * @description fetch the deposit address for a currency associated with this account
2333
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/wallets/deposit-instructions/crypto/-symbol-
2334
+ * @param {string} code unified currency code
2335
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2336
+ * @param {string} [params.network] network for deposit address
2337
+ * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
2338
+ */
2339
+ async fetchDepositAddress(code, params = {}) {
2340
+ await Promise.all([this.loadMarkets(), this.handleToken()]);
2341
+ const currency = this.currency(code);
2342
+ const request = {
2343
+ 'symbol': currency['id'],
2344
+ };
2345
+ const response = await this.privateGetV1WalletsDepositInstructionsCryptoSymbol(this.extend(request, params));
2346
+ //
2347
+ // [
2348
+ // {
2349
+ // "network": "ETH",
2350
+ // "address": "0xc2fc755082d052bb334763b144851a0031999f33",
2351
+ // "symbol": "ETH"
2352
+ // }
2353
+ // ]
2354
+ //
2355
+ const safeResponse = this.toArray(response);
2356
+ const length = safeResponse.length;
2357
+ let data = this.safeDict(safeResponse, 0, {});
2358
+ let network = undefined;
2359
+ [network, params] = this.handleNetworkCodeAndParams(params);
2360
+ const networkDefinedByUser = network !== undefined;
2361
+ if ((length > 1) || (networkDefinedByUser)) {
2362
+ // some currencies have multiple networks
2363
+ if (network === undefined) {
2364
+ // use default network if not specified and multiple are available
2365
+ network = this.defaultNetworkCode(code);
2366
+ }
2367
+ if (network !== undefined) {
2368
+ // find the entry that matches the network or return first entry if not found and user did not specify a network
2369
+ for (let i = 0; i < safeResponse.length; i++) {
2370
+ const entry = this.safeDict(safeResponse, i, {});
2371
+ const networkId = this.safeString(entry, 'network');
2372
+ const networkCode = this.networkIdToCode(networkId);
2373
+ if (network === networkCode) {
2374
+ data = entry;
2375
+ break;
2376
+ }
2377
+ }
2378
+ if (networkDefinedByUser) {
2379
+ data = {}; // return an empty structure if the user-defined network was not found
2380
+ }
2381
+ }
2382
+ }
2383
+ return this.parseDepositAddress(data, currency);
2384
+ }
2385
+ parseDepositAddress(depositAddress, currency = undefined) {
2386
+ const id = this.safeString(depositAddress, 'symbol');
2387
+ const network = this.safeString(depositAddress, 'network');
2388
+ return {
2389
+ 'info': depositAddress,
2390
+ 'currency': this.safeCurrencyCode(id, currency),
2391
+ 'network': this.networkIdToCode(network),
2392
+ 'address': this.safeString(depositAddress, 'address'),
2393
+ 'tag': undefined,
2394
+ };
2395
+ }
2396
+ /**
2397
+ * @method
2398
+ * @name bullish#fetchBalance
2399
+ * @description query for balance and get the amount of funds available for trading or funds locked in orders
2400
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/accounts/asset
2401
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/accounts/asset/-symbol-
2402
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2403
+ * @param {string} params.tradingAccountId the trading account id (mandatory parameter)
2404
+ * @param {string} [params.code] unified currency code, default is undefined
2405
+ * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
2406
+ */
2407
+ async fetchBalance(params = {}) {
2408
+ await Promise.all([this.loadMarkets(), this.handleToken()]);
2409
+ const tradingAccountId = await this.loadAccount(params);
2410
+ const request = {
2411
+ 'tradingAccountId': tradingAccountId,
2412
+ };
2413
+ let response = undefined;
2414
+ const code = this.safeString(params, 'code');
2415
+ if (code !== undefined) {
2416
+ request['symbol'] = this.currency(code)['id'];
2417
+ response = await this.privateGetV1AccountsAssetSymbol(this.extend(request, params));
2418
+ return this.parseBalanceForSingleCurrency(response, code);
2419
+ }
2420
+ else {
2421
+ response = await this.privateGetV1AccountsAsset(this.extend(request, params));
2422
+ //
2423
+ // [
2424
+ // {
2425
+ // "assetId": "10",
2426
+ // "assetSymbol": "AAVE",
2427
+ // "availableQuantity": "10000000.00000000",
2428
+ // "borrowedQuantity": "0.00000000",
2429
+ // "loanedQuantity": "0.00000000",
2430
+ // "lockedQuantity": "0.00000000",
2431
+ // "publishedAtTimestamp": "1747942728870",
2432
+ // "tradingAccountId": "111309424211255",
2433
+ // "updatedAtDatetime": "2025-05-13T11:33:08.801Z",
2434
+ // "updatedAtTimestamp": "1747135988801"
2435
+ // }, ...
2436
+ // ]
2437
+ //
2438
+ return this.parseBalance(response);
2439
+ }
2440
+ }
2441
+ parseBalanceForSingleCurrency(response, code) {
2442
+ const result = { 'info': response };
2443
+ const account = this.account();
2444
+ account['free'] = this.safeString(response, 'availableQuantity');
2445
+ account['used'] = this.safeString(response, 'lockedQuantity');
2446
+ result[code] = account;
2447
+ return this.safeBalance(result);
2448
+ }
2449
+ parseBalance(response) {
2450
+ const result = {
2451
+ 'info': response,
2452
+ };
2453
+ for (let i = 0; i < response.length; i++) {
2454
+ const balance = response[i];
2455
+ const symbol = this.safeString(balance, 'assetSymbol');
2456
+ const code = this.safeCurrencyCode(symbol);
2457
+ const account = this.account();
2458
+ account['total'] = this.safeString(balance, 'availableQuantity');
2459
+ account['used'] = this.safeString(balance, 'lockedQuantity');
2460
+ result[code] = account;
2461
+ }
2462
+ return this.safeBalance(result);
2463
+ }
2464
+ /**
2465
+ * @method
2466
+ * @name bullish#fetchPositions
2467
+ * @description fetch all open positions
2468
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/derivatives-positions
2469
+ * @param {string[]|undefined} symbols list of unified market symbols
2470
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2471
+ * @param {string} params.tradingAccountId the trading account id
2472
+ * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
2473
+ */
2474
+ async fetchPositions(symbols = undefined, params = {}) {
2475
+ await Promise.all([this.loadMarkets(), this.handleToken()]);
2476
+ const tradingAccountId = await this.loadAccount(params);
2477
+ const request = {
2478
+ 'tradingAccountId': tradingAccountId,
2479
+ };
2480
+ const response = await this.privateGetV1DerivativesPositions(this.extend(request, params));
2481
+ //
2482
+ // [
2483
+ // {
2484
+ // "tradingAccountId": "111000000000001",
2485
+ // "symbol": "BTC-USDC-PERP",
2486
+ // "side": "BUY",
2487
+ // "quantity": "1.00000000",
2488
+ // "notional": "1.0000",
2489
+ // "entryNotional": "1.0000",
2490
+ // "mtmPnl": "1.0000",
2491
+ // "reportedMtmPnl": "1.0000",
2492
+ // "reportedFundingPnl": "1.0000",
2493
+ // "realizedPnl": "1.0000",
2494
+ // "settlementAssetSymbol": "USDC",
2495
+ // "createdAtDatetime": "2021-05-20T01:01:01.000Z",
2496
+ // "createdAtTimestamp": "1621490985000",
2497
+ // "updatedAtDatetime": "2021-05-20T01:01:01.000Z",
2498
+ // "updatedAtTimestamp": "1621490985000"
2499
+ // }
2500
+ // ]
2501
+ //
2502
+ const results = this.parsePositions(response, symbols);
2503
+ return this.filterByArrayPositions(results, 'symbol', symbols, false);
2504
+ }
2505
+ parsePosition(position, market = undefined) {
2506
+ //
2507
+ // [
2508
+ // {
2509
+ // "tradingAccountId": "111000000000001",
2510
+ // "symbol": "BTC-USDC-PERP",
2511
+ // "side": "BUY",
2512
+ // "quantity": "1.00000000",
2513
+ // "notional": "1.0000",
2514
+ // "entryNotional": "1.0000",
2515
+ // "mtmPnl": "1.0000",
2516
+ // "reportedMtmPnl": "1.0000",
2517
+ // "reportedFundingPnl": "1.0000",
2518
+ // "realizedPnl": "1.0000",
2519
+ // "settlementAssetSymbol": "USDC",
2520
+ // "createdAtDatetime": "2021-05-20T01:01:01.000Z",
2521
+ // "createdAtTimestamp": "1621490985000",
2522
+ // "updatedAtDatetime": "2021-05-20T01:01:01.000Z",
2523
+ // "updatedAtTimestamp": "1621490985000"
2524
+ // }
2525
+ // ]
2526
+ //
2527
+ market = this.safeMarket(this.safeString(position, 'symbol'), market);
2528
+ const symbol = market['symbol'];
2529
+ const timestamp = this.safeInteger(position, 'createdAtTimestamp');
2530
+ const side = this.safeString(position, 'side');
2531
+ return this.safePosition({
2532
+ 'info': position,
2533
+ 'id': undefined,
2534
+ 'symbol': symbol,
2535
+ 'timestamp': timestamp,
2536
+ 'datetime': this.iso8601(timestamp),
2537
+ 'lastUpdateTimestamp': this.safeInteger(position, 'updatedAtTimestamp'),
2538
+ 'hedged': undefined,
2539
+ 'side': this.parsePositionSide(side),
2540
+ 'contracts': this.safeNumber(position, 'quantity'),
2541
+ 'contractSize': undefined,
2542
+ 'entryPrice': undefined,
2543
+ 'markPrice': undefined,
2544
+ 'lastPrice': undefined,
2545
+ 'notional': this.safeNumber(position, 'notional'),
2546
+ 'leverage': undefined,
2547
+ 'collateral': undefined,
2548
+ 'initialMargin': undefined,
2549
+ 'initialMarginPercentage': undefined,
2550
+ 'maintenanceMargin': undefined,
2551
+ 'maintenanceMarginPercentage': undefined,
2552
+ 'unrealizedPnl': undefined,
2553
+ 'liquidationPrice': undefined,
2554
+ 'marginMode': undefined,
2555
+ 'marginRatio': undefined,
2556
+ 'percentage': undefined,
2557
+ 'stopLossPrice': undefined,
2558
+ 'takeProfitPrice': undefined,
2559
+ });
2560
+ }
2561
+ parsePositionSide(side) {
2562
+ const sides = {
2563
+ 'BUY': 'long',
2564
+ 'SELL': 'short',
2565
+ };
2566
+ return this.safeString(sides, side, side);
2567
+ }
2568
+ /**
2569
+ * @method
2570
+ * @name bullish#fetchTransfers
2571
+ * @description fetch a history of internal transfers made on an account
2572
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/history/transfer
2573
+ * @param {string} code unified currency code of the currency transferred
2574
+ * @param {int} [since] the earliest time in ms to fetch transfers for
2575
+ * @param {int} [limit] the maximum number of transfer structures to retrieve
2576
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2577
+ * @param {int} params.until the latest time in ms to fetch transfers for (default time now)
2578
+ * @param {string} params.tradingAccountId the trading account id
2579
+ * @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
2580
+ */
2581
+ async fetchTransfers(code = undefined, since = undefined, limit = undefined, params = {}) {
2582
+ await Promise.all([this.loadMarkets(), this.handleToken()]);
2583
+ const tradingAccountId = await this.loadAccount(params);
2584
+ const maxLimit = 100;
2585
+ let paginate = false;
2586
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchTransfers', 'paginate');
2587
+ if (paginate) {
2588
+ params = this.handlePaginationParams('fetchTransfers', since, params);
2589
+ return await this.fetchPaginatedCallDynamic('fetchTransfers', code, since, limit, params, maxLimit);
2590
+ }
2591
+ const request = {
2592
+ 'tradingAccountId': tradingAccountId,
2593
+ };
2594
+ let currency = undefined;
2595
+ if (code !== undefined) {
2596
+ currency = this.currency(code);
2597
+ request['assetSymbol'] = currency['id'];
2598
+ }
2599
+ const until = this.safeInteger(params, 'until');
2600
+ if ((since === undefined) && (until === undefined)) {
2601
+ // since and until are mandatory for this endpoint, set until to now if both are undefined
2602
+ const now = this.milliseconds();
2603
+ params = this.extend(params, { 'until': now });
2604
+ }
2605
+ params = this.handleSinceAndUntil(since, params);
2606
+ if (limit !== undefined) {
2607
+ request['_pageSize'] = this.getClosestLimit(limit);
2608
+ }
2609
+ const response = await this.privateGetV1HistoryTransfer(this.extend(request, params));
2610
+ //
2611
+ // [
2612
+ // {
2613
+ // "requestId": "1",
2614
+ // "toTradingAccountId": "111000000000001",
2615
+ // "fromTradingAccountId": "121000000000001",
2616
+ // "assetSymbol": "BTC",
2617
+ // "quantity": "1.00000000",
2618
+ // "status": "CLOSED",
2619
+ // "statusReasonCode": "6002",
2620
+ // "statusReason": "Executed",
2621
+ // "createdAtTimestamp": "1621490985000",
2622
+ // "createdAtDatetime": "2021-05-20T01:01:01.000Z"
2623
+ // }
2624
+ // ]
2625
+ //
2626
+ return this.parseTransfers(response, currency, since, limit);
2627
+ }
2628
+ /**
2629
+ * @method
2630
+ * @name bullish#transfer
2631
+ * @description transfer currency internally between wallets on the same account
2632
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#post-/v1/command-commandType-V1TransferAsset
2633
+ * @param {string} code unified currency codeåå
2634
+ * @param {float} amount amount to transfer
2635
+ * @param {string} fromAccount account ID to transfer from
2636
+ * @param {string} toAccount account ID to transfer to
2637
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2638
+ * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
2639
+ */
2640
+ async transfer(code, amount, fromAccount, toAccount, params = {}) {
2641
+ await Promise.all([this.loadMarkets(), this.handleToken()]);
2642
+ // todo check this method properly
2643
+ const currency = this.currency(code);
2644
+ const request = {
2645
+ 'commandType': 'V2TransferAsset',
2646
+ 'assetSymbol': currency['id'],
2647
+ 'quantity': this.currencyToPrecision(code, amount),
2648
+ 'fromTradingAccountId': fromAccount,
2649
+ 'toTradingAccountId': toAccount,
2650
+ };
2651
+ const response = await this.privatePostV2Command(this.extend(request, params));
2652
+ //
2653
+ // {
2654
+ // "message": "Command acknowledged - TransferAsset",
2655
+ // "requestId": "633909659774222336"
2656
+ // }
2657
+ //
2658
+ const transferOptions = this.safeDict(this.options, 'transfer', {});
2659
+ const fillResponseFromRequest = this.safeBool(transferOptions, 'fillResponseFromRequest', true);
2660
+ const transfer = this.parseTransfer(response, currency);
2661
+ if (fillResponseFromRequest) {
2662
+ transfer['fromAccount'] = fromAccount;
2663
+ transfer['toAccount'] = toAccount;
2664
+ transfer['amount'] = amount;
2665
+ transfer['currency'] = code;
2666
+ }
2667
+ return transfer;
2668
+ }
2669
+ parseTransfer(transfer, currency = undefined) {
2670
+ //
2671
+ // fetchTransfers
2672
+ // {
2673
+ // "requestId": "1",
2674
+ // "toTradingAccountId": "111000000000001",
2675
+ // "fromTradingAccountId": "121000000000001",
2676
+ // "assetSymbol": "BTC",
2677
+ // "quantity": "1.00000000",
2678
+ // "status": "CLOSED",
2679
+ // "statusReasonCode": "6002",
2680
+ // "statusReason": "Executed",
2681
+ // "createdAtTimestamp": "1621490985000",
2682
+ // "createdAtDatetime": "2021-05-20T01:01:01.000Z"
2683
+ // }
2684
+ //
2685
+ // transfer
2686
+ // {
2687
+ // "message": "Command acknowledged - TransferAsset",
2688
+ // "requestId": "633909659774222336"
2689
+ // }
2690
+ //
2691
+ const timestamp = this.safeInteger(transfer, 'createdAtTimestamp');
2692
+ const currencyId = this.safeString(transfer, 'assetSymbol');
2693
+ let status = this.safeString(transfer, 'status');
2694
+ if (status === undefined) {
2695
+ status = this.safeString(transfer, 'message');
2696
+ }
2697
+ return {
2698
+ 'id': this.safeString(transfer, 'requestId'),
2699
+ 'timestamp': timestamp,
2700
+ 'datetime': this.iso8601(timestamp),
2701
+ 'currency': this.safeCurrencyCode(currencyId, currency),
2702
+ 'amount': this.safeNumber(transfer, 'quantity'),
2703
+ 'fromAccount': this.safeString(transfer, 'fromTradingAccountId'),
2704
+ 'toAccount': this.safeString(transfer, 'toTradingAccountId'),
2705
+ 'status': this.parseTransferStatus(status),
2706
+ 'info': transfer,
2707
+ };
2708
+ }
2709
+ parseTransferStatus(status) {
2710
+ const statuses = {
2711
+ 'CLOSED': 'ok',
2712
+ 'OPEN': 'pending',
2713
+ 'REJECTED': 'failed',
2714
+ 'Command acknowledged - TransferAsset': 'ok',
2715
+ };
2716
+ return this.safeString(statuses, status, status);
2717
+ }
2718
+ /**
2719
+ * @method
2720
+ * @name bullish#fetchBorrowRateHistory
2721
+ * @description retrieves a history of a currencies borrow interest rate at specific time slots
2722
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/history/borrow-interest
2723
+ * @param {string} code unified currency code
2724
+ * @param {int} [since] timestamp for the earliest borrow rate
2725
+ * @param {int} [limit] the maximum number of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure} to retrieve
2726
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2727
+ * @param {int} params.until the latest time in ms to fetch entries for
2728
+ * @param {string} params.tradingAccountId the trading account id
2729
+ * @returns {object[]} an array of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
2730
+ */
2731
+ async fetchBorrowRateHistory(code, since = undefined, limit = undefined, params = {}) {
2732
+ await Promise.all([this.loadMarkets(), this.handleToken()]);
2733
+ const tradingAccountId = await this.loadAccount(params);
2734
+ const currency = this.currency(code);
2735
+ let request = {
2736
+ 'assetSymbol': currency['id'],
2737
+ 'tradingAccountId': tradingAccountId,
2738
+ };
2739
+ const now = this.milliseconds();
2740
+ let startTimestamp = since;
2741
+ [request, params] = this.handleUntilOption('createdAtDatetime[lte]', request, params);
2742
+ let until = this.safeInteger(request, 'createdAtDatetime[lte]');
2743
+ // current endpoint requires both since and until parameters
2744
+ if (startTimestamp === undefined) {
2745
+ startTimestamp = now - 1000 * 60 * 60 * 24 * 90; // Only the last 90 days of data is available for querying
2746
+ }
2747
+ if (until === undefined) {
2748
+ until = now;
2749
+ }
2750
+ request['createdAtDatetime[gte]'] = this.iso8601(startTimestamp);
2751
+ request['createdAtDatetime[lte]'] = this.iso8601(until);
2752
+ const response = await this.privateGetV1HistoryBorrowInterest(this.extend(request, params));
2753
+ //
2754
+ // [
2755
+ // {
2756
+ // "assetId": "1",
2757
+ // "assetSymbol": "BTC",
2758
+ // "borrowedQuantity": "1.00000000",
2759
+ // "totalBorrowedQuantity": "1.00000000",
2760
+ // "createdAtDatetime": "2020-08-21T08:00:00.000Z",
2761
+ // "createdAtTimestamp": "1621490985000"
2762
+ // }
2763
+ // ]
2764
+ //
2765
+ return this.parseBorrowRateHistory(response, code, since, limit);
2766
+ }
2767
+ parseBorrowRate(info, currency = undefined) {
2768
+ //
2769
+ // {
2770
+ // "assetId": "1",
2771
+ // "assetSymbol": "BTC",
2772
+ // "borrowedQuantity": "1.00000000",
2773
+ // "totalBorrowedQuantity": "1.00000000",
2774
+ // "createdAtDatetime": "2020-08-21T08:00:00.000Z",
2775
+ // "createdAtTimestamp": "1621490985000"
2776
+ // }
2777
+ //
2778
+ const timestamp = this.safeInteger(info, 'createdAtTimestamp');
2779
+ const currencyId = this.safeString(info, 'assetSymbol');
2780
+ return {
2781
+ 'currency': this.safeCurrencyCode(currencyId, currency),
2782
+ 'rate': this.safeNumber(info, 'borrowedQuantity'),
2783
+ 'period': 86400000,
2784
+ 'timestamp': timestamp,
2785
+ 'datetime': this.iso8601(timestamp),
2786
+ 'info': info,
2787
+ };
2788
+ }
2789
+ getTimestamp() {
2790
+ return this.milliseconds() - this.options['timeDifference'];
2791
+ }
2792
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
2793
+ const request = this.omit(params, this.extractParams(path));
2794
+ const endpoint = '/' + this.implodeParams(path, params);
2795
+ let url = this.urls['api'][api] + endpoint;
2796
+ if (api === 'private') {
2797
+ this.checkRequiredCredentials();
2798
+ const nonce = this.microseconds().toString();
2799
+ const timestamp = this.getTimestamp().toString();
2800
+ if (method === 'GET') {
2801
+ const payload = timestamp + nonce + method + '/trading-api/' + path;
2802
+ const signature = this.hmac(this.encode(payload), this.encode(this.secret), sha256.sha256, 'hex');
2803
+ headers = {
2804
+ 'BX-TIMESTAMP': timestamp,
2805
+ 'BX-NONCE': nonce,
2806
+ 'BX-SIGNATURE': signature,
2807
+ };
2808
+ }
2809
+ else if (method === 'POST') {
2810
+ body = this.json(params);
2811
+ const payload = timestamp + nonce + method + '/trading-api/' + path + body;
2812
+ const digest = this.hash(this.encode(payload), sha256.sha256, 'hex');
2813
+ const signature = this.hmac(this.encode(digest), this.encode(this.secret), sha256.sha256, 'hex');
2814
+ headers = {
2815
+ 'BX-TIMESTAMP': timestamp,
2816
+ 'BX-NONCE': nonce,
2817
+ 'BX-SIGNATURE': signature,
2818
+ 'Content-Type': 'application/json',
2819
+ };
2820
+ headers['Content-Type'] = 'application/json';
2821
+ const rateLimitToken = this.safeString(request, 'rateLimitToken');
2822
+ if (rateLimitToken !== undefined) {
2823
+ headers['BX-RATE-LIMIT-TOKEN'] = rateLimitToken;
2824
+ }
2825
+ }
2826
+ if (path === 'v1/users/hmac/login') {
2827
+ headers['BX-PUBLIC-KEY'] = this.apiKey;
2828
+ }
2829
+ else {
2830
+ const token = this.token;
2831
+ if ((token === undefined)) {
2832
+ throw new errors.AuthenticationError(this.id + ' requires a token, please call signIn() first');
2833
+ }
2834
+ headers['Authorization'] = 'Bearer ' + token;
2835
+ // headers['BX-NONCE-WINDOW-ENABLED'] = 'false'; // default is false
2836
+ }
2837
+ }
2838
+ if (method === 'GET') {
2839
+ const query = this.urlencode(request);
2840
+ if (query.length) {
2841
+ url += '?' + query;
2842
+ }
2843
+ }
2844
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
2845
+ }
2846
+ /**
2847
+ * @method
2848
+ * @name bullish#signIn
2849
+ * @description sign in, must be called prior to using other authenticated methods
2850
+ * @see https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#overview--add-authenticated-request-header
2851
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2852
+ * @returns response from exchange
2853
+ */
2854
+ async signIn(params = {}) {
2855
+ const response = await this.privateGetV1UsersHmacLogin(params);
2856
+ //
2857
+ // {
2858
+ // "authorizer": "113363EFA2CA00007368524E02000000",
2859
+ // "ownerAuthorizer": "113363EFA2CA00007368524E02000000",
2860
+ // "token": "eyJhbGciOiJFUzI1NiJ9.eyJpc3MiOiJiMXgtYXV0aC1zZXJ2aWNlIiwic3ViIjoiNDY0OTc4MzAiLCJleHAiOjE3NDczMzgzNDMsIlNUQUdFIjoiQVVUSEVOVElDQVRFRF9XSVRIX0JMT0NLQ0hBSU4ifQ.5FSyrihzc1wsJqAY8pVX36Y4ZXg3HopLJypPEbHg5bBK8FbL_oLxkj6zM_iOYL2a1x6-ICG0pQjr8hF_k8Yg-w"
2861
+ // }
2862
+ //
2863
+ const token = this.safeString(response, 'token');
2864
+ const authorizer = this.safeString(response, 'authorizer');
2865
+ this.options['authorizer'] = authorizer;
2866
+ this.token = token;
2867
+ this.options['tokenExpires'] = this.sum(this.milliseconds(), 1000 * 60 * 60 * 24); // token expires in 24 hours
2868
+ return token;
2869
+ }
2870
+ async handleToken(params = {}) {
2871
+ const now = this.milliseconds();
2872
+ const token = this.token;
2873
+ const tokenExpires = this.safeInteger(this.options, 'tokenExpires');
2874
+ if ((token === undefined) || (tokenExpires === undefined) || (now > tokenExpires)) {
2875
+ return await this.signIn();
2876
+ }
2877
+ else {
2878
+ return this.token;
2879
+ }
2880
+ }
2881
+ handleErrors(httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
2882
+ if (response === undefined) {
2883
+ return undefined; // fallback to default error handler
2884
+ }
2885
+ //
2886
+ // {
2887
+ // "type": "HttpInvalidParameterException",
2888
+ // "message": "HTTP_INVALID_PARAMETER: '100m' is not a valid time bucket"
2889
+ // }
2890
+ //
2891
+ // {
2892
+ // "message": "Order size outside valid range",
2893
+ // "raw": null,
2894
+ // "errorCode": 6023,
2895
+ // "errorCodeName": "ORDER_SIZE_OUTSIDE_VALID_RANGE"
2896
+ // }
2897
+ //
2898
+ const code = this.safeString(response, 'errorCode');
2899
+ const type = this.safeString(response, 'type');
2900
+ if ((code !== undefined && code !== '0' && code !== '1001') || (type !== undefined && type === 'HttpInvalidParameterException')) {
2901
+ let message = '';
2902
+ const errorCodeName = this.safeString(response, 'errorCodeName');
2903
+ if (errorCodeName !== undefined) {
2904
+ message = errorCodeName;
2905
+ }
2906
+ else {
2907
+ message = type;
2908
+ }
2909
+ const feedback = this.id + ' ' + body;
2910
+ this.throwExactlyMatchedException(this.exceptions['exact'], message, feedback);
2911
+ this.throwBroadlyMatchedException(this.exceptions['broad'], message, feedback);
2912
+ this.throwExactlyMatchedException(this.exceptions['exact'], code, feedback);
2913
+ throw new errors.ExchangeError(feedback); // unknown message
2914
+ }
2915
+ return undefined;
2916
+ }
2917
+ }
2918
+
2919
+ exports["default"] = bullish;