ccxt 4.1.44 → 4.1.46

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 (242) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +2132 -768
  3. package/dist/ccxt.browser.min.js +9 -9
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/ace.js +1 -3
  6. package/dist/cjs/src/ascendex.js +1 -3
  7. package/dist/cjs/src/base/Exchange.js +11 -3
  8. package/dist/cjs/src/base/ws/Cache.js +50 -0
  9. package/dist/cjs/src/bigone.js +2 -6
  10. package/dist/cjs/src/binance.js +16 -12
  11. package/dist/cjs/src/bit2c.js +2 -4
  12. package/dist/cjs/src/bitbns.js +5 -15
  13. package/dist/cjs/src/bitfinex.js +1 -3
  14. package/dist/cjs/src/bitfinex2.js +1 -3
  15. package/dist/cjs/src/bitflyer.js +4 -12
  16. package/dist/cjs/src/bitforex.js +4 -8
  17. package/dist/cjs/src/bithumb.js +4 -10
  18. package/dist/cjs/src/bitmart.js +64 -59
  19. package/dist/cjs/src/bitmex.js +2 -6
  20. package/dist/cjs/src/bitopro.js +6 -16
  21. package/dist/cjs/src/bitrue.js +6 -14
  22. package/dist/cjs/src/bitvavo.js +9 -14
  23. package/dist/cjs/src/btctradeua.js +2 -4
  24. package/dist/cjs/src/bybit.js +88 -132
  25. package/dist/cjs/src/cex.js +2 -4
  26. package/dist/cjs/src/coinbasepro.js +2 -2
  27. package/dist/cjs/src/coinex.js +7 -24
  28. package/dist/cjs/src/coinfalcon.js +1 -3
  29. package/dist/cjs/src/coinmate.js +2 -4
  30. package/dist/cjs/src/coinone.js +2 -6
  31. package/dist/cjs/src/coinsph.js +5 -13
  32. package/dist/cjs/src/cryptocom.js +1 -1
  33. package/dist/cjs/src/currencycom.js +2 -6
  34. package/dist/cjs/src/gate.js +5 -7
  35. package/dist/cjs/src/gemini.js +1 -3
  36. package/dist/cjs/src/hitbtc.js +290 -100
  37. package/dist/cjs/src/hollaex.js +1 -3
  38. package/dist/cjs/src/huobi.js +4 -14
  39. package/dist/cjs/src/huobijp.js +1 -3
  40. package/dist/cjs/src/indodax.js +4 -10
  41. package/dist/cjs/src/kucoinfutures.js +2 -7
  42. package/dist/cjs/src/kuna.js +1 -0
  43. package/dist/cjs/src/luno.js +1 -3
  44. package/dist/cjs/src/mercado.js +7 -17
  45. package/dist/cjs/src/mexc.js +5 -15
  46. package/dist/cjs/src/oceanex.js +2 -4
  47. package/dist/cjs/src/okx.js +33 -21
  48. package/dist/cjs/src/phemex.js +12 -33
  49. package/dist/cjs/src/poloniexfutures.js +2 -6
  50. package/dist/cjs/src/pro/binance.js +203 -1
  51. package/dist/cjs/src/pro/bitget.js +181 -0
  52. package/dist/cjs/src/pro/bitmart.js +2 -4
  53. package/dist/cjs/src/pro/bitrue.js +0 -4
  54. package/dist/cjs/src/pro/bitstamp.js +2 -4
  55. package/dist/cjs/src/pro/bitvavo.js +3 -7
  56. package/dist/cjs/src/pro/bybit.js +154 -10
  57. package/dist/cjs/src/pro/cex.js +2 -6
  58. package/dist/cjs/src/pro/cryptocom.js +131 -1
  59. package/dist/cjs/src/pro/gate.js +161 -0
  60. package/dist/cjs/src/pro/huobi.js +128 -4
  61. package/dist/cjs/src/pro/krakenfutures.js +129 -0
  62. package/dist/cjs/src/pro/kucoinfutures.js +182 -0
  63. package/dist/cjs/src/pro/okx.js +121 -0
  64. package/dist/cjs/src/pro/whitebit.js +3 -7
  65. package/dist/cjs/src/probit.js +2 -6
  66. package/dist/cjs/src/tokocrypto.js +3 -7
  67. package/dist/cjs/src/wavesexchange.js +2 -4
  68. package/dist/cjs/src/wazirx.js +4 -10
  69. package/dist/cjs/src/whitebit.js +3 -7
  70. package/dist/cjs/src/woo.js +0 -3
  71. package/dist/cjs/src/yobit.js +3 -7
  72. package/js/ccxt.d.ts +1 -1
  73. package/js/ccxt.js +1 -1
  74. package/js/src/abstract/bequant.d.ts +37 -7
  75. package/js/src/abstract/binance.d.ts +1 -0
  76. package/js/src/abstract/binancecoinm.d.ts +1 -0
  77. package/js/src/abstract/binanceus.d.ts +1 -0
  78. package/js/src/abstract/binanceusdm.d.ts +1 -0
  79. package/js/src/abstract/bitcoincom.d.ts +37 -7
  80. package/js/src/abstract/bybit.d.ts +3 -0
  81. package/js/src/abstract/fmfwio.d.ts +37 -7
  82. package/js/src/abstract/hitbtc.d.ts +37 -7
  83. package/js/src/abstract/hitbtc3.d.ts +37 -7
  84. package/js/src/abstract/okex.d.ts +6 -1
  85. package/js/src/abstract/okex5.d.ts +6 -1
  86. package/js/src/abstract/okx.d.ts +6 -1
  87. package/js/src/ace.d.ts +2 -2
  88. package/js/src/ace.js +2 -4
  89. package/js/src/alpaca.d.ts +2 -2
  90. package/js/src/ascendex.d.ts +2 -2
  91. package/js/src/ascendex.js +1 -3
  92. package/js/src/base/Exchange.d.ts +4 -1
  93. package/js/src/base/Exchange.js +11 -3
  94. package/js/src/base/ws/Cache.d.ts +5 -1
  95. package/js/src/base/ws/Cache.js +50 -1
  96. package/js/src/bigone.d.ts +2 -2
  97. package/js/src/bigone.js +3 -7
  98. package/js/src/binance.d.ts +2 -2
  99. package/js/src/binance.js +16 -12
  100. package/js/src/bingx.d.ts +2 -2
  101. package/js/src/bit2c.d.ts +2 -2
  102. package/js/src/bit2c.js +3 -5
  103. package/js/src/bitbank.d.ts +2 -2
  104. package/js/src/bitbns.d.ts +2 -2
  105. package/js/src/bitbns.js +5 -15
  106. package/js/src/bitfinex.d.ts +2 -2
  107. package/js/src/bitfinex.js +1 -3
  108. package/js/src/bitfinex2.js +1 -3
  109. package/js/src/bitflyer.d.ts +2 -2
  110. package/js/src/bitflyer.js +4 -12
  111. package/js/src/bitforex.d.ts +2 -2
  112. package/js/src/bitforex.js +5 -9
  113. package/js/src/bitget.d.ts +2 -2
  114. package/js/src/bithumb.d.ts +2 -2
  115. package/js/src/bithumb.js +4 -10
  116. package/js/src/bitmart.d.ts +2 -2
  117. package/js/src/bitmart.js +64 -59
  118. package/js/src/bitmex.js +2 -6
  119. package/js/src/bitopro.d.ts +2 -2
  120. package/js/src/bitopro.js +6 -16
  121. package/js/src/bitpanda.d.ts +2 -2
  122. package/js/src/bitrue.d.ts +2 -2
  123. package/js/src/bitrue.js +6 -14
  124. package/js/src/bitso.d.ts +2 -2
  125. package/js/src/bitstamp.d.ts +2 -2
  126. package/js/src/bitstamp1.d.ts +2 -2
  127. package/js/src/bittrex.d.ts +2 -2
  128. package/js/src/bitvavo.d.ts +2 -2
  129. package/js/src/bitvavo.js +9 -14
  130. package/js/src/bl3p.d.ts +2 -2
  131. package/js/src/blockchaincom.d.ts +4 -4
  132. package/js/src/btcalpha.d.ts +2 -2
  133. package/js/src/btcbox.d.ts +2 -2
  134. package/js/src/btcmarkets.d.ts +2 -2
  135. package/js/src/btctradeua.d.ts +2 -2
  136. package/js/src/btctradeua.js +3 -5
  137. package/js/src/btcturk.d.ts +2 -2
  138. package/js/src/bybit.d.ts +2 -4
  139. package/js/src/bybit.js +88 -132
  140. package/js/src/cex.d.ts +2 -2
  141. package/js/src/cex.js +2 -4
  142. package/js/src/coinbase.d.ts +2 -2
  143. package/js/src/coinbasepro.d.ts +2 -2
  144. package/js/src/coinbasepro.js +2 -2
  145. package/js/src/coincheck.d.ts +2 -2
  146. package/js/src/coinex.js +7 -24
  147. package/js/src/coinfalcon.d.ts +2 -2
  148. package/js/src/coinfalcon.js +2 -4
  149. package/js/src/coinlist.d.ts +12 -12
  150. package/js/src/coinmate.d.ts +3 -3
  151. package/js/src/coinmate.js +3 -5
  152. package/js/src/coinone.d.ts +2 -2
  153. package/js/src/coinone.js +2 -6
  154. package/js/src/coinsph.d.ts +2 -2
  155. package/js/src/coinsph.js +5 -13
  156. package/js/src/coinspot.d.ts +2 -2
  157. package/js/src/cryptocom.d.ts +2 -2
  158. package/js/src/cryptocom.js +1 -1
  159. package/js/src/currencycom.d.ts +2 -2
  160. package/js/src/currencycom.js +2 -6
  161. package/js/src/delta.d.ts +2 -2
  162. package/js/src/deribit.d.ts +3 -3
  163. package/js/src/digifinex.d.ts +2 -2
  164. package/js/src/gate.d.ts +2 -2
  165. package/js/src/gate.js +5 -7
  166. package/js/src/gemini.d.ts +3 -3
  167. package/js/src/gemini.js +1 -3
  168. package/js/src/hitbtc.d.ts +3 -0
  169. package/js/src/hitbtc.js +291 -101
  170. package/js/src/hollaex.js +1 -3
  171. package/js/src/huobi.d.ts +2 -2
  172. package/js/src/huobi.js +4 -14
  173. package/js/src/huobijp.d.ts +2 -2
  174. package/js/src/huobijp.js +2 -4
  175. package/js/src/independentreserve.d.ts +2 -2
  176. package/js/src/indodax.d.ts +2 -2
  177. package/js/src/indodax.js +4 -10
  178. package/js/src/kraken.d.ts +2 -2
  179. package/js/src/krakenfutures.d.ts +2 -2
  180. package/js/src/kucoin.d.ts +2 -2
  181. package/js/src/kucoinfutures.d.ts +2 -2
  182. package/js/src/kucoinfutures.js +2 -7
  183. package/js/src/kuna.d.ts +3 -3
  184. package/js/src/kuna.js +1 -0
  185. package/js/src/latoken.d.ts +2 -2
  186. package/js/src/lbank2.d.ts +2 -2
  187. package/js/src/luno.d.ts +2 -2
  188. package/js/src/luno.js +1 -3
  189. package/js/src/lykke.d.ts +2 -2
  190. package/js/src/mercado.d.ts +2 -2
  191. package/js/src/mercado.js +7 -17
  192. package/js/src/mexc.js +5 -15
  193. package/js/src/novadax.d.ts +2 -2
  194. package/js/src/oceanex.d.ts +4 -4
  195. package/js/src/oceanex.js +2 -4
  196. package/js/src/okcoin.d.ts +2 -2
  197. package/js/src/okx.d.ts +2 -2
  198. package/js/src/okx.js +33 -21
  199. package/js/src/paymium.d.ts +2 -2
  200. package/js/src/phemex.js +12 -33
  201. package/js/src/poloniexfutures.d.ts +2 -2
  202. package/js/src/poloniexfutures.js +2 -6
  203. package/js/src/pro/binance.d.ts +6 -0
  204. package/js/src/pro/binance.js +204 -2
  205. package/js/src/pro/bitget.d.ts +3 -0
  206. package/js/src/pro/bitget.js +182 -1
  207. package/js/src/pro/bitmart.js +2 -4
  208. package/js/src/pro/bitrue.js +0 -4
  209. package/js/src/pro/bitstamp.js +3 -5
  210. package/js/src/pro/bitvavo.js +4 -8
  211. package/js/src/pro/bybit.d.ts +5 -1
  212. package/js/src/pro/bybit.js +156 -12
  213. package/js/src/pro/cex.js +3 -7
  214. package/js/src/pro/cryptocom.d.ts +4 -0
  215. package/js/src/pro/cryptocom.js +132 -2
  216. package/js/src/pro/gate.d.ts +5 -0
  217. package/js/src/pro/gate.js +162 -1
  218. package/js/src/pro/huobi.d.ts +2 -0
  219. package/js/src/pro/huobi.js +129 -5
  220. package/js/src/pro/krakenfutures.d.ts +3 -0
  221. package/js/src/pro/krakenfutures.js +129 -0
  222. package/js/src/pro/kucoinfutures.d.ts +5 -0
  223. package/js/src/pro/kucoinfutures.js +182 -0
  224. package/js/src/pro/okx.d.ts +2 -0
  225. package/js/src/pro/okx.js +123 -2
  226. package/js/src/pro/whitebit.js +4 -8
  227. package/js/src/probit.d.ts +2 -2
  228. package/js/src/probit.js +3 -7
  229. package/js/src/timex.d.ts +2 -2
  230. package/js/src/tokocrypto.d.ts +2 -2
  231. package/js/src/tokocrypto.js +4 -8
  232. package/js/src/wavesexchange.js +3 -5
  233. package/js/src/wazirx.d.ts +2 -2
  234. package/js/src/wazirx.js +5 -11
  235. package/js/src/whitebit.d.ts +2 -2
  236. package/js/src/whitebit.js +3 -7
  237. package/js/src/woo.d.ts +2 -2
  238. package/js/src/woo.js +1 -4
  239. package/js/src/yobit.js +3 -7
  240. package/js/src/zaif.d.ts +2 -2
  241. package/package.json +1 -1
  242. package/skip-tests.json +3 -1
