ccxt 4.1.56 → 4.1.58

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 (318) hide show
  1. package/.git-templates/hooks/pre-push +2 -2
  2. package/README.md +3 -3
  3. package/build.sh +30 -18
  4. package/dist/ccxt.browser.js +3893 -3214
  5. package/dist/ccxt.browser.min.js +10 -10
  6. package/dist/cjs/ccxt.js +1 -1
  7. package/dist/cjs/src/ace.js +17 -13
  8. package/dist/cjs/src/alpaca.js +6 -6
  9. package/dist/cjs/src/ascendex.js +35 -29
  10. package/dist/cjs/src/base/Exchange.js +39 -26
  11. package/dist/cjs/src/base/Precise.js +1 -3
  12. package/dist/cjs/src/base/ws/Client.js +1 -1
  13. package/dist/cjs/src/bigone.js +24 -20
  14. package/dist/cjs/src/binance.js +97 -76
  15. package/dist/cjs/src/bingx.js +63 -44
  16. package/dist/cjs/src/bit2c.js +18 -15
  17. package/dist/cjs/src/bitbank.js +16 -15
  18. package/dist/cjs/src/bitbns.js +28 -18
  19. package/dist/cjs/src/bitfinex.js +23 -21
  20. package/dist/cjs/src/bitfinex2.js +32 -28
  21. package/dist/cjs/src/bitflyer.js +28 -20
  22. package/dist/cjs/src/bitforex.js +25 -18
  23. package/dist/cjs/src/bitget.js +184 -147
  24. package/dist/cjs/src/bithumb.js +23 -16
  25. package/dist/cjs/src/bitmart.js +110 -89
  26. package/dist/cjs/src/bitmex.js +104 -64
  27. package/dist/cjs/src/bitopro.js +38 -26
  28. package/dist/cjs/src/bitpanda.js +24 -23
  29. package/dist/cjs/src/bitrue.js +33 -24
  30. package/dist/cjs/src/bitso.js +24 -23
  31. package/dist/cjs/src/bitstamp.js +24 -23
  32. package/dist/cjs/src/bittrex.js +30 -29
  33. package/dist/cjs/src/bitvavo.js +38 -30
  34. package/dist/cjs/src/bl3p.js +11 -10
  35. package/dist/cjs/src/blockchaincom.js +20 -20
  36. package/dist/cjs/src/btcalpha.js +18 -17
  37. package/dist/cjs/src/btcbox.js +13 -12
  38. package/dist/cjs/src/btcmarkets.js +20 -19
  39. package/dist/cjs/src/btcturk.js +14 -13
  40. package/dist/cjs/src/bybit.js +84 -54
  41. package/dist/cjs/src/cex.js +16 -14
  42. package/dist/cjs/src/coinbase.js +29 -27
  43. package/dist/cjs/src/coinbasepro.js +27 -25
  44. package/dist/cjs/src/coincheck.js +15 -14
  45. package/dist/cjs/src/coinex.js +100 -77
  46. package/dist/cjs/src/coinlist.js +28 -27
  47. package/dist/cjs/src/coinmate.js +20 -17
  48. package/dist/cjs/src/coinone.js +21 -16
  49. package/dist/cjs/src/coinsph.js +37 -28
  50. package/dist/cjs/src/coinspot.js +12 -11
  51. package/dist/cjs/src/cryptocom.js +40 -202
  52. package/dist/cjs/src/currencycom.js +32 -25
  53. package/dist/cjs/src/delta.js +34 -28
  54. package/dist/cjs/src/deribit.js +39 -36
  55. package/dist/cjs/src/digifinex.js +64 -44
  56. package/dist/cjs/src/exmo.js +29 -27
  57. package/dist/cjs/src/gate.js +67 -53
  58. package/dist/cjs/src/gemini.js +23 -20
  59. package/dist/cjs/src/hitbtc.js +65 -56
  60. package/dist/cjs/src/hollaex.js +30 -27
  61. package/dist/cjs/src/htx.js +132 -143
  62. package/dist/cjs/src/huobijp.js +22 -20
  63. package/dist/cjs/src/idex.js +22 -21
  64. package/dist/cjs/src/independentreserve.js +15 -14
  65. package/dist/cjs/src/indodax.js +30 -26
  66. package/dist/cjs/src/kraken.js +29 -27
  67. package/dist/cjs/src/krakenfutures.js +29 -22
  68. package/dist/cjs/src/kucoin.js +48 -43
  69. package/dist/cjs/src/kucoinfutures.js +33 -28
  70. package/dist/cjs/src/kuna.js +25 -24
  71. package/dist/cjs/src/latoken.js +24 -22
  72. package/dist/cjs/src/lbank.js +45 -30
  73. package/dist/cjs/src/luno.js +22 -19
  74. package/dist/cjs/src/lykke.js +19 -17
  75. package/dist/cjs/src/mercado.js +30 -19
  76. package/dist/cjs/src/mexc.js +60 -49
  77. package/dist/cjs/src/ndax.js +23 -22
  78. package/dist/cjs/src/novadax.js +23 -22
  79. package/dist/cjs/src/oceanex.js +22 -19
  80. package/dist/cjs/src/okcoin.js +29 -23
  81. package/dist/cjs/src/okx.js +87 -82
  82. package/dist/cjs/src/p2b.js +79 -82
  83. package/dist/cjs/src/paymium.js +10 -10
  84. package/dist/cjs/src/phemex.js +63 -40
  85. package/dist/cjs/src/poloniex.js +22 -22
  86. package/dist/cjs/src/poloniexfutures.js +23 -19
  87. package/dist/cjs/src/pro/alpaca.js +5 -5
  88. package/dist/cjs/src/pro/ascendex.js +4 -4
  89. package/dist/cjs/src/pro/binance.js +16 -16
  90. package/dist/cjs/src/pro/bingx.js +1 -1
  91. package/dist/cjs/src/pro/bitfinex.js +4 -4
  92. package/dist/cjs/src/pro/bitfinex2.js +6 -6
  93. package/dist/cjs/src/pro/bitget.js +7 -7
  94. package/dist/cjs/src/pro/bitmart.js +7 -5
  95. package/dist/cjs/src/pro/bitmex.js +6 -6
  96. package/dist/cjs/src/pro/bitopro.js +4 -4
  97. package/dist/cjs/src/pro/bitpanda.js +6 -6
  98. package/dist/cjs/src/pro/bitrue.js +2 -2
  99. package/dist/cjs/src/pro/bitstamp.js +6 -4
  100. package/dist/cjs/src/pro/bittrex.js +15 -6
  101. package/dist/cjs/src/pro/bitvavo.js +11 -7
  102. package/dist/cjs/src/pro/blockchaincom.js +8 -8
  103. package/dist/cjs/src/pro/bybit.js +7 -7
  104. package/dist/cjs/src/pro/cex.js +13 -9
  105. package/dist/cjs/src/pro/coinbase.js +5 -5
  106. package/dist/cjs/src/pro/coinbasepro.js +11 -10
  107. package/dist/cjs/src/pro/coinex.js +7 -9
  108. package/dist/cjs/src/pro/cryptocom.js +9 -9
  109. package/dist/cjs/src/pro/currencycom.js +4 -4
  110. package/dist/cjs/src/pro/deribit.js +6 -6
  111. package/dist/cjs/src/pro/exmo.js +12 -14
  112. package/dist/cjs/src/pro/gate.js +7 -7
  113. package/dist/cjs/src/pro/gemini.js +3 -3
  114. package/dist/cjs/src/pro/hitbtc.js +263 -4
  115. package/dist/cjs/src/pro/hollaex.js +5 -5
  116. package/dist/cjs/src/pro/htx.js +6 -6
  117. package/dist/cjs/src/pro/huobijp.js +3 -3
  118. package/dist/cjs/src/pro/idex.js +4 -4
  119. package/dist/cjs/src/pro/independentreserve.js +2 -2
  120. package/dist/cjs/src/pro/kraken.js +10 -10
  121. package/dist/cjs/src/pro/krakenfutures.js +41 -17
  122. package/dist/cjs/src/pro/kucoin.js +7 -7
  123. package/dist/cjs/src/pro/kucoinfutures.js +8 -6
  124. package/dist/cjs/src/pro/luno.js +2 -2
  125. package/dist/cjs/src/pro/mexc.js +6 -6
  126. package/dist/cjs/src/pro/ndax.js +3 -3
  127. package/dist/cjs/src/pro/okcoin.js +5 -5
  128. package/dist/cjs/src/pro/okx.js +12 -12
  129. package/dist/cjs/src/pro/phemex.js +6 -6
  130. package/dist/cjs/src/pro/poloniex.js +7 -7
  131. package/dist/cjs/src/pro/poloniexfutures.js +5 -5
  132. package/dist/cjs/src/pro/probit.js +6 -6
  133. package/dist/cjs/src/pro/upbit.js +3 -3
  134. package/dist/cjs/src/pro/wazirx.js +8 -8
  135. package/dist/cjs/src/pro/whitebit.js +12 -8
  136. package/dist/cjs/src/pro/woo.js +1 -1
  137. package/dist/cjs/src/probit.js +28 -23
  138. package/dist/cjs/src/tidex.js +16 -15
  139. package/dist/cjs/src/timex.js +19 -18
  140. package/dist/cjs/src/tokocrypto.js +27 -22
  141. package/dist/cjs/src/upbit.js +19 -19
  142. package/dist/cjs/src/wavesexchange.js +22 -19
  143. package/dist/cjs/src/wazirx.js +24 -17
  144. package/dist/cjs/src/whitebit.js +33 -27
  145. package/dist/cjs/src/woo.js +44 -34
  146. package/dist/cjs/src/yobit.js +25 -20
  147. package/dist/cjs/src/zaif.js +9 -9
  148. package/dist/cjs/src/zonda.js +18 -17
  149. package/js/ccxt.d.ts +1 -1
  150. package/js/ccxt.js +1 -1
  151. package/js/src/abstract/bybit.d.ts +1 -0
  152. package/js/src/abstract/cryptocom.d.ts +0 -20
  153. package/js/src/ace.js +18 -14
  154. package/js/src/alpaca.js +6 -6
  155. package/js/src/ascendex.js +35 -29
  156. package/js/src/base/Exchange.d.ts +37 -34
  157. package/js/src/base/Exchange.js +39 -26
  158. package/js/src/base/Precise.d.ts +4 -4
  159. package/js/src/base/Precise.js +1 -3
  160. package/js/src/base/functions/type.d.ts +25 -25
  161. package/js/src/base/types.d.ts +21 -14
  162. package/js/src/base/ws/Client.js +1 -1
  163. package/js/src/bigone.js +25 -21
  164. package/js/src/binance.d.ts +2 -2
  165. package/js/src/binance.js +97 -76
  166. package/js/src/bingx.js +63 -44
  167. package/js/src/bit2c.js +19 -16
  168. package/js/src/bitbank.js +16 -15
  169. package/js/src/bitbns.js +28 -18
  170. package/js/src/bitfinex.js +23 -21
  171. package/js/src/bitfinex2.js +32 -28
  172. package/js/src/bitflyer.js +28 -20
  173. package/js/src/bitforex.js +26 -19
  174. package/js/src/bitget.d.ts +25 -3
  175. package/js/src/bitget.js +184 -147
  176. package/js/src/bithumb.js +23 -16
  177. package/js/src/bitmart.d.ts +1 -1
  178. package/js/src/bitmart.js +110 -89
  179. package/js/src/bitmex.d.ts +2 -2
  180. package/js/src/bitmex.js +104 -64
  181. package/js/src/bitopro.js +38 -26
  182. package/js/src/bitpanda.js +24 -23
  183. package/js/src/bitrue.js +33 -24
  184. package/js/src/bitso.js +24 -23
  185. package/js/src/bitstamp.d.ts +2 -2
  186. package/js/src/bitstamp.js +24 -23
  187. package/js/src/bittrex.js +30 -29
  188. package/js/src/bitvavo.js +38 -30
  189. package/js/src/bl3p.js +11 -10
  190. package/js/src/blockchaincom.js +20 -20
  191. package/js/src/btcalpha.js +18 -17
  192. package/js/src/btcbox.js +13 -12
  193. package/js/src/btcmarkets.js +20 -19
  194. package/js/src/btcturk.js +14 -13
  195. package/js/src/bybit.d.ts +1 -1
  196. package/js/src/bybit.js +84 -54
  197. package/js/src/cex.js +16 -14
  198. package/js/src/coinbase.js +29 -27
  199. package/js/src/coinbasepro.js +27 -25
  200. package/js/src/coincheck.js +15 -14
  201. package/js/src/coinex.d.ts +1 -1
  202. package/js/src/coinex.js +100 -77
  203. package/js/src/coinlist.js +28 -27
  204. package/js/src/coinmate.js +21 -18
  205. package/js/src/coinone.js +21 -16
  206. package/js/src/coinsph.js +37 -28
  207. package/js/src/coinspot.js +12 -11
  208. package/js/src/cryptocom.d.ts +0 -23
  209. package/js/src/cryptocom.js +40 -202
  210. package/js/src/currencycom.js +32 -25
  211. package/js/src/delta.js +35 -29
  212. package/js/src/deribit.js +39 -36
  213. package/js/src/digifinex.d.ts +2 -2
  214. package/js/src/digifinex.js +65 -45
  215. package/js/src/exmo.js +29 -27
  216. package/js/src/gate.d.ts +1 -1
  217. package/js/src/gate.js +67 -53
  218. package/js/src/gemini.js +23 -20
  219. package/js/src/hitbtc.d.ts +1 -0
  220. package/js/src/hitbtc.js +65 -56
  221. package/js/src/hollaex.js +30 -27
  222. package/js/src/htx.d.ts +11 -3
  223. package/js/src/htx.js +132 -143
  224. package/js/src/huobijp.js +23 -21
  225. package/js/src/idex.js +22 -21
  226. package/js/src/independentreserve.js +15 -14
  227. package/js/src/indodax.js +30 -26
  228. package/js/src/kraken.js +29 -27
  229. package/js/src/krakenfutures.js +29 -22
  230. package/js/src/kucoin.d.ts +1 -1
  231. package/js/src/kucoin.js +48 -43
  232. package/js/src/kucoinfutures.js +33 -28
  233. package/js/src/kuna.js +25 -24
  234. package/js/src/latoken.js +25 -23
  235. package/js/src/lbank.js +46 -31
  236. package/js/src/luno.js +22 -19
  237. package/js/src/lykke.js +19 -17
  238. package/js/src/mercado.js +30 -19
  239. package/js/src/mexc.d.ts +1 -1
  240. package/js/src/mexc.js +60 -49
  241. package/js/src/ndax.js +23 -22
  242. package/js/src/novadax.js +23 -22
  243. package/js/src/oceanex.js +22 -19
  244. package/js/src/okcoin.js +29 -23
  245. package/js/src/okx.d.ts +2 -2
  246. package/js/src/okx.js +87 -82
  247. package/js/src/p2b.d.ts +8 -7
  248. package/js/src/p2b.js +79 -81
  249. package/js/src/paymium.js +10 -10
  250. package/js/src/phemex.js +63 -40
  251. package/js/src/poloniex.js +22 -22
  252. package/js/src/poloniexfutures.js +23 -19
  253. package/js/src/pro/alpaca.js +5 -5
  254. package/js/src/pro/ascendex.js +4 -4
  255. package/js/src/pro/binance.js +16 -16
  256. package/js/src/pro/bingx.js +1 -1
  257. package/js/src/pro/bitfinex.js +4 -4
  258. package/js/src/pro/bitfinex2.d.ts +1 -1
  259. package/js/src/pro/bitfinex2.js +6 -6
  260. package/js/src/pro/bitget.js +7 -7
  261. package/js/src/pro/bitmart.js +7 -5
  262. package/js/src/pro/bitmex.js +6 -6
  263. package/js/src/pro/bitopro.js +4 -4
  264. package/js/src/pro/bitpanda.js +6 -6
  265. package/js/src/pro/bitrue.js +2 -2
  266. package/js/src/pro/bitstamp.js +7 -5
  267. package/js/src/pro/bittrex.js +15 -6
  268. package/js/src/pro/bitvavo.js +12 -8
  269. package/js/src/pro/blockchaincom.js +8 -8
  270. package/js/src/pro/bybit.js +7 -7
  271. package/js/src/pro/cex.js +14 -10
  272. package/js/src/pro/coinbase.js +5 -5
  273. package/js/src/pro/coinbasepro.js +12 -11
  274. package/js/src/pro/coinex.js +7 -9
  275. package/js/src/pro/cryptocom.js +9 -9
  276. package/js/src/pro/currencycom.js +4 -4
  277. package/js/src/pro/deribit.js +6 -6
  278. package/js/src/pro/exmo.js +12 -14
  279. package/js/src/pro/gate.js +7 -7
  280. package/js/src/pro/gemini.js +3 -3
  281. package/js/src/pro/hitbtc.d.ts +8 -1
  282. package/js/src/pro/hitbtc.js +264 -5
  283. package/js/src/pro/hollaex.js +5 -5
  284. package/js/src/pro/htx.js +6 -6
  285. package/js/src/pro/huobijp.js +3 -3
  286. package/js/src/pro/idex.js +4 -4
  287. package/js/src/pro/independentreserve.js +2 -2
  288. package/js/src/pro/kraken.js +10 -10
  289. package/js/src/pro/krakenfutures.d.ts +1 -0
  290. package/js/src/pro/krakenfutures.js +42 -18
  291. package/js/src/pro/kucoin.js +7 -7
  292. package/js/src/pro/kucoinfutures.js +8 -6
  293. package/js/src/pro/luno.js +2 -2
  294. package/js/src/pro/mexc.js +6 -6
  295. package/js/src/pro/ndax.js +3 -3
  296. package/js/src/pro/okcoin.js +5 -5
  297. package/js/src/pro/okx.js +12 -12
  298. package/js/src/pro/phemex.js +6 -6
  299. package/js/src/pro/poloniex.js +7 -7
  300. package/js/src/pro/poloniexfutures.js +5 -5
  301. package/js/src/pro/probit.js +6 -6
  302. package/js/src/pro/upbit.js +3 -3
  303. package/js/src/pro/wazirx.js +8 -8
  304. package/js/src/pro/whitebit.js +13 -9
  305. package/js/src/pro/woo.js +1 -1
  306. package/js/src/probit.js +29 -24
  307. package/js/src/tidex.js +16 -15
  308. package/js/src/timex.js +19 -18
  309. package/js/src/tokocrypto.js +28 -23
  310. package/js/src/upbit.js +19 -19
  311. package/js/src/wavesexchange.js +23 -20
  312. package/js/src/wazirx.js +25 -18
  313. package/js/src/whitebit.js +33 -27
  314. package/js/src/woo.js +45 -35
  315. package/js/src/yobit.js +25 -20
  316. package/js/src/zaif.js +9 -9
  317. package/js/src/zonda.js +18 -17
  318. package/package.json +1 -1
