ccxt 4.1.85 → 4.1.87

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 (355) hide show
  1. package/README.md +5 -8
  2. package/dist/ccxt.browser.js +17662 -23869
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -16
  5. package/dist/cjs/src/ace.js +1 -1
  6. package/dist/cjs/src/alpaca.js +2 -2
  7. package/dist/cjs/src/ascendex.js +2 -2
  8. package/dist/cjs/src/base/Exchange.js +50 -20
  9. package/dist/cjs/src/bigone.js +1 -1
  10. package/dist/cjs/src/binance.js +2 -2
  11. package/dist/cjs/src/binanceus.js +0 -2
  12. package/dist/cjs/src/bingx.js +1 -1
  13. package/dist/cjs/src/bit2c.js +1 -1
  14. package/dist/cjs/src/bitbank.js +1 -1
  15. package/dist/cjs/src/bitbns.js +1 -1
  16. package/dist/cjs/src/bitfinex.js +1 -1
  17. package/dist/cjs/src/bitfinex2.js +1 -1
  18. package/dist/cjs/src/bitflyer.js +1 -1
  19. package/dist/cjs/src/bitforex.js +1 -3
  20. package/dist/cjs/src/bitget.js +2 -3
  21. package/dist/cjs/src/bithumb.js +1 -1
  22. package/dist/cjs/src/bitmart.js +1 -1
  23. package/dist/cjs/src/bitmex.js +2 -2
  24. package/dist/cjs/src/bitopro.js +1 -1
  25. package/dist/cjs/src/bitpanda.js +1 -1
  26. package/dist/cjs/src/bitrue.js +1 -1
  27. package/dist/cjs/src/bitso.js +1 -1
  28. package/dist/cjs/src/bitstamp.js +1 -1
  29. package/dist/cjs/src/bittrex.js +1 -1
  30. package/dist/cjs/src/bitvavo.js +1 -1
  31. package/dist/cjs/src/bl3p.js +1 -1
  32. package/dist/cjs/src/blockchaincom.js +1 -1
  33. package/dist/cjs/src/btcalpha.js +1 -1
  34. package/dist/cjs/src/btcbox.js +1 -1
  35. package/dist/cjs/src/btcmarkets.js +1 -1
  36. package/dist/cjs/src/btcturk.js +1 -1
  37. package/dist/cjs/src/bybit.js +3 -5
  38. package/dist/cjs/src/cex.js +1 -1
  39. package/dist/cjs/src/coinbase.js +1 -1
  40. package/dist/cjs/src/coinbasepro.js +1 -1
  41. package/dist/cjs/src/coincheck.js +1 -1
  42. package/dist/cjs/src/coinex.js +2 -2
  43. package/dist/cjs/src/coinlist.js +1 -3
  44. package/dist/cjs/src/coinmate.js +1 -1
  45. package/dist/cjs/src/coinone.js +1 -1
  46. package/dist/cjs/src/coinsph.js +1 -3
  47. package/dist/cjs/src/coinspot.js +1 -1
  48. package/dist/cjs/src/cryptocom.js +3 -5
  49. package/dist/cjs/src/currencycom.js +1 -1
  50. package/dist/cjs/src/delta.js +1 -1
  51. package/dist/cjs/src/deribit.js +1 -1
  52. package/dist/cjs/src/digifinex.js +160 -112
  53. package/dist/cjs/src/exmo.js +1 -1
  54. package/dist/cjs/src/gate.js +1 -211
  55. package/dist/cjs/src/gemini.js +1 -1
  56. package/dist/cjs/src/hitbtc.js +2 -2
  57. package/dist/cjs/src/hitbtc3.js +1 -1
  58. package/dist/cjs/src/hollaex.js +1 -1
  59. package/dist/cjs/src/htx.js +2 -2
  60. package/dist/cjs/src/huobijp.js +1 -1
  61. package/dist/cjs/src/idex.js +1 -1
  62. package/dist/cjs/src/independentreserve.js +1 -1
  63. package/dist/cjs/src/indodax.js +1 -1
  64. package/dist/cjs/src/kraken.js +2 -2
  65. package/dist/cjs/src/krakenfutures.js +3 -3
  66. package/dist/cjs/src/kucoin.js +2 -6
  67. package/dist/cjs/src/kuna.js +1 -3
  68. package/dist/cjs/src/latoken.js +2 -2
  69. package/dist/cjs/src/lbank.js +1 -1
  70. package/dist/cjs/src/luno.js +1 -1
  71. package/dist/cjs/src/lykke.js +1 -1
  72. package/dist/cjs/src/mercado.js +1 -1
  73. package/dist/cjs/src/mexc.js +102 -55
  74. package/dist/cjs/src/ndax.js +1 -1
  75. package/dist/cjs/src/novadax.js +1 -1
  76. package/dist/cjs/src/oceanex.js +1 -1
  77. package/dist/cjs/src/okcoin.js +1 -1
  78. package/dist/cjs/src/okx.js +4 -5
  79. package/dist/cjs/src/p2b.js +1 -3
  80. package/dist/cjs/src/paymium.js +1 -1
  81. package/dist/cjs/src/phemex.js +1 -1
  82. package/dist/cjs/src/poloniex.js +51 -51
  83. package/dist/cjs/src/poloniexfutures.js +1 -1
  84. package/dist/cjs/src/pro/bitget.js +1 -1
  85. package/dist/cjs/src/pro/bitmex.js +206 -0
  86. package/dist/cjs/src/pro/coinex.js +2 -1
  87. package/dist/cjs/src/pro/krakenfutures.js +6 -6
  88. package/dist/cjs/src/pro/mexc.js +1 -1
  89. package/dist/cjs/src/pro/poloniex.js +1 -1
  90. package/dist/cjs/src/pro/poloniexfutures.js +3 -3
  91. package/dist/cjs/src/probit.js +27 -19
  92. package/dist/cjs/src/static_dependencies/jsencrypt/JSEncrypt.js +1 -1
  93. package/dist/cjs/src/static_dependencies/jsencrypt/JSEncryptRSAKey.js +3 -3
  94. package/dist/cjs/src/timex.js +1 -1
  95. package/dist/cjs/src/tokocrypto.js +8 -5
  96. package/dist/cjs/src/upbit.js +37 -27
  97. package/dist/cjs/src/wavesexchange.js +1 -1
  98. package/dist/cjs/src/wazirx.js +1 -3
  99. package/dist/cjs/src/whitebit.js +1 -3
  100. package/dist/cjs/src/woo.js +1 -3
  101. package/dist/cjs/src/yobit.js +1 -1
  102. package/dist/cjs/src/zaif.js +1 -1
  103. package/dist/cjs/src/zonda.js +1 -1
  104. package/js/ccxt.d.ts +3 -21
  105. package/js/ccxt.js +2 -14
  106. package/js/src/ace.d.ts +2 -2
  107. package/js/src/ace.js +1 -1
  108. package/js/src/alpaca.d.ts +2 -2
  109. package/js/src/alpaca.js +2 -2
  110. package/js/src/ascendex.d.ts +2 -2
  111. package/js/src/ascendex.js +2 -2
  112. package/js/src/base/Exchange.d.ts +7 -3
  113. package/js/src/base/Exchange.js +50 -20
  114. package/js/src/base/types.d.ts +1 -0
  115. package/js/src/bigone.d.ts +2 -2
  116. package/js/src/bigone.js +1 -1
  117. package/js/src/binance.d.ts +2 -2
  118. package/js/src/binance.js +2 -2
  119. package/js/src/binanceus.js +0 -2
  120. package/js/src/bingx.d.ts +1 -1
  121. package/js/src/bingx.js +1 -1
  122. package/js/src/bit2c.d.ts +2 -2
  123. package/js/src/bit2c.js +1 -1
  124. package/js/src/bitbank.d.ts +2 -2
  125. package/js/src/bitbank.js +1 -1
  126. package/js/src/bitbns.d.ts +2 -2
  127. package/js/src/bitbns.js +1 -1
  128. package/js/src/bitfinex.d.ts +2 -2
  129. package/js/src/bitfinex.js +1 -1
  130. package/js/src/bitfinex2.d.ts +2 -2
  131. package/js/src/bitfinex2.js +1 -1
  132. package/js/src/bitflyer.d.ts +2 -2
  133. package/js/src/bitflyer.js +1 -1
  134. package/js/src/bitforex.d.ts +2 -2
  135. package/js/src/bitforex.js +1 -3
  136. package/js/src/bitget.d.ts +2 -2
  137. package/js/src/bitget.js +2 -3
  138. package/js/src/bithumb.d.ts +2 -2
  139. package/js/src/bithumb.js +1 -1
  140. package/js/src/bitmart.d.ts +2 -2
  141. package/js/src/bitmart.js +1 -1
  142. package/js/src/bitmex.d.ts +2 -2
  143. package/js/src/bitmex.js +2 -2
  144. package/js/src/bitopro.d.ts +2 -2
  145. package/js/src/bitopro.js +1 -1
  146. package/js/src/bitpanda.d.ts +2 -2
  147. package/js/src/bitpanda.js +1 -1
  148. package/js/src/bitrue.d.ts +2 -2
  149. package/js/src/bitrue.js +1 -1
  150. package/js/src/bitso.d.ts +2 -2
  151. package/js/src/bitso.js +1 -1
  152. package/js/src/bitstamp.d.ts +2 -2
  153. package/js/src/bitstamp.js +1 -1
  154. package/js/src/bittrex.d.ts +1 -1
  155. package/js/src/bittrex.js +1 -1
  156. package/js/src/bitvavo.d.ts +2 -2
  157. package/js/src/bitvavo.js +1 -1
  158. package/js/src/bl3p.d.ts +2 -2
  159. package/js/src/bl3p.js +1 -1
  160. package/js/src/blockchaincom.d.ts +2 -2
  161. package/js/src/blockchaincom.js +1 -1
  162. package/js/src/btcalpha.d.ts +2 -2
  163. package/js/src/btcalpha.js +1 -1
  164. package/js/src/btcbox.d.ts +2 -2
  165. package/js/src/btcbox.js +1 -1
  166. package/js/src/btcmarkets.d.ts +2 -2
  167. package/js/src/btcmarkets.js +1 -1
  168. package/js/src/btcturk.d.ts +2 -2
  169. package/js/src/btcturk.js +1 -1
  170. package/js/src/bybit.d.ts +2 -2
  171. package/js/src/bybit.js +3 -5
  172. package/js/src/cex.d.ts +2 -2
  173. package/js/src/cex.js +1 -1
  174. package/js/src/coinbase.d.ts +2 -2
  175. package/js/src/coinbase.js +1 -1
  176. package/js/src/coinbasepro.d.ts +2 -2
  177. package/js/src/coinbasepro.js +1 -1
  178. package/js/src/coincheck.d.ts +2 -2
  179. package/js/src/coincheck.js +1 -1
  180. package/js/src/coinex.d.ts +2 -2
  181. package/js/src/coinex.js +2 -2
  182. package/js/src/coinlist.d.ts +2 -2
  183. package/js/src/coinlist.js +1 -3
  184. package/js/src/coinmate.d.ts +2 -2
  185. package/js/src/coinmate.js +1 -1
  186. package/js/src/coinone.d.ts +2 -2
  187. package/js/src/coinone.js +1 -1
  188. package/js/src/coinsph.d.ts +2 -2
  189. package/js/src/coinsph.js +1 -3
  190. package/js/src/coinspot.d.ts +2 -2
  191. package/js/src/coinspot.js +1 -1
  192. package/js/src/cryptocom.d.ts +2 -2
  193. package/js/src/cryptocom.js +3 -5
  194. package/js/src/currencycom.d.ts +2 -2
  195. package/js/src/currencycom.js +1 -1
  196. package/js/src/delta.d.ts +2 -2
  197. package/js/src/delta.js +1 -1
  198. package/js/src/deribit.d.ts +2 -2
  199. package/js/src/deribit.js +1 -1
  200. package/js/src/digifinex.d.ts +2 -2
  201. package/js/src/digifinex.js +160 -112
  202. package/js/src/exmo.d.ts +2 -2
  203. package/js/src/exmo.js +1 -1
  204. package/js/src/gate.d.ts +2 -29
  205. package/js/src/gate.js +1 -211
  206. package/js/src/gemini.d.ts +2 -2
  207. package/js/src/gemini.js +1 -1
  208. package/js/src/hitbtc.d.ts +2 -2
  209. package/js/src/hitbtc.js +2 -2
  210. package/js/src/hitbtc3.d.ts +1 -1
  211. package/js/src/hitbtc3.js +1 -1
  212. package/js/src/hollaex.d.ts +2 -2
  213. package/js/src/hollaex.js +1 -1
  214. package/js/src/htx.d.ts +2 -2
  215. package/js/src/htx.js +2 -2
  216. package/js/src/huobijp.d.ts +2 -2
  217. package/js/src/huobijp.js +1 -1
  218. package/js/src/idex.d.ts +2 -2
  219. package/js/src/idex.js +1 -1
  220. package/js/src/independentreserve.d.ts +2 -2
  221. package/js/src/independentreserve.js +1 -1
  222. package/js/src/indodax.d.ts +2 -2
  223. package/js/src/indodax.js +1 -1
  224. package/js/src/kraken.d.ts +2 -2
  225. package/js/src/kraken.js +2 -2
  226. package/js/src/krakenfutures.d.ts +2 -2
  227. package/js/src/krakenfutures.js +3 -3
  228. package/js/src/kucoin.d.ts +2 -2
  229. package/js/src/kucoin.js +2 -6
  230. package/js/src/kucoinfutures.d.ts +1 -1
  231. package/js/src/kuna.d.ts +2 -2
  232. package/js/src/kuna.js +1 -3
  233. package/js/src/latoken.d.ts +2 -2
  234. package/js/src/latoken.js +2 -2
  235. package/js/src/lbank.d.ts +2 -2
  236. package/js/src/lbank.js +1 -1
  237. package/js/src/luno.d.ts +2 -2
  238. package/js/src/luno.js +1 -1
  239. package/js/src/lykke.d.ts +2 -2
  240. package/js/src/lykke.js +1 -1
  241. package/js/src/mercado.d.ts +2 -2
  242. package/js/src/mercado.js +1 -1
  243. package/js/src/mexc.d.ts +2 -2
  244. package/js/src/mexc.js +102 -55
  245. package/js/src/ndax.d.ts +2 -2
  246. package/js/src/ndax.js +1 -1
  247. package/js/src/novadax.d.ts +2 -2
  248. package/js/src/novadax.js +1 -1
  249. package/js/src/oceanex.d.ts +2 -2
  250. package/js/src/oceanex.js +1 -1
  251. package/js/src/okcoin.d.ts +2 -2
  252. package/js/src/okcoin.js +1 -1
  253. package/js/src/okx.d.ts +2 -2
  254. package/js/src/okx.js +4 -5
  255. package/js/src/p2b.d.ts +2 -2
  256. package/js/src/p2b.js +1 -3
  257. package/js/src/paymium.d.ts +2 -2
  258. package/js/src/paymium.js +1 -1
  259. package/js/src/phemex.d.ts +2 -2
  260. package/js/src/phemex.js +1 -1
  261. package/js/src/poloniex.d.ts +2 -2
  262. package/js/src/poloniex.js +51 -51
  263. package/js/src/poloniexfutures.d.ts +2 -2
  264. package/js/src/poloniexfutures.js +1 -1
  265. package/js/src/pro/alpaca.d.ts +8 -8
  266. package/js/src/pro/ascendex.d.ts +7 -7
  267. package/js/src/pro/binance.d.ts +24 -24
  268. package/js/src/pro/bingx.d.ts +7 -7
  269. package/js/src/pro/bitfinex.d.ts +6 -6
  270. package/js/src/pro/bitfinex2.d.ts +11 -11
  271. package/js/src/pro/bitget.d.ts +18 -18
  272. package/js/src/pro/bitget.js +1 -1
  273. package/js/src/pro/bitmart.d.ts +13 -13
  274. package/js/src/pro/bitmex.d.ts +11 -9
  275. package/js/src/pro/bitmex.js +207 -1
  276. package/js/src/pro/bitopro.d.ts +5 -5
  277. package/js/src/pro/bitpanda.d.ts +10 -10
  278. package/js/src/pro/bitrue.d.ts +5 -5
  279. package/js/src/pro/bitstamp.d.ts +6 -6
  280. package/js/src/pro/bitvavo.d.ts +7 -7
  281. package/js/src/pro/blockchaincom.d.ts +10 -10
  282. package/js/src/pro/bybit.d.ts +14 -14
  283. package/js/src/pro/cex.d.ts +20 -20
  284. package/js/src/pro/coinbase.d.ts +7 -6
  285. package/js/src/pro/coinbasepro.d.ts +12 -12
  286. package/js/src/pro/coinex.d.ts +12 -12
  287. package/js/src/pro/coinex.js +2 -1
  288. package/js/src/pro/cryptocom.d.ts +13 -13
  289. package/js/src/pro/currencycom.d.ts +6 -6
  290. package/js/src/pro/deribit.d.ts +8 -8
  291. package/js/src/pro/exmo.d.ts +6 -6
  292. package/js/src/pro/gate.d.ts +11 -11
  293. package/js/src/pro/gemini.d.ts +7 -7
  294. package/js/src/pro/hitbtc.d.ts +13 -13
  295. package/js/src/pro/hollaex.d.ts +6 -6
  296. package/js/src/pro/htx.d.ts +12 -12
  297. package/js/src/pro/huobijp.d.ts +5 -5
  298. package/js/src/pro/idex.d.ts +7 -7
  299. package/js/src/pro/independentreserve.d.ts +4 -4
  300. package/js/src/pro/kraken.d.ts +11 -11
  301. package/js/src/pro/krakenfutures.d.ts +15 -15
  302. package/js/src/pro/krakenfutures.js +6 -6
  303. package/js/src/pro/kucoin.d.ts +13 -13
  304. package/js/src/pro/kucoinfutures.d.ts +10 -10
  305. package/js/src/pro/luno.d.ts +3 -3
  306. package/js/src/pro/mexc.d.ts +11 -11
  307. package/js/src/pro/mexc.js +1 -1
  308. package/js/src/pro/ndax.d.ts +5 -5
  309. package/js/src/pro/okcoin.d.ts +7 -7
  310. package/js/src/pro/okx.d.ts +16 -16
  311. package/js/src/pro/phemex.d.ts +9 -9
  312. package/js/src/pro/poloniex.d.ts +13 -13
  313. package/js/src/pro/poloniex.js +1 -1
  314. package/js/src/pro/poloniexfutures.d.ts +10 -10
  315. package/js/src/pro/poloniexfutures.js +3 -3
  316. package/js/src/pro/probit.d.ts +7 -7
  317. package/js/src/pro/upbit.d.ts +4 -4
  318. package/js/src/pro/wazirx.d.ts +12 -12
  319. package/js/src/pro/whitebit.d.ts +10 -10
  320. package/js/src/pro/woo.d.ts +11 -11
  321. package/js/src/probit.d.ts +2 -2
  322. package/js/src/probit.js +27 -19
  323. package/js/src/static_dependencies/jsencrypt/JSEncrypt.d.ts +1 -1
  324. package/js/src/static_dependencies/jsencrypt/JSEncrypt.js +1 -1
  325. package/js/src/static_dependencies/jsencrypt/JSEncryptRSAKey.d.ts +3 -3
  326. package/js/src/static_dependencies/jsencrypt/JSEncryptRSAKey.js +3 -3
  327. package/js/src/timex.d.ts +2 -2
  328. package/js/src/timex.js +1 -1
  329. package/js/src/tokocrypto.d.ts +2 -2
  330. package/js/src/tokocrypto.js +8 -5
  331. package/js/src/upbit.d.ts +2 -2
  332. package/js/src/upbit.js +37 -27
  333. package/js/src/wavesexchange.d.ts +2 -2
  334. package/js/src/wavesexchange.js +1 -1
  335. package/js/src/wazirx.d.ts +2 -2
  336. package/js/src/wazirx.js +1 -3
  337. package/js/src/whitebit.d.ts +2 -2
  338. package/js/src/whitebit.js +1 -3
  339. package/js/src/woo.d.ts +2 -2
  340. package/js/src/woo.js +1 -3
  341. package/js/src/yobit.d.ts +2 -2
  342. package/js/src/yobit.js +1 -1
  343. package/js/src/zaif.d.ts +2 -2
  344. package/js/src/zaif.js +1 -1
  345. package/js/src/zonda.d.ts +2 -2
  346. package/js/src/zonda.js +1 -1
  347. package/jsdoc2md.js +0 -2
  348. package/package.json +4 -3
  349. package/skip-tests.json +4 -0
  350. package/js/src/abstract/bittrex.d.ts +0 -79
  351. package/js/src/abstract/bittrex.js +0 -11
  352. package/js/src/abstract/coinbaseprime.d.ts +0 -69
  353. package/js/src/abstract/coinbaseprime.js +0 -11
  354. package/js/src/abstract/coinbasepro.d.ts +0 -69
  355. package/js/src/abstract/coinbasepro.js +0 -11
