ccxt 4.4.30 → 4.4.32

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 (496) hide show
  1. package/README.md +9 -3
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/ace.js +123 -123
  5. package/dist/cjs/src/alpaca.js +237 -237
  6. package/dist/cjs/src/ascendex.js +342 -341
  7. package/dist/cjs/src/bigone.js +242 -242
  8. package/dist/cjs/src/binance.js +1339 -1291
  9. package/dist/cjs/src/bingx.js +639 -639
  10. package/dist/cjs/src/bit2c.js +111 -111
  11. package/dist/cjs/src/bitbank.js +142 -142
  12. package/dist/cjs/src/bitbns.js +140 -140
  13. package/dist/cjs/src/bitfinex.js +231 -231
  14. package/dist/cjs/src/bitfinex2.js +403 -403
  15. package/dist/cjs/src/bitflyer.js +184 -184
  16. package/dist/cjs/src/bitget.js +848 -846
  17. package/dist/cjs/src/bithumb.js +125 -124
  18. package/dist/cjs/src/bitmart.js +525 -525
  19. package/dist/cjs/src/bitmex.js +317 -317
  20. package/dist/cjs/src/bitopro.js +221 -221
  21. package/dist/cjs/src/bitrue.js +315 -315
  22. package/dist/cjs/src/bitso.js +220 -220
  23. package/dist/cjs/src/bitstamp.js +251 -251
  24. package/dist/cjs/src/bitteam.js +183 -183
  25. package/dist/cjs/src/bitvavo.js +247 -251
  26. package/dist/cjs/src/bl3p.js +82 -82
  27. package/dist/cjs/src/blockchaincom.js +211 -211
  28. package/dist/cjs/src/blofin.js +332 -331
  29. package/dist/cjs/src/btcalpha.js +166 -166
  30. package/dist/cjs/src/btcbox.js +108 -108
  31. package/dist/cjs/src/btcmarkets.js +198 -198
  32. package/dist/cjs/src/btcturk.js +124 -124
  33. package/dist/cjs/src/bybit.js +906 -900
  34. package/dist/cjs/src/cex.js +227 -226
  35. package/dist/cjs/src/coinbase.js +481 -481
  36. package/dist/cjs/src/coinbaseexchange.js +274 -274
  37. package/dist/cjs/src/coinbaseinternational.js +304 -304
  38. package/dist/cjs/src/coincatch.js +650 -650
  39. package/dist/cjs/src/coincheck.js +113 -113
  40. package/dist/cjs/src/coinex.js +611 -601
  41. package/dist/cjs/src/coinlist.js +304 -303
  42. package/dist/cjs/src/coinmate.js +162 -161
  43. package/dist/cjs/src/coinmetro.js +187 -187
  44. package/dist/cjs/src/coinone.js +124 -123
  45. package/dist/cjs/src/coinsph.js +237 -237
  46. package/dist/cjs/src/coinspot.js +82 -82
  47. package/dist/cjs/src/cryptocom.js +342 -341
  48. package/dist/cjs/src/currencycom.js +225 -224
  49. package/dist/cjs/src/delta.js +320 -320
  50. package/dist/cjs/src/deribit.js +411 -408
  51. package/dist/cjs/src/digifinex.js +432 -431
  52. package/dist/cjs/src/exmo.js +328 -327
  53. package/dist/cjs/src/gate.js +830 -791
  54. package/dist/cjs/src/gemini.js +199 -198
  55. package/dist/cjs/src/hashkey.js +520 -517
  56. package/dist/cjs/src/hitbtc.js +465 -462
  57. package/dist/cjs/src/hollaex.js +253 -252
  58. package/dist/cjs/src/htx.js +791 -848
  59. package/dist/cjs/src/huobijp.js +219 -218
  60. package/dist/cjs/src/hyperliquid.js +421 -417
  61. package/dist/cjs/src/idex.js +238 -237
  62. package/dist/cjs/src/independentreserve.js +133 -132
  63. package/dist/cjs/src/indodax.js +177 -171
  64. package/dist/cjs/src/kraken.js +381 -377
  65. package/dist/cjs/src/krakenfutures.js +285 -279
  66. package/dist/cjs/src/kucoin.js +632 -622
  67. package/dist/cjs/src/kucoinfutures.js +533 -457
  68. package/dist/cjs/src/kuna.js +283 -282
  69. package/dist/cjs/src/latoken.js +211 -210
  70. package/dist/cjs/src/lbank.js +268 -267
  71. package/dist/cjs/src/luno.js +174 -173
  72. package/dist/cjs/src/lykke.js +172 -171
  73. package/dist/cjs/src/mercado.js +123 -122
  74. package/dist/cjs/src/mexc.js +650 -646
  75. package/dist/cjs/src/ndax.js +229 -228
  76. package/dist/cjs/src/novadax.js +230 -229
  77. package/dist/cjs/src/oceanex.js +187 -186
  78. package/dist/cjs/src/okcoin.js +286 -285
  79. package/dist/cjs/src/okx.js +909 -904
  80. package/dist/cjs/src/onetrading.js +218 -218
  81. package/dist/cjs/src/oxfun.js +335 -334
  82. package/dist/cjs/src/p2b.js +154 -154
  83. package/dist/cjs/src/paradex.js +249 -244
  84. package/dist/cjs/src/paymium.js +101 -101
  85. package/dist/cjs/src/phemex.js +388 -390
  86. package/dist/cjs/src/poloniex.js +270 -270
  87. package/dist/cjs/src/poloniexfutures.js +250 -250
  88. package/dist/cjs/src/pro/alpaca.js +64 -64
  89. package/dist/cjs/src/pro/ascendex.js +64 -64
  90. package/dist/cjs/src/pro/binance.js +546 -543
  91. package/dist/cjs/src/pro/bingx.js +116 -116
  92. package/dist/cjs/src/pro/bitfinex.js +42 -42
  93. package/dist/cjs/src/pro/bitfinex2.js +66 -66
  94. package/dist/cjs/src/pro/bitget.js +188 -181
  95. package/dist/cjs/src/pro/bithumb.js +40 -40
  96. package/dist/cjs/src/pro/bitmart.js +121 -119
  97. package/dist/cjs/src/pro/bitmex.js +135 -133
  98. package/dist/cjs/src/pro/bitopro.js +49 -49
  99. package/dist/cjs/src/pro/bitrue.js +19 -19
  100. package/dist/cjs/src/pro/bitstamp.js +29 -29
  101. package/dist/cjs/src/pro/bitvavo.js +299 -301
  102. package/dist/cjs/src/pro/blockchaincom.js +62 -62
  103. package/dist/cjs/src/pro/blofin.js +132 -130
  104. package/dist/cjs/src/pro/bybit.js +317 -313
  105. package/dist/cjs/src/pro/cex.js +168 -168
  106. package/dist/cjs/src/pro/coinbase.js +93 -91
  107. package/dist/cjs/src/pro/coinbaseexchange.js +95 -95
  108. package/dist/cjs/src/pro/coinbaseinternational.js +111 -111
  109. package/dist/cjs/src/pro/coincatch.js +150 -143
  110. package/dist/cjs/src/pro/coincheck.js +21 -21
  111. package/dist/cjs/src/pro/coinex.js +110 -110
  112. package/dist/cjs/src/pro/coinone.js +30 -30
  113. package/dist/cjs/src/pro/cryptocom.js +227 -227
  114. package/dist/cjs/src/pro/currencycom.js +45 -45
  115. package/dist/cjs/src/pro/deribit.js +127 -127
  116. package/dist/cjs/src/pro/exmo.js +66 -66
  117. package/dist/cjs/src/pro/gate.js +287 -283
  118. package/dist/cjs/src/pro/gemini.js +74 -74
  119. package/dist/cjs/src/pro/hashkey.js +87 -85
  120. package/dist/cjs/src/pro/hitbtc.js +190 -190
  121. package/dist/cjs/src/pro/hollaex.js +51 -51
  122. package/dist/cjs/src/pro/htx.js +96 -94
  123. package/dist/cjs/src/pro/huobijp.js +38 -38
  124. package/dist/cjs/src/pro/hyperliquid.js +151 -150
  125. package/dist/cjs/src/pro/idex.js +48 -48
  126. package/dist/cjs/src/pro/independentreserve.js +19 -19
  127. package/dist/cjs/src/pro/kraken.js +167 -167
  128. package/dist/cjs/src/pro/krakenfutures.js +137 -138
  129. package/dist/cjs/src/pro/kucoin.js +167 -168
  130. package/dist/cjs/src/pro/kucoinfutures.js +147 -147
  131. package/dist/cjs/src/pro/lbank.js +95 -95
  132. package/dist/cjs/src/pro/luno.js +21 -21
  133. package/dist/cjs/src/pro/mexc.js +102 -103
  134. package/dist/cjs/src/pro/ndax.js +42 -42
  135. package/dist/cjs/src/pro/okcoin.js +61 -61
  136. package/dist/cjs/src/pro/okx.js +332 -330
  137. package/dist/cjs/src/pro/onetrading.js +71 -71
  138. package/dist/cjs/src/pro/oxfun.js +193 -191
  139. package/dist/cjs/src/pro/p2b.js +77 -77
  140. package/dist/cjs/src/pro/paradex.js +39 -39
  141. package/dist/cjs/src/pro/phemex.js +94 -94
  142. package/dist/cjs/src/pro/poloniex.js +171 -171
  143. package/dist/cjs/src/pro/poloniexfutures.js +62 -62
  144. package/dist/cjs/src/pro/probit.js +63 -63
  145. package/dist/cjs/src/pro/upbit.js +80 -80
  146. package/dist/cjs/src/pro/vertex.js +65 -63
  147. package/dist/cjs/src/pro/wazirx.js +70 -70
  148. package/dist/cjs/src/pro/whitebit.js +83 -83
  149. package/dist/cjs/src/pro/woo.js +106 -104
  150. package/dist/cjs/src/pro/woofipro.js +105 -103
  151. package/dist/cjs/src/pro/xt.js +119 -119
  152. package/dist/cjs/src/probit.js +229 -229
  153. package/dist/cjs/src/timex.js +198 -197
  154. package/dist/cjs/src/tokocrypto.js +214 -213
  155. package/dist/cjs/src/tradeogre.js +92 -91
  156. package/dist/cjs/src/upbit.js +243 -242
  157. package/dist/cjs/src/vertex.js +258 -258
  158. package/dist/cjs/src/wavesexchange.js +176 -172
  159. package/dist/cjs/src/wazirx.js +168 -168
  160. package/dist/cjs/src/whitebit.js +361 -361
  161. package/dist/cjs/src/woo.js +571 -572
  162. package/dist/cjs/src/woofipro.js +392 -391
  163. package/dist/cjs/src/xt.js +436 -435
  164. package/dist/cjs/src/yobit.js +159 -158
  165. package/dist/cjs/src/zaif.js +103 -103
  166. package/dist/cjs/src/zonda.js +168 -168
  167. package/js/ccxt.d.ts +1 -1
  168. package/js/ccxt.js +1 -1
  169. package/js/src/ace.d.ts +123 -0
  170. package/js/src/ace.js +123 -123
  171. package/js/src/alpaca.d.ts +237 -0
  172. package/js/src/alpaca.js +237 -237
  173. package/js/src/ascendex.d.ts +339 -0
  174. package/js/src/ascendex.js +342 -341
  175. package/js/src/base/types.d.ts +1 -0
  176. package/js/src/bigone.d.ts +242 -0
  177. package/js/src/bigone.js +242 -242
  178. package/js/src/binance.d.ts +1306 -0
  179. package/js/src/binance.js +1339 -1291
  180. package/js/src/bingx.d.ts +639 -0
  181. package/js/src/bingx.js +639 -639
  182. package/js/src/bit2c.d.ts +111 -0
  183. package/js/src/bit2c.js +111 -111
  184. package/js/src/bitbank.d.ts +142 -0
  185. package/js/src/bitbank.js +142 -142
  186. package/js/src/bitbns.d.ts +140 -0
  187. package/js/src/bitbns.js +140 -140
  188. package/js/src/bitfinex.d.ts +231 -0
  189. package/js/src/bitfinex.js +231 -231
  190. package/js/src/bitfinex2.d.ts +403 -0
  191. package/js/src/bitfinex2.js +403 -403
  192. package/js/src/bitflyer.d.ts +184 -0
  193. package/js/src/bitflyer.js +184 -184
  194. package/js/src/bitget.d.ts +846 -0
  195. package/js/src/bitget.js +848 -846
  196. package/js/src/bithumb.d.ts +125 -0
  197. package/js/src/bithumb.js +125 -124
  198. package/js/src/bitmart.d.ts +525 -0
  199. package/js/src/bitmart.js +525 -525
  200. package/js/src/bitmex.d.ts +317 -0
  201. package/js/src/bitmex.js +317 -317
  202. package/js/src/bitopro.d.ts +221 -0
  203. package/js/src/bitopro.js +221 -221
  204. package/js/src/bitrue.d.ts +315 -0
  205. package/js/src/bitrue.js +315 -315
  206. package/js/src/bitso.d.ts +220 -0
  207. package/js/src/bitso.js +220 -220
  208. package/js/src/bitstamp.d.ts +251 -0
  209. package/js/src/bitstamp.js +251 -251
  210. package/js/src/bitteam.d.ts +183 -0
  211. package/js/src/bitteam.js +183 -183
  212. package/js/src/bitvavo.d.ts +247 -0
  213. package/js/src/bitvavo.js +247 -251
  214. package/js/src/bl3p.d.ts +82 -0
  215. package/js/src/bl3p.js +82 -82
  216. package/js/src/blockchaincom.d.ts +211 -0
  217. package/js/src/blockchaincom.js +211 -211
  218. package/js/src/blofin.d.ts +332 -0
  219. package/js/src/blofin.js +332 -331
  220. package/js/src/btcalpha.d.ts +166 -0
  221. package/js/src/btcalpha.js +166 -166
  222. package/js/src/btcbox.d.ts +108 -0
  223. package/js/src/btcbox.js +108 -108
  224. package/js/src/btcmarkets.d.ts +198 -0
  225. package/js/src/btcmarkets.js +198 -198
  226. package/js/src/btcturk.d.ts +124 -0
  227. package/js/src/btcturk.js +124 -124
  228. package/js/src/bybit.d.ts +906 -1
  229. package/js/src/bybit.js +906 -900
  230. package/js/src/cex.d.ts +227 -0
  231. package/js/src/cex.js +227 -226
  232. package/js/src/coinbase.d.ts +481 -0
  233. package/js/src/coinbase.js +481 -481
  234. package/js/src/coinbaseexchange.d.ts +274 -0
  235. package/js/src/coinbaseexchange.js +274 -274
  236. package/js/src/coinbaseinternational.d.ts +304 -0
  237. package/js/src/coinbaseinternational.js +304 -304
  238. package/js/src/coincatch.d.ts +646 -0
  239. package/js/src/coincatch.js +650 -650
  240. package/js/src/coincheck.d.ts +113 -0
  241. package/js/src/coincheck.js +113 -113
  242. package/js/src/coinex.d.ts +603 -0
  243. package/js/src/coinex.js +611 -601
  244. package/js/src/coinlist.d.ts +304 -0
  245. package/js/src/coinlist.js +304 -303
  246. package/js/src/coinmate.d.ts +162 -0
  247. package/js/src/coinmate.js +162 -161
  248. package/js/src/coinmetro.d.ts +187 -0
  249. package/js/src/coinmetro.js +187 -187
  250. package/js/src/coinone.d.ts +124 -0
  251. package/js/src/coinone.js +124 -123
  252. package/js/src/coinsph.d.ts +237 -0
  253. package/js/src/coinsph.js +237 -237
  254. package/js/src/coinspot.d.ts +82 -0
  255. package/js/src/coinspot.js +82 -82
  256. package/js/src/cryptocom.d.ts +342 -0
  257. package/js/src/cryptocom.js +342 -341
  258. package/js/src/currencycom.d.ts +225 -0
  259. package/js/src/currencycom.js +225 -224
  260. package/js/src/delta.d.ts +320 -0
  261. package/js/src/delta.js +320 -320
  262. package/js/src/deribit.d.ts +411 -0
  263. package/js/src/deribit.js +411 -408
  264. package/js/src/digifinex.d.ts +430 -0
  265. package/js/src/digifinex.js +432 -431
  266. package/js/src/exmo.d.ts +328 -0
  267. package/js/src/exmo.js +328 -327
  268. package/js/src/gate.d.ts +803 -1
  269. package/js/src/gate.js +830 -791
  270. package/js/src/gemini.d.ts +199 -0
  271. package/js/src/gemini.js +199 -198
  272. package/js/src/hashkey.d.ts +516 -0
  273. package/js/src/hashkey.js +520 -517
  274. package/js/src/hitbtc.d.ts +465 -0
  275. package/js/src/hitbtc.js +465 -462
  276. package/js/src/hollaex.d.ts +253 -0
  277. package/js/src/hollaex.js +253 -252
  278. package/js/src/htx.d.ts +765 -2
  279. package/js/src/htx.js +791 -848
  280. package/js/src/huobijp.d.ts +219 -0
  281. package/js/src/huobijp.js +219 -218
  282. package/js/src/hyperliquid.d.ts +419 -0
  283. package/js/src/hyperliquid.js +421 -417
  284. package/js/src/idex.d.ts +238 -0
  285. package/js/src/idex.js +238 -237
  286. package/js/src/independentreserve.d.ts +133 -0
  287. package/js/src/independentreserve.js +133 -132
  288. package/js/src/indodax.d.ts +171 -0
  289. package/js/src/indodax.js +177 -171
  290. package/js/src/kraken.d.ts +381 -0
  291. package/js/src/kraken.js +381 -377
  292. package/js/src/krakenfutures.d.ts +282 -0
  293. package/js/src/krakenfutures.js +285 -279
  294. package/js/src/kucoin.d.ts +613 -0
  295. package/js/src/kucoin.js +632 -622
  296. package/js/src/kucoinfutures.d.ts +441 -0
  297. package/js/src/kucoinfutures.js +533 -457
  298. package/js/src/kuna.d.ts +283 -0
  299. package/js/src/kuna.js +283 -282
  300. package/js/src/latoken.d.ts +211 -0
  301. package/js/src/latoken.js +211 -210
  302. package/js/src/lbank.d.ts +268 -0
  303. package/js/src/lbank.js +268 -267
  304. package/js/src/luno.d.ts +174 -0
  305. package/js/src/luno.js +174 -173
  306. package/js/src/lykke.d.ts +172 -0
  307. package/js/src/lykke.js +172 -171
  308. package/js/src/mercado.d.ts +123 -0
  309. package/js/src/mercado.js +123 -122
  310. package/js/src/mexc.d.ts +647 -0
  311. package/js/src/mexc.js +650 -646
  312. package/js/src/ndax.d.ts +229 -0
  313. package/js/src/ndax.js +229 -228
  314. package/js/src/novadax.d.ts +230 -0
  315. package/js/src/novadax.js +230 -229
  316. package/js/src/oceanex.d.ts +187 -0
  317. package/js/src/oceanex.js +187 -186
  318. package/js/src/okcoin.d.ts +286 -0
  319. package/js/src/okcoin.js +286 -285
  320. package/js/src/okx.d.ts +907 -0
  321. package/js/src/okx.js +909 -904
  322. package/js/src/onetrading.d.ts +218 -0
  323. package/js/src/onetrading.js +218 -218
  324. package/js/src/oxfun.d.ts +336 -3
  325. package/js/src/oxfun.js +335 -334
  326. package/js/src/p2b.d.ts +154 -0
  327. package/js/src/p2b.js +154 -154
  328. package/js/src/paradex.d.ts +241 -0
  329. package/js/src/paradex.js +249 -244
  330. package/js/src/paymium.d.ts +101 -0
  331. package/js/src/paymium.js +101 -101
  332. package/js/src/phemex.d.ts +366 -0
  333. package/js/src/phemex.js +388 -390
  334. package/js/src/poloniex.d.ts +270 -0
  335. package/js/src/poloniex.js +270 -270
  336. package/js/src/poloniexfutures.d.ts +250 -0
  337. package/js/src/poloniexfutures.js +250 -250
  338. package/js/src/pro/alpaca.d.ts +64 -0
  339. package/js/src/pro/alpaca.js +64 -64
  340. package/js/src/pro/ascendex.d.ts +64 -0
  341. package/js/src/pro/ascendex.js +64 -64
  342. package/js/src/pro/binance.d.ts +546 -0
  343. package/js/src/pro/binance.js +546 -543
  344. package/js/src/pro/bingx.d.ts +116 -0
  345. package/js/src/pro/bingx.js +116 -116
  346. package/js/src/pro/bitfinex.d.ts +42 -0
  347. package/js/src/pro/bitfinex.js +42 -42
  348. package/js/src/pro/bitfinex2.d.ts +66 -0
  349. package/js/src/pro/bitfinex2.js +66 -66
  350. package/js/src/pro/bitget.d.ts +187 -0
  351. package/js/src/pro/bitget.js +188 -181
  352. package/js/src/pro/bithumb.d.ts +40 -0
  353. package/js/src/pro/bithumb.js +40 -40
  354. package/js/src/pro/bitmart.d.ts +121 -0
  355. package/js/src/pro/bitmart.js +121 -119
  356. package/js/src/pro/bitmex.d.ts +135 -0
  357. package/js/src/pro/bitmex.js +135 -133
  358. package/js/src/pro/bitopro.d.ts +49 -0
  359. package/js/src/pro/bitopro.js +49 -49
  360. package/js/src/pro/bitrue.d.ts +19 -0
  361. package/js/src/pro/bitrue.js +19 -19
  362. package/js/src/pro/bitstamp.d.ts +29 -0
  363. package/js/src/pro/bitstamp.js +29 -29
  364. package/js/src/pro/bitvavo.d.ts +254 -1
  365. package/js/src/pro/bitvavo.js +299 -301
  366. package/js/src/pro/blockchaincom.d.ts +62 -0
  367. package/js/src/pro/blockchaincom.js +62 -62
  368. package/js/src/pro/blofin.d.ts +132 -0
  369. package/js/src/pro/blofin.js +132 -130
  370. package/js/src/pro/bybit.d.ts +317 -0
  371. package/js/src/pro/bybit.js +317 -313
  372. package/js/src/pro/cex.d.ts +168 -0
  373. package/js/src/pro/cex.js +168 -168
  374. package/js/src/pro/coinbase.d.ts +93 -0
  375. package/js/src/pro/coinbase.js +93 -91
  376. package/js/src/pro/coinbaseexchange.d.ts +95 -0
  377. package/js/src/pro/coinbaseexchange.js +95 -95
  378. package/js/src/pro/coinbaseinternational.d.ts +111 -0
  379. package/js/src/pro/coinbaseinternational.js +111 -111
  380. package/js/src/pro/coincatch.d.ts +150 -0
  381. package/js/src/pro/coincatch.js +150 -143
  382. package/js/src/pro/coincheck.d.ts +21 -0
  383. package/js/src/pro/coincheck.js +21 -21
  384. package/js/src/pro/coinex.d.ts +110 -0
  385. package/js/src/pro/coinex.js +110 -110
  386. package/js/src/pro/coinone.d.ts +30 -0
  387. package/js/src/pro/coinone.js +30 -30
  388. package/js/src/pro/cryptocom.d.ts +227 -0
  389. package/js/src/pro/cryptocom.js +227 -227
  390. package/js/src/pro/currencycom.d.ts +45 -0
  391. package/js/src/pro/currencycom.js +45 -45
  392. package/js/src/pro/deribit.d.ts +127 -0
  393. package/js/src/pro/deribit.js +127 -127
  394. package/js/src/pro/exmo.d.ts +66 -0
  395. package/js/src/pro/exmo.js +66 -66
  396. package/js/src/pro/gate.d.ts +287 -0
  397. package/js/src/pro/gate.js +287 -283
  398. package/js/src/pro/gemini.d.ts +74 -0
  399. package/js/src/pro/gemini.js +74 -74
  400. package/js/src/pro/hashkey.d.ts +87 -0
  401. package/js/src/pro/hashkey.js +87 -85
  402. package/js/src/pro/hitbtc.d.ts +190 -0
  403. package/js/src/pro/hitbtc.js +190 -190
  404. package/js/src/pro/hollaex.d.ts +51 -0
  405. package/js/src/pro/hollaex.js +51 -51
  406. package/js/src/pro/htx.d.ts +96 -0
  407. package/js/src/pro/htx.js +96 -94
  408. package/js/src/pro/huobijp.d.ts +38 -0
  409. package/js/src/pro/huobijp.js +38 -38
  410. package/js/src/pro/hyperliquid.d.ts +151 -0
  411. package/js/src/pro/hyperliquid.js +151 -150
  412. package/js/src/pro/idex.d.ts +48 -0
  413. package/js/src/pro/idex.js +48 -48
  414. package/js/src/pro/independentreserve.d.ts +19 -0
  415. package/js/src/pro/independentreserve.js +19 -19
  416. package/js/src/pro/kraken.d.ts +167 -0
  417. package/js/src/pro/kraken.js +167 -167
  418. package/js/src/pro/krakenfutures.d.ts +137 -0
  419. package/js/src/pro/krakenfutures.js +137 -138
  420. package/js/src/pro/kucoin.d.ts +167 -0
  421. package/js/src/pro/kucoin.js +167 -168
  422. package/js/src/pro/kucoinfutures.d.ts +147 -0
  423. package/js/src/pro/kucoinfutures.js +147 -147
  424. package/js/src/pro/lbank.d.ts +95 -0
  425. package/js/src/pro/lbank.js +95 -95
  426. package/js/src/pro/luno.d.ts +21 -0
  427. package/js/src/pro/luno.js +21 -21
  428. package/js/src/pro/mexc.d.ts +101 -0
  429. package/js/src/pro/mexc.js +102 -103
  430. package/js/src/pro/ndax.d.ts +42 -0
  431. package/js/src/pro/ndax.js +42 -42
  432. package/js/src/pro/okcoin.d.ts +61 -0
  433. package/js/src/pro/okcoin.js +61 -61
  434. package/js/src/pro/okx.d.ts +332 -0
  435. package/js/src/pro/okx.js +332 -330
  436. package/js/src/pro/onetrading.d.ts +71 -0
  437. package/js/src/pro/onetrading.js +71 -71
  438. package/js/src/pro/oxfun.d.ts +193 -0
  439. package/js/src/pro/oxfun.js +193 -191
  440. package/js/src/pro/p2b.d.ts +77 -0
  441. package/js/src/pro/p2b.js +77 -77
  442. package/js/src/pro/paradex.d.ts +39 -0
  443. package/js/src/pro/paradex.js +39 -39
  444. package/js/src/pro/phemex.d.ts +94 -0
  445. package/js/src/pro/phemex.js +94 -94
  446. package/js/src/pro/poloniex.d.ts +171 -0
  447. package/js/src/pro/poloniex.js +171 -171
  448. package/js/src/pro/poloniexfutures.d.ts +62 -0
  449. package/js/src/pro/poloniexfutures.js +62 -62
  450. package/js/src/pro/probit.d.ts +63 -0
  451. package/js/src/pro/probit.js +63 -63
  452. package/js/src/pro/upbit.d.ts +80 -0
  453. package/js/src/pro/upbit.js +80 -80
  454. package/js/src/pro/vertex.d.ts +65 -0
  455. package/js/src/pro/vertex.js +65 -63
  456. package/js/src/pro/wazirx.d.ts +70 -0
  457. package/js/src/pro/wazirx.js +70 -70
  458. package/js/src/pro/whitebit.d.ts +83 -0
  459. package/js/src/pro/whitebit.js +83 -83
  460. package/js/src/pro/woo.d.ts +106 -0
  461. package/js/src/pro/woo.js +106 -104
  462. package/js/src/pro/woofipro.d.ts +105 -0
  463. package/js/src/pro/woofipro.js +105 -103
  464. package/js/src/pro/xt.d.ts +119 -0
  465. package/js/src/pro/xt.js +119 -119
  466. package/js/src/probit.d.ts +229 -0
  467. package/js/src/probit.js +229 -229
  468. package/js/src/timex.d.ts +198 -0
  469. package/js/src/timex.js +198 -197
  470. package/js/src/tokocrypto.d.ts +214 -0
  471. package/js/src/tokocrypto.js +214 -213
  472. package/js/src/tradeogre.d.ts +92 -0
  473. package/js/src/tradeogre.js +92 -91
  474. package/js/src/upbit.d.ts +243 -0
  475. package/js/src/upbit.js +243 -242
  476. package/js/src/vertex.d.ts +258 -0
  477. package/js/src/vertex.js +258 -258
  478. package/js/src/wavesexchange.d.ts +176 -0
  479. package/js/src/wavesexchange.js +176 -172
  480. package/js/src/wazirx.d.ts +168 -0
  481. package/js/src/wazirx.js +168 -168
  482. package/js/src/whitebit.d.ts +361 -0
  483. package/js/src/whitebit.js +361 -361
  484. package/js/src/woo.d.ts +571 -0
  485. package/js/src/woo.js +571 -572
  486. package/js/src/woofipro.d.ts +392 -0
  487. package/js/src/woofipro.js +392 -391
  488. package/js/src/xt.d.ts +439 -4
  489. package/js/src/xt.js +436 -435
  490. package/js/src/yobit.d.ts +159 -0
  491. package/js/src/yobit.js +159 -158
  492. package/js/src/zaif.d.ts +103 -0
  493. package/js/src/zaif.js +103 -103
  494. package/js/src/zonda.d.ts +168 -0
  495. package/js/src/zonda.js +168 -168
  496. package/package.json +1 -1