package/js/src/okx.js CHANGED
@@ -50,14 +50,13 @@ export default class okx extends Exchange {
50
50
  'fetchBalance': true,
51
51
  'fetchBidsAsks': undefined,
52
52
  'fetchBorrowInterest': true,
53
- 'fetchBorrowRate': true,
54
53
  'fetchBorrowRateHistories': true,
55
54
  'fetchBorrowRateHistory': true,
56
- 'fetchBorrowRates': true,
57
- 'fetchBorrowRatesPerSymbol': false,
58
55
  'fetchCanceledOrders': true,
59
56
  'fetchClosedOrder': undefined,
60
57
  'fetchClosedOrders': true,
58
+ 'fetchCrossBorrowRate': true,
59
+ 'fetchCrossBorrowRates': true,
61
60
  'fetchCurrencies': true,
62
61
  'fetchDeposit': true,
63
62
  'fetchDepositAddress': true,
@@ -73,6 +72,8 @@ export default class okx extends Exchange {
73
72
  'fetchFundingRates': false,
74
73
  'fetchGreeks': true,
75
74
  'fetchIndexOHLCV': true,
75
+ 'fetchIsolatedBorrowRate': false,
76
+ 'fetchIsolatedBorrowRates': false,
76
77
  'fetchL3OrderBook': false,
77
78
  'fetchLedger': true,
78
79
  'fetchLedgerEntry': undefined,
@@ -1166,7 +1167,7 @@ export default class okx extends Exchange {
1166
1167
  * @description the latest known information on the availability of the exchange API
1167
1168
  * @see https://www.okx.com/docs-v5/en/#status-get-status
1168
1169
  * @param {object} [params] extra parameters specific to the okx api endpoint
1169
- * @returns {object} a [status structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#exchange-status-structure}
1170
+ * @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
1170
1171
  */
1171
1172
  const response = await this.publicGetSystemStatus(params);
1172
1173
  //
@@ -1238,7 +1239,7 @@ export default class okx extends Exchange {
1238
1239
  * @description fetch all the accounts associated with a profile
1239
1240
  * @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-account-configuration
1240
1241
  * @param {object} [params] extra parameters specific to the okx api endpoint
1241
- * @returns {object} a dictionary of [account structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#account-structure} indexed by the account type
1242
+ * @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
1242
1243
  */
1243
1244
  const response = await this.privateGetAccountConfig(params);
1244
1245
  //
@@ -1659,7 +1660,7 @@ export default class okx extends Exchange {
1659
1660
  * @param {string} symbol unified symbol of the market to fetch the order book for
1660
1661
  * @param {int} [limit] the maximum amount of order book entries to return
1661
1662
  * @param {object} [params] extra parameters specific to the okx api endpoint
1662
- * @returns {object} A dictionary of [order book structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-book-structure} indexed by market symbols
1663
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
1663
1664
  */
1664
1665
  await this.loadMarkets();
1665
1666
  const market = this.market(symbol);
@@ -1760,7 +1761,7 @@ export default class okx extends Exchange {
1760
1761
  * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-ticker
1761
1762
  * @param {string} symbol unified symbol of the market to fetch the ticker for
1762
1763
  * @param {object} [params] extra parameters specific to the okx api endpoint
1763
- * @returns {object} a [ticker structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
1764
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
1764
1765
  */
1765
1766
  await this.loadMarkets();
1766
1767
  const market = this.market(symbol);
@@ -1851,7 +1852,7 @@ export default class okx extends Exchange {
1851
1852
  * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
1852
1853
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1853
1854
  * @param {object} [params] extra parameters specific to the okx api endpoint
1854
- * @returns {object} a dictionary of [ticker structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
1855
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
1855
1856
  */
1856
1857
  await this.loadMarkets();
1857
1858
  symbols = this.marketSymbols(symbols);
@@ -1968,7 +1969,7 @@ export default class okx extends Exchange {
1968
1969
  * @param {int} [limit] the maximum amount of trades to fetch
1969
1970
  * @param {object} [params] extra parameters specific to the okx api endpoint
1970
1971
  * @param {boolean} [params.paginate] *only applies to publicGetMarketHistoryTrades* default false, when true will automatically paginate by calling this endpoint multiple times
1971
- * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
1972
+ * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
1972
1973
  */
1973
1974
  await this.loadMarkets();
1974
1975
  let paginate = false;
@@ -2177,12 +2178,14 @@ export default class okx extends Exchange {
2177
2178
  * @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate-history
2178
2179
  * @param {string} symbol unified symbol of the market to fetch the funding rate history for
2179
2180
  * @param {int} [since] timestamp in ms of the earliest funding rate to fetch
2180
- * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure} to fetch
2181
+ * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} to fetch
2181
2182
  * @param {object} [params] extra parameters specific to the okx api endpoint
2182
2183
  * @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)
2183
- * @returns {object[]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
2184
+ * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
2184
2185
  */
2185
- this.checkRequiredSymbol('fetchFundingRateHistory', symbol);
2186
+ if (symbol === undefined) {
2187
+ throw new ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
2188
+ }
2186
2189
  await this.loadMarkets();
2187
2190
  let paginate = false;
2188
2191
  [paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
@@ -2320,7 +2323,7 @@ export default class okx extends Exchange {
2320
2323
  * @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-fee-rates
2321
2324
  * @param {string} symbol unified market symbol
2322
2325
  * @param {object} [params] extra parameters specific to the okx api endpoint
2323
- * @returns {object} a [fee structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#fee-structure}
2326
+ * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
2324
2327
  */
2325
2328
  await this.loadMarkets();
2326
2329
  const market = this.market(symbol);
@@ -2370,7 +2373,7 @@ export default class okx extends Exchange {
2370
2373
  * @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-balance
2371
2374
  * @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-balance
2372
2375
  * @param {object} [params] extra parameters specific to the okx api endpoint
2373
- * @returns {object} a [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
2376
+ * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
2374
2377
  */
2375
2378
  await this.loadMarkets();
2376
2379
  const [marketType, query] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
@@ -2765,7 +2768,7 @@ export default class okx extends Exchange {
2765
2768
  * @param {float} [params.stopLoss.price] used for stop loss limit orders, not used for stop loss market price orders
2766
2769
  * @param {string} [params.stopLoss.type] 'market' or 'limit' used to specify the stop loss price type
2767
2770
  * @param {string} [params.positionSide] if position mode is one-way: set to 'net', if position mode is hedge-mode: set to 'long' or 'short'
2768
- * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
2771
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2769
2772
  */
2770
2773
  await this.loadMarkets();
2771
2774
  const market = this.market(symbol);
@@ -2808,7 +2811,7 @@ export default class okx extends Exchange {
2808
2811
  * @description create a list of trade orders
2809
2812
  * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-multiple-orders
2810
2813
  * @param {array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
2811
- * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
2814
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2812
2815
  */
2813
2816
  await this.loadMarkets();
2814
2817
  const ordersRequests = [];
@@ -2935,7 +2938,7 @@ export default class okx extends Exchange {
2935
2938
  * @param {float} [params.takeProfit.triggerPrice] take profit trigger price
2936
2939
  * @param {float} [params.takeProfit.price] used for take profit limit orders, not used for take profit market price orders
2937
2940
  * @param {string} [params.takeProfit.type] 'market' or 'limit' used to specify the take profit price type
2938
- * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
2941
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2939
2942
  */
2940
2943
  await this.loadMarkets();
2941
2944
  const market = this.market(symbol);
@@ -2972,9 +2975,11 @@ export default class okx extends Exchange {
2972
2975
  * @param {string} id order id
2973
2976
  * @param {string} symbol unified symbol of the market the order was made in
2974
2977
  * @param {object} [params] extra parameters specific to the okx api endpoint
2975
- * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
2978
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2976
2979
  */
2977
- this.checkRequiredSymbol('cancelOrder', symbol);
2980
+ if (symbol === undefined) {
2981
+ throw new ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
2982
+ }
2978
2983
  const stop = this.safeValue(params, 'stop');
2979
2984
  if (stop) {
2980
2985
  const orderInner = await this.cancelOrders([id], symbol, params);
@@ -3026,10 +3031,12 @@ export default class okx extends Exchange {
3026
3031
  * @param {string[]} ids order ids
3027
3032
  * @param {string} symbol unified market symbol
3028
3033
  * @param {object} [params] extra parameters specific to the okx api endpoint
3029
- * @returns {object} an list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
3034
+ * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
3030
3035
  */
3031
3036
  // TODO : the original endpoint signature differs, according to that you can skip individual symbol and assign ids in batch. At this moment, `params` is not being used too.
3032
- this.checkRequiredSymbol('cancelOrders', symbol);
3037
+ if (symbol === undefined) {
3038
+ throw new ArgumentsRequired(this.id + ' cancelOrders() requires a symbol argument');
3039
+ }
3033
3040
  await this.loadMarkets();
3034
3041
  const market = this.market(symbol);
3035
3042
  const request = [];
@@ -3338,9 +3345,11 @@ export default class okx extends Exchange {
3338
3345
  * @param {string} id the order id
3339
3346
  * @param {string} symbol unified market symbol
3340
3347
  * @param {object} [params] extra and exchange specific parameters
3341
- * @returns [an order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
3348
+ * @returns [an order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3342
3349
  */
3343
- this.checkRequiredSymbol('fetchOrder', symbol);
3350
+ if (symbol === undefined) {
3351
+ throw new ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
3352
+ }
3344
3353
  await this.loadMarkets();
3345
3354
  const market = this.market(symbol);
3346
3355
  const request = {
@@ -3490,7 +3499,7 @@ export default class okx extends Exchange {
3490
3499
  * @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
3491
3500
  * @param {string} [params.algoId] Algo ID "'433845797218942976'"
3492
3501
  * @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)
3493
- * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
3502
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
3494
3503
  */
3495
3504
  await this.loadMarkets();
3496
3505
  let paginate = false;
@@ -3645,7 +3654,7 @@ export default class okx extends Exchange {
3645
3654
  * @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
3646
3655
  * @param {string} [params.algoId] Algo ID "'433845797218942976'"
3647
3656
  * @param {int} [params.until] timestamp in ms to fetch orders for
3648
- * @returns {object} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
3657
+ * @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
3649
3658
  */
3650
3659
  await this.loadMarkets();
3651
3660
  const request = {
@@ -3822,7 +3831,7 @@ export default class okx extends Exchange {
3822
3831
  * @param {string} [params.algoId] Algo ID "'433845797218942976'"
3823
3832
  * @param {int} [params.until] timestamp in ms to fetch orders for
3824
3833
  * @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)
3825
- * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
3834
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
3826
3835
  */
3827
3836
  await this.loadMarkets();
3828
3837
  let paginate = false;
@@ -3991,7 +4000,7 @@ export default class okx extends Exchange {
3991
4000
  * @param {object} [params] extra parameters specific to the okx api endpoint
3992
4001
  * @param {int} [params.until] Timestamp in ms of the latest time to retrieve trades for
3993
4002
  * @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)
3994
- * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
4003
+ * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
3995
4004
  */
3996
4005
  await this.loadMarkets();
3997
4006
  let paginate = false;
@@ -4059,7 +4068,7 @@ export default class okx extends Exchange {
4059
4068
  * @param {int} [since] the earliest time in ms to fetch trades for
4060
4069
  * @param {int} [limit] the maximum number of trades to retrieve
4061
4070
  * @param {object} [params] extra parameters specific to the okx api endpoint
4062
- * @returns {object[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
4071
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
4063
4072
  */
4064
4073
  const request = {
4065
4074
  // 'instrument_id': market['id'],
@@ -4085,7 +4094,7 @@ export default class okx extends Exchange {
4085
4094
  * @param {string} [params.marginMode] 'cross' or 'isolated'
4086
4095
  * @param {int} [params.until] the latest time in ms to fetch entries for
4087
4096
  * @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)
4088
- * @returns {object} a [ledger structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ledger-structure}
4097
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
4089
4098
  */
4090
4099
  await this.loadMarkets();
4091
4100
  let paginate = false;
@@ -4383,7 +4392,7 @@ export default class okx extends Exchange {
4383
4392
  * @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-deposit-address
4384
4393
  * @param {string} code unified currency code of the currency for the deposit address
4385
4394
  * @param {object} [params] extra parameters specific to the okx api endpoint
4386
- * @returns {object} a dictionary of [address structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#address-structure} indexed by the network
4395
+ * @returns {object} a dictionary of [address structures]{@link https://docs.ccxt.com/#/?id=address-structure} indexed by the network
4387
4396
  */
4388
4397
  await this.loadMarkets();
4389
4398
  const currency = this.currency(code);
@@ -4425,7 +4434,7 @@ export default class okx extends Exchange {
4425
4434
  * @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-deposit-address
4426
4435
  * @param {string} code unified currency code
4427
4436
  * @param {object} [params] extra parameters specific to the okx api endpoint
4428
- * @returns {object} an [address structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#address-structure}
4437
+ * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
4429
4438
  */
4430
4439
  const rawNetwork = this.safeStringUpper(params, 'network');
4431
4440
  const networks = this.safeValue(this.options, 'networks', {});
@@ -4469,7 +4478,7 @@ export default class okx extends Exchange {
4469
4478
  * @param {string} address the address to withdraw to
4470
4479
  * @param {string} tag
4471
4480
  * @param {object} [params] extra parameters specific to the okx api endpoint
4472
- * @returns {object} a [transaction structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
4481
+ * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
4473
4482
  */
4474
4483
  [tag, params] = this.handleWithdrawTagAndParams(tag, params);
4475
4484
  this.checkAddress(address);
@@ -4549,7 +4558,7 @@ export default class okx extends Exchange {
4549
4558
  * @param {object} [params] extra parameters specific to the okx api endpoint
4550
4559
  * @param {int} [params.until] the latest time in ms to fetch entries for
4551
4560
  * @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)
4552
- * @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
4561
+ * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
4553
4562
  */
4554
4563
  await this.loadMarkets();
4555
4564
  let paginate = false;
@@ -4627,7 +4636,7 @@ export default class okx extends Exchange {
4627
4636
  * @param {string} id deposit id
4628
4637
  * @param {string} code filter by currency code
4629
4638
  * @param {object} [params] extra parameters specific to the okx api endpoint
4630
- * @returns {object} a [transaction structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
4639
+ * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
4631
4640
  */
4632
4641
  await this.loadMarkets();
4633
4642
  const request = {
@@ -4655,7 +4664,7 @@ export default class okx extends Exchange {
4655
4664
  * @param {object} [params] extra parameters specific to the okx api endpoint
4656
4665
  * @param {int} [params.until] the latest time in ms to fetch entries for
4657
4666
  * @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)
4658
- * @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
4667
+ * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
4659
4668
  */
4660
4669
  await this.loadMarkets();
4661
4670
  let paginate = false;
@@ -4725,7 +4734,7 @@ export default class okx extends Exchange {
4725
4734
  * @param {string} id withdrawal id
4726
4735
  * @param {string} code unified currency code of the currency withdrawn, default is undefined
4727
4736
  * @param {object} [params] extra parameters specific to the okx api endpoint
4728
- * @returns {object} a [transaction structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
4737
+ * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
4729
4738
  */
4730
4739
  await this.loadMarkets();
4731
4740
  const request = {
@@ -4905,7 +4914,7 @@ export default class okx extends Exchange {
4905
4914
  * @param {string} symbol unified market symbol
4906
4915
  * @param {object} [params] extra parameters specific to the okx api endpoint
4907
4916
  * @param {string} [params.marginMode] 'cross' or 'isolated'
4908
- * @returns {object} a [leverage structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#leverage-structure}
4917
+ * @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
4909
4918
  */
4910
4919
  await this.loadMarkets();
4911
4920
  let marginMode = undefined;
@@ -4947,7 +4956,7 @@ export default class okx extends Exchange {
4947
4956
  * @param {string} symbol unified market symbol of the market the position is held in, default is undefined
4948
4957
  * @param {object} [params] extra parameters specific to the okx api endpoint
4949
4958
  * @param {string} [params.instType] MARGIN, SWAP, FUTURES, OPTION
4950
- * @returns {object} a [position structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#position-structure}
4959
+ * @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
4951
4960
  */
4952
4961
  await this.loadMarkets();
4953
4962
  const market = this.market(symbol);
@@ -5023,7 +5032,7 @@ export default class okx extends Exchange {
5023
5032
  * @param {string[]|undefined} symbols list of unified market symbols
5024
5033
  * @param {object} [params] extra parameters specific to the okx api endpoint
5025
5034
  * @param {string} [params.instType] MARGIN, SWAP, FUTURES, OPTION
5026
- * @returns {object[]} a list of [position structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#position-structure}
5035
+ * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
5027
5036
  */
5028
5037
  await this.loadMarkets();
5029
5038
  const request = {
@@ -5257,7 +5266,7 @@ export default class okx extends Exchange {
5257
5266
  * @param {string} fromAccount account to transfer from
5258
5267
  * @param {string} toAccount account to transfer to
5259
5268
  * @param {object} [params] extra parameters specific to the okx api endpoint
5260
- * @returns {object} a [transfer structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#transfer-structure}
5269
+ * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
5261
5270
  */
5262
5271
  await this.loadMarkets();
5263
5272
  const currency = this.currency(code);
@@ -5431,7 +5440,7 @@ export default class okx extends Exchange {
5431
5440
  * @param {int} [since] the earliest time in ms to fetch transfers for
5432
5441
  * @param {int} [limit] the maximum number of transfers structures to retrieve
5433
5442
  * @param {object} [params] extra parameters specific to the okx api endpoint
5434
- * @returns {object[]} a list of [transfer structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transfer-structure}
5443
+ * @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
5435
5444
  */
5436
5445
  await this.loadMarkets();
5437
5446
  let currency = undefined;
@@ -5596,7 +5605,7 @@ export default class okx extends Exchange {
5596
5605
  * @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate
5597
5606
  * @param {string} symbol unified market symbol
5598
5607
  * @param {object} [params] extra parameters specific to the okx api endpoint
5599
- * @returns {object} a [funding rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-structure}
5608
+ * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
5600
5609
  */
5601
5610
  await this.loadMarkets();
5602
5611
  const market = this.market(symbol);
@@ -5637,7 +5646,7 @@ export default class okx extends Exchange {
5637
5646
  * @param {int} [since] the earliest time in ms to fetch funding history for
5638
5647
  * @param {int} [limit] the maximum number of funding history structures to retrieve
5639
5648
  * @param {object} [params] extra parameters specific to the okx api endpoint
5640
- * @returns {object} a [funding history structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-history-structure}
5649
+ * @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
5641
5650
  */
5642
5651
  await this.loadMarkets();
5643
5652
  const request = {
@@ -5799,7 +5808,9 @@ export default class okx extends Exchange {
5799
5808
  * @param {string} [params.posSide] 'long' or 'short' for isolated margin long/short mode on futures and swap markets
5800
5809
  * @returns {object} response from the exchange
5801
5810
  */
5802
- this.checkRequiredSymbol('setLeverage', symbol);
5811
+ if (symbol === undefined) {
5812
+ throw new ArgumentsRequired(this.id + ' setLeverage() requires a symbol argument');
5813
+ }
5803
5814
  // WARNING: THIS WILL INCREASE LIQUIDATION PRICE FOR OPEN ISOLATED LONG POSITIONS
5804
5815
  // AND DECREASE LIQUIDATION PRICE FOR OPEN ISOLATED SHORT POSITIONS
5805
5816
  if ((leverage < 1) || (leverage > 125)) {
@@ -5893,7 +5904,9 @@ export default class okx extends Exchange {
5893
5904
  * @param {int} [params.leverage] leverage
5894
5905
  * @returns {object} response from the exchange
5895
5906
  */
5896
- this.checkRequiredSymbol('setMarginMode', symbol);
5907
+ if (symbol === undefined) {
5908
+ throw new ArgumentsRequired(this.id + ' setMarginMode() requires a symbol argument');
5909
+ }
5897
5910
  // WARNING: THIS WILL INCREASE LIQUIDATION PRICE FOR OPEN ISOLATED LONG POSITIONS
5898
5911
  // AND DECREASE LIQUIDATION PRICE FOR OPEN ISOLATED SHORT POSITIONS
5899
5912
  marginMode = marginMode.toLowerCase();
@@ -5929,14 +5942,14 @@ export default class okx extends Exchange {
5929
5942
  //
5930
5943
  return response;
5931
5944
  }
5932
- async fetchBorrowRates(params = {}) {
5945
+ async fetchCrossBorrowRates(params = {}) {
5933
5946
  /**
5934
5947
  * @method
5935
- * @name okx#fetchBorrowRates
5948
+ * @name okx#fetchCrossBorrowRates
5936
5949
  * @description fetch the borrow interest rates of all currencies
5937
5950
  * @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-interest-rate
5938
5951
  * @param {object} [params] extra parameters specific to the okx api endpoint
5939
- * @returns {object} a list of [borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-rate-structure}
5952
+ * @returns {object} a list of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
5940
5953
  */
5941
5954
  await this.loadMarkets();
5942
5955
  const response = await this.privateGetAccountInterestRate(params);
@@ -5952,32 +5965,22 @@ export default class okx extends Exchange {
5952
5965
  // ],
5953
5966
  // }
5954
5967
  //
5955
- const timestamp = this.milliseconds();
5956
- const data = this.safeValue(response, 'data');
5957
- const rates = {};
5968
+ const data = this.safeValue(response, 'data', []);
5969
+ const rates = [];
5958
5970
  for (let i = 0; i < data.length; i++) {
5959
- const rate = data[i];
5960
- const code = this.safeCurrencyCode(this.safeString(rate, 'ccy'));
5961
- rates[code] = {
5962
- 'currency': code,
5963
- 'rate': this.safeNumber(rate, 'interestRate'),
5964
- 'period': 86400000,
5965
- 'timestamp': timestamp,
5966
- 'datetime': this.iso8601(timestamp),
5967
- 'info': rate,
5968
- };
5971
+ rates.push(this.parseBorrowRate(data[i]));
5969
5972
  }
5970
5973
  return rates;
5971
5974
  }
5972
- async fetchBorrowRate(code, params = {}) {
5975
+ async fetchCrossBorrowRate(code, params = {}) {
5973
5976
  /**
5974
5977
  * @method
5975
- * @name okx#fetchBorrowRate
5978
+ * @name okx#fetchCrossBorrowRate
5976
5979
  * @description fetch the rate of interest to borrow a currency for margin trading
5977
5980
  * @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-interest-rate
5978
5981
  * @param {string} code unified currency code
5979
5982
  * @param {object} [params] extra parameters specific to the okx api endpoint
5980
- * @returns {object} a [borrow rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-rate-structure}
5983
+ * @returns {object} a [borrow rate structure]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
5981
5984
  */
5982
5985
  await this.loadMarkets();
5983
5986
  const currency = this.currency(code);
@@ -6073,7 +6076,7 @@ export default class okx extends Exchange {
6073
6076
  * @param {int} [since] timestamp in ms of the earliest borrowRate, default is undefined
6074
6077
  * @param {int} [limit] max number of borrow rate prices to return, default is undefined
6075
6078
  * @param {object} [params] extra parameters specific to the okx api endpoint
6076
- * @returns {object} a dictionary of [borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-rate-structure} indexed by the market symbol
6079
+ * @returns {object} a dictionary of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure} indexed by the market symbol
6077
6080
  */
6078
6081
  await this.loadMarkets();
6079
6082
  const request = {
@@ -6114,9 +6117,9 @@ export default class okx extends Exchange {
6114
6117
  * @see https://www.okx.com/docs-v5/en/#financial-product-savings-get-public-borrow-history-public
6115
6118
  * @param {string} code unified currency code
6116
6119
  * @param {int} [since] timestamp for the earliest borrow rate
6117
- * @param {int} [limit] the maximum number of [borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-rate-structure} to retrieve
6120
+ * @param {int} [limit] the maximum number of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure} to retrieve
6118
6121
  * @param {object} [params] extra parameters specific to the exchange api endpoint
6119
- * @returns {object[]} an array of [borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-rate-structure}
6122
+ * @returns {object[]} an array of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
6120
6123
  */
6121
6124
  await this.loadMarkets();
6122
6125
  const currency = this.currency(code);
@@ -6207,7 +6210,7 @@ export default class okx extends Exchange {
6207
6210
  * @param {string} symbol unified market symbol
6208
6211
  * @param {float} amount the amount of margin to remove
6209
6212
  * @param {object} [params] extra parameters specific to the okx api endpoint
6210
- * @returns {object} a [margin structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#reduce-margin-structure}
6213
+ * @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=reduce-margin-structure}
6211
6214
  */
6212
6215
  return await this.modifyMarginHelper(symbol, amount, 'reduce', params);
6213
6216
  }
@@ -6220,7 +6223,7 @@ export default class okx extends Exchange {
6220
6223
  * @param {string} symbol unified market symbol
6221
6224
  * @param {float} amount amount of margin to add
6222
6225
  * @param {object} [params] extra parameters specific to the okx api endpoint
6223
- * @returns {object} a [margin structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#add-margin-structure}
6226
+ * @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=add-margin-structure}
6224
6227
  */
6225
6228
  return await this.modifyMarginHelper(symbol, amount, 'add', params);
6226
6229
  }
@@ -6233,7 +6236,7 @@ export default class okx extends Exchange {
6233
6236
  * @param {string} symbol unified market symbol
6234
6237
  * @param {object} [params] extra parameters specific to the okx api endpoint
6235
6238
  * @param {string} [params.marginMode] 'cross' or 'isolated'
6236
- * @returns {object} a [leverage tiers structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#leverage-tiers-structure}
6239
+ * @returns {object} a [leverage tiers structure]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}
6237
6240
  */
6238
6241
  await this.loadMarkets();
6239
6242
  const market = this.market(symbol);
@@ -6331,11 +6334,11 @@ export default class okx extends Exchange {
6331
6334
  * @param {string} code the unified currency code for the currency of the interest
6332
6335
  * @param {string} symbol the market symbol of an isolated margin market, if undefined, the interest for cross margin markets is returned
6333
6336
  * @param {int} [since] timestamp in ms of the earliest time to receive interest records for
6334
- * @param {int} [limit] the number of [borrow interest structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-interest-structure} to retrieve
6337
+ * @param {int} [limit] the number of [borrow interest structures]{@link https://docs.ccxt.com/#/?id=borrow-interest-structure} to retrieve
6335
6338
  * @param {object} [params] exchange specific parameters
6336
6339
  * @param {int} [params.type] Loan type 1 - VIP loans 2 - Market loans *Default is Market loans*
6337
6340
  * @param {string} [params.marginMode] 'cross' or 'isolated'
6338
- * @returns {object[]} An list of [borrow interest structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-interest-structure}
6341
+ * @returns {object[]} An list of [borrow interest structures]{@link https://docs.ccxt.com/#/?id=borrow-interest-structure}
6339
6342
  */
6340
6343
  await this.loadMarkets();
6341
6344
  let marginMode = undefined;
@@ -6413,7 +6416,7 @@ export default class okx extends Exchange {
6413
6416
  * @param {float} amount the amount to borrow
6414
6417
  * @param {string} symbol not used by okx.borrowMargin ()
6415
6418
  * @param {object} [params] extra parameters specific to the okx api endpoint
6416
- * @returns {object} a [margin loan structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#margin-loan-structure}
6419
+ * @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
6417
6420
  */
6418
6421
  await this.loadMarkets();
6419
6422
  const currency = this.currency(code);
@@ -6457,7 +6460,7 @@ export default class okx extends Exchange {
6457
6460
  * @param {float} amount the amount to repay
6458
6461
  * @param {string} symbol not used by okx.repayMargin ()
6459
6462
  * @param {object} [params] extra parameters specific to the okx api endpoint
6460
- * @returns {object} a [margin loan structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#margin-loan-structure}
6463
+ * @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
6461
6464
  */
6462
6465
  await this.loadMarkets();
6463
6466
  const currency = this.currency(code);
@@ -6522,7 +6525,7 @@ export default class okx extends Exchange {
6522
6525
  * @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-open-interest
6523
6526
  * @param {string} symbol Unified CCXT market symbol
6524
6527
  * @param {object} [params] exchange specific parameters
6525
- * @returns {object} an open interest structure{@link https://github.com/ccxt/ccxt/wiki/Manual#open-interest-structure}
6528
+ * @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
6526
6529
  */
6527
6530
  await this.loadMarkets();
6528
6531
  const market = this.market(symbol);
@@ -6568,7 +6571,7 @@ export default class okx extends Exchange {
6568
6571
  * @param {int} [limit] Not used by okx, but parsed internally by CCXT
6569
6572
  * @param {object} [params] Exchange specific parameters
6570
6573
  * @param {int} [params.until] The time in ms of the latest record to retrieve as a unix timestamp
6571
- * @returns An array of [open interest structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#open-interest-structure}
6574
+ * @returns An array of [open interest structures]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
6572
6575
  */
6573
6576
  const options = this.safeValue(this.options, 'fetchOpenInterestHistory', {});
6574
6577
  const timeframes = this.safeValue(options, 'timeframes', {});
@@ -6699,7 +6702,7 @@ export default class okx extends Exchange {
6699
6702
  * @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-currencies
6700
6703
  * @param {string[]|undefined} codes list of unified currency codes
6701
6704
  * @param {object} [params] extra parameters specific to the okx api endpoint
6702
- * @returns {object[]} a list of [fees structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#fee-structure}
6705
+ * @returns {object[]} a list of [fees structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
6703
6706
  */
6704
6707
  await this.loadMarkets();
6705
6708
  const response = await this.privateGetAssetCurrencies(params);
@@ -6820,11 +6823,13 @@ export default class okx extends Exchange {
6820
6823
  * @param {int} [since] timestamp in ms
6821
6824
  * @param {int} [limit] number of records
6822
6825
  * @param {object} [params] exchange specific params
6823
- * @returns {object[]} a list of [settlement history objects]{@link https://github.com/ccxt/ccxt/wiki/Manual#settlement-history-structure}
6826
+ * @returns {object[]} a list of [settlement history objects]{@link https://docs.ccxt.com/#/?id=settlement-history-structure}
6824
6827
  */
6825
- this.checkRequiredSymbol('fetchSettlementHistory', symbol);
6828
+ if (symbol === undefined) {
6829
+ throw new ArgumentsRequired(this.id + ' fetchSettlementHistory() requires a symbol argument');
6830
+ }
6826
6831
  await this.loadMarkets();
6827
- const market = (symbol === undefined) ? undefined : this.market(symbol);
6832
+ const market = this.market(symbol);
6828
6833
  let type = undefined;
6829
6834
  [type, params] = this.handleMarketTypeAndParams('fetchSettlementHistory', market, params);
6830
6835
  if (type !== 'future' && type !== 'option') {
@@ -6917,7 +6922,7 @@ export default class okx extends Exchange {
6917
6922
  * @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-underlying
6918
6923
  * @param {object} [params] exchange specific params
6919
6924
  * @param {string} [params.type] the contract market type, 'option', 'swap' or 'future', the default is 'option'
6920
- * @returns {object[]} a list of [underlying assets]{@link https://github.com/ccxt/ccxt/wiki/Manual#underlying-assets-structure}
6925
+ * @returns {object[]} a list of [underlying assets]{@link https://docs.ccxt.com/#/?id=underlying-assets-structure}
6921
6926
  */
6922
6927
  await this.loadMarkets();
6923
6928
  let marketType = undefined;
@@ -6955,7 +6960,7 @@ export default class okx extends Exchange {
6955
6960
  * @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-option-market-data
6956
6961
  * @param {string} symbol unified symbol of the market to fetch greeks for
6957
6962
  * @param {object} [params] extra parameters specific to the okx api endpoint
6958
- * @returns {object} a [greeks structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#greeks-structure}
6963
+ * @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
6959
6964
  */
6960
6965
  await this.loadMarkets();
6961
6966
  const market = this.market(symbol);
package/js/src/p2b.d.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  import { Market } from '../ccxt.js';
2
2
  import Exchange from './abstract/p2b.js';
3
- import { Int, OHLCV, Order, OrderSide, OrderType, Strings, Ticker, Tickers } from './base/types.js';
3
+ import { Int, OHLCV, Order, OrderSide, OrderType, Str, Strings, Ticker, Tickers } from './base/types.js';
4
4
  /**
5
5
  * @class p2b
6
6
  * @extends Exchange
7
7
  */
8
8
  export default class p2b extends Exchange {
9
9
  describe(): any;
10
- fetchMarkets(params?: {}): Promise<any[]>;
10
+ fetchMarkets(params?: {}): Promise<import("./base/types.js").MarketInterface[]>;
11
+ parseMarket(market: any): Market;
11
12
  fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
12
13
  fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
13
14
  parseTicker(ticker: any, market?: Market): Ticker;
@@ -19,11 +20,11 @@ export default class p2b extends Exchange {
19
20
  fetchBalance(params?: {}): Promise<import("./base/types.js").Balances>;
20
21
  parseBalance(response: any): import("./base/types.js").Balances;
21
22
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
22
- cancelOrder(id: string, symbol?: string, params?: {}): Promise<Order>;
23
- fetchOpenOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
24
- fetchOrderTrades(id: string, symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
25
- fetchMyTrades(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
26
- fetchClosedOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
23
+ cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
24
+ fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
25
+ fetchOrderTrades(id: string, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
26
+ fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
27
+ fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
27
28
  parseOrder(order: any, market?: Market): Order;
28
29
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
29
30
  url: string;