@@ -18,6 +18,7 @@ class bitmex extends bitmex$1 {
18
18
  'watchOrderBook': true,
19
19
  'watchOrderBookForSymbols': true,
20
20
  'watchOrders': true,
21
+ 'watchPostions': true,
21
22
  'watchTicker': true,
22
23
  'watchTickers': false,
23
24
  'watchTrades': true,
@@ -591,6 +592,210 @@ class bitmex extends bitmex$1 {
591
592
  }
592
593
  }
593
594
  }
595
+ async watchPositions(symbols = undefined, since = undefined, limit = undefined, params = {}) {
596
+ /**
597
+ * @method
598
+ * @name bitmex#watchPositions
599
+ * @see https://www.bitmex.com/app/wsAPI
600
+ * @description watch all open positions
601
+ * @param {string[]|undefined} symbols list of unified market symbols
602
+ * @param {object} params extra parameters specific to the exchange API endpoint
603
+ * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
604
+ */
605
+ await this.loadMarkets();
606
+ await this.authenticate();
607
+ const subscriptionHash = 'position';
608
+ let messageHash = 'positions';
609
+ if (!this.isEmpty(symbols)) {
610
+ messageHash = '::' + symbols.join(',');
611
+ }
612
+ const url = this.urls['api']['ws'];
613
+ const request = {
614
+ 'op': 'subscribe',
615
+ 'args': [
616
+ subscriptionHash,
617
+ ],
618
+ };
619
+ const newPositions = await this.watch(url, messageHash, request, subscriptionHash);
620
+ if (this.newUpdates) {
621
+ return newPositions;
622
+ }
623
+ return this.filterBySymbolsSinceLimit(this.positions, symbols, since, limit, true);
624
+ }
625
+ handlePositions(client, message) {
626
+ //
627
+ // partial
628
+ // {
629
+ // table: 'position',
630
+ // action: 'partial',
631
+ // keys: [ 'account', 'symbol' ],
632
+ // types: {
633
+ // account: 'long',
634
+ // symbol: 'symbol',
635
+ // currency: 'symbol',
636
+ // underlying: 'symbol',
637
+ // quoteCurrency: 'symbol',
638
+ // commission: 'float',
639
+ // initMarginReq: 'float',
640
+ // maintMarginReq: 'float',
641
+ // riskLimit: 'long',
642
+ // leverage: 'float',
643
+ // crossMargin: 'boolean',
644
+ // deleveragePercentile: 'float',
645
+ // rebalancedPnl: 'long',
646
+ // prevRealisedPnl: 'long',
647
+ // prevUnrealisedPnl: 'long',
648
+ // openingQty: 'long',
649
+ // openOrderBuyQty: 'long',
650
+ // openOrderBuyCost: 'long',
651
+ // openOrderBuyPremium: 'long',
652
+ // openOrderSellQty: 'long',
653
+ // openOrderSellCost: 'long',
654
+ // openOrderSellPremium: 'long',
655
+ // currentQty: 'long',
656
+ // currentCost: 'long',
657
+ // currentComm: 'long',
658
+ // realisedCost: 'long',
659
+ // unrealisedCost: 'long',
660
+ // grossOpenPremium: 'long',
661
+ // isOpen: 'boolean',
662
+ // markPrice: 'float',
663
+ // markValue: 'long',
664
+ // riskValue: 'long',
665
+ // homeNotional: 'float',
666
+ // foreignNotional: 'float',
667
+ // posState: 'symbol',
668
+ // posCost: 'long',
669
+ // posCross: 'long',
670
+ // posComm: 'long',
671
+ // posLoss: 'long',
672
+ // posMargin: 'long',
673
+ // posMaint: 'long',
674
+ // initMargin: 'long',
675
+ // maintMargin: 'long',
676
+ // realisedPnl: 'long',
677
+ // unrealisedPnl: 'long',
678
+ // unrealisedPnlPcnt: 'float',
679
+ // unrealisedRoePcnt: 'float',
680
+ // avgCostPrice: 'float',
681
+ // avgEntryPrice: 'float',
682
+ // breakEvenPrice: 'float',
683
+ // marginCallPrice: 'float',
684
+ // liquidationPrice: 'float',
685
+ // bankruptPrice: 'float',
686
+ // timestamp: 'timestamp'
687
+ // },
688
+ // filter: { account: 412475 },
689
+ // data: [
690
+ // {
691
+ // account: 412475,
692
+ // symbol: 'XBTUSD',
693
+ // currency: 'XBt',
694
+ // underlying: 'XBT',
695
+ // quoteCurrency: 'USD',
696
+ // commission: 0.00075,
697
+ // initMarginReq: 0.01,
698
+ // maintMarginReq: 0.0035,
699
+ // riskLimit: 20000000000,
700
+ // leverage: 100,
701
+ // crossMargin: true,
702
+ // deleveragePercentile: 1,
703
+ // rebalancedPnl: 0,
704
+ // prevRealisedPnl: 0,
705
+ // prevUnrealisedPnl: 0,
706
+ // openingQty: 400,
707
+ // openOrderBuyQty: 0,
708
+ // openOrderBuyCost: 0,
709
+ // openOrderBuyPremium: 0,
710
+ // openOrderSellQty: 0,
711
+ // openOrderSellCost: 0,
712
+ // openOrderSellPremium: 0,
713
+ // currentQty: 400,
714
+ // currentCost: -912269,
715
+ // currentComm: 684,
716
+ // realisedCost: 0,
717
+ // unrealisedCost: -912269,
718
+ // grossOpenPremium: 0,
719
+ // isOpen: true,
720
+ // markPrice: 43772,
721
+ // markValue: -913828,
722
+ // riskValue: 913828,
723
+ // homeNotional: 0.00913828,
724
+ // foreignNotional: -400,
725
+ // posCost: -912269,
726
+ // posCross: 1559,
727
+ // posComm: 694,
728
+ // posLoss: 0,
729
+ // posMargin: 11376,
730
+ // posMaint: 3887,
731
+ // initMargin: 0,
732
+ // maintMargin: 9817,
733
+ // realisedPnl: -684,
734
+ // unrealisedPnl: -1559,
735
+ // unrealisedPnlPcnt: -0.0017,
736
+ // unrealisedRoePcnt: -0.1709,
737
+ // avgCostPrice: 43846.7643,
738
+ // avgEntryPrice: 43846.7643,
739
+ // breakEvenPrice: 43880,
740
+ // marginCallPrice: 20976,
741
+ // liquidationPrice: 20976,
742
+ // bankruptPrice: 20941,
743
+ // timestamp: '2023-12-07T00:09:00.709Z'
744
+ // }
745
+ // ]
746
+ // }
747
+ // update
748
+ // {
749
+ // table: 'position',
750
+ // action: 'update',
751
+ // data: [
752
+ // {
753
+ // account: 412475,
754
+ // symbol: 'XBTUSD',
755
+ // currency: 'XBt',
756
+ // currentQty: 400,
757
+ // markPrice: 43772.75,
758
+ // markValue: -913812,
759
+ // riskValue: 913812,
760
+ // homeNotional: 0.00913812,
761
+ // posCross: 1543,
762
+ // posComm: 693,
763
+ // posMargin: 11359,
764
+ // posMaint: 3886,
765
+ // maintMargin: 9816,
766
+ // unrealisedPnl: -1543,
767
+ // unrealisedRoePcnt: -0.1691,
768
+ // liquidationPrice: 20976,
769
+ // timestamp: '2023-12-07T00:09:10.760Z'
770
+ // }
771
+ // ]
772
+ // }
773
+ //
774
+ if (this.positions === undefined) {
775
+ this.positions = new Cache.ArrayCacheBySymbolBySide();
776
+ }
777
+ const cache = this.positions;
778
+ const rawPositions = this.safeValue(message, 'data', []);
779
+ const newPositions = [];
780
+ for (let i = 0; i < rawPositions.length; i++) {
781
+ const rawPosition = rawPositions[i];
782
+ const position = this.parsePosition(rawPosition);
783
+ newPositions.push(position);
784
+ cache.append(position);
785
+ }
786
+ const messageHashes = this.findMessageHashes(client, 'positions::');
787
+ for (let i = 0; i < messageHashes.length; i++) {
788
+ const messageHash = messageHashes[i];
789
+ const parts = messageHash.split('::');
790
+ const symbolsString = parts[1];
791
+ const symbols = symbolsString.split(',');
792
+ const positions = this.filterByArray(newPositions, 'symbol', symbols, false);
793
+ if (!this.isEmpty(positions)) {
794
+ client.resolve(positions, messageHash);
795
+ }
796
+ }
797
+ client.resolve(newPositions, 'positions');
798
+ }
594
799
  async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