package/js/src/phemex.js CHANGED
@@ -491,6 +491,13 @@ export default class phemex extends Exchange {
491
491
  'transfer': {
492
492
  'fillResponseFromRequest': true,
493
493
  },
494
+ 'triggerPriceTypesMap': {
495
+ 'last': 'ByLastPrice',
496
+ 'mark': 'ByMarkPrice',
497
+ 'index': 'ByIndexPrice',
498
+ 'ask': 'ByAskPrice',
499
+ 'bid': 'ByBidPrice',
500
+ },
494
501
  },
495
502
  });
496
503
  }
@@ -743,15 +750,15 @@ export default class phemex extends Exchange {
743
750
  'info': market,
744
751
  });
745
752
  }
753
+ /**
754
+ * @method
755
+ * @name phemex#fetchMarkets
756
+ * @description retrieves data on all markets for phemex
757
+ * @see https://phemex-docs.github.io/#query-product-information-3
758
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
759
+ * @returns {object[]} an array of objects representing market data
760
+ */
746
761
  async fetchMarkets(params = {}) {
747
- /**
748
- * @method
749
- * @name phemex#fetchMarkets
750
- * @description retrieves data on all markets for phemex
751
- * @see https://phemex-docs.github.io/#query-product-information-3
752
- * @param {object} [params] extra parameters specific to the exchange API endpoint
753
- * @returns {object[]} an array of objects representing market data
754
- */
755
762
  const v2Products = await this.v2GetPublicProducts(params);
756
763
  //
757
764
  // {
@@ -973,14 +980,14 @@ export default class phemex extends Exchange {
973
980
  }
974
981
  return result;
975
982
  }
