ccxt 4.1.56 → 4.1.57
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.
- package/.git-templates/hooks/pre-push +2 -2
- package/README.md +3 -3
- package/build.sh +30 -18
- package/dist/ccxt.browser.js +3872 -3202
- package/dist/ccxt.browser.min.js +10 -10
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ace.js +17 -13
- package/dist/cjs/src/alpaca.js +6 -6
- package/dist/cjs/src/ascendex.js +35 -29
- package/dist/cjs/src/base/Exchange.js +39 -26
- package/dist/cjs/src/base/Precise.js +1 -3
- package/dist/cjs/src/bigone.js +24 -20
- package/dist/cjs/src/binance.js +97 -76
- package/dist/cjs/src/bingx.js +63 -44
- package/dist/cjs/src/bit2c.js +18 -15
- package/dist/cjs/src/bitbank.js +16 -15
- package/dist/cjs/src/bitbns.js +28 -18
- package/dist/cjs/src/bitfinex.js +23 -21
- package/dist/cjs/src/bitfinex2.js +32 -28
- package/dist/cjs/src/bitflyer.js +28 -20
- package/dist/cjs/src/bitforex.js +25 -18
- package/dist/cjs/src/bitget.js +184 -147
- package/dist/cjs/src/bithumb.js +23 -16
- package/dist/cjs/src/bitmart.js +106 -85
- package/dist/cjs/src/bitmex.js +104 -64
- package/dist/cjs/src/bitopro.js +38 -26
- package/dist/cjs/src/bitpanda.js +24 -23
- package/dist/cjs/src/bitrue.js +33 -24
- package/dist/cjs/src/bitso.js +24 -23
- package/dist/cjs/src/bitstamp.js +24 -23
- package/dist/cjs/src/bittrex.js +30 -29
- package/dist/cjs/src/bitvavo.js +38 -30
- package/dist/cjs/src/bl3p.js +11 -10
- package/dist/cjs/src/blockchaincom.js +20 -20
- package/dist/cjs/src/btcalpha.js +18 -17
- package/dist/cjs/src/btcbox.js +13 -12
- package/dist/cjs/src/btcmarkets.js +20 -19
- package/dist/cjs/src/btcturk.js +14 -13
- package/dist/cjs/src/bybit.js +84 -54
- package/dist/cjs/src/cex.js +16 -14
- package/dist/cjs/src/coinbase.js +29 -27
- package/dist/cjs/src/coinbasepro.js +27 -25
- package/dist/cjs/src/coincheck.js +15 -14
- package/dist/cjs/src/coinex.js +100 -77
- package/dist/cjs/src/coinlist.js +28 -27
- package/dist/cjs/src/coinmate.js +20 -17
- package/dist/cjs/src/coinone.js +21 -16
- package/dist/cjs/src/coinsph.js +37 -28
- package/dist/cjs/src/coinspot.js +12 -11
- package/dist/cjs/src/cryptocom.js +40 -202
- package/dist/cjs/src/currencycom.js +32 -25
- package/dist/cjs/src/delta.js +34 -28
- package/dist/cjs/src/deribit.js +39 -36
- package/dist/cjs/src/digifinex.js +64 -44
- package/dist/cjs/src/exmo.js +29 -27
- package/dist/cjs/src/gate.js +67 -53
- package/dist/cjs/src/gemini.js +23 -20
- package/dist/cjs/src/hitbtc.js +65 -56
- package/dist/cjs/src/hollaex.js +30 -27
- package/dist/cjs/src/htx.js +132 -143
- package/dist/cjs/src/huobijp.js +22 -20
- package/dist/cjs/src/idex.js +22 -21
- package/dist/cjs/src/independentreserve.js +15 -14
- package/dist/cjs/src/indodax.js +30 -26
- package/dist/cjs/src/kraken.js +29 -27
- package/dist/cjs/src/krakenfutures.js +29 -22
- package/dist/cjs/src/kucoin.js +48 -43
- package/dist/cjs/src/kucoinfutures.js +33 -28
- package/dist/cjs/src/kuna.js +25 -24
- package/dist/cjs/src/latoken.js +24 -22
- package/dist/cjs/src/lbank.js +45 -30
- package/dist/cjs/src/luno.js +22 -19
- package/dist/cjs/src/lykke.js +19 -17
- package/dist/cjs/src/mercado.js +30 -19
- package/dist/cjs/src/mexc.js +60 -49
- package/dist/cjs/src/ndax.js +23 -22
- package/dist/cjs/src/novadax.js +23 -22
- package/dist/cjs/src/oceanex.js +22 -19
- package/dist/cjs/src/okcoin.js +29 -23
- package/dist/cjs/src/okx.js +87 -82
- package/dist/cjs/src/p2b.js +79 -82
- package/dist/cjs/src/paymium.js +10 -10
- package/dist/cjs/src/phemex.js +63 -40
- package/dist/cjs/src/poloniex.js +22 -22
- package/dist/cjs/src/poloniexfutures.js +23 -19
- package/dist/cjs/src/pro/alpaca.js +5 -5
- package/dist/cjs/src/pro/ascendex.js +4 -4
- package/dist/cjs/src/pro/binance.js +16 -16
- package/dist/cjs/src/pro/bingx.js +1 -1
- package/dist/cjs/src/pro/bitfinex.js +4 -4
- package/dist/cjs/src/pro/bitfinex2.js +6 -6
- package/dist/cjs/src/pro/bitget.js +7 -7
- package/dist/cjs/src/pro/bitmart.js +7 -5
- package/dist/cjs/src/pro/bitmex.js +6 -6
- package/dist/cjs/src/pro/bitopro.js +4 -4
- package/dist/cjs/src/pro/bitpanda.js +6 -6
- package/dist/cjs/src/pro/bitrue.js +2 -2
- package/dist/cjs/src/pro/bitstamp.js +6 -4
- package/dist/cjs/src/pro/bittrex.js +6 -6
- package/dist/cjs/src/pro/bitvavo.js +11 -7
- package/dist/cjs/src/pro/blockchaincom.js +8 -8
- package/dist/cjs/src/pro/bybit.js +7 -7
- package/dist/cjs/src/pro/cex.js +13 -9
- package/dist/cjs/src/pro/coinbase.js +5 -5
- package/dist/cjs/src/pro/coinbasepro.js +11 -10
- package/dist/cjs/src/pro/coinex.js +7 -9
- package/dist/cjs/src/pro/cryptocom.js +9 -9
- package/dist/cjs/src/pro/currencycom.js +4 -4
- package/dist/cjs/src/pro/deribit.js +6 -6
- package/dist/cjs/src/pro/exmo.js +12 -14
- package/dist/cjs/src/pro/gate.js +7 -7
- package/dist/cjs/src/pro/gemini.js +3 -3
- package/dist/cjs/src/pro/hitbtc.js +263 -4
- package/dist/cjs/src/pro/hollaex.js +5 -5
- package/dist/cjs/src/pro/htx.js +6 -6
- package/dist/cjs/src/pro/huobijp.js +3 -3
- package/dist/cjs/src/pro/idex.js +4 -4
- package/dist/cjs/src/pro/independentreserve.js +2 -2
- package/dist/cjs/src/pro/kraken.js +10 -10
- package/dist/cjs/src/pro/krakenfutures.js +41 -17
- package/dist/cjs/src/pro/kucoin.js +7 -7
- package/dist/cjs/src/pro/kucoinfutures.js +8 -6
- package/dist/cjs/src/pro/luno.js +2 -2
- package/dist/cjs/src/pro/mexc.js +6 -6
- package/dist/cjs/src/pro/ndax.js +3 -3
- package/dist/cjs/src/pro/okcoin.js +5 -5
- package/dist/cjs/src/pro/okx.js +12 -12
- package/dist/cjs/src/pro/phemex.js +6 -6
- package/dist/cjs/src/pro/poloniex.js +7 -7
- package/dist/cjs/src/pro/poloniexfutures.js +5 -5
- package/dist/cjs/src/pro/probit.js +6 -6
- package/dist/cjs/src/pro/upbit.js +3 -3
- package/dist/cjs/src/pro/wazirx.js +8 -8
- package/dist/cjs/src/pro/whitebit.js +12 -8
- package/dist/cjs/src/pro/woo.js +1 -1
- package/dist/cjs/src/probit.js +28 -23
- package/dist/cjs/src/tidex.js +16 -15
- package/dist/cjs/src/timex.js +19 -18
- package/dist/cjs/src/tokocrypto.js +27 -22
- package/dist/cjs/src/upbit.js +19 -19
- package/dist/cjs/src/wavesexchange.js +22 -19
- package/dist/cjs/src/wazirx.js +24 -17
- package/dist/cjs/src/whitebit.js +33 -27
- package/dist/cjs/src/woo.js +44 -34
- package/dist/cjs/src/yobit.js +25 -20
- package/dist/cjs/src/zaif.js +9 -9
- package/dist/cjs/src/zonda.js +18 -17
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bybit.d.ts +1 -0
- package/js/src/abstract/cryptocom.d.ts +0 -20
- package/js/src/ace.js +18 -14
- package/js/src/alpaca.js +6 -6
- package/js/src/ascendex.js +35 -29
- package/js/src/base/Exchange.d.ts +37 -34
- package/js/src/base/Exchange.js +39 -26
- package/js/src/base/Precise.d.ts +4 -4
- package/js/src/base/Precise.js +1 -3
- package/js/src/base/functions/type.d.ts +25 -25
- package/js/src/base/types.d.ts +21 -14
- package/js/src/bigone.js +25 -21
- package/js/src/binance.d.ts +2 -2
- package/js/src/binance.js +97 -76
- package/js/src/bingx.js +63 -44
- package/js/src/bit2c.js +19 -16
- package/js/src/bitbank.js +16 -15
- package/js/src/bitbns.js +28 -18
- package/js/src/bitfinex.js +23 -21
- package/js/src/bitfinex2.js +32 -28
- package/js/src/bitflyer.js +28 -20
- package/js/src/bitforex.js +26 -19
- package/js/src/bitget.d.ts +25 -3
- package/js/src/bitget.js +184 -147
- package/js/src/bithumb.js +23 -16
- package/js/src/bitmart.d.ts +1 -1
- package/js/src/bitmart.js +106 -85
- package/js/src/bitmex.d.ts +2 -2
- package/js/src/bitmex.js +104 -64
- package/js/src/bitopro.js +38 -26
- package/js/src/bitpanda.js +24 -23
- package/js/src/bitrue.js +33 -24
- package/js/src/bitso.js +24 -23
- package/js/src/bitstamp.d.ts +2 -2
- package/js/src/bitstamp.js +24 -23
- package/js/src/bittrex.js +30 -29
- package/js/src/bitvavo.js +38 -30
- package/js/src/bl3p.js +11 -10
- package/js/src/blockchaincom.js +20 -20
- package/js/src/btcalpha.js +18 -17
- package/js/src/btcbox.js +13 -12
- package/js/src/btcmarkets.js +20 -19
- package/js/src/btcturk.js +14 -13
- package/js/src/bybit.d.ts +1 -1
- package/js/src/bybit.js +84 -54
- package/js/src/cex.js +16 -14
- package/js/src/coinbase.js +29 -27
- package/js/src/coinbasepro.js +27 -25
- package/js/src/coincheck.js +15 -14
- package/js/src/coinex.d.ts +1 -1
- package/js/src/coinex.js +100 -77
- package/js/src/coinlist.js +28 -27
- package/js/src/coinmate.js +21 -18
- package/js/src/coinone.js +21 -16
- package/js/src/coinsph.js +37 -28
- package/js/src/coinspot.js +12 -11
- package/js/src/cryptocom.d.ts +0 -23
- package/js/src/cryptocom.js +40 -202
- package/js/src/currencycom.js +32 -25
- package/js/src/delta.js +35 -29
- package/js/src/deribit.js +39 -36
- package/js/src/digifinex.d.ts +2 -2
- package/js/src/digifinex.js +65 -45
- package/js/src/exmo.js +29 -27
- package/js/src/gate.d.ts +1 -1
- package/js/src/gate.js +67 -53
- package/js/src/gemini.js +23 -20
- package/js/src/hitbtc.d.ts +1 -0
- package/js/src/hitbtc.js +65 -56
- package/js/src/hollaex.js +30 -27
- package/js/src/htx.d.ts +11 -3
- package/js/src/htx.js +132 -143
- package/js/src/huobijp.js +23 -21
- package/js/src/idex.js +22 -21
- package/js/src/independentreserve.js +15 -14
- package/js/src/indodax.js +30 -26
- package/js/src/kraken.js +29 -27
- package/js/src/krakenfutures.js +29 -22
- package/js/src/kucoin.d.ts +1 -1
- package/js/src/kucoin.js +48 -43
- package/js/src/kucoinfutures.js +33 -28
- package/js/src/kuna.js +25 -24
- package/js/src/latoken.js +25 -23
- package/js/src/lbank.js +46 -31
- package/js/src/luno.js +22 -19
- package/js/src/lykke.js +19 -17
- package/js/src/mercado.js +30 -19
- package/js/src/mexc.d.ts +1 -1
- package/js/src/mexc.js +60 -49
- package/js/src/ndax.js +23 -22
- package/js/src/novadax.js +23 -22
- package/js/src/oceanex.js +22 -19
- package/js/src/okcoin.js +29 -23
- package/js/src/okx.d.ts +2 -2
- package/js/src/okx.js +87 -82
- package/js/src/p2b.d.ts +8 -7
- package/js/src/p2b.js +79 -81
- package/js/src/paymium.js +10 -10
- package/js/src/phemex.js +63 -40
- package/js/src/poloniex.js +22 -22
- package/js/src/poloniexfutures.js +23 -19
- package/js/src/pro/alpaca.js +5 -5
- package/js/src/pro/ascendex.js +4 -4
- package/js/src/pro/binance.js +16 -16
- package/js/src/pro/bingx.js +1 -1
- package/js/src/pro/bitfinex.js +4 -4
- package/js/src/pro/bitfinex2.d.ts +1 -1
- package/js/src/pro/bitfinex2.js +6 -6
- package/js/src/pro/bitget.js +7 -7
- package/js/src/pro/bitmart.js +7 -5
- package/js/src/pro/bitmex.js +6 -6
- package/js/src/pro/bitopro.js +4 -4
- package/js/src/pro/bitpanda.js +6 -6
- package/js/src/pro/bitrue.js +2 -2
- package/js/src/pro/bitstamp.js +7 -5
- package/js/src/pro/bittrex.js +6 -6
- package/js/src/pro/bitvavo.js +12 -8
- package/js/src/pro/blockchaincom.js +8 -8
- package/js/src/pro/bybit.js +7 -7
- package/js/src/pro/cex.js +14 -10
- package/js/src/pro/coinbase.js +5 -5
- package/js/src/pro/coinbasepro.js +12 -11
- package/js/src/pro/coinex.js +7 -9
- package/js/src/pro/cryptocom.js +9 -9
- package/js/src/pro/currencycom.js +4 -4
- package/js/src/pro/deribit.js +6 -6
- package/js/src/pro/exmo.js +12 -14
- package/js/src/pro/gate.js +7 -7
- package/js/src/pro/gemini.js +3 -3
- package/js/src/pro/hitbtc.d.ts +8 -1
- package/js/src/pro/hitbtc.js +264 -5
- package/js/src/pro/hollaex.js +5 -5
- package/js/src/pro/htx.js +6 -6
- package/js/src/pro/huobijp.js +3 -3
- package/js/src/pro/idex.js +4 -4
- package/js/src/pro/independentreserve.js +2 -2
- package/js/src/pro/kraken.js +10 -10
- package/js/src/pro/krakenfutures.d.ts +1 -0
- package/js/src/pro/krakenfutures.js +42 -18
- package/js/src/pro/kucoin.js +7 -7
- package/js/src/pro/kucoinfutures.js +8 -6
- package/js/src/pro/luno.js +2 -2
- package/js/src/pro/mexc.js +6 -6
- package/js/src/pro/ndax.js +3 -3
- package/js/src/pro/okcoin.js +5 -5
- package/js/src/pro/okx.js +12 -12
- package/js/src/pro/phemex.js +6 -6
- package/js/src/pro/poloniex.js +7 -7
- package/js/src/pro/poloniexfutures.js +5 -5
- package/js/src/pro/probit.js +6 -6
- package/js/src/pro/upbit.js +3 -3
- package/js/src/pro/wazirx.js +8 -8
- package/js/src/pro/whitebit.js +13 -9
- package/js/src/pro/woo.js +1 -1
- package/js/src/probit.js +29 -24
- package/js/src/tidex.js +16 -15
- package/js/src/timex.js +19 -18
- package/js/src/tokocrypto.js +28 -23
- package/js/src/upbit.js +19 -19
- package/js/src/wavesexchange.js +23 -20
- package/js/src/wazirx.js +25 -18
- package/js/src/whitebit.js +33 -27
- package/js/src/woo.js +45 -35
- package/js/src/yobit.js +25 -20
- package/js/src/zaif.js +9 -9
- package/js/src/zonda.js +18 -17
- package/package.json +1 -1
package/dist/cjs/src/okx.js
CHANGED
|
@@ -47,14 +47,13 @@ class okx extends okx$1 {
|
|
|
47
47
|
'fetchBalance': true,
|
|
48
48
|
'fetchBidsAsks': undefined,
|
|
49
49
|
'fetchBorrowInterest': true,
|
|
50
|
-
'fetchBorrowRate': true,
|
|
51
50
|
'fetchBorrowRateHistories': true,
|
|
52
51
|
'fetchBorrowRateHistory': true,
|
|
53
|
-
'fetchBorrowRates': true,
|
|
54
|
-
'fetchBorrowRatesPerSymbol': false,
|
|
55
52
|
'fetchCanceledOrders': true,
|
|
56
53
|
'fetchClosedOrder': undefined,
|
|
57
54
|
'fetchClosedOrders': true,
|
|
55
|
+
'fetchCrossBorrowRate': true,
|
|
56
|
+
'fetchCrossBorrowRates': true,
|
|
58
57
|
'fetchCurrencies': true,
|
|
59
58
|
'fetchDeposit': true,
|
|
60
59
|
'fetchDepositAddress': true,
|
|
@@ -70,6 +69,8 @@ class okx extends okx$1 {
|
|
|
70
69
|
'fetchFundingRates': false,
|
|
71
70
|
'fetchGreeks': true,
|
|
72
71
|
'fetchIndexOHLCV': true,
|
|
72
|
+
'fetchIsolatedBorrowRate': false,
|
|
73
|
+
'fetchIsolatedBorrowRates': false,
|
|
73
74
|
'fetchL3OrderBook': false,
|
|
74
75
|
'fetchLedger': true,
|
|
75
76
|
'fetchLedgerEntry': undefined,
|
|
@@ -1163,7 +1164,7 @@ class okx extends okx$1 {
|
|
|
1163
1164
|
* @description the latest known information on the availability of the exchange API
|
|
1164
1165
|
* @see https://www.okx.com/docs-v5/en/#status-get-status
|
|
1165
1166
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
1166
|
-
* @returns {object} a [status structure]{@link https://
|
|
1167
|
+
* @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
|
|
1167
1168
|
*/
|
|
1168
1169
|
const response = await this.publicGetSystemStatus(params);
|
|
1169
1170
|
//
|
|
@@ -1235,7 +1236,7 @@ class okx extends okx$1 {
|
|
|
1235
1236
|
* @description fetch all the accounts associated with a profile
|
|
1236
1237
|
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-account-configuration
|
|
1237
1238
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
1238
|
-
* @returns {object} a dictionary of [account structures]{@link https://
|
|
1239
|
+
* @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
|
|
1239
1240
|
*/
|
|
1240
1241
|
const response = await this.privateGetAccountConfig(params);
|
|
1241
1242
|
//
|
|
@@ -1656,7 +1657,7 @@ class okx extends okx$1 {
|
|
|
1656
1657
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
1657
1658
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
1658
1659
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
1659
|
-
* @returns {object} A dictionary of [order book structures]{@link https://
|
|
1660
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
1660
1661
|
*/
|
|
1661
1662
|
await this.loadMarkets();
|
|
1662
1663
|
const market = this.market(symbol);
|
|
@@ -1757,7 +1758,7 @@ class okx extends okx$1 {
|
|
|
1757
1758
|
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-ticker
|
|
1758
1759
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
1759
1760
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
1760
|
-
* @returns {object} a [ticker structure]{@link https://
|
|
1761
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1761
1762
|
*/
|
|
1762
1763
|
await this.loadMarkets();
|
|
1763
1764
|
const market = this.market(symbol);
|
|
@@ -1848,7 +1849,7 @@ class okx extends okx$1 {
|
|
|
1848
1849
|
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
|
|
1849
1850
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
1850
1851
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
1851
|
-
* @returns {object} a dictionary of [ticker structures]{@link https://
|
|
1852
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1852
1853
|
*/
|
|
1853
1854
|
await this.loadMarkets();
|
|
1854
1855
|
symbols = this.marketSymbols(symbols);
|
|
@@ -1965,7 +1966,7 @@ class okx extends okx$1 {
|
|
|
1965
1966
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
1966
1967
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
1967
1968
|
* @param {boolean} [params.paginate] *only applies to publicGetMarketHistoryTrades* default false, when true will automatically paginate by calling this endpoint multiple times
|
|
1968
|
-
* @returns {Trade[]} a list of [trade structures]{@link https://
|
|
1969
|
+
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
1969
1970
|
*/
|
|
1970
1971
|
await this.loadMarkets();
|
|
1971
1972
|
let paginate = false;
|
|
@@ -2174,12 +2175,14 @@ class okx extends okx$1 {
|
|
|
2174
2175
|
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate-history
|
|
2175
2176
|
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
2176
2177
|
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
|
|
2177
|
-
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://
|
|
2178
|
+
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} to fetch
|
|
2178
2179
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
2179
2180
|
* @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)
|
|
2180
|
-
* @returns {object[]} a list of [funding rate structures]{@link https://
|
|
2181
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
|
|
2181
2182
|
*/
|
|
2182
|
-
|
|
2183
|
+
if (symbol === undefined) {
|
|
2184
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
|
|
2185
|
+
}
|
|
2183
2186
|
await this.loadMarkets();
|
|
2184
2187
|
let paginate = false;
|
|
2185
2188
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
|
|
@@ -2317,7 +2320,7 @@ class okx extends okx$1 {
|
|
|
2317
2320
|
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-fee-rates
|
|
2318
2321
|
* @param {string} symbol unified market symbol
|
|
2319
2322
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
2320
|
-
* @returns {object} a [fee structure]{@link https://
|
|
2323
|
+
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
2321
2324
|
*/
|
|
2322
2325
|
await this.loadMarkets();
|
|
2323
2326
|
const market = this.market(symbol);
|
|
@@ -2367,7 +2370,7 @@ class okx extends okx$1 {
|
|
|
2367
2370
|
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-balance
|
|
2368
2371
|
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-balance
|
|
2369
2372
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
2370
|
-
* @returns {object} a [balance structure]{@link https://
|
|
2373
|
+
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
2371
2374
|
*/
|
|
2372
2375
|
await this.loadMarkets();
|
|
2373
2376
|
const [marketType, query] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
|
|
@@ -2762,7 +2765,7 @@ class okx extends okx$1 {
|
|
|
2762
2765
|
* @param {float} [params.stopLoss.price] used for stop loss limit orders, not used for stop loss market price orders
|
|
2763
2766
|
* @param {string} [params.stopLoss.type] 'market' or 'limit' used to specify the stop loss price type
|
|
2764
2767
|
* @param {string} [params.positionSide] if position mode is one-way: set to 'net', if position mode is hedge-mode: set to 'long' or 'short'
|
|
2765
|
-
* @returns {object} an [order structure]{@link https://
|
|
2768
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2766
2769
|
*/
|
|
2767
2770
|
await this.loadMarkets();
|
|
2768
2771
|
const market = this.market(symbol);
|
|
@@ -2805,7 +2808,7 @@ class okx extends okx$1 {
|
|
|
2805
2808
|
* @description create a list of trade orders
|
|
2806
2809
|
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-multiple-orders
|
|
2807
2810
|
* @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
|
|
2808
|
-
* @returns {object} an [order structure]{@link https://
|
|
2811
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2809
2812
|
*/
|
|
2810
2813
|
await this.loadMarkets();
|
|
2811
2814
|
const ordersRequests = [];
|
|
@@ -2932,7 +2935,7 @@ class okx extends okx$1 {
|
|
|
2932
2935
|
* @param {float} [params.takeProfit.triggerPrice] take profit trigger price
|
|
2933
2936
|
* @param {float} [params.takeProfit.price] used for take profit limit orders, not used for take profit market price orders
|
|
2934
2937
|
* @param {string} [params.takeProfit.type] 'market' or 'limit' used to specify the take profit price type
|
|
2935
|
-
* @returns {object} an [order structure]{@link https://
|
|
2938
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2936
2939
|
*/
|
|
2937
2940
|
await this.loadMarkets();
|
|
2938
2941
|
const market = this.market(symbol);
|
|
@@ -2969,9 +2972,11 @@ class okx extends okx$1 {
|
|
|
2969
2972
|
* @param {string} id order id
|
|
2970
2973
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
2971
2974
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
2972
|
-
* @returns {object} An [order structure]{@link https://
|
|
2975
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2973
2976
|
*/
|
|
2974
|
-
|
|
2977
|
+
if (symbol === undefined) {
|
|
2978
|
+
throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
2979
|
+
}
|
|
2975
2980
|
const stop = this.safeValue(params, 'stop');
|
|
2976
2981
|
if (stop) {
|
|
2977
2982
|
const orderInner = await this.cancelOrders([id], symbol, params);
|
|
@@ -3023,10 +3028,12 @@ class okx extends okx$1 {
|
|
|
3023
3028
|
* @param {string[]} ids order ids
|
|
3024
3029
|
* @param {string} symbol unified market symbol
|
|
3025
3030
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
3026
|
-
* @returns {object} an list of [order structures]{@link https://
|
|
3031
|
+
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3027
3032
|
*/
|
|
3028
3033
|
// 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.
|
|
3029
|
-
|
|
3034
|
+
if (symbol === undefined) {
|
|
3035
|
+
throw new errors.ArgumentsRequired(this.id + ' cancelOrders() requires a symbol argument');
|
|
3036
|
+
}
|
|
3030
3037
|
await this.loadMarkets();
|
|
3031
3038
|
const market = this.market(symbol);
|
|
3032
3039
|
const request = [];
|
|
@@ -3335,9 +3342,11 @@ class okx extends okx$1 {
|
|
|
3335
3342
|
* @param {string} id the order id
|
|
3336
3343
|
* @param {string} symbol unified market symbol
|
|
3337
3344
|
* @param {object} [params] extra and exchange specific parameters
|
|
3338
|
-
* @returns [an order structure]{@link https://
|
|
3345
|
+
* @returns [an order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3339
3346
|
*/
|
|
3340
|
-
|
|
3347
|
+
if (symbol === undefined) {
|
|
3348
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
|
|
3349
|
+
}
|
|
3341
3350
|
await this.loadMarkets();
|
|
3342
3351
|
const market = this.market(symbol);
|
|
3343
3352
|
const request = {
|
|
@@ -3487,7 +3496,7 @@ class okx extends okx$1 {
|
|
|
3487
3496
|
* @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
|
3488
3497
|
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
3489
3498
|
* @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)
|
|
3490
|
-
* @returns {Order[]} a list of [order structures]{@link https://
|
|
3499
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3491
3500
|
*/
|
|
3492
3501
|
await this.loadMarkets();
|
|
3493
3502
|
let paginate = false;
|
|
@@ -3642,7 +3651,7 @@ class okx extends okx$1 {
|
|
|
3642
3651
|
* @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
|
3643
3652
|
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
3644
3653
|
* @param {int} [params.until] timestamp in ms to fetch orders for
|
|
3645
|
-
* @returns {object} a list of [order structures]{@link https://
|
|
3654
|
+
* @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3646
3655
|
*/
|
|
3647
3656
|
await this.loadMarkets();
|
|
3648
3657
|
const request = {
|
|
@@ -3819,7 +3828,7 @@ class okx extends okx$1 {
|
|
|
3819
3828
|
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
3820
3829
|
* @param {int} [params.until] timestamp in ms to fetch orders for
|
|
3821
3830
|
* @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)
|
|
3822
|
-
* @returns {Order[]} a list of [order structures]{@link https://
|
|
3831
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3823
3832
|
*/
|
|
3824
3833
|
await this.loadMarkets();
|
|
3825
3834
|
let paginate = false;
|
|
@@ -3988,7 +3997,7 @@ class okx extends okx$1 {
|
|
|
3988
3997
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
3989
3998
|
* @param {int} [params.until] Timestamp in ms of the latest time to retrieve trades for
|
|
3990
3999
|
* @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)
|
|
3991
|
-
* @returns {Trade[]} a list of [trade structures]{@link https://
|
|
4000
|
+
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
3992
4001
|
*/
|
|
3993
4002
|
await this.loadMarkets();
|
|
3994
4003
|
let paginate = false;
|
|
@@ -4056,7 +4065,7 @@ class okx extends okx$1 {
|
|
|
4056
4065
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
4057
4066
|
* @param {int} [limit] the maximum number of trades to retrieve
|
|
4058
4067
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4059
|
-
* @returns {object[]} a list of [trade structures]{@link https://
|
|
4068
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
4060
4069
|
*/
|
|
4061
4070
|
const request = {
|
|
4062
4071
|
// 'instrument_id': market['id'],
|
|
@@ -4082,7 +4091,7 @@ class okx extends okx$1 {
|
|
|
4082
4091
|
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
4083
4092
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4084
4093
|
* @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)
|
|
4085
|
-
* @returns {object} a [ledger structure]{@link https://
|
|
4094
|
+
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
4086
4095
|
*/
|
|
4087
4096
|
await this.loadMarkets();
|
|
4088
4097
|
let paginate = false;
|
|
@@ -4380,7 +4389,7 @@ class okx extends okx$1 {
|
|
|
4380
4389
|
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-deposit-address
|
|
4381
4390
|
* @param {string} code unified currency code of the currency for the deposit address
|
|
4382
4391
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4383
|
-
* @returns {object} a dictionary of [address structures]{@link https://
|
|
4392
|
+
* @returns {object} a dictionary of [address structures]{@link https://docs.ccxt.com/#/?id=address-structure} indexed by the network
|
|
4384
4393
|
*/
|
|
4385
4394
|
await this.loadMarkets();
|
|
4386
4395
|
const currency = this.currency(code);
|
|
@@ -4422,7 +4431,7 @@ class okx extends okx$1 {
|
|
|
4422
4431
|
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-deposit-address
|
|
4423
4432
|
* @param {string} code unified currency code
|
|
4424
4433
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4425
|
-
* @returns {object} an [address structure]{@link https://
|
|
4434
|
+
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
4426
4435
|
*/
|
|
4427
4436
|
const rawNetwork = this.safeStringUpper(params, 'network');
|
|
4428
4437
|
const networks = this.safeValue(this.options, 'networks', {});
|
|
@@ -4466,7 +4475,7 @@ class okx extends okx$1 {
|
|
|
4466
4475
|
* @param {string} address the address to withdraw to
|
|
4467
4476
|
* @param {string} tag
|
|
4468
4477
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4469
|
-
* @returns {object} a [transaction structure]{@link https://
|
|
4478
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
4470
4479
|
*/
|
|
4471
4480
|
[tag, params] = this.handleWithdrawTagAndParams(tag, params);
|
|
4472
4481
|
this.checkAddress(address);
|
|
@@ -4546,7 +4555,7 @@ class okx extends okx$1 {
|
|
|
4546
4555
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4547
4556
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4548
4557
|
* @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)
|
|
4549
|
-
* @returns {object[]} a list of [transaction structures]{@link https://
|
|
4558
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
4550
4559
|
*/
|
|
4551
4560
|
await this.loadMarkets();
|
|
4552
4561
|
let paginate = false;
|
|
@@ -4624,7 +4633,7 @@ class okx extends okx$1 {
|
|
|
4624
4633
|
* @param {string} id deposit id
|
|
4625
4634
|
* @param {string} code filter by currency code
|
|
4626
4635
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4627
|
-
* @returns {object} a [transaction structure]{@link https://
|
|
4636
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
4628
4637
|
*/
|
|
4629
4638
|
await this.loadMarkets();
|
|
4630
4639
|
const request = {
|
|
@@ -4652,7 +4661,7 @@ class okx extends okx$1 {
|
|
|
4652
4661
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4653
4662
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4654
4663
|
* @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)
|
|
4655
|
-
* @returns {object[]} a list of [transaction structures]{@link https://
|
|
4664
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
4656
4665
|
*/
|
|
4657
4666
|
await this.loadMarkets();
|
|
4658
4667
|
let paginate = false;
|
|
@@ -4722,7 +4731,7 @@ class okx extends okx$1 {
|
|
|
4722
4731
|
* @param {string} id withdrawal id
|
|
4723
4732
|
* @param {string} code unified currency code of the currency withdrawn, default is undefined
|
|
4724
4733
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4725
|
-
* @returns {object} a [transaction structure]{@link https://
|
|
4734
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
4726
4735
|
*/
|
|
4727
4736
|
await this.loadMarkets();
|
|
4728
4737
|
const request = {
|
|
@@ -4902,7 +4911,7 @@ class okx extends okx$1 {
|
|
|
4902
4911
|
* @param {string} symbol unified market symbol
|
|
4903
4912
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4904
4913
|
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
4905
|
-
* @returns {object} a [leverage structure]{@link https://
|
|
4914
|
+
* @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
|
|
4906
4915
|
*/
|
|
4907
4916
|
await this.loadMarkets();
|
|
4908
4917
|
let marginMode = undefined;
|
|
@@ -4944,7 +4953,7 @@ class okx extends okx$1 {
|
|
|
4944
4953
|
* @param {string} symbol unified market symbol of the market the position is held in, default is undefined
|
|
4945
4954
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4946
4955
|
* @param {string} [params.instType] MARGIN, SWAP, FUTURES, OPTION
|
|
4947
|
-
* @returns {object} a [position structure]{@link https://
|
|
4956
|
+
* @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
4948
4957
|
*/
|
|
4949
4958
|
await this.loadMarkets();
|
|
4950
4959
|
const market = this.market(symbol);
|
|
@@ -5020,7 +5029,7 @@ class okx extends okx$1 {
|
|
|
5020
5029
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
5021
5030
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
5022
5031
|
* @param {string} [params.instType] MARGIN, SWAP, FUTURES, OPTION
|
|
5023
|
-
* @returns {object[]} a list of [position structure]{@link https://
|
|
5032
|
+
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
5024
5033
|
*/
|
|
5025
5034
|
await this.loadMarkets();
|
|
5026
5035
|
const request = {
|
|
@@ -5254,7 +5263,7 @@ class okx extends okx$1 {
|
|
|
5254
5263
|
* @param {string} fromAccount account to transfer from
|
|
5255
5264
|
* @param {string} toAccount account to transfer to
|
|
5256
5265
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
5257
|
-
* @returns {object} a [transfer structure]{@link https://
|
|
5266
|
+
* @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
5258
5267
|
*/
|
|
5259
5268
|
await this.loadMarkets();
|
|
5260
5269
|
const currency = this.currency(code);
|
|
@@ -5428,7 +5437,7 @@ class okx extends okx$1 {
|
|
|
5428
5437
|
* @param {int} [since] the earliest time in ms to fetch transfers for
|
|
5429
5438
|
* @param {int} [limit] the maximum number of transfers structures to retrieve
|
|
5430
5439
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
5431
|
-
* @returns {object[]} a list of [transfer structures]{@link https://
|
|
5440
|
+
* @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
5432
5441
|
*/
|
|
5433
5442
|
await this.loadMarkets();
|
|
5434
5443
|
let currency = undefined;
|
|
@@ -5593,7 +5602,7 @@ class okx extends okx$1 {
|
|
|
5593
5602
|
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate
|
|
5594
5603
|
* @param {string} symbol unified market symbol
|
|
5595
5604
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
5596
|
-
* @returns {object} a [funding rate structure]{@link https://
|
|
5605
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
5597
5606
|
*/
|
|
5598
5607
|
await this.loadMarkets();
|
|
5599
5608
|
const market = this.market(symbol);
|
|
@@ -5634,7 +5643,7 @@ class okx extends okx$1 {
|
|
|
5634
5643
|
* @param {int} [since] the earliest time in ms to fetch funding history for
|
|
5635
5644
|
* @param {int} [limit] the maximum number of funding history structures to retrieve
|
|
5636
5645
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
5637
|
-
* @returns {object} a [funding history structure]{@link https://
|
|
5646
|
+
* @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
|
|
5638
5647
|
*/
|
|
5639
5648
|
await this.loadMarkets();
|
|
5640
5649
|
const request = {
|
|
@@ -5796,7 +5805,9 @@ class okx extends okx$1 {
|
|
|
5796
5805
|
* @param {string} [params.posSide] 'long' or 'short' for isolated margin long/short mode on futures and swap markets
|
|
5797
5806
|
* @returns {object} response from the exchange
|
|
5798
5807
|
*/
|
|
5799
|
-
|
|
5808
|
+
if (symbol === undefined) {
|
|
5809
|
+
throw new errors.ArgumentsRequired(this.id + ' setLeverage() requires a symbol argument');
|
|
5810
|
+
}
|
|
5800
5811
|
// WARNING: THIS WILL INCREASE LIQUIDATION PRICE FOR OPEN ISOLATED LONG POSITIONS
|
|
5801
5812
|
// AND DECREASE LIQUIDATION PRICE FOR OPEN ISOLATED SHORT POSITIONS
|
|
5802
5813
|
if ((leverage < 1) || (leverage > 125)) {
|
|
@@ -5890,7 +5901,9 @@ class okx extends okx$1 {
|
|
|
5890
5901
|
* @param {int} [params.leverage] leverage
|
|
5891
5902
|
* @returns {object} response from the exchange
|
|
5892
5903
|
*/
|
|
5893
|
-
|
|
5904
|
+
if (symbol === undefined) {
|
|
5905
|
+
throw new errors.ArgumentsRequired(this.id + ' setMarginMode() requires a symbol argument');
|
|
5906
|
+
}
|
|
5894
5907
|
// WARNING: THIS WILL INCREASE LIQUIDATION PRICE FOR OPEN ISOLATED LONG POSITIONS
|
|
5895
5908
|
// AND DECREASE LIQUIDATION PRICE FOR OPEN ISOLATED SHORT POSITIONS
|
|
5896
5909
|
marginMode = marginMode.toLowerCase();
|
|
@@ -5926,14 +5939,14 @@ class okx extends okx$1 {
|
|
|
5926
5939
|
//
|
|
5927
5940
|
return response;
|
|
5928
5941
|
}
|
|
5929
|
-
async
|
|
5942
|
+
async fetchCrossBorrowRates(params = {}) {
|
|
5930
5943
|
/**
|
|
5931
5944
|
* @method
|
|
5932
|
-
* @name okx#
|
|
5945
|
+
* @name okx#fetchCrossBorrowRates
|
|
5933
5946
|
* @description fetch the borrow interest rates of all currencies
|
|
5934
5947
|
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-interest-rate
|
|
5935
5948
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
5936
|
-
* @returns {object} a list of [borrow rate structures]{@link https://
|
|
5949
|
+
* @returns {object} a list of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
|
|
5937
5950
|
*/
|
|
5938
5951
|
await this.loadMarkets();
|
|
5939
5952
|
const response = await this.privateGetAccountInterestRate(params);
|
|
@@ -5949,32 +5962,22 @@ class okx extends okx$1 {
|
|
|
5949
5962
|
// ],
|
|
5950
5963
|
// }
|
|
5951
5964
|
//
|
|
5952
|
-
const
|
|
5953
|
-
const
|
|
5954
|
-
const rates = {};
|
|
5965
|
+
const data = this.safeValue(response, 'data', []);
|
|
5966
|
+
const rates = [];
|
|
5955
5967
|
for (let i = 0; i < data.length; i++) {
|
|
5956
|
-
|
|
5957
|
-
const code = this.safeCurrencyCode(this.safeString(rate, 'ccy'));
|
|
5958
|
-
rates[code] = {
|
|
5959
|
-
'currency': code,
|
|
5960
|
-
'rate': this.safeNumber(rate, 'interestRate'),
|
|
5961
|
-
'period': 86400000,
|
|
5962
|
-
'timestamp': timestamp,
|
|
5963
|
-
'datetime': this.iso8601(timestamp),
|
|
5964
|
-
'info': rate,
|
|
5965
|
-
};
|
|
5968
|
+
rates.push(this.parseBorrowRate(data[i]));
|
|
5966
5969
|
}
|
|
5967
5970
|
return rates;
|
|
5968
5971
|
}
|
|
5969
|
-
async
|
|
5972
|
+
async fetchCrossBorrowRate(code, params = {}) {
|
|
5970
5973
|
/**
|
|
5971
5974
|
* @method
|
|
5972
|
-
* @name okx#
|
|
5975
|
+
* @name okx#fetchCrossBorrowRate
|
|
5973
5976
|
* @description fetch the rate of interest to borrow a currency for margin trading
|
|
5974
5977
|
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-interest-rate
|
|
5975
5978
|
* @param {string} code unified currency code
|
|
5976
5979
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
5977
|
-
* @returns {object} a [borrow rate structure]{@link https://
|
|
5980
|
+
* @returns {object} a [borrow rate structure]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
|
|
5978
5981
|
*/
|
|
5979
5982
|
await this.loadMarkets();
|
|
5980
5983
|
const currency = this.currency(code);
|
|
@@ -6070,7 +6073,7 @@ class okx extends okx$1 {
|
|
|
6070
6073
|
* @param {int} [since] timestamp in ms of the earliest borrowRate, default is undefined
|
|
6071
6074
|
* @param {int} [limit] max number of borrow rate prices to return, default is undefined
|
|
6072
6075
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
6073
|
-
* @returns {object} a dictionary of [borrow rate structures]{@link https://
|
|
6076
|
+
* @returns {object} a dictionary of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure} indexed by the market symbol
|
|
6074
6077
|
*/
|
|
6075
6078
|
await this.loadMarkets();
|
|
6076
6079
|
const request = {
|
|
@@ -6111,9 +6114,9 @@ class okx extends okx$1 {
|
|
|
6111
6114
|
* @see https://www.okx.com/docs-v5/en/#financial-product-savings-get-public-borrow-history-public
|
|
6112
6115
|
* @param {string} code unified currency code
|
|
6113
6116
|
* @param {int} [since] timestamp for the earliest borrow rate
|
|
6114
|
-
* @param {int} [limit] the maximum number of [borrow rate structures]{@link https://
|
|
6117
|
+
* @param {int} [limit] the maximum number of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure} to retrieve
|
|
6115
6118
|
* @param {object} [params] extra parameters specific to the exchange api endpoint
|
|
6116
|
-
* @returns {object[]} an array of [borrow rate structures]{@link https://
|
|
6119
|
+
* @returns {object[]} an array of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
|
|
6117
6120
|
*/
|
|
6118
6121
|
await this.loadMarkets();
|
|
6119
6122
|
const currency = this.currency(code);
|
|
@@ -6204,7 +6207,7 @@ class okx extends okx$1 {
|
|
|
6204
6207
|
* @param {string} symbol unified market symbol
|
|
6205
6208
|
* @param {float} amount the amount of margin to remove
|
|
6206
6209
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
6207
|
-
* @returns {object} a [margin structure]{@link https://
|
|
6210
|
+
* @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=reduce-margin-structure}
|
|
6208
6211
|
*/
|
|
6209
6212
|
return await this.modifyMarginHelper(symbol, amount, 'reduce', params);
|
|
6210
6213
|
}
|
|
@@ -6217,7 +6220,7 @@ class okx extends okx$1 {
|
|
|
6217
6220
|
* @param {string} symbol unified market symbol
|
|
6218
6221
|
* @param {float} amount amount of margin to add
|
|
6219
6222
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
6220
|
-
* @returns {object} a [margin structure]{@link https://
|
|
6223
|
+
* @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=add-margin-structure}
|
|
6221
6224
|
*/
|
|
6222
6225
|
return await this.modifyMarginHelper(symbol, amount, 'add', params);
|
|
6223
6226
|
}
|
|
@@ -6230,7 +6233,7 @@ class okx extends okx$1 {
|
|
|
6230
6233
|
* @param {string} symbol unified market symbol
|
|
6231
6234
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
6232
6235
|
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
6233
|
-
* @returns {object} a [leverage tiers structure]{@link https://
|
|
6236
|
+
* @returns {object} a [leverage tiers structure]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}
|
|
6234
6237
|
*/
|
|
6235
6238
|
await this.loadMarkets();
|
|
6236
6239
|
const market = this.market(symbol);
|
|
@@ -6328,11 +6331,11 @@ class okx extends okx$1 {
|
|
|
6328
6331
|
* @param {string} code the unified currency code for the currency of the interest
|
|
6329
6332
|
* @param {string} symbol the market symbol of an isolated margin market, if undefined, the interest for cross margin markets is returned
|
|
6330
6333
|
* @param {int} [since] timestamp in ms of the earliest time to receive interest records for
|
|
6331
|
-
* @param {int} [limit] the number of [borrow interest structures]{@link https://
|
|
6334
|
+
* @param {int} [limit] the number of [borrow interest structures]{@link https://docs.ccxt.com/#/?id=borrow-interest-structure} to retrieve
|
|
6332
6335
|
* @param {object} [params] exchange specific parameters
|
|
6333
6336
|
* @param {int} [params.type] Loan type 1 - VIP loans 2 - Market loans *Default is Market loans*
|
|
6334
6337
|
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
6335
|
-
* @returns {object[]} An list of [borrow interest structures]{@link https://
|
|
6338
|
+
* @returns {object[]} An list of [borrow interest structures]{@link https://docs.ccxt.com/#/?id=borrow-interest-structure}
|
|
6336
6339
|
*/
|
|
6337
6340
|
await this.loadMarkets();
|
|
6338
6341
|
let marginMode = undefined;
|
|
@@ -6410,7 +6413,7 @@ class okx extends okx$1 {
|
|
|
6410
6413
|
* @param {float} amount the amount to borrow
|
|
6411
6414
|
* @param {string} symbol not used by okx.borrowMargin ()
|
|
6412
6415
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
6413
|
-
* @returns {object} a [margin loan structure]{@link https://
|
|
6416
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
6414
6417
|
*/
|
|
6415
6418
|
await this.loadMarkets();
|
|
6416
6419
|
const currency = this.currency(code);
|
|
@@ -6454,7 +6457,7 @@ class okx extends okx$1 {
|
|
|
6454
6457
|
* @param {float} amount the amount to repay
|
|
6455
6458
|
* @param {string} symbol not used by okx.repayMargin ()
|
|
6456
6459
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
6457
|
-
* @returns {object} a [margin loan structure]{@link https://
|
|
6460
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
6458
6461
|
*/
|
|
6459
6462
|
await this.loadMarkets();
|
|
6460
6463
|
const currency = this.currency(code);
|
|
@@ -6519,7 +6522,7 @@ class okx extends okx$1 {
|
|
|
6519
6522
|
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-open-interest
|
|
6520
6523
|
* @param {string} symbol Unified CCXT market symbol
|
|
6521
6524
|
* @param {object} [params] exchange specific parameters
|
|
6522
|
-
* @returns {object} an open interest structure{@link https://
|
|
6525
|
+
* @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
6523
6526
|
*/
|
|
6524
6527
|
await this.loadMarkets();
|
|
6525
6528
|
const market = this.market(symbol);
|
|
@@ -6565,7 +6568,7 @@ class okx extends okx$1 {
|
|
|
6565
6568
|
* @param {int} [limit] Not used by okx, but parsed internally by CCXT
|
|
6566
6569
|
* @param {object} [params] Exchange specific parameters
|
|
6567
6570
|
* @param {int} [params.until] The time in ms of the latest record to retrieve as a unix timestamp
|
|
6568
|
-
* @returns An array of [open interest structures]{@link https://
|
|
6571
|
+
* @returns An array of [open interest structures]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
6569
6572
|
*/
|
|
6570
6573
|
const options = this.safeValue(this.options, 'fetchOpenInterestHistory', {});
|
|
6571
6574
|
const timeframes = this.safeValue(options, 'timeframes', {});
|
|
@@ -6696,7 +6699,7 @@ class okx extends okx$1 {
|
|
|
6696
6699
|
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-currencies
|
|
6697
6700
|
* @param {string[]|undefined} codes list of unified currency codes
|
|
6698
6701
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
6699
|
-
* @returns {object[]} a list of [fees structures]{@link https://
|
|
6702
|
+
* @returns {object[]} a list of [fees structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
6700
6703
|
*/
|
|
6701
6704
|
await this.loadMarkets();
|
|
6702
6705
|
const response = await this.privateGetAssetCurrencies(params);
|
|
@@ -6817,11 +6820,13 @@ class okx extends okx$1 {
|
|
|
6817
6820
|
* @param {int} [since] timestamp in ms
|
|
6818
6821
|
* @param {int} [limit] number of records
|
|
6819
6822
|
* @param {object} [params] exchange specific params
|
|
6820
|
-
* @returns {object[]} a list of [settlement history objects]{@link https://
|
|
6823
|
+
* @returns {object[]} a list of [settlement history objects]{@link https://docs.ccxt.com/#/?id=settlement-history-structure}
|
|
6821
6824
|
*/
|
|
6822
|
-
|
|
6825
|
+
if (symbol === undefined) {
|
|
6826
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchSettlementHistory() requires a symbol argument');
|
|
6827
|
+
}
|
|
6823
6828
|
await this.loadMarkets();
|
|
6824
|
-
const market =
|
|
6829
|
+
const market = this.market(symbol);
|
|
6825
6830
|
let type = undefined;
|
|
6826
6831
|
[type, params] = this.handleMarketTypeAndParams('fetchSettlementHistory', market, params);
|
|
6827
6832
|
if (type !== 'future' && type !== 'option') {
|
|
@@ -6914,7 +6919,7 @@ class okx extends okx$1 {
|
|
|
6914
6919
|
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-underlying
|
|
6915
6920
|
* @param {object} [params] exchange specific params
|
|
6916
6921
|
* @param {string} [params.type] the contract market type, 'option', 'swap' or 'future', the default is 'option'
|
|
6917
|
-
* @returns {object[]} a list of [underlying assets]{@link https://
|
|
6922
|
+
* @returns {object[]} a list of [underlying assets]{@link https://docs.ccxt.com/#/?id=underlying-assets-structure}
|
|
6918
6923
|
*/
|
|
6919
6924
|
await this.loadMarkets();
|
|
6920
6925
|
let marketType = undefined;
|
|
@@ -6952,7 +6957,7 @@ class okx extends okx$1 {
|
|
|
6952
6957
|
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-option-market-data
|
|
6953
6958
|
* @param {string} symbol unified symbol of the market to fetch greeks for
|
|
6954
6959
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
6955
|
-
* @returns {object} a [greeks structure]{@link https://
|
|
6960
|
+
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
6956
6961
|
*/
|
|
6957
6962
|
await this.loadMarkets();
|
|
6958
6963
|
const market = this.market(symbol);
|