@@ -39,6 +39,7 @@ class hitbtc extends hitbtc$1 {
39
39
  'createStopMarketOrder': true,
40
40
  'createStopOrder': true,
41
41
  'editOrder': true,
42
+ 'fetchAccounts': false,
42
43
  'fetchBalance': true,
43
44
  'fetchBorrowRate': undefined,
44
45
  'fetchBorrowRateHistories': undefined,
@@ -54,15 +55,20 @@ class hitbtc extends hitbtc$1 {
54
55
  'fetchFundingHistory': undefined,
55
56
  'fetchFundingRate': true,
56
57
  'fetchFundingRateHistory': true,
57
- 'fetchFundingRates': false,
58
+ 'fetchFundingRates': true,
58
59
  'fetchIndexOHLCV': true,
59
60
  'fetchLeverage': true,
60
61
  'fetchLeverageTiers': undefined,
61
- 'fetchMarketLeverageTiers': undefined,
62
+ 'fetchLiquidations': false,
63
+ 'fetchMarginMode': false,
64
+ 'fetchMarketLeverageTiers': false,
62
65
  'fetchMarkets': true,
63
66
  'fetchMarkOHLCV': true,
67
+ 'fetchMyLiquidations': false,
64
68
  'fetchMyTrades': true,
65
69
  'fetchOHLCV': true,
70
+ 'fetchOpenInterest': true,
71
+ 'fetchOpenInterestHistory': false,
66
72
  'fetchOpenOrder': true,
67
73
  'fetchOpenOrders': true,
68
74
  'fetchOrder': true,
@@ -82,6 +88,7 @@ class hitbtc extends hitbtc$1 {
82
88
  'fetchWithdrawals': true,
83
89
  'reduceMargin': true,
84
90
  'setLeverage': true,
91
+ 'setMargin': false,
85
92
  'setMarginMode': false,
86
93
  'setPositionMode': false,
87
94
  'transfer': true,
@@ -113,56 +120,79 @@ class hitbtc extends hitbtc$1 {
113
120
  'public': {
114
121
  'get': {
115
122
  'public/currency': 10,
123
+ 'public/currency/{currency}': 10,
116
124
  'public/symbol': 10,
125
+ 'public/symbol/{symbol}': 10,
117
126
  'public/ticker': 10,
127
+ 'public/ticker/{symbol}': 10,
118
128
  'public/price/rate': 10,
129
+ 'public/price/history': 10,
130
+ 'public/price/ticker': 10,
131
+ 'public/price/ticker/{symbol}': 10,
119
132
  'public/trades': 10,
133
+ 'public/trades/{symbol}': 10,
120
134
  'public/orderbook': 10,
135
+ 'public/orderbook/{symbol}': 10,
121
136
  'public/candles': 10,
137
+ 'public/candles/{symbol}': 10,
122
138
  'public/futures/info': 10,
139
+ 'public/futures/info/{symbol}': 10,
123
140
  'public/futures/history/funding': 10,
141
+ 'public/futures/history/funding/{symbol}': 10,
124
142
  'public/futures/candles/index_price': 10,
143
+ 'public/futures/candles/index_price/{symbol}': 10,
125
144
  'public/futures/candles/mark_price': 10,
145
+ 'public/futures/candles/mark_price/{symbol}': 10,
126
146
  'public/futures/candles/premium_index': 10,
147
+ 'public/futures/candles/premium_index/{symbol}': 10,
127
148
  'public/futures/candles/open_interest': 10,
149
+ 'public/futures/candles/open_interest/{symbol}': 10,
128
150
  },
129
151
  },
130
152
  'private': {
131
153
  'get': {
132
154
  'spot/balance': 15,
133
- 'spot/order': 15,
134
- 'spot/order/{client_order_id}': 15,
155
+ 'spot/balance/{currency}': 15,
156
+ 'spot/order': 1,
157
+ 'spot/order/{client_order_id}': 1,
135
158
  'spot/fee': 15,
136
159
  'spot/fee/{symbol}': 15,
137
160
  'spot/history/order': 15,
138
161
  'spot/history/trade': 15,
139
- 'margin/account': 15,
140
- 'margin/account/isolated/{symbol}': 15,
141
- 'margin/order': 15,
142
- 'margin/order/{client_order_id}': 15,
143
- 'margin/history/clearing': 15,
162
+ 'margin/account': 1,
163
+ 'margin/account/isolated/{symbol}': 1,
164
+ 'margin/account/cross/{currency}': 1,
165
+ 'margin/order': 1,
166
+ 'margin/order/{client_order_id}': 1,
167
+ 'margin/config': 15,
144
168
  'margin/history/order': 15,
145
- 'margin/history/positions': 15,
146
169
  'margin/history/trade': 15,
170
+ 'margin/history/positions': 15,
171
+ 'margin/history/clearing': 15,
147
172
  'futures/balance': 15,
148
- 'futures/account': 15,
149
- 'futures/account/isolated/{symbol}': 15,
150
- 'futures/order': 15,
151
- 'futures/order/{client_order_id}': 15,
173
+ 'futures/balance/{currency}': 15,
174
+ 'futures/account': 1,
175
+ 'futures/account/isolated/{symbol}': 1,
176
+ 'futures/order': 1,
177
+ 'futures/order/{client_order_id}': 1,
178
+ 'futures/config': 15,
152
179
  'futures/fee': 15,
153
180
  'futures/fee/{symbol}': 15,
154
- 'futures/history/clearing': 15,
155
181
  'futures/history/order': 15,
156
- 'futures/history/positions': 15,
157
182
  'futures/history/trade': 15,
158
- 'wallet/balance': 15,
159
- 'wallet/crypto/address': 15,
160
- 'wallet/crypto/address/recent-deposit': 15,
161
- 'wallet/crypto/address/recent-withdraw': 15,
162
- 'wallet/crypto/address/check-mine': 15,
163
- 'wallet/transactions': 15,
164
- 'wallet/crypto/check-offchain-available': 15,
165
- 'wallet/crypto/fee/estimate': 15,
183
+ 'futures/history/positions': 15,
184
+ 'futures/history/clearing': 15,
185
+ 'wallet/balance': 30,
186
+ 'wallet/balance/{currency}': 30,
187
+ 'wallet/crypto/address': 30,
188
+ 'wallet/crypto/address/recent-deposit': 30,
189
+ 'wallet/crypto/address/recent-withdraw': 30,
190
+ 'wallet/crypto/address/check-mine': 30,
191
+ 'wallet/transactions': 30,
192
+ 'wallet/transactions/{tx_id}': 30,
193
+ 'wallet/crypto/fee/estimate': 30,
194
+ 'wallet/airdrops': 30,
195
+ 'wallet/amount-locks': 30,
166
196
  'sub-account': 15,
167
197
  'sub-account/acl': 15,
168
198
  'sub-account/balance/{subAccID}': 15,
@@ -170,12 +200,19 @@ class hitbtc extends hitbtc$1 {
170
200
  },
171
201
  'post': {
172
202
  'spot/order': 1,
203
+ 'spot/order/list': 1,
173
204
  'margin/order': 1,
205
+ 'margin/order/list': 1,
174
206
  'futures/order': 1,
175
- 'wallet/convert': 15,
176
- 'wallet/crypto/address': 15,
177
- 'wallet/crypto/withdraw': 15,
178
- 'wallet/transfer': 15,
207
+ 'futures/order/list': 1,
208
+ 'wallet/crypto/address': 30,
209
+ 'wallet/crypto/withdraw': 30,
210
+ 'wallet/convert': 30,
211
+ 'wallet/transfer': 30,
212
+ 'wallet/internal/withdraw': 30,
213
+ 'wallet/crypto/check-offchain-available': 30,
214
+ 'wallet/crypto/fees/estimate': 30,
215
+ 'wallet/airdrops/{id}/claim': 30,
179
216
  'sub-account/freeze': 15,
180
217
  'sub-account/activate': 15,
181
218
  'sub-account/transfer': 15,
@@ -194,15 +231,15 @@ class hitbtc extends hitbtc$1 {
194
231
  'margin/order': 1,
195
232
  'margin/order/{client_order_id}': 1,
196
233
  'futures/position': 1,
197
- 'futures/position/isolated/{symbol}': 1,
234
+ 'futures/position/{margin_mode}/{symbol}': 1,
198
235
  'futures/order': 1,
199
236
  'futures/order/{client_order_id}': 1,
200
- 'wallet/crypto/withdraw/{id}': 1,
237
+ 'wallet/crypto/withdraw/{id}': 30,
201
238
  },
202
239
  'put': {
203
240
  'margin/account/isolated/{symbol}': 1,
204
241
  'futures/account/isolated/{symbol}': 1,
205
- 'wallet/crypto/withdraw/{id}': 1,
242
+ 'wallet/crypto/withdraw/{id}': 30,
206
243
  },
207
244
  },
208
245
  },
@@ -995,18 +1032,38 @@ class hitbtc extends hitbtc$1 {
995
1032
  * @method
996
1033
  * @name hitbtc#fetchTicker
997
1034
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
1035
+ * @see https://api.hitbtc.com/#tickers
998
1036
  * @param {string} symbol unified symbol of the market to fetch the ticker for
999
1037
  * @param {object} [params] extra parameters specific to the hitbtc api endpoint
1000
1038
  * @returns {object} a [ticker structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
1001
1039
  */
1002
- const response = await this.fetchTickers([symbol], params);
1003
- return this.safeValue(response, symbol);
1040
+ await this.loadMarkets();
1041
+ const market = this.market(symbol);
1042
+ const request = {
1043
+ 'symbol': market['id'],
1044
+ };
1045
+ const response = await this.publicGetPublicTickerSymbol(this.extend(request, params));
1046
+ //
1047
+ // {
1048
+ // "ask": "0.020572",
1049
+ // "bid": "0.020566",
1050
+ // "last": "0.020574",
1051
+ // "low": "0.020388",
1052
+ // "high": "0.021084",
1053
+ // "open": "0.020913",
1054
+ // "volume": "138444.3666",
1055
+ // "volume_quote": "2853.6874972480",
1056
+ // "timestamp": "2021-06-02T17:52:36.731Z"
1057
+ // }
1058
+ //
1059
+ return this.parseTicker(response, market);
1004
1060
  }
1005
1061
  async fetchTickers(symbols = undefined, params = {}) {
1006
1062
  /**
1007
1063
  * @method
1008
1064
  * @name hitbtc#fetchTickers
1009
1065
  * @description fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
1066
+ * @see https://api.hitbtc.com/#tickers
1010
1067
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1011
1068
  * @param {object} [params] extra parameters specific to the hitbtc api endpoint
1012
1069
  * @returns {object} a dictionary of [ticker structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
@@ -1094,6 +1151,7 @@ class hitbtc extends hitbtc$1 {
1094
1151
  * @method
1095
1152
  * @name hitbtc#fetchTrades
1096
1153
  * @description get the list of most recent trades for a particular symbol
1154
+ * @see https://api.hitbtc.com/#trades
1097
1155
  * @param {string} symbol unified symbol of the market to fetch trades for
1098
1156
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
1099
1157
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -1103,20 +1161,26 @@ class hitbtc extends hitbtc$1 {
1103
1161
  await this.loadMarkets();
1104
1162
  let market = undefined;
1105
1163
  const request = {};
1106
- if (symbol !== undefined) {
1107
- market = this.market(symbol);
1108
- // symbol is optional for hitbtc fetchTrades
1109
- request['symbols'] = market['id'];
1110
- }
1111
1164
  if (limit !== undefined) {
1112
1165
  request['limit'] = Math.min(limit, 1000);
1113
1166
  }
1114
1167
  if (since !== undefined) {
1115
1168
  request['from'] = since;
1116
1169
  }
1117
- const response = await this.publicGetPublicTrades(this.extend(request, params));
1118
- const marketIds = Object.keys(response);
1170
+ let response = undefined;
1171
+ if (symbol !== undefined) {
1172
+ market = this.market(symbol);
1173
+ request['symbol'] = market['id'];
1174
+ response = await this.publicGetPublicTradesSymbol(this.extend(request, params));
1175
+ }
1176
+ else {
1177
+ response = await this.publicGetPublicTrades(this.extend(request, params));
1178
+ }
1179
+ if (symbol !== undefined) {
1180
+ return this.parseTrades(response, market);
1181
+ }
1119
1182
  let trades = [];
1183
+ const marketIds = Object.keys(response);
1120
1184
  for (let i = 0; i < marketIds.length; i++) {
1121
1185
  const marketId = marketIds[i];
1122
1186
  const marketInner = this.market(marketId);
@@ -1452,6 +1516,7 @@ class hitbtc extends hitbtc$1 {
1452
1516
  * @method
1453
1517
  * @name hitbtc#fetchOrderBooks
1454
1518
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data for multiple markets
1519
+ * @see https://api.hitbtc.com/#order-books
1455
1520
  * @param {string[]|undefined} symbols list of unified market symbols, all symbols fetched if undefined, default is undefined
1456
1521
  * @param {int} [limit] max number of entries per orderbook to return, default is undefined
1457
1522
  * @param {object} [params] extra parameters specific to the hitbtc api endpoint
@@ -1483,13 +1548,23 @@ class hitbtc extends hitbtc$1 {
1483
1548
  * @method
1484
1549
  * @name hitbtc#fetchOrderBook
1485
1550
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
1551
+ * @see https://api.hitbtc.com/#order-books
1486
1552
  * @param {string} symbol unified symbol of the market to fetch the order book for
1487
1553
  * @param {int} [limit] the maximum amount of order book entries to return
1488
1554
  * @param {object} [params] extra parameters specific to the hitbtc api endpoint
1489
1555
  * @returns {object} A dictionary of [order book structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-book-structure} indexed by market symbols
1490
1556
  */
1491
- const result = await this.fetchOrderBooks([symbol], limit, params);
1492
- return result[symbol];
1557
+ await this.loadMarkets();
1558
+ const market = this.market(symbol);
1559
+ const request = {
1560
+ 'symbol': market['id'],
1561
+ };
1562
+ if (limit !== undefined) {
1563
+ request['depth'] = limit;
1564
+ }
1565
+ const response = await this.publicGetPublicOrderbookSymbol(this.extend(request, params));
1566
+ const timestamp = this.parse8601(this.safeString(response, 'timestamp'));
1567
+ return this.parseOrderBook(response, symbol, timestamp, 'bid', 'ask');
1493
1568
  }
1494
1569
  parseTradingFee(fee, market = undefined) {
1495
1570
  //
@@ -1575,6 +1650,9 @@ class hitbtc extends hitbtc$1 {
1575
1650
  * @name hitbtc#fetchOHLCV
1576
1651
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1577
1652
  * @see https://api.hitbtc.com/#candles
1653
+ * @see https://api.hitbtc.com/#futures-index-price-candles
1654
+ * @see https://api.hitbtc.com/#futures-mark-price-candles
1655
+ * @see https://api.hitbtc.com/#futures-premium-index-candles
1578
1656
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
1579
1657
  * @param {string} timeframe the length of time each candle represents
1580
1658
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -1592,7 +1670,7 @@ class hitbtc extends hitbtc$1 {
1592
1670
  }
1593
1671
  const market = this.market(symbol);
1594
1672
  let request = {
1595
- 'symbols': market['id'],
1673
+ 'symbol': market['id'],
1596
1674
  'period': this.safeString(this.timeframes, timeframe, timeframe),
1597
1675
  };
1598
1676
  [request, params] = this.handleUntilOption('till', request, params);
@@ -1604,50 +1682,47 @@ class hitbtc extends hitbtc$1 {
1604
1682
  }
1605
1683
  const price = this.safeString(params, 'price');
1606
1684
  params = this.omit(params, 'price');
1607
- let method = 'publicGetPublicCandles';
1685
+ let response = undefined;
1608
1686
  if (price === 'mark') {
1609
- method = 'publicGetPublicFuturesCandlesMarkPrice';
1687
+ response = await this.publicGetPublicFuturesCandlesMarkPriceSymbol(this.extend(request, params));
1610
1688
  }
1611
1689
  else if (price === 'index') {
1612
- method = 'publicGetPublicFuturesCandlesIndexPrice';
1690
+ response = await this.publicGetPublicFuturesCandlesIndexPriceSymbol(this.extend(request, params));
1613
1691
  }
1614
1692
  else if (price === 'premiumIndex') {
1615
- method = 'publicGetPublicFuturesCandlesPremiumIndex';
1693
+ response = await this.publicGetPublicFuturesCandlesPremiumIndexSymbol(this.extend(request, params));
1694
+ }
1695
+ else {
1696
+ response = await this.publicGetPublicCandlesSymbol(this.extend(request, params));
1616
1697
  }
1617
- const response = await this[method](this.extend(request, params));
1618
1698
  //
1619
1699
  // Spot and Swap
1620
1700
  //
1621
- // {
1622
- // "ETHUSDT": [
1623
- // {
1624
- // "timestamp": "2021-10-25T07:38:00.000Z",
1625
- // "open": "4173.391",
1626
- // "close": "4170.923",
1627
- // "min": "4170.923",
1628
- // "max": "4173.986",
1629
- // "volume": "0.1879",
1630
- // "volume_quote": "784.2517846"
1631
- // }
1632
- // ]
1633
- // }
1701
+ // [
1702
+ // {
1703
+ // "timestamp": "2021-10-25T07:38:00.000Z",
1704
+ // "open": "4173.391",
1705
+ // "close": "4170.923",
1706
+ // "min": "4170.923",
1707
+ // "max": "4173.986",
1708
+ // "volume": "0.1879",
1709
+ // "volume_quote": "784.2517846"
1710
+ // }
1711
+ // ]
1634
1712
  //
1635
1713
  // Mark, Index and Premium Index
1636
1714
  //
1637
- // {
1638
- // "BTCUSDT_PERP": [
1639
- // {
1640
- // "timestamp": "2022-04-01T01:28:00.000Z",
1641
- // "open": "45146.39",
1642
- // "close": "45219.43",
1643
- // "min": "45146.39",
1644
- // "max": "45219.43"
1645
- // },
1646
- // ]
1647
- // }
1715
+ // [
1716
+ // {
1717
+ // "timestamp": "2022-04-01T01:28:00.000Z",
1718
+ // "open": "45146.39",
1719
+ // "close": "45219.43",
1720
+ // "min": "45146.39",
1721
+ // "max": "45219.43"
1722
+ // },
1723
+ // ]
1648
1724
  //
1649
- const ohlcvs = this.safeValue(response, market['id']);
1650
- return this.parseOHLCVs(ohlcvs, market, timeframe, since, limit);
1725
+ return this.parseOHLCVs(response, market, timeframe, since, limit);
1651
1726
  }
1652
1727
  parseOHLCV(ohlcv, market = undefined) {
1653
1728
  //
@@ -2047,7 +2122,7 @@ class hitbtc extends hitbtc$1 {
2047
2122
  * @param {float} amount how much of currency you want to trade in units of base currency
2048
2123
  * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
2049
2124
  * @param {object} [params] extra parameters specific to the hitbtc api endpoint
2050
- * @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported for spot-margin, swap supports both
2125
+ * @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported for spot-margin, swap supports both, default is 'cross'
2051
2126
  * @param {bool} [params.margin] true for creating a margin order
2052
2127
  * @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
2053
2128
  * @param {bool} [params.postOnly] if true, the order will only be posted to the order book and not executed immediately
@@ -2121,7 +2196,11 @@ class hitbtc extends hitbtc$1 {
2121
2196
  throw new errors.ExchangeError(this.id + ' createOrder() requires a stopPrice parameter for stop-loss and take-profit orders');
2122
2197
  }
2123
2198
  params = this.omit(params, ['triggerPrice', 'timeInForce', 'stopPrice', 'stop_price', 'reduceOnly', 'postOnly']);
2124
- if ((marketType === 'swap') && (marginMode !== undefined)) {
2199
+ if (marketType === 'swap') {
2200
+ // set default margin mode to cross
2201
+ if (marginMode === undefined) {
2202
+ marginMode = 'cross';
2203
+ }
2125
2204
  request['margin_mode'] = marginMode;
2126
2205
  }
2127
2206
  let response = undefined;
@@ -2400,6 +2479,60 @@ class hitbtc extends hitbtc$1 {
2400
2479
  //
2401
2480
  return this.parseTransaction(response, currency);
2402
2481
  }
2482
+ async fetchFundingRates(symbols = undefined, params = {}) {
2483
+ /**
2484
+ * @method
2485
+ * @name hitbtc#fetchFundingRates
2486
+ * @description fetches funding rates for multiple markets
2487
+ * @see https://api.hitbtc.com/#futures-info
2488
+ * @param {string[]} symbols unified symbols of the markets to fetch the funding rates for, all market funding rates are returned if not assigned
2489
+ * @param {object} [params] extra parameters specific to the hitbtc api endpoint
2490
+ * @returns {object} an array of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-structure}
2491
+ */
2492
+ await this.loadMarkets();
2493
+ let market = undefined;
2494
+ const request = {};
2495
+ if (symbols !== undefined) {
2496
+ symbols = this.marketSymbols(symbols);
2497
+ market = this.market(symbols[0]);
2498
+ const queryMarketIds = this.marketIds(symbols);
2499
+ request['symbols'] = queryMarketIds.join(',');
2500
+ }
2501
+ let type = undefined;
2502
+ [type, params] = this.handleMarketTypeAndParams('fetchFundingRates', market, params);
2503
+ if (type !== 'swap') {
2504
+ throw new errors.NotSupported(this.id + ' fetchFundingRates() does not support ' + type + ' markets');
2505
+ }
2506
+ const response = await this.publicGetPublicFuturesInfo(this.extend(request, params));
2507
+ //
2508
+ // {
2509
+ // "BTCUSDT_PERP": {
2510
+ // "contract_type": "perpetual",
2511
+ // "mark_price": "30897.68",
2512
+ // "index_price": "30895.29",
2513
+ // "funding_rate": "0.0001",
2514
+ // "open_interest": "93.7128",
2515
+ // "next_funding_time": "2021-07-21T16:00:00.000Z",
2516
+ // "indicative_funding_rate": "0.0001",
2517
+ // "premium_index": "0.000047541807127312",
2518
+ // "avg_premium_index": "0.000087063368020112",
2519
+ // "interest_rate": "0.0001",
2520
+ // "timestamp": "2021-07-21T09:48:37.235Z"
2521
+ // }
2522
+ // }
2523
+ //
2524
+ const marketIds = Object.keys(response);
2525
+ const fundingRates = {};
2526
+ for (let i = 0; i < marketIds.length; i++) {
2527
+ const marketId = this.safeString(marketIds, i);
2528
+ const rawFundingRate = this.safeValue(response, marketId);
2529
+ const marketInner = this.market(marketId);
2530
+ const symbol = marketInner['symbol'];
2531
+ const fundingRate = this.parseFundingRate(rawFundingRate, marketInner);
2532
+ fundingRates[symbol] = fundingRate;
2533
+ }
2534
+ return this.filterByArray(fundingRates, 'symbol', symbols);
2535
+ }
2403
2536
  async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
2404
2537
  /**
2405
2538
  * @method
@@ -2690,11 +2823,75 @@ class hitbtc extends hitbtc$1 {
2690
2823
  'takeProfitPrice': undefined,
2691
2824
  });
2692
2825
  }
2826
+ parseOpenInterest(interest, market = undefined) {
2827
+ //
2828
+ // {
2829
+ // "contract_type": "perpetual",
2830
+ // "mark_price": "42307.43",
2831
+ // "index_price": "42303.27",
2832
+ // "funding_rate": "0.0001",
2833
+ // "open_interest": "30.9826",
2834
+ // "next_funding_time": "2022-03-22T16:00:00.000Z",
2835
+ // "indicative_funding_rate": "0.0001",
2836
+ // "premium_index": "0",
2837
+ // "avg_premium_index": "0.000029587712038098",
2838
+ // "interest_rate": "0.0001",
2839
+ // "timestamp": "2022-03-22T08:08:26.687Z"
2840
+ // }
2841
+ //
2842
+ const datetime = this.safeString(interest, 'timestamp');
2843
+ const value = this.safeNumber(interest, 'open_interest');
2844
+ return this.safeOpenInterest({
2845
+ 'symbol': market['symbol'],
2846
+ 'openInterestAmount': undefined,
2847
+ 'openInterestValue': value,
2848
+ 'timestamp': this.parse8601(datetime),
2849
+ 'datetime': datetime,
2850
+ 'info': interest,
2851
+ }, market);
2852
+ }
2853
+ async fetchOpenInterest(symbol, params = {}) {
2854
+ /**
2855
+ * @method
2856
+ * @name hitbtc#fetchOpenInterest
2857
+ * @description Retrieves the open interest of a derivative trading pair
2858
+ * @see https://api.hitbtc.com/#futures-info
2859
+ * @param {string} symbol Unified CCXT market symbol
2860
+ * @param {object} [params] exchange specific parameters
2861
+ * @returns {object} an open interest structure{@link https://github.com/ccxt/ccxt/wiki/Manual#interest-history-structure}
2862
+ */
2863
+ await this.loadMarkets();
2864
+ const market = this.market(symbol);
2865
+ if (!market['swap']) {
2866
+ throw new errors.BadSymbol(this.id + ' fetchOpenInterest() supports swap contracts only');
2867
+ }
2868
+ const request = {
2869
+ 'symbol': market['id'],
2870
+ };
2871
+ const response = await this.publicGetPublicFuturesInfoSymbol(this.extend(request, params));
2872
+ //
2873
+ // {
2874
+ // "contract_type": "perpetual",
2875
+ // "mark_price": "42307.43",
2876
+ // "index_price": "42303.27",
2877
+ // "funding_rate": "0.0001",
2878
+ // "open_interest": "30.9826",
2879
+ // "next_funding_time": "2022-03-22T16:00:00.000Z",
2880
+ // "indicative_funding_rate": "0.0001",
2881
+ // "premium_index": "0",
2882
+ // "avg_premium_index": "0.000029587712038098",
2883
+ // "interest_rate": "0.0001",
2884
+ // "timestamp": "2022-03-22T08:08:26.687Z"
2885
+ // }
2886
+ //
2887
+ return this.parseOpenInterest(response, market);
2888
+ }
2693
2889
  async fetchFundingRate(symbol, params = {}) {
2694
2890
  /**
2695
2891
  * @method
2696
2892
  * @name hitbtc#fetchFundingRate
2697
2893
  * @description fetch the current funding rate
2894
+ * @see https://api.hitbtc.com/#futures-info
2698
2895
  * @param {string} symbol unified market symbol
2699
2896
  * @param {object} [params] extra parameters specific to the hitbtc api endpoint
2700
2897
  * @returns {object} a [funding rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-structure}
@@ -2704,31 +2901,26 @@ class hitbtc extends hitbtc$1 {
2704
2901
  if (!market['swap']) {
2705
2902
  throw new errors.BadSymbol(this.id + ' fetchFundingRate() supports swap contracts only');
2706
2903
  }
2707
- const request = {};
2708
- if (symbol !== undefined) {
2709
- symbol = market['symbol'];
2710
- request['symbols'] = market['id'];
2711
- }
2712
- const response = await this.publicGetPublicFuturesInfo(this.extend(request, params));
2904
+ const request = {
2905
+ 'symbol': market['id'],
2906
+ };
2907
+ const response = await this.publicGetPublicFuturesInfoSymbol(this.extend(request, params));
2713
2908
  //
2714
2909
  // {
2715
- // "BTCUSDT_PERP": {
2716
- // "contract_type": "perpetual",
2717
- // "mark_price": "42307.43",
2718
- // "index_price": "42303.27",
2719
- // "funding_rate": "0.0001",
2720
- // "open_interest": "30.9826",
2721
- // "next_funding_time": "2022-03-22T16:00:00.000Z",
2722
- // "indicative_funding_rate": "0.0001",
2723
- // "premium_index": "0",
2724
- // "avg_premium_index": "0.000029587712038098",
2725
- // "interest_rate": "0.0001",
2726
- // "timestamp": "2022-03-22T08:08:26.687Z"
2727
- // }
2910
+ // "contract_type": "perpetual",
2911
+ // "mark_price": "42307.43",
2912
+ // "index_price": "42303.27",
2913
+ // "funding_rate": "0.0001",
2914
+ // "open_interest": "30.9826",
2915
+ // "next_funding_time": "2022-03-22T16:00:00.000Z",
2916
+ // "indicative_funding_rate": "0.0001",
2917
+ // "premium_index": "0",
2918
+ // "avg_premium_index": "0.000029587712038098",
2919
+ // "interest_rate": "0.0001",
2920
+ // "timestamp": "2022-03-22T08:08:26.687Z"
2728
2921
  // }
2729
2922
  //
2730
- const data = this.safeValue(response, market['id'], {});
2731
- return this.parseFundingRate(data, market);
2923
+ return this.parseFundingRate(response, market);
2732
2924
  }
2733
2925
  parseFundingRate(contract, market = undefined) {
2734
2926
  //
@@ -2932,10 +3124,8 @@ class hitbtc extends hitbtc$1 {
2932
3124
  * @param {object} [params] extra parameters specific to the hitbtc api endpoint
2933
3125
  * @returns {object} response from the exchange
2934
3126
  */
3127
+ this.checkRequiredSymbol('setLeverage', symbol);
2935
3128
  await this.loadMarkets();
2936
- if (symbol === undefined) {
2937
- throw new errors.ArgumentsRequired(this.id + ' setLeverage() requires a symbol argument');
2938
- }
2939
3129
  if (params['margin_balance'] === undefined) {
2940
3130
  throw new errors.ArgumentsRequired(this.id + ' setLeverage() requires a margin_balance parameter that will transfer margin to the specified trading pair');
2941
3131
  }
@@ -1223,9 +1223,7 @@ class hollaex extends hollaex$1 {
1223
1223
  * @param {object} [params] extra parameters specific to the hollaex api endpoint
1224
1224
  * @returns {object[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1225
1225
  */
1226
- if (symbol === undefined) {
1227
- throw new errors.ArgumentsRequired(this.id + " cancelAllOrders() requires a 'symbol' argument");
1228
- }
1226
+ this.checkRequiredSymbol('cancelAllOrders', symbol);
1229
1227
  await this.loadMarkets();
1230
1228
  const request = {};
1231
1229
  let market = undefined;