983
+ /**
984
+ * @method
985
+ * @name phemex#fetchCurrencies
986
+ * @description fetches all available currencies on an exchange
987
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
988
+ * @returns {object} an associative dictionary of currencies
989
+ */
976
990
  async fetchCurrencies(params = {}) {
977
- /**
978
- * @method
979
- * @name phemex#fetchCurrencies
980
- * @description fetches all available currencies on an exchange
981
- * @param {object} [params] extra parameters specific to the exchange API endpoint
982
- * @returns {object} an associative dictionary of currencies
983
- */
984
991
  const response = await this.v2GetPublicProducts(params);
985
992
  //
986
993
  // {
@@ -1078,17 +1085,17 @@ export default class phemex extends Exchange {
1078
1085
  result[asksKey] = this.sortBy(result[asksKey], 0);
1079
1086
  return result;
1080
1087
  }
1088
+ /**
1089
+ * @method
1090
+ * @name phemex#fetchOrderBook
1091
+ * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
1092
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryorderbook
1093
+ * @param {string} symbol unified symbol of the market to fetch the order book for
1094
+ * @param {int} [limit] the maximum amount of order book entries to return
1095
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1096
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
1097
+ */
1081
1098
  async fetchOrderBook(symbol, limit = undefined, params = {}) {
1082
- /**
1083
- * @method
1084
- * @name phemex#fetchOrderBook
1085
- * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
1086
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryorderbook
1087
- * @param {string} symbol unified symbol of the market to fetch the order book for
1088
- * @param {int} [limit] the maximum amount of order book entries to return
1089
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1090
- * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
1091
- */
1092
1099
  await this.loadMarkets();
1093
1100
  const market = this.market(symbol);
1094
1101
  const request = {
@@ -1216,21 +1223,21 @@ export default class phemex extends Exchange {
1216
1223
  baseVolume,
1217
1224
  ];
1218
1225
  }
1226
+ /**
1227
+ * @method
1228
+ * @name phemex#fetchOHLCV
1229
+ * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1230
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#querykline
1231
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-kline
1232
+ * @param {string} symbol unified symbol of the market to fetch OHLCV data for
1233
+ * @param {string} timeframe the length of time each candle represents
1234
+ * @param {int} [since] *only used for USDT settled contracts, otherwise is emulated and not supported by the exchange* timestamp in ms of the earliest candle to fetch
1235
+ * @param {int} [limit] the maximum amount of candles to fetch
1236
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1237
+ * @param {int} [params.until] *USDT settled/ linear swaps only* end time in ms
1238
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
1239
+ */
1219
1240
  async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
1220
- /**
1221
- * @method
1222
- * @name phemex#fetchOHLCV
1223
- * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1224
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#querykline
1225
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-kline
1226
- * @param {string} symbol unified symbol of the market to fetch OHLCV data for
1227
- * @param {string} timeframe the length of time each candle represents
1228
- * @param {int} [since] *only used for USDT settled contracts, otherwise is emulated and not supported by the exchange* timestamp in ms of the earliest candle to fetch
1229
- * @param {int} [limit] the maximum amount of candles to fetch
1230
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1231
- * @param {int} [params.until] *USDT settled/ linear swaps only* end time in ms
1232
- * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
1233
- */
1234
1241
  await this.loadMarkets();
1235
1242
  const market = this.market(symbol);
1236
1243
  const userLimit = limit;
@@ -1395,16 +1402,16 @@ export default class phemex extends Exchange {
1395
1402
  'info': ticker,
1396
1403
  }, market);
1397
1404
  }