595
800
  /**
596
801
  * @method
@@ -1373,6 +1578,7 @@ class bitmex extends bitmex$1 {
1373
1578
  'order': this.handleOrders,
1374
1579
  'execution': this.handleMyTrades,
1375
1580
  'margin': this.handleBalance,
1581
+ 'position': this.handlePositions,
1376
1582
  };
1377
1583
  const method = this.safeValue(methods, table);
1378
1584
  if (method === undefined) {
@@ -406,7 +406,8 @@ class coinex extends coinex$1 {
406
406
  * @param {object} [params] extra parameters specific to the exchange API endpoint
407
407
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
408
408
  */
409
- return await this.watchTickers([symbol], params);
409
+ const tickers = await this.watchTickers([symbol], params);
410
+ return this.safeValue(tickers, symbol);
410
411
  }
411
412
  async watchTickers(symbols = undefined, params = {}) {
412
413
  /**
@@ -96,10 +96,10 @@ class krakenfutures extends krakenfutures$1 {
96
96
  * @ignore
97
97
  * @method
98
98
  * @description Connects to a websocket channel
99
- * @param {String} name name of the channel
99
+ * @param {string} name name of the channel
100
100
  * @param {string[]} symbols CCXT market symbols
101
- * @param {Object} [params] extra parameters specific to the krakenfutures api
102
- * @returns {Object} data from the websocket stream
101
+ * @param {object} [params] extra parameters specific to the krakenfutures api
102
+ * @returns {object} data from the websocket stream
103
103
  */
104
104
  await this.loadMarkets();
105
105
  const url = this.urls['api']['ws'];
@@ -130,10 +130,10 @@ class krakenfutures extends krakenfutures$1 {
130
130
  * @ignore
131
131
  * @method
132
132
  * @description Connects to a websocket channel
133
- * @param {String} name name of the channel
133
+ * @param {string} name name of the channel
134
134
  * @param {string[]} symbols CCXT market symbols
135
- * @param {Object} [params] extra parameters specific to the krakenfutures api
136
- * @returns {Object} data from the websocket stream
135
+ * @param {object} [params] extra parameters specific to the krakenfutures api
136
+ * @returns {object} data from the websocket stream
137
137
  */
138
138
  await this.loadMarkets();
139
139
  await this.authenticate();
@@ -739,7 +739,7 @@ class mexc extends mexc$1 {
739
739
  * @param {int} [since] the earliest time in ms to fetch orders for
740
740
  * @param {int} [limit] the maximum number of orde structures to retrieve
741
741
  * @param {object} [params] extra parameters specific to the exchange API endpoint
742
- * @params {string|undefined} params.type the type of orders to retrieve, can be 'spot' or 'margin'
742
+ * @param {string|undefined} params.type the type of orders to retrieve, can be 'spot' or 'margin'
743
743
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
744
744
  */
745
745
  await this.loadMarkets();
@@ -201,7 +201,7 @@ class poloniex extends poloniex$1 {
201
201
  * @param {string} [params.stpMode] self-trade prevention, defaults to expire_taker, none: enable self-trade; expire_taker: taker order will be canceled when self-trade happens
202
202
  * @param {string} [params.slippageTolerance] used to control the maximum slippage ratio, the value range is greater than 0 and less than 1
203
203
  * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
204
- */
204
+ */
205
205
  await this.loadMarkets();
206
206
  await this.authenticate();
207
207
  const market = this.market(symbol);
@@ -126,9 +126,9 @@ class poloniexfutures extends poloniexfutures$1 {
126
126
  * @param {string} name name of the channel and suscriptionHash
127
127
  * @param {bool} isPrivate true for the authenticated url, false for the public url
128
128
  * @param {string} symbol is required for all public channels, not required for private channels (except position)
129
- * @param {Object} subscription subscription parameters
130
- * @param {Object} [params] extra parameters specific to the poloniex api
131
- * @returns {Object} data from the websocket stream
129
+ * @param {object} subscription subscription parameters
130
+ * @param {object} [params] extra parameters specific to the poloniex api
131
+ * @returns {object} data from the websocket stream
132
132
  */
133
133
  const url = await this.negotiate(isPrivate);
134
134
  if (symbol !== undefined) {
@@ -9,7 +9,7 @@ var number = require('./base/functions/number.js');
9
9
  // ---------------------------------------------------------------------------
10
10
  /**
11
11
  * @class probit
12
- * @extends Exchange
12
+ * @augments Exchange
13
13
  */
14
14
  class probit extends probit$1 {
15
15
  describe() {
@@ -28,7 +28,10 @@ class probit extends probit$1 {
28
28
  'option': false,
29
29
  'addMargin': false,
30
30
  'cancelOrder': true,
31
+ 'createMarketBuyOrderWithCost': true,
31
32
  'createMarketOrder': true,
33
+ 'createMarketOrderWithCost': false,
34
+ 'createMarketSellOrderWithCost': false,
32
35
  'createOrder': true,
33
36
  'createReduceOnlyOrder': false,
34
37
  'createStopLimitOrder': false,
@@ -315,6 +318,7 @@ class probit extends probit$1 {
315
318
  'precision': {
316
319
  'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'quantity_precision'))),
317
320
  'price': this.safeNumber(market, 'price_increment'),
321
+ 'cost': this.parseNumber(this.parsePrecision(this.safeString(market, 'cost_precision'))),
318
322
  },
319
323
  'limits': {
320
324
  'leverage': {
@@ -1187,14 +1191,15 @@ class probit extends probit$1 {
1187
1191
  /**
1188
1192
  * @method
1189
1193
  * @name probit#createOrder
1190
- * @see https://docs-en.probit.com/reference/order-1
1191
1194
  * @description create a trade order
1195
+ * @see https://docs-en.probit.com/reference/order-1
1192
1196
  * @param {string} symbol unified symbol of the market to create an order in
1193
1197
  * @param {string} type 'market' or 'limit'
1194
1198
  * @param {string} side 'buy' or 'sell'
1195
- * @param {float} amount how much of currency you want to trade in units of base currency
1199
+ * @param {float} amount how much you want to trade in units of the base currency
1196
1200
  * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1197
1201
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1202
+ * @param {float} [params.cost] the quote quantity that can be used as an alternative for the amount for market buy orders
1198
1203
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1199
1204
  */
1200
1205
  await this.loadMarkets();
@@ -1212,7 +1217,7 @@ class probit extends probit$1 {
1212
1217
  if (clientOrderId !== undefined) {
1213
1218
  request['client_order_id'] = clientOrderId;
1214
1219
  }
1215
- let costToPrecision = undefined;
1220
+ let quoteAmount = undefined;
1216
1221
  if (type === 'limit') {
1217
1222
  request['limit_price'] = this.priceToPrecision(symbol, price);
1218
1223
  request['quantity'] = this.amountToPrecision(symbol, amount);
@@ -1220,25 +1225,28 @@ class probit extends probit$1 {
1220
1225
  else if (type === 'market') {
1221
1226
  // for market buy it requires the amount of quote currency to spend
1222
1227
  if (side === 'buy') {
1223
- let cost = this.safeNumber(params, 'cost');
1224
- const createMarketBuyOrderRequiresPrice = this.safeValue(this.options, 'createMarketBuyOrderRequiresPrice', true);
1225
- if (createMarketBuyOrderRequiresPrice) {
1226
- if (price !== undefined) {
1227
- if (cost === undefined) {
1228
- const amountString = this.numberToString(amount);
1229
- const priceString = this.numberToString(price);
1230
- cost = this.parseNumber(Precise["default"].stringMul(amountString, priceString));
1231
- }
1228
+ let createMarketBuyOrderRequiresPrice = true;
1229
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
1230
+ const cost = this.safeString(params, 'cost');
1231
+ params = this.omit(params, 'cost');
1232
+ if (cost !== undefined) {
1233
+ quoteAmount = this.costToPrecision(symbol, cost);
1234
+ }
1235
+ else if (createMarketBuyOrderRequiresPrice) {
1236
+ if (price === undefined) {
1237
+ throw new errors.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument');
1232
1238
  }
1233
- else if (cost === undefined) {
1234
- throw new errors.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate total order cost (amount to spend), where cost = amount * price. Supply a price argument to createOrder() call if you want the cost to be calculated for you from price and amount, or, alternatively, add .options["createMarketBuyOrderRequiresPrice"] = false and supply the total cost value in the "amount" argument or in the "cost" extra parameter (the exchange-specific behaviour)');
1239
+ else {
1240
+ const amountString = this.numberToString(amount);
1241
+ const priceString = this.numberToString(price);
1242
+ const costRequest = Precise["default"].stringMul(amountString, priceString);
1243
+ quoteAmount = this.costToPrecision(symbol, costRequest);
1235
1244
  }
1236
1245
  }
1237
1246
  else {
1238
- cost = (cost === undefined) ? amount : cost;
1247
+ quoteAmount = this.costToPrecision(symbol, amount);
1239
1248
  }
1240
- costToPrecision = this.costToPrecision(symbol, cost);
1241
- request['cost'] = costToPrecision;
1249
+ request['cost'] = quoteAmount;
1242
1250
  }
1243
1251
  else {
1244
1252
  request['quantity'] = this.amountToPrecision(symbol, amount);
@@ -1273,7 +1281,7 @@ class probit extends probit$1 {
1273
1281
  // returned by the exchange on market buys
1274
1282
  if ((type === 'market') && (side === 'buy')) {
1275
1283
  order['amount'] = undefined;
1276
- order['cost'] = this.parseNumber(costToPrecision);
1284
+ order['cost'] = this.parseNumber(quoteAmount);
1277
1285
  order['remaining'] = undefined;
1278
1286
  }
1279
1287
  return order;
@@ -10,7 +10,7 @@ const version = typeof process !== 'undefined'
10
10
  : undefined;
11
11
  /**
12
12
  *
13
- * @param {Object} [options = {}] - An object to customize JSEncrypt behaviour
13
+ * @param {object} [options = {}] - An object to customize JSEncrypt behaviour
14
14
  * possible parameters are:
15
15
  * - default_key_size {number} default: 1024 the key size in bit
16
16
  * - default_public_exponent {string} default: '010001' the hexadecimal representation of the public exponent
@@ -253,7 +253,7 @@ class JSEncryptRSAKey extends rsa.RSAKey {
253
253
  /**
254
254
  * Check if the object contains the necessary parameters to populate the rsa modulus
255
255
  * and public exponent parameters.
256
- * @param {Object} [obj={}] - An object that may contain the two public key
256
+ * @param {object} [obj={}] - An object that may contain the two public key
257
257
  * parameters
258
258
  * @returns {boolean} true if the object contains both the modulus and the public exponent
259
259
  * properties (n and e)
@@ -267,7 +267,7 @@ class JSEncryptRSAKey extends rsa.RSAKey {
267
267
  }
268
268
  /**
269
269
  * Check if the object contains ALL the parameters of an RSA key.
270
- * @param {Object} [obj={}] - An object that may contain nine rsa key
270
+ * @param {object} [obj={}] - An object that may contain nine rsa key
271
271
  * parameters
272
272
  * @returns {boolean} true if the object contains all the parameters needed
273
273
  * @todo check for types of the parameters all the parameters but the public exponent
@@ -288,7 +288,7 @@ class JSEncryptRSAKey extends rsa.RSAKey {
288
288
  /**
289
289
  * Parse the properties of obj in the current rsa object. Obj should AT LEAST
290
290
  * include the modulus and public exponent (n, e) parameters.
291
- * @param {Object} obj - the object containing rsa parameters
291
+ * @param {object} obj - the object containing rsa parameters
292
292
  * @private
293
293
  */
294
294
  parsePropertiesFrom(obj) {
@@ -7,7 +7,7 @@ var number = require('./base/functions/number.js');
7
7
 
8
8
  /**
9
9
  * @class timex
10
- * @extends Exchange
10
+ * @augments Exchange
11
11
  */
12
12
  class timex extends timex$1 {
13
13
  describe() {
@@ -10,7 +10,7 @@ var sha256 = require('./static_dependencies/noble-hashes/sha256.js');
10
10
  // ---------------------------------------------------------------------------
11
11
  /**
12
12
  * @class tokocrypto
13
- * @extends Exchange
13
+ * @augments Exchange
14
14
  */
15
15
  class tokocrypto extends tokocrypto$1 {
16
16
  describe() {
@@ -102,7 +102,6 @@ class tokocrypto extends tokocrypto$1 {
102
102
  'fetchWithdrawals': true,
103
103
  'fetchWithdrawalWhitelist': false,
104
104
  'reduceMargin': false,
105
- 'repayMargin': false,
106
105
  'setLeverage': false,
107
106
  'setMargin': false,
108
107
  'setMarginMode': false,
@@ -1015,16 +1014,21 @@ class tokocrypto extends tokocrypto$1 {
1015
1014
  const data = this.safeValue(responseInner, 'data', {});
1016
1015
  return this.parseTrades(data, market, since, limit);
1017
1016
  }
1017
+ if (limit !== undefined) {
1018
+ request['limit'] = limit; // default = 500, maximum = 1000
1019
+ }
1018
1020
  const defaultMethod = 'binanceGetTrades';
1019
1021
  const method = this.safeString(this.options, 'fetchTradesMethod', defaultMethod);
1022
+ let response = undefined;
1020
1023
  if ((method === 'binanceGetAggTrades') && (since !== undefined)) {
1021
1024
  request['startTime'] = since;
1022
1025
  // https://github.com/ccxt/ccxt/issues/6400
1023
1026
  // https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#compressedaggregate-trades-list
1024
1027
  request['endTime'] = this.sum(since, 3600000);
1028
+ response = await this.binanceGetAggTrades(this.extend(request, params));
1025
1029
  }
1026
- if (limit !== undefined) {
1027
- request['limit'] = limit; // default = 500, maximum = 1000
1030
+ else {
1031
+ response = await this.binanceGetTrades(this.extend(request, params));
1028
1032
  }
1029
1033
  //
1030
1034
  // Caveats:
@@ -1035,7 +1039,6 @@ class tokocrypto extends tokocrypto$1 {
1035
1039
  // - 'tradeId' accepted and returned by this method is "aggregate" trade id
1036
1040
  // which is different from actual trade id
1037
1041
  // - setting both fromId and time window results in error
1038
- const response = await this[method](this.extend(request, params));
1039
1042
  //
1040
1043
  // aggregate trades
1041
1044
  //
@@ -12,7 +12,7 @@ var rsa = require('./base/functions/rsa.js');
12
12
  // ---------------------------------------------------------------------------
13
13
  /**
14
14
  * @class upbit
15
- * @extends Exchange
15
+ * @augments Exchange
16
16
  */
17
17
  class upbit extends upbit$1 {
18
18
  describe() {
@@ -33,7 +33,10 @@ class upbit extends upbit$1 {
33
33
  'option': false,
34
34
  'cancelOrder': true,
35
35
  'createDepositAddress': true,
36
+ 'createMarketBuyOrderWithCost': true,
36
37
  'createMarketOrder': true,
38
+ 'createMarketOrderWithCost': false,
39
+ 'createMarketSellOrderWithCost': false,
37
40
  'createOrder': true,
38
41
  'fetchBalance': true,
39
42
  'fetchCanceledOrders': true,
@@ -1020,29 +1023,19 @@ class upbit extends upbit$1 {
1020
1023
  /**
1021
1024
  * @method
1022
1025
  * @name upbit#createOrder
1023
- * @see https://docs.upbit.com/reference/%EC%A3%BC%EB%AC%B8%ED%95%98%EA%B8%B0
1024
1026
  * @description create a trade order
1027
+ * @see https://docs.upbit.com/reference/%EC%A3%BC%EB%AC%B8%ED%95%98%EA%B8%B0
1025
1028
  * @param {string} symbol unified symbol of the market to create an order in
1026
1029
  * @param {string} type 'market' or 'limit'
1027
1030
  * @param {string} side 'buy' or 'sell'
1028
- * @param {float} amount how much of currency you want to trade in units of base currency
1031
+ * @param {float} amount how much you want to trade in units of the base currency
1029
1032
  * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1030
1033
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1034
+ * @param {float} [params.cost] for market buy orders, the quote quantity that can be used as an alternative for the amount
1031
1035
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1032
1036
  */
1033
- if (type === 'market') {
1034
- // for market buy it requires the amount of quote currency to spend
1035
- if (side === 'buy') {
1036
- if (this.options['createMarketBuyOrderRequiresPrice']) {
1037
- if (price === undefined) {
1038
- throw new errors.InvalidOrder(this.id + ' createOrder() requires the price argument with market buy orders to calculate total order cost (amount to spend), where cost = amount * price. Supply a price argument to createOrder() call if you want the cost to be calculated for you from price and amount, or, alternatively, add .options["createMarketBuyOrderRequiresPrice"] = false to supply the cost in the amount argument (the exchange-specific behaviour)');
1039
- }
1040
- else {
1041
- amount = amount * price;
1042
- }
1043
- }
1044
- }
1045
- }
1037
+ await this.loadMarkets();
1038
+ const market = this.market(symbol);
1046
1039
  let orderSide = undefined;
1047
1040
  if (side === 'buy') {
1048
1041
  orderSide = 'bid';
@@ -1053,26 +1046,43 @@ class upbit extends upbit$1 {
1053
1046
  else {
1054
1047
  throw new errors.InvalidOrder(this.id + ' createOrder() allows buy or sell side only!');
1055
1048
  }
1056
- await this.loadMarkets();
1057
- const market = this.market(symbol);
1058
1049
  const request = {
1059
1050
  'market': market['id'],
1060
1051
  'side': orderSide,
1061
1052
  };
1062
1053
  if (type === 'limit') {
1063
- request['volume'] = this.amountToPrecision(symbol, amount);
1064
1054
  request['price'] = this.priceToPrecision(symbol, price);
1065
- request['ord_type'] = type;
1066
1055
  }
1067
- else if (type === 'market') {
1068
- if (side === 'buy') {
1069
- request['ord_type'] = 'price';
1070
- request['price'] = this.priceToPrecision(symbol, amount);
1056
+ if ((type === 'market') && (side === 'buy')) {
1057
+ // for market buy it requires the amount of quote currency to spend
1058
+ let quoteAmount = undefined;
1059
+ let createMarketBuyOrderRequiresPrice = true;
1060
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
1061
+ const cost = this.safeNumber(params, 'cost');
1062
+ params = this.omit(params, 'cost');
1063
+ if (cost !== undefined) {
1064
+ quoteAmount = this.costToPrecision(symbol, cost);
1071
1065
  }
1072
- else if (side === 'sell') {
1073
- request['ord_type'] = type;
1074
- request['volume'] = this.amountToPrecision(symbol, amount);
1066
+ else if (createMarketBuyOrderRequiresPrice) {
1067
+ if (price === undefined) {
1068
+ throw new errors.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend (quote quantity) in the amount argument');
1069
+ }
1070
+ else {
1071
+ const amountString = this.numberToString(amount);
1072
+ const priceString = this.numberToString(price);
1073
+ const costRequest = Precise["default"].stringMul(amountString, priceString);
1074
+ quoteAmount = this.costToPrecision(symbol, costRequest);
1075
+ }
1075
1076
  }
1077
+ else {
1078
+ quoteAmount = this.costToPrecision(symbol, amount);
1079
+ }
1080
+ request['ord_type'] = 'price';
1081
+ request['price'] = quoteAmount;
1082
+ }
1083
+ else {
1084
+ request['ord_type'] = type;
1085
+ request['volume'] = this.amountToPrecision(symbol, amount);
1076
1086
  }
1077
1087
  const clientOrderId = this.safeString2(params, 'clientOrderId', 'identifier');
1078
1088
  if (clientOrderId !== undefined) {
@@ -10,7 +10,7 @@ var number = require('./base/functions/number.js');
10
10
  // ---------------------------------------------------------------------------
11
11
  /**
12
12
  * @class wavesexchange
13
- * @extends Exchange
13
+ * @augments Exchange
14
14
  */
15
15
  class wavesexchange extends wavesexchange$1 {
16
16
  describe() {
@@ -8,7 +8,7 @@ var sha256 = require('./static_dependencies/noble-hashes/sha256.js');
8
8
 
9
9
  /**
10
10
  * @class wazirx
11
- * @extends Exchange
11
+ * @augments Exchange
12
12
  */
13
13
  class wazirx extends wazirx$1 {
14
14
  describe() {
@@ -27,7 +27,6 @@ class wazirx extends wazirx$1 {
27
27
  'future': false,
28
28
  'option': false,
29
29
  'addMargin': false,
30
- 'borrowMargin': false,
31
30
  'cancelAllOrders': true,
32
31
  'cancelOrder': true,
33
32
  'closeAllPositions': false,
@@ -88,7 +87,6 @@ class wazirx extends wazirx$1 {
88
87
  'fetchTransfers': false,
89
88
  'fetchWithdrawals': false,
90
89
  'reduceMargin': false,
91
- 'repayMargin': false,
92
90
  'setLeverage': false,
93
91
  'setMargin': false,
94
92
  'setMarginMode': false,