1405
+ /**
1406
+ * @method
1407
+ * @name phemex#fetchTicker
1408
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
1409
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query24hrsticker
1410
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
1411
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1412
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
1413
+ */
1398
1414
  async fetchTicker(symbol, params = {}) {
1399
- /**
1400
- * @method
1401
- * @name phemex#fetchTicker
1402
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
1403
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query24hrsticker
1404
- * @param {string} symbol unified symbol of the market to fetch the ticker for
1405
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1406
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
1407
- */
1408
1415
  await this.loadMarkets();
1409
1416
  const market = this.market(symbol);
1410
1417
  const request = {
@@ -1470,18 +1477,18 @@ export default class phemex extends Exchange {
1470
1477
  const result = this.safeDict(response, 'result', {});
1471
1478
  return this.parseTicker(result, market);
1472
1479
  }
1480
+ /**
1481
+ * @method
1482
+ * @name phemex#fetchTickers
1483
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
1484
+ * @see https://phemex-docs.github.io/#query-24-hours-ticker-for-all-symbols-2 // spot
1485
+ * @see https://phemex-docs.github.io/#query-24-ticker-for-all-symbols // linear
1486
+ * @see https://phemex-docs.github.io/#query-24-hours-ticker-for-all-symbols // inverse
1487
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1488
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1489
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
1490
+ */
1473
1491
  async fetchTickers(symbols = undefined, params = {}) {
1474
- /**
1475
- * @method
1476
- * @name phemex#fetchTickers
1477
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
1478
- * @see https://phemex-docs.github.io/#query-24-hours-ticker-for-all-symbols-2 // spot
1479
- * @see https://phemex-docs.github.io/#query-24-ticker-for-all-symbols // linear
1480
- * @see https://phemex-docs.github.io/#query-24-hours-ticker-for-all-symbols // inverse
1481
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1482
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1483
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
1484
- */
1485
1492
  await this.loadMarkets();
1486
1493
  let market = undefined;
1487
1494
  if (symbols !== undefined) {
@@ -1506,18 +1513,18 @@ export default class phemex extends Exchange {
1506
1513
  const result = this.safeList(response, 'result', []);
1507
1514
  return this.parseTickers(result, symbols);
1508
1515
  }
1516
+ /**
1517
+ * @method
1518
+ * @name phemex#fetchTrades
1519
+ * @description get the list of most recent trades for a particular symbol
1520
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#querytrades
1521
+ * @param {string} symbol unified symbol of the market to fetch trades for
1522
+ * @param {int} [since] timestamp in ms of the earliest trade to fetch
1523
+ * @param {int} [limit] the maximum amount of trades to fetch
1524
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1525
+ * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
1526
+ */
1509
1527
  async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
1510
- /**
1511
- * @method
1512
- * @name phemex#fetchTrades
1513
- * @description get the list of most recent trades for a particular symbol
1514
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#querytrades
1515
- * @param {string} symbol unified symbol of the market to fetch trades for
1516
- * @param {int} [since] timestamp in ms of the earliest trade to fetch
1517
- * @param {int} [limit] the maximum amount of trades to fetch
1518
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1519
- * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
1520
- */
1521
1528
  await this.loadMarkets();
1522
1529
  const market = this.market(symbol);
1523
1530
  const request = {
@@ -1955,19 +1962,19 @@ export default class phemex extends Exchange {
1955
1962
  result[code] = account;
1956
1963
  return this.safeBalance(result);
1957
1964
  }
1965
+ /**
1966
+ * @method
1967
+ * @name phemex#fetchBalance
1968
+ * @description query for balance and get the amount of funds available for trading or funds locked in orders
1969
+ * @see https://phemex-docs.github.io/#query-wallets
1970
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-account-positions
1971
+ * @see https://phemex-docs.github.io/#query-trading-account-and-positions
1972
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1973
+ * @param {string} [params.type] spot or swap
1974
+ * @param {string} [params.code] *swap only* currency code of the balance to query (USD, USDT, etc), default is USDT
1975
+ * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
1976
+ */
1958
1977
  async fetchBalance(params = {}) {
1959
- /**
1960
- * @method
1961
- * @name phemex#fetchBalance
1962
- * @description query for balance and get the amount of funds available for trading or funds locked in orders
1963
- * @see https://phemex-docs.github.io/#query-wallets
1964
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-account-positions
1965
- * @see https://phemex-docs.github.io/#query-trading-account-and-positions
1966
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1967
- * @param {string} [params.type] spot or swap
1968
- * @param {string} [params.code] *swap only* currency code of the balance to query (USD, USDT, etc), default is USDT
1969
- * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
1970
- */
1971
1978
  await this.loadMarkets();
1972
1979
  let type = undefined;
1973
1980
  [type, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
@@ -2140,6 +2147,7 @@ export default class phemex extends Exchange {
2140
2147
  'PartiallyFilled': 'open',
2141
2148
  'Filled': 'closed',
2142
2149
  'Canceled': 'canceled',
2150
+ 'Suspended': 'canceled',
2143
2151
  '1': 'open',
2144
2152
  '2': 'canceled',
2145
2153
  '3': 'closed',
@@ -2485,28 +2493,28 @@ export default class phemex extends Exchange {
2485
2493
  }
2486
2494
  return this.parseSpotOrder(order, market);
2487
2495
  }
2496
+ /**
2497
+ * @method
2498
+ * @name phemex#createOrder
2499
+ * @description create a trade order
2500
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#place-order
2501
+ * @see https://phemex-docs.github.io/#place-order-http-put-prefered-3
2502
+ * @param {string} symbol unified symbol of the market to create an order in
2503
+ * @param {string} type 'market' or 'limit'
2504
+ * @param {string} side 'buy' or 'sell'
2505
+ * @param {float} amount how much of currency you want to trade in units of base currency
2506
+ * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
2507
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2508
+ * @param {float} [params.trigger] trigger price for conditional orders
2509
+ * @param {object} [params.takeProfit] *swap only* *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered (perpetual swap markets only)
2510
+ * @param {float} [params.takeProfit.triggerPrice] take profit trigger price
2511
+ * @param {object} [params.stopLoss] *swap only* *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered (perpetual swap markets only)
2512
+ * @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
2513
+ * @param {string} [params.posSide] *swap only* "Merged" for one way mode, "Long" for buy side of hedged mode, "Short" for sell side of hedged mode
2514
+ * @param {bool} [params.hedged] *swap only* true for hedged mode, false for one way mode, default is false
2515
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2516
+ */
2488
2517
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
2489
- /**
2490
- * @method
2491
- * @name phemex#createOrder
2492
- * @description create a trade order
2493
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#place-order
2494
- * @see https://phemex-docs.github.io/#place-order-http-put-prefered-3
2495
- * @param {string} symbol unified symbol of the market to create an order in
2496
- * @param {string} type 'market' or 'limit'
2497
- * @param {string} side 'buy' or 'sell'
2498
- * @param {float} amount how much of currency you want to trade in units of base currency
2499
- * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
2500
- * @param {object} [params] extra parameters specific to the exchange API endpoint
2501
- * @param {float} [params.trigger] trigger price for conditional orders
2502
- * @param {object} [params.takeProfit] *swap only* *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered (perpetual swap markets only)
2503
- * @param {float} [params.takeProfit.triggerPrice] take profit trigger price
2504
- * @param {object} [params.stopLoss] *swap only* *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered (perpetual swap markets only)
2505
- * @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
2506
- * @param {string} [params.posSide] *swap only* "Merged" for one way mode, "Long" for buy side of hedged mode, "Short" for sell side of hedged mode
2507
- * @param {bool} [params.hedged] *swap only* true for hedged mode, false for one way mode, default is false
2508
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2509
- */
2510
2518
  await this.loadMarkets();
2511
2519
  const market = this.market(symbol);
2512
2520
  const requestSide = this.capitalize(side);
@@ -2646,17 +2654,11 @@ export default class phemex extends Exchange {
2646
2654
  }
2647
2655
  const stopLossTriggerPriceType = this.safeString2(stopLoss, 'triggerPriceType', 'slTrigger');
2648
2656
  if (stopLossTriggerPriceType !== undefined) {
2649
- if (market['settle'] === 'USDT') {
2650
- if ((stopLossTriggerPriceType !== 'ByMarkPrice') && (stopLossTriggerPriceType !== 'ByLastPrice') && (stopLossTriggerPriceType !== 'ByIndexPrice') && (stopLossTriggerPriceType !== 'ByAskPrice') && (stopLossTriggerPriceType !== 'ByBidPrice') && (stopLossTriggerPriceType !== 'ByMarkPriceLimit') && (stopLossTriggerPriceType !== 'ByLastPriceLimit')) {
2651
- throw new InvalidOrder(this.id + ' createOrder() take profit trigger price type must be one of "ByMarkPrice", "ByIndexPrice", "ByAskPrice", "ByBidPrice", "ByMarkPriceLimit", "ByLastPriceLimit" or "ByLastPrice"');
2652
- }
2653
- }
2654
- else {
2655
- if ((stopLossTriggerPriceType !== 'ByMarkPrice') && (stopLossTriggerPriceType !== 'ByLastPrice')) {
2656
- throw new InvalidOrder(this.id + ' createOrder() take profit trigger price type must be one of "ByMarkPrice", or "ByLastPrice"');
2657
- }
2658
- }
2659
- request['slTrigger'] = stopLossTriggerPriceType;
2657
+ request['slTrigger'] = this.safeString(this.options['triggerPriceTypesMap'], stopLossTriggerPriceType, stopLossTriggerPriceType);
2658
+ }
2659
+ const slLimitPrice = this.safeString(stopLoss, 'price');
2660
+ if (slLimitPrice !== undefined) {
2661
+ request['slPxRp'] = this.priceToPrecision(symbol, slLimitPrice);
2660
2662
  }
2661
2663
  }
2662
2664
  if (takeProfitDefined) {
@@ -2670,19 +2672,13 @@ export default class phemex extends Exchange {
2670
2672
  else {
2671
2673
  request['takeProfitEp'] = this.toEp(takeProfitTriggerPrice, market);
2672
2674
  }
2673
- const takeProfitTriggerPriceType = this.safeString2(stopLoss, 'triggerPriceType', 'tpTrigger');
2675
+ const takeProfitTriggerPriceType = this.safeString2(takeProfit, 'triggerPriceType', 'tpTrigger');
2674
2676
  if (takeProfitTriggerPriceType !== undefined) {
2675
- if (market['settle'] === 'USDT') {
2676
- if ((takeProfitTriggerPriceType !== 'ByMarkPrice') && (takeProfitTriggerPriceType !== 'ByLastPrice') && (takeProfitTriggerPriceType !== 'ByIndexPrice') && (takeProfitTriggerPriceType !== 'ByAskPrice') && (takeProfitTriggerPriceType !== 'ByBidPrice') && (takeProfitTriggerPriceType !== 'ByMarkPriceLimit') && (takeProfitTriggerPriceType !== 'ByLastPriceLimit')) {
2677
- throw new InvalidOrder(this.id + ' createOrder() take profit trigger price type must be one of "ByMarkPrice", "ByIndexPrice", "ByAskPrice", "ByBidPrice", "ByMarkPriceLimit", "ByLastPriceLimit" or "ByLastPrice"');
2678
- }
2679
- }
2680
- else {
2681
- if ((takeProfitTriggerPriceType !== 'ByMarkPrice') && (takeProfitTriggerPriceType !== 'ByLastPrice')) {
2682
- throw new InvalidOrder(this.id + ' createOrder() take profit trigger price type must be one of "ByMarkPrice", or "ByLastPrice"');
2683
- }
2684
- }
2685
- request['tpTrigger'] = takeProfitTriggerPriceType;
2677
+ request['tpTrigger'] = this.safeString(this.options['triggerPriceTypesMap'], takeProfitTriggerPriceType, takeProfitTriggerPriceType);
2678
+ }
2679
+ const tpLimitPrice = this.safeString(takeProfit, 'price');
2680
+ if (tpLimitPrice !== undefined) {
2681
+ request['tpPxRp'] = this.priceToPrecision(symbol, tpLimitPrice);
2686
2682
  }
2687
2683
  }
2688
2684
  }
@@ -2806,22 +2802,22 @@ export default class phemex extends Exchange {
2806
2802
  const data = this.safeDict(response, 'data', {});
2807
2803
  return this.parseOrder(data, market);
2808
2804
  }
2805
+ /**
2806
+ * @method
2807
+ * @name phemex#editOrder
2808
+ * @description edit a trade order
2809
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#amend-order-by-orderid
2810
+ * @param {string} id cancel order id
2811
+ * @param {string} symbol unified symbol of the market to create an order in
2812
+ * @param {string} type 'market' or 'limit'
2813
+ * @param {string} side 'buy' or 'sell'
2814
+ * @param {float} amount how much of currency you want to trade in units of base currency
2815
+ * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
2816
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2817
+ * @param {string} [params.posSide] either 'Merged' or 'Long' or 'Short'
2818
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2819
+ */
2809
2820
  async editOrder(id, symbol, type = undefined, side = undefined, amount = undefined, price = undefined, params = {}) {
2810
- /**
2811
- * @method
2812
- * @name phemex#editOrder
2813
- * @description edit a trade order
2814
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#amend-order-by-orderid
2815
- * @param {string} id cancel order id
2816
- * @param {string} symbol unified symbol of the market to create an order in
2817
- * @param {string} type 'market' or 'limit'
2818
- * @param {string} side 'buy' or 'sell'
2819
- * @param {float} amount how much of currency you want to trade in units of base currency
2820
- * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
2821
- * @param {object} [params] extra parameters specific to the exchange API endpoint
2822
- * @param {string} [params.posSide] either 'Merged' or 'Long' or 'Short'
2823
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2824
- */
2825
2821
  await this.loadMarkets();
2826
2822
  const market = this.market(symbol);
2827
2823
  const request = {
@@ -2885,18 +2881,18 @@ export default class phemex extends Exchange {
2885
2881
  const data = this.safeDict(response, 'data', {});
2886
2882
  return this.parseOrder(data, market);
2887
2883
  }
2884
+ /**
2885
+ * @method
2886
+ * @name phemex#cancelOrder
2887
+ * @description cancels an open order
2888
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#cancel-single-order-by-orderid
2889
+ * @param {string} id order id
2890
+ * @param {string} symbol unified symbol of the market the order was made in
2891
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2892
+ * @param {string} [params.posSide] either 'Merged' or 'Long' or 'Short'
2893
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2894
+ */
2888
2895
  async cancelOrder(id, symbol = undefined, params = {}) {
2889
- /**
2890
- * @method
2891
- * @name phemex#cancelOrder
2892
- * @description cancels an open order
2893
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#cancel-single-order-by-orderid
2894
- * @param {string} id order id
2895
- * @param {string} symbol unified symbol of the market the order was made in
2896
- * @param {object} [params] extra parameters specific to the exchange API endpoint
2897
- * @param {string} [params.posSide] either 'Merged' or 'Long' or 'Short'
2898
- * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2899
- */
2900
2896
  if (symbol === undefined) {
2901
2897
  throw new ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
2902
2898
  }
@@ -2930,16 +2926,16 @@ export default class phemex extends Exchange {
2930
2926
  const data = this.safeDict(response, 'data', {});
2931
2927
  return this.parseOrder(data, market);
2932
2928
  }
2929
+ /**
2930
+ * @method
2931
+ * @name phemex#cancelAllOrders
2932
+ * @description cancel all open orders in a market
2933
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#cancelall
2934
+ * @param {string} symbol unified market symbol of the market to cancel orders in
2935
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2936
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
2937
+ */
2933
2938
  async cancelAllOrders(symbol = undefined, params = {}) {
2934
- /**
2935
- * @method
2936
- * @name phemex#cancelAllOrders
2937
- * @description cancel all open orders in a market
2938
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#cancelall
2939
- * @param {string} symbol unified market symbol of the market to cancel orders in
2940
- * @param {object} [params] extra parameters specific to the exchange API endpoint
2941
- * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
2942
- */
2943
2939
  if (symbol === undefined) {
2944
2940
  throw new ArgumentsRequired(this.id + ' cancelAllOrders() requires a symbol argument');
2945
2941
  }
@@ -2994,17 +2990,17 @@ export default class phemex extends Exchange {
2994
2990
  }),
2995
2991
  ];
2996
2992
  }
2993
+ /**
2994
+ * @method
2995
+ * @name phemex#fetchOrder
2996
+ * @see https://phemex-docs.github.io/#query-orders-by-ids
2997
+ * @description fetches information on an order made by the user
2998
+ * @param {string} id the order id
2999
+ * @param {string} symbol unified symbol of the market the order was made in
3000
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3001
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3002
+ */
2997
3003
  async fetchOrder(id, symbol = undefined, params = {}) {
2998
- /**
2999
- * @method
3000
- * @name phemex#fetchOrder
3001
- * @see https://phemex-docs.github.io/#query-orders-by-ids
3002
- * @description fetches information on an order made by the user
3003
- * @param {string} id the order id
3004
- * @param {string} symbol unified symbol of the market the order was made in
3005
- * @param {object} [params] extra parameters specific to the exchange API endpoint
3006
- * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3007
- */
3008
3004
  if (symbol === undefined) {
3009
3005
  throw new ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
3010
3006
  }
@@ -3051,18 +3047,18 @@ export default class phemex extends Exchange {
3051
3047
  }
3052
3048
  return this.parseOrder(order, market);
3053
3049
  }
3050
+ /**
3051
+ * @method
3052
+ * @name phemex#fetchOrders
3053
+ * @description fetches information on multiple orders made by the user
3054
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryorder
3055
+ * @param {string} symbol unified market symbol of the market orders were made in
3056
+ * @param {int} [since] the earliest time in ms to fetch orders for
3057
+ * @param {int} [limit] the maximum number of order structures to retrieve
3058
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3059
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
3060
+ */
3054
3061
  async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
3055
- /**
3056
- * @method
3057
- * @name phemex#fetchOrders
3058
- * @description fetches information on multiple orders made by the user
3059
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryorder
3060
- * @param {string} symbol unified market symbol of the market orders were made in
3061
- * @param {int} [since] the earliest time in ms to fetch orders for
3062
- * @param {int} [limit] the maximum number of order structures to retrieve
3063
- * @param {object} [params] extra parameters specific to the exchange API endpoint
3064
- * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
3065
- */
3066
3062
  if (symbol === undefined) {
3067
3063
  throw new ArgumentsRequired(this.id + ' fetchOrders() requires a symbol argument');
3068
3064
  }
@@ -3092,20 +3088,20 @@ export default class phemex extends Exchange {
3092
3088
  const rows = this.safeList(data, 'rows', data);
3093
3089
  return this.parseOrders(rows, market, since, limit);
3094
3090
  }
3091
+ /**
3092
+ * @method
3093
+ * @name phemex#fetchOpenOrders
3094
+ * @description fetch all unfilled currently open orders
3095
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryopenorder
3096
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md
3097
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#spotListAllOpenOrder
3098
+ * @param {string} symbol unified market symbol
3099
+ * @param {int} [since] the earliest time in ms to fetch open orders for
3100
+ * @param {int} [limit] the maximum number of open order structures to retrieve
3101
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3102
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
3103
+ */
3095
3104
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
3096
- /**
3097
- * @method
3098
- * @name phemex#fetchOpenOrders
3099
- * @description fetch all unfilled currently open orders
3100
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryopenorder
3101
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md
3102
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#spotListAllOpenOrder
3103
- * @param {string} symbol unified market symbol
3104
- * @param {int} [since] the earliest time in ms to fetch open orders for
3105
- * @param {int} [limit] the maximum number of open order structures to retrieve
3106
- * @param {object} [params] extra parameters specific to the exchange API endpoint
3107
- * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
3108
- */
3109
3105
  await this.loadMarkets();
3110
3106
  if (symbol === undefined) {
3111
3107
  throw new ArgumentsRequired(this.id + ' fetchOpenOrders() requires a symbol argument');
@@ -3142,22 +3138,22 @@ export default class phemex extends Exchange {
3142
3138
  return this.parseOrders(rows, market, since, limit);
3143
3139
  }
3144
3140
  }
3141
+ /**
3142
+ * @method
3143
+ * @name phemex#fetchClosedOrders
3144
+ * @description fetches information on multiple closed orders made by the user
3145
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryorder
3146
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#queryorder
3147
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedgedd-Perpetual-API.md#query-closed-orders-by-symbol
3148
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#spotDataOrdersByIds
3149
+ * @param {string} symbol unified market symbol of the market orders were made in
3150
+ * @param {int} [since] the earliest time in ms to fetch orders for
3151
+ * @param {int} [limit] the maximum number of order structures to retrieve
3152
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3153
+ * @param {string} [params.settle] the settlement currency to fetch orders for
3154
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
3155
+ */
3145
3156
  async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
3146
- /**
3147
- * @method
3148
- * @name phemex#fetchClosedOrders
3149
- * @description fetches information on multiple closed orders made by the user
3150
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryorder
3151
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#queryorder
3152
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedgedd-Perpetual-API.md#query-closed-orders-by-symbol
3153
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#spotDataOrdersByIds
3154
- * @param {string} symbol unified market symbol of the market orders were made in
3155
- * @param {int} [since] the earliest time in ms to fetch orders for
3156
- * @param {int} [limit] the maximum number of order structures to retrieve
3157
- * @param {object} [params] extra parameters specific to the exchange API endpoint
3158
- * @param {string} [params.settle] the settlement currency to fetch orders for
3159
- * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
3160
- */
3161
3157
  await this.loadMarkets();
3162
3158
  let market = undefined;
3163
3159
  if (symbol !== undefined) {
@@ -3229,20 +3225,20 @@ export default class phemex extends Exchange {
3229
3225
  return this.parseOrders(rows, market, since, limit);
3230
3226
  }
3231
3227
  }
3228
+ /**
3229
+ * @method
3230
+ * @name phemex#fetchMyTrades
3231
+ * @description fetch all trades made by the user
3232
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-user-trade
3233
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-user-trade
3234
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#spotDataTradesHist
3235
+ * @param {string} symbol unified market symbol
3236
+ * @param {int} [since] the earliest time in ms to fetch trades for
3237
+ * @param {int} [limit] the maximum number of trades structures to retrieve
3238
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3239
+ * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
3240
+ */
3232
3241
  async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
3233
- /**
3234
- * @method
3235
- * @name phemex#fetchMyTrades
3236
- * @description fetch all trades made by the user
3237
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-user-trade
3238
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-user-trade
3239
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#spotDataTradesHist
3240
- * @param {string} symbol unified market symbol
3241
- * @param {int} [since] the earliest time in ms to fetch trades for
3242
- * @param {int} [limit] the maximum number of trades structures to retrieve
3243
- * @param {object} [params] extra parameters specific to the exchange API endpoint
3244
- * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
3245
- */
3246
3242
  await this.loadMarkets();
3247
3243
  let market = undefined;
3248
3244
  if (symbol !== undefined) {
@@ -3391,15 +3387,15 @@ export default class phemex extends Exchange {
3391
3387
  }
3392
3388
  return this.parseTrades(data, market, since, limit);
3393
3389
  }
3390
+ /**
3391
+ * @method
3392
+ * @name phemex#fetchDepositAddress
3393
+ * @description fetch the deposit address for a currency associated with this account
3394
+ * @param {string} code unified currency code
3395
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3396
+ * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
3397
+ */
3394
3398
  async fetchDepositAddress(code, params = {}) {
3395
- /**
3396
- * @method
3397
- * @name phemex#fetchDepositAddress
3398
- * @description fetch the deposit address for a currency associated with this account
3399
- * @param {string} code unified currency code
3400
- * @param {object} [params] extra parameters specific to the exchange API endpoint
3401
- * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
3402
- */
3403
3399
  await this.loadMarkets();
3404
3400
  const currency = this.currency(code);
3405
3401
  const request = {
@@ -3439,17 +3435,17 @@ export default class phemex extends Exchange {
3439
3435
  'tag': tag,
3440
3436
  };
3441
3437
  }
3438
+ /**
3439
+ * @method
3440
+ * @name phemex#fetchDeposits
3441
+ * @description fetch all deposits made to an account
3442
+ * @param {string} code unified currency code
3443
+ * @param {int} [since] the earliest time in ms to fetch deposits for
3444
+ * @param {int} [limit] the maximum number of deposits structures to retrieve
3445
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3446
+ * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
3447
+ */
3442
3448
  async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
3443
- /**
3444
- * @method
3445
- * @name phemex#fetchDeposits
3446
- * @description fetch all deposits made to an account
3447
- * @param {string} code unified currency code
3448
- * @param {int} [since] the earliest time in ms to fetch deposits for
3449
- * @param {int} [limit] the maximum number of deposits structures to retrieve
3450
- * @param {object} [params] extra parameters specific to the exchange API endpoint
3451
- * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
3452
- */
3453
3449
  await this.loadMarkets();
3454
3450
  let currency = undefined;
3455
3451
  if (code !== undefined) {
@@ -3479,17 +3475,17 @@ export default class phemex extends Exchange {
3479
3475
  const data = this.safeList(response, 'data', []);
3480
3476
  return this.parseTransactions(data, currency, since, limit);
3481
3477
  }
3478
+ /**
3479
+ * @method
3480
+ * @name phemex#fetchWithdrawals
3481
+ * @description fetch all withdrawals made from an account
3482
+ * @param {string} code unified currency code
3483
+ * @param {int} [since] the earliest time in ms to fetch withdrawals for
3484
+ * @param {int} [limit] the maximum number of withdrawals structures to retrieve
3485
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3486
+ * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
3487
+ */
3482
3488
  async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
3483
- /**
3484
- * @method
3485
- * @name phemex#fetchWithdrawals
3486
- * @description fetch all withdrawals made from an account
3487
- * @param {string} code unified currency code
3488
- * @param {int} [since] the earliest time in ms to fetch withdrawals for
3489
- * @param {int} [limit] the maximum number of withdrawals structures to retrieve
3490
- * @param {object} [params] extra parameters specific to the exchange API endpoint
3491
- * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
3492
- */
3493
3489
  await this.loadMarkets();
3494
3490
  let currency = undefined;
3495
3491
  if (code !== undefined) {
@@ -3657,19 +3653,19 @@ export default class phemex extends Exchange {
3657
3653
  'fee': fee,
3658
3654
  };
3659
3655
  }
3656
+ /**
3657
+ * @method
3658
+ * @name phemex#fetchPositions
3659
+ * @description fetch all open positions
3660
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-trading-account-and-positions
3661
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-account-positions
3662
+ * @see https://phemex-docs.github.io/#query-account-positions-with-unrealized-pnl
3663
+ * @param {string[]} [symbols] list of unified market symbols
3664
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3665
+ * @param {string} [params.method] *USDT contracts only* 'privateGetGAccountsAccountPositions' or 'privateGetAccountsPositions' default is 'privateGetGAccountsAccountPositions'
3666
+ * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
3667
+ */
3660
3668
  async fetchPositions(symbols = undefined, params = {}) {
3661
- /**
3662
- * @method
3663
- * @name phemex#fetchPositions
3664
- * @description fetch all open positions
3665
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-trading-account-and-positions
3666
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-account-positions
3667
- * @see https://phemex-docs.github.io/#query-account-positions-with-unrealized-pnl
3668
- * @param {string[]} [symbols] list of unified market symbols
3669
- * @param {object} [params] extra parameters specific to the exchange API endpoint
3670
- * @param {string} [param.method] *USDT contracts only* 'privateGetGAccountsAccountPositions' or 'privateGetAccountsPositions' default is 'privateGetGAccountsAccountPositions'
3671
- * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
3672
- */
3673
3669
  await this.loadMarkets();
3674
3670
  symbols = this.marketSymbols(symbols);
3675
3671
  let subType = undefined;
@@ -3944,18 +3940,18 @@ export default class phemex extends Exchange {
3944
3940
  'takeProfitPrice': undefined,
3945
3941
  });
3946
3942
  }
3943
+ /**
3944
+ * @method
3945
+ * @name phemex#fetchFundingHistory
3946
+ * @description fetch the history of funding payments paid and received on this account
3947
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#futureDataFundingFeesHist
3948
+ * @param {string} symbol unified market symbol
3949
+ * @param {int} [since] the earliest time in ms to fetch funding history for
3950
+ * @param {int} [limit] the maximum number of funding history structures to retrieve
3951
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3952
+ * @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
3953
+ */
3947
3954
  async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
3948
- /**
3949
- * @method
3950
- * @name phemex#fetchFundingHistory
3951
- * @description fetch the history of funding payments paid and received on this account
3952
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#futureDataFundingFeesHist
3953
- * @param {string} symbol unified market symbol
3954
- * @param {int} [since] the earliest time in ms to fetch funding history for
3955
- * @param {int} [limit] the maximum number of funding history structures to retrieve
3956
- * @param {object} [params] extra parameters specific to the exchange API endpoint
3957
- * @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
3958
- */
3959
3955
  if (symbol === undefined) {
3960
3956
  throw new ArgumentsRequired(this.id + ' fetchFundingHistory() requires a symbol argument');
3961
3957
  }
@@ -4036,15 +4032,15 @@ export default class phemex extends Exchange {
4036
4032
  }
4037
4033
  return value;
4038
4034
  }
4035
+ /**
4036
+ * @method
4037
+ * @name phemex#fetchFundingRate
4038
+ * @description fetch the current funding rate
4039
+ * @param {string} symbol unified market symbol
4040
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4041
+ * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
4042
+ */
4039
4043
  async fetchFundingRate(symbol, params = {}) {
4040
- /**
4041
- * @method
4042
- * @name phemex#fetchFundingRate
4043
- * @description fetch the current funding rate
4044
- * @param {string} symbol unified market symbol
4045
- * @param {object} [params] extra parameters specific to the exchange API endpoint
4046
- * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
4047
- */
4048
4044
  await this.loadMarkets();
4049
4045
  const market = this.market(symbol);
4050
4046
  if (!market['swap']) {
@@ -4148,17 +4144,17 @@ export default class phemex extends Exchange {
4148
4144
  'interval': undefined,
4149
4145
  };
4150
4146
  }
4147
+ /**
4148
+ * @method
4149
+ * @name phemex#setMargin
4150
+ * @description Either adds or reduces margin in an isolated position in order to set the margin to a specific value
4151
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#assign-position-balance-in-isolated-marign-mode
4152
+ * @param {string} symbol unified market symbol of the market to set margin in
4153
+ * @param {float} amount the amount to set the margin to
4154
+ * @param {object} [params] parameters specific to the exchange API endpoint
4155
+ * @returns {object} A [margin structure]{@link https://docs.ccxt.com/#/?id=add-margin-structure}
4156
+ */
4151
4157
  async setMargin(symbol, amount, params = {}) {
4152
- /**
4153
- * @method
4154
- * @name phemex#setMargin
4155
- * @description Either adds or reduces margin in an isolated position in order to set the margin to a specific value
4156
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#assign-position-balance-in-isolated-marign-mode
4157
- * @param {string} symbol unified market symbol of the market to set margin in
4158
- * @param {float} amount the amount to set the margin to
4159
- * @param {object} [params] parameters specific to the exchange API endpoint
4160
- * @returns {object} A [margin structure]{@link https://docs.ccxt.com/#/?id=add-margin-structure}
4161
- */
4162
4158
  await this.loadMarkets();
4163
4159
  const market = this.market(symbol);
4164
4160
  const request = {
@@ -4207,16 +4203,16 @@ export default class phemex extends Exchange {
4207
4203
  'datetime': undefined,
4208
4204
  };
4209
4205
  }
4206
+ /**
4207
+ * @method
4208
+ * @name phemex#setMarginMode
4209
+ * @description set margin mode to 'cross' or 'isolated'
4210
+ * @param {string} marginMode 'cross' or 'isolated'
4211
+ * @param {string} symbol unified market symbol
4212
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4213
+ * @returns {object} response from the exchange
4214
+ */
4210
4215
  async setMarginMode(marginMode, symbol = undefined, params = {}) {
4211
- /**
4212
- * @method
4213
- * @name phemex#setMarginMode
4214
- * @description set margin mode to 'cross' or 'isolated'
4215
- * @param {string} marginMode 'cross' or 'isolated'
4216
- * @param {string} symbol unified market symbol
4217
- * @param {object} [params] extra parameters specific to the exchange API endpoint
4218
- * @returns {object} response from the exchange
4219
- */
4220
4216
  if (symbol === undefined) {
4221
4217
  throw new ArgumentsRequired(this.id + ' setMarginMode() requires a symbol argument');
4222
4218
  }
@@ -4242,17 +4238,17 @@ export default class phemex extends Exchange {
4242
4238
  };
4243
4239
  return await this.privatePutPositionsLeverage(this.extend(request, params));
4244
4240
  }
4241
+ /**
4242
+ * @method
4243
+ * @name phemex#setPositionMode
4244
+ * @description set hedged to true or false for a market
4245
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#switch-position-mode-synchronously
4246
+ * @param {bool} hedged set to true to use dualSidePosition
4247
+ * @param {string} symbol not used by binance setPositionMode ()
4248
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4249
+ * @returns {object} response from the exchange
4250
+ */
4245
4251
  async setPositionMode(hedged, symbol = undefined, params = {}) {
4246
- /**
4247
- * @method
4248
- * @name phemex#setPositionMode
4249
- * @description set hedged to true or false for a market
4250
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#switch-position-mode-synchronously
4251
- * @param {bool} hedged set to true to use dualSidePosition
4252
- * @param {string} symbol not used by binance setPositionMode ()
4253
- * @param {object} [params] extra parameters specific to the exchange API endpoint
4254
- * @returns {object} response from the exchange
4255
- */
4256
4252
  this.checkRequiredArgument('setPositionMode', symbol, 'symbol');
4257
4253
  await this.loadMarkets();
4258
4254
  const market = this.market(symbol);
@@ -4270,15 +4266,15 @@ export default class phemex extends Exchange {
4270
4266
  }
4271
4267
  return await this.privatePutGPositionsSwitchPosModeSync(this.extend(request, params));
4272
4268
  }
4269
+ /**
4270
+ * @method
4271
+ * @name phemex#fetchLeverageTiers
4272
+ * @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
4273
+ * @param {string[]|undefined} symbols list of unified market symbols
4274
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4275
+ * @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
4276
+ */
4273
4277
  async fetchLeverageTiers(symbols = undefined, params = {}) {
4274
- /**
4275
- * @method
4276
- * @name phemex#fetchLeverageTiers
4277
- * @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
4278
- * @param {string[]|undefined} symbols list of unified market symbols
4279
- * @param {object} [params] extra parameters specific to the exchange API endpoint
4280
- * @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
4281
- */
4282
4278
  await this.loadMarkets();
4283
4279
  if (symbols !== undefined) {
4284
4280
  const first = this.safeValue(symbols, 0);
@@ -4386,7 +4382,8 @@ export default class phemex extends Exchange {
4386
4382
  // ]
4387
4383
  // },
4388
4384
  //
4389
- market = this.safeMarket(undefined, market);
4385
+ const marketId = this.safeString(info, 'symbol');
4386
+ market = this.safeMarket(marketId, market);
4390
4387
  const riskLimits = (market['info']['riskLimits']);
4391
4388
  const tiers = [];
4392
4389
  let minNotional = 0;
@@ -4395,6 +4392,7 @@ export default class phemex extends Exchange {
4395
4392
  const maxNotional = this.safeInteger(tier, 'limit');
4396
4393
  tiers.push({
4397
4394
  'tier': this.sum(i, 1),
4395
+ 'symbol': this.safeSymbol(marketId, market),
4398
4396
  'currency': market['settle'],
4399
4397
  'minNotional': minNotional,
4400
4398
  'maxNotional': maxNotional,
@@ -4446,20 +4444,20 @@ export default class phemex extends Exchange {
4446
4444
  url = this.implodeHostname(this.urls['api'][api]) + url;
4447
4445
  return { 'url': url, 'method': method, 'body': body, 'headers': headers };
4448
4446
  }
4447
+ /**
4448
+ * @method
4449
+ * @name phemex#setLeverage
4450
+ * @description set the level of leverage for a market
4451
+ * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#set-leverage
4452
+ * @param {float} leverage the rate of leverage, 100 > leverage > -100 excluding numbers between -1 to 1
4453
+ * @param {string} symbol unified market symbol
4454
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4455
+ * @param {bool} [params.hedged] set to true if hedged position mode is enabled (by default long and short leverage are set to the same value)
4456
+ * @param {float} [params.longLeverageRr] *hedged mode only* set the leverage for long positions
4457
+ * @param {float} [params.shortLeverageRr] *hedged mode only* set the leverage for short positions
4458
+ * @returns {object} response from the exchange
4459
+ */
4449
4460
  async setLeverage(leverage, symbol = undefined, params = {}) {
4450
- /**
4451
- * @method
4452
- * @name phemex#setLeverage
4453
- * @description set the level of leverage for a market
4454
- * @see https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#set-leverage
4455
- * @param {float} leverage the rate of leverage, 100 > leverage > -100 excluding numbers between -1 to 1
4456
- * @param {string} symbol unified market symbol
4457
- * @param {object} [params] extra parameters specific to the exchange API endpoint
4458
- * @param {bool} [params.hedged] set to true if hedged position mode is enabled (by default long and short leverage are set to the same value)
4459
- * @param {float} [params.longLeverageRr] *hedged mode only* set the leverage for long positions
4460
- * @param {float} [params.shortLeverageRr] *hedged mode only* set the leverage for short positions
4461
- * @returns {object} response from the exchange
4462
- */
4463
4461
  // WARNING: THIS WILL INCREASE LIQUIDATION PRICE FOR OPEN ISOLATED LONG POSITIONS
4464
4462
  // AND DECREASE LIQUIDATION PRICE FOR OPEN ISOLATED SHORT POSITIONS
4465
4463
  if (symbol === undefined) {
@@ -4495,19 +4493,19 @@ export default class phemex extends Exchange {
4495
4493
  }
4496
4494
  return response;
4497
4495
  }
4496
+ /**
4497
+ * @method
4498
+ * @name phemex#transfer
4499
+ * @description transfer currency internally between wallets on the same account
4500
+ * @param {string} code unified currency code
4501
+ * @param {float} amount amount to transfer
4502
+ * @param {string} fromAccount account to transfer from
4503
+ * @param {string} toAccount account to transfer to
4504
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4505
+ * @param {string} [params.bizType] for transferring between main and sub-acounts either 'SPOT' or 'PERPETUAL' default is 'SPOT'
4506
+ * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
4507
+ */
4498
4508
  async transfer(code, amount, fromAccount, toAccount, params = {}) {
4499
- /**
4500
- * @method
4501
- * @name phemex#transfer
4502
- * @description transfer currency internally between wallets on the same account
4503
- * @param {string} code unified currency code
4504
- * @param {float} amount amount to transfer
4505
- * @param {string} fromAccount account to transfer from
4506
- * @param {string} toAccount account to transfer to
4507
- * @param {object} [params] extra parameters specific to the exchange API endpoint
4508
- * @param {string} [params.bizType] for transferring between main and sub-acounts either 'SPOT' or 'PERPETUAL' default is 'SPOT'
4509
- * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
4510
- */
4511
4509
  await this.loadMarkets();
4512
4510
  const currency = this.currency(code);
4513
4511
  const accountsByType = this.safeValue(this.options, 'accountsByType', {});
@@ -4582,17 +4580,17 @@ export default class phemex extends Exchange {
4582
4580
  }
4583
4581
  return transfer;
4584
4582
  }
4583
+ /**
4584
+ * @method
4585
+ * @name phemex#fetchTransfers
4586
+ * @description fetch a history of internal transfers made on an account
4587
+ * @param {string} code unified currency code of the currency transferred
4588
+ * @param {int} [since] the earliest time in ms to fetch transfers for
4589
+ * @param {int} [limit] the maximum number of transfers structures to retrieve
4590
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4591
+ * @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
4592
+ */
4585
4593
  async fetchTransfers(code = undefined, since = undefined, limit = undefined, params = {}) {
4586
- /**
4587
- * @method
4588
- * @name phemex#fetchTransfers
4589
- * @description fetch a history of internal transfers made on an account
4590
- * @param {string} code unified currency code of the currency transferred
4591
- * @param {int} [since] the earliest time in ms to fetch transfers for
4592
- * @param {int} [limit] the maximum number of transfers structures to retrieve
4593
- * @param {object} [params] extra parameters specific to the exchange API endpoint
4594
- * @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
4595
- */
4596
4594
  await this.loadMarkets();
4597
4595
  if (code === undefined) {
4598
4596
  throw new ArgumentsRequired(this.id + ' fetchTransfers() requires a code argument');
@@ -4697,20 +4695,20 @@ export default class phemex extends Exchange {
4697
4695
  };
4698
4696
  return this.safeString(statuses, status, status);
4699
4697
  }
4698
+ /**
4699
+ * @method
4700
+ * @name phemex#fetchFundingRateHistory
4701
+ * @description fetches historical funding rate prices
4702
+ * @see https://phemex-docs.github.io/#query-funding-rate-history-2
4703
+ * @param {string} symbol unified symbol of the market to fetch the funding rate history for
4704
+ * @param {int} [since] timestamp in ms of the earliest funding rate to fetch
4705
+ * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} to fetch
4706
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4707
+ * @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)
4708
+ * @param {int} [params.until] timestamp in ms of the latest funding rate
4709
+ * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
4710
+ */
4700
4711
  async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
4701
- /**
4702
- * @method
4703
- * @name phemex#fetchFundingRateHistory
4704
- * @description fetches historical funding rate prices
4705
- * @see https://phemex-docs.github.io/#query-funding-rate-history-2
4706
- * @param {string} symbol unified symbol of the market to fetch the funding rate history for
4707
- * @param {int} [since] timestamp in ms of the earliest funding rate to fetch
4708
- * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} to fetch
4709
- * @param {object} [params] extra parameters specific to the exchange API endpoint
4710
- * @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)
4711
- * @param {int} [params.until] timestamp in ms of the latest funding rate
4712
- * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
4713
- */
4714
4712
  if (symbol === undefined) {
4715
4713
  throw new ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
4716
4714
  }
@@ -4782,20 +4780,20 @@ export default class phemex extends Exchange {
4782
4780
  const sorted = this.sortBy(result, 'timestamp');
4783
4781
  return this.filterBySymbolSinceLimit(sorted, symbol, since, limit);
4784
4782
  }
4783
+ /**
4784
+ * @method
4785
+ * @name phemex#withdraw
4786
+ * @description make a withdrawal
4787
+ * @see https://phemex-docs.github.io/#create-withdraw-request
4788
+ * @param {string} code unified currency code
4789
+ * @param {float} amount the amount to withdraw
4790
+ * @param {string} address the address to withdraw to
4791
+ * @param {string} tag
4792
+ * @param {object} [params] extra parameters specific to the phemex api endpoint
4793
+ * @param {string} [params.network] unified network code
4794
+ * @returns {object} a [transaction structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
4795
+ */
4785
4796
  async withdraw(code, amount, address, tag = undefined, params = {}) {
4786
- /**
4787
- * @method
4788
- * @name phemex#withdraw
4789
- * @description make a withdrawal
4790
- * @see https://phemex-docs.github.io/#create-withdraw-request
4791
- * @param {string} code unified currency code
4792
- * @param {float} amount the amount to withdraw
4793
- * @param {string} address the address to withdraw to
4794
- * @param {string} tag
4795
- * @param {object} [params] extra parameters specific to the phemex api endpoint
4796
- * @param {string} [params.network] unified network code
4797
- * @returns {object} a [transaction structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
4798
- */
4799
4797
  [tag, params] = this.handleWithdrawTagAndParams(tag, params);
4800
4798
  await this.loadMarkets();
4801
4799
  this.checkAddress(address);
@@ -4855,16 +4853,16 @@ export default class phemex extends Exchange {
4855
4853
  const data = this.safeDict(response, 'data', {});
4856
4854
  return this.parseTransaction(data, currency);
4857
4855
  }
4856
+ /**
4857
+ * @method
4858
+ * @name phemex#fetchOpenInterest
4859
+ * @description retrieves the open interest of a trading pair
4860
+ * @see https://phemex-docs.github.io/#query-24-hours-ticker
4861
+ * @param {string} symbol unified CCXT market symbol
4862
+ * @param {object} [params] exchange specific parameters
4863
+ * @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
4864
+ */
4858
4865
  async fetchOpenInterest(symbol, params = {}) {
4859
- /**
4860
- * @method
4861
- * @name phemex#fetchOpenInterest
4862
- * @description retrieves the open interest of a trading pair
4863
- * @see https://phemex-docs.github.io/#query-24-hours-ticker
4864
- * @param {string} symbol unified CCXT market symbol
4865
- * @param {object} [params] exchange specific parameters
4866
- * @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
4867
- */
4868
4866
  await this.loadMarkets();
4869
4867
  const market = this.market(symbol);
4870
4868
  if (!market['contract']) {