ccxt 4.1.55 → 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/CONTRIBUTING.md +1 -1
- package/README.md +6 -6
- package/build.sh +30 -8
- package/dist/ccxt.browser.js +5592 -4907
- package/dist/ccxt.browser.min.js +13 -13
- 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 +17 -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 +129 -94
- 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 +101 -78
- 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 +135 -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 +92 -84
- package/dist/cjs/src/p2b.js +80 -83
- 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/bitbank.d.ts +1 -0
- package/js/src/abstract/bybit.d.ts +1 -0
- package/js/src/abstract/cryptocom.d.ts +0 -20
- package/js/src/abstract/htx.d.ts +3 -0
- package/js/src/abstract/huobi.d.ts +3 -0
- package/js/src/abstract/huobipro.d.ts +3 -0
- package/js/src/abstract/okex.d.ts +3 -1
- package/js/src/abstract/okex5.d.ts +3 -1
- package/js/src/abstract/okx.d.ts +3 -1
- 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 +17 -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 +129 -94
- 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 +101 -78
- 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 +135 -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 +92 -84
- package/js/src/p2b.d.ts +8 -7
- package/js/src/p2b.js +80 -82
- 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 +2 -2
- package/js/src/bitstamp1.d.ts +0 -28
- package/js/src/bitstamp1.js +0 -430
- package/js/src/lbank2.d.ts +0 -90
- package/js/src/lbank2.js +0 -2779
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,
|
|
@@ -181,6 +182,7 @@ class okx extends okx$1 {
|
|
|
181
182
|
'market/open-oracle': 50,
|
|
182
183
|
'market/exchange-rate': 20,
|
|
183
184
|
'market/index-components': 1,
|
|
185
|
+
'public/economic-calendar': 50,
|
|
184
186
|
'market/block-tickers': 1,
|
|
185
187
|
'market/block-ticker': 1,
|
|
186
188
|
'public/block-trades': 1,
|
|
@@ -312,7 +314,6 @@ class okx extends okx$1 {
|
|
|
312
314
|
'asset/subaccount/bills': 5 / 3,
|
|
313
315
|
'asset/subaccount/managed-subaccount-bills': 5 / 3,
|
|
314
316
|
'users/entrust-subaccount-list': 10,
|
|
315
|
-
'users/partner/if-rebate': 1,
|
|
316
317
|
'account/subaccount/interest-limits': 4,
|
|
317
318
|
// grid trading
|
|
318
319
|
'tradingBot/grid/orders-algo-pending': 1,
|
|
@@ -359,6 +360,9 @@ class okx extends okx$1 {
|
|
|
359
360
|
'finance/sfp/dcd/orders': 2,
|
|
360
361
|
'broker/fd/rebate-per-orders': 300,
|
|
361
362
|
'broker/fd/if-rebate': 5,
|
|
363
|
+
// affiliate
|
|
364
|
+
'affiliate/invitee/detail': 1,
|
|
365
|
+
'users/partner/if-rebate': 1,
|
|
362
366
|
},
|
|
363
367
|
'post': {
|
|
364
368
|
// rfq
|
|
@@ -1160,7 +1164,7 @@ class okx extends okx$1 {
|
|
|
1160
1164
|
* @description the latest known information on the availability of the exchange API
|
|
1161
1165
|
* @see https://www.okx.com/docs-v5/en/#status-get-status
|
|
1162
1166
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
1163
|
-
* @returns {object} a [status structure]{@link https://
|
|
1167
|
+
* @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
|
|
1164
1168
|
*/
|
|
1165
1169
|
const response = await this.publicGetSystemStatus(params);
|
|
1166
1170
|
//
|
|
@@ -1232,7 +1236,7 @@ class okx extends okx$1 {
|
|
|
1232
1236
|
* @description fetch all the accounts associated with a profile
|
|
1233
1237
|
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-account-configuration
|
|
1234
1238
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
1235
|
-
* @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
|
|
1236
1240
|
*/
|
|
1237
1241
|
const response = await this.privateGetAccountConfig(params);
|
|
1238
1242
|
//
|
|
@@ -1653,7 +1657,7 @@ class okx extends okx$1 {
|
|
|
1653
1657
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
1654
1658
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
1655
1659
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
1656
|
-
* @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
|
|
1657
1661
|
*/
|
|
1658
1662
|
await this.loadMarkets();
|
|
1659
1663
|
const market = this.market(symbol);
|
|
@@ -1754,7 +1758,7 @@ class okx extends okx$1 {
|
|
|
1754
1758
|
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-ticker
|
|
1755
1759
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
1756
1760
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
1757
|
-
* @returns {object} a [ticker structure]{@link https://
|
|
1761
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1758
1762
|
*/
|
|
1759
1763
|
await this.loadMarkets();
|
|
1760
1764
|
const market = this.market(symbol);
|
|
@@ -1845,7 +1849,7 @@ class okx extends okx$1 {
|
|
|
1845
1849
|
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
|
|
1846
1850
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
1847
1851
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
1848
|
-
* @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}
|
|
1849
1853
|
*/
|
|
1850
1854
|
await this.loadMarkets();
|
|
1851
1855
|
symbols = this.marketSymbols(symbols);
|
|
@@ -1962,7 +1966,7 @@ class okx extends okx$1 {
|
|
|
1962
1966
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
1963
1967
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
1964
1968
|
* @param {boolean} [params.paginate] *only applies to publicGetMarketHistoryTrades* default false, when true will automatically paginate by calling this endpoint multiple times
|
|
1965
|
-
* @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}
|
|
1966
1970
|
*/
|
|
1967
1971
|
await this.loadMarkets();
|
|
1968
1972
|
let paginate = false;
|
|
@@ -2171,12 +2175,14 @@ class okx extends okx$1 {
|
|
|
2171
2175
|
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate-history
|
|
2172
2176
|
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
2173
2177
|
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
|
|
2174
|
-
* @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
|
|
2175
2179
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
2176
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)
|
|
2177
|
-
* @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}
|
|
2178
2182
|
*/
|
|
2179
|
-
|
|
2183
|
+
if (symbol === undefined) {
|
|
2184
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
|
|
2185
|
+
}
|
|
2180
2186
|
await this.loadMarkets();
|
|
2181
2187
|
let paginate = false;
|
|
2182
2188
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
|
|
@@ -2314,7 +2320,7 @@ class okx extends okx$1 {
|
|
|
2314
2320
|
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-fee-rates
|
|
2315
2321
|
* @param {string} symbol unified market symbol
|
|
2316
2322
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
2317
|
-
* @returns {object} a [fee structure]{@link https://
|
|
2323
|
+
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
2318
2324
|
*/
|
|
2319
2325
|
await this.loadMarkets();
|
|
2320
2326
|
const market = this.market(symbol);
|
|
@@ -2364,7 +2370,7 @@ class okx extends okx$1 {
|
|
|
2364
2370
|
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-balance
|
|
2365
2371
|
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-balance
|
|
2366
2372
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
2367
|
-
* @returns {object} a [balance structure]{@link https://
|
|
2373
|
+
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
2368
2374
|
*/
|
|
2369
2375
|
await this.loadMarkets();
|
|
2370
2376
|
const [marketType, query] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
|
|
@@ -2615,7 +2621,7 @@ class okx extends okx$1 {
|
|
|
2615
2621
|
else if (fok) {
|
|
2616
2622
|
request['ordType'] = 'fok';
|
|
2617
2623
|
}
|
|
2618
|
-
|
|
2624
|
+
if (stopLossDefined || takeProfitDefined) {
|
|
2619
2625
|
if (stopLossDefined) {
|
|
2620
2626
|
const stopLossTriggerPrice = this.safeValueN(stopLoss, ['triggerPrice', 'stopPrice', 'slTriggerPx']);
|
|
2621
2627
|
if (stopLossTriggerPrice === undefined) {
|
|
@@ -2759,7 +2765,7 @@ class okx extends okx$1 {
|
|
|
2759
2765
|
* @param {float} [params.stopLoss.price] used for stop loss limit orders, not used for stop loss market price orders
|
|
2760
2766
|
* @param {string} [params.stopLoss.type] 'market' or 'limit' used to specify the stop loss price type
|
|
2761
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'
|
|
2762
|
-
* @returns {object} an [order structure]{@link https://
|
|
2768
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2763
2769
|
*/
|
|
2764
2770
|
await this.loadMarkets();
|
|
2765
2771
|
const market = this.market(symbol);
|
|
@@ -2802,7 +2808,7 @@ class okx extends okx$1 {
|
|
|
2802
2808
|
* @description create a list of trade orders
|
|
2803
2809
|
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-multiple-orders
|
|
2804
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
|
|
2805
|
-
* @returns {object} an [order structure]{@link https://
|
|
2811
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2806
2812
|
*/
|
|
2807
2813
|
await this.loadMarkets();
|
|
2808
2814
|
const ordersRequests = [];
|
|
@@ -2929,7 +2935,7 @@ class okx extends okx$1 {
|
|
|
2929
2935
|
* @param {float} [params.takeProfit.triggerPrice] take profit trigger price
|
|
2930
2936
|
* @param {float} [params.takeProfit.price] used for take profit limit orders, not used for take profit market price orders
|
|
2931
2937
|
* @param {string} [params.takeProfit.type] 'market' or 'limit' used to specify the take profit price type
|
|
2932
|
-
* @returns {object} an [order structure]{@link https://
|
|
2938
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2933
2939
|
*/
|
|
2934
2940
|
await this.loadMarkets();
|
|
2935
2941
|
const market = this.market(symbol);
|
|
@@ -2966,9 +2972,11 @@ class okx extends okx$1 {
|
|
|
2966
2972
|
* @param {string} id order id
|
|
2967
2973
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
2968
2974
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
2969
|
-
* @returns {object} An [order structure]{@link https://
|
|
2975
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2970
2976
|
*/
|
|
2971
|
-
|
|
2977
|
+
if (symbol === undefined) {
|
|
2978
|
+
throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
2979
|
+
}
|
|
2972
2980
|
const stop = this.safeValue(params, 'stop');
|
|
2973
2981
|
if (stop) {
|
|
2974
2982
|
const orderInner = await this.cancelOrders([id], symbol, params);
|
|
@@ -3020,10 +3028,12 @@ class okx extends okx$1 {
|
|
|
3020
3028
|
* @param {string[]} ids order ids
|
|
3021
3029
|
* @param {string} symbol unified market symbol
|
|
3022
3030
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
3023
|
-
* @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}
|
|
3024
3032
|
*/
|
|
3025
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.
|
|
3026
|
-
|
|
3034
|
+
if (symbol === undefined) {
|
|
3035
|
+
throw new errors.ArgumentsRequired(this.id + ' cancelOrders() requires a symbol argument');
|
|
3036
|
+
}
|
|
3027
3037
|
await this.loadMarkets();
|
|
3028
3038
|
const market = this.market(symbol);
|
|
3029
3039
|
const request = [];
|
|
@@ -3332,9 +3342,11 @@ class okx extends okx$1 {
|
|
|
3332
3342
|
* @param {string} id the order id
|
|
3333
3343
|
* @param {string} symbol unified market symbol
|
|
3334
3344
|
* @param {object} [params] extra and exchange specific parameters
|
|
3335
|
-
* @returns [an order structure]{@link https://
|
|
3345
|
+
* @returns [an order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3336
3346
|
*/
|
|
3337
|
-
|
|
3347
|
+
if (symbol === undefined) {
|
|
3348
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
|
|
3349
|
+
}
|
|
3338
3350
|
await this.loadMarkets();
|
|
3339
3351
|
const market = this.market(symbol);
|
|
3340
3352
|
const request = {
|
|
@@ -3484,7 +3496,7 @@ class okx extends okx$1 {
|
|
|
3484
3496
|
* @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
|
3485
3497
|
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
3486
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)
|
|
3487
|
-
* @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}
|
|
3488
3500
|
*/
|
|
3489
3501
|
await this.loadMarkets();
|
|
3490
3502
|
let paginate = false;
|
|
@@ -3639,7 +3651,7 @@ class okx extends okx$1 {
|
|
|
3639
3651
|
* @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
|
3640
3652
|
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
3641
3653
|
* @param {int} [params.until] timestamp in ms to fetch orders for
|
|
3642
|
-
* @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}
|
|
3643
3655
|
*/
|
|
3644
3656
|
await this.loadMarkets();
|
|
3645
3657
|
const request = {
|
|
@@ -3816,7 +3828,7 @@ class okx extends okx$1 {
|
|
|
3816
3828
|
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
3817
3829
|
* @param {int} [params.until] timestamp in ms to fetch orders for
|
|
3818
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)
|
|
3819
|
-
* @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}
|
|
3820
3832
|
*/
|
|
3821
3833
|
await this.loadMarkets();
|
|
3822
3834
|
let paginate = false;
|
|
@@ -3985,7 +3997,7 @@ class okx extends okx$1 {
|
|
|
3985
3997
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
3986
3998
|
* @param {int} [params.until] Timestamp in ms of the latest time to retrieve trades for
|
|
3987
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)
|
|
3988
|
-
* @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}
|
|
3989
4001
|
*/
|
|
3990
4002
|
await this.loadMarkets();
|
|
3991
4003
|
let paginate = false;
|
|
@@ -4053,7 +4065,7 @@ class okx extends okx$1 {
|
|
|
4053
4065
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
4054
4066
|
* @param {int} [limit] the maximum number of trades to retrieve
|
|
4055
4067
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4056
|
-
* @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}
|
|
4057
4069
|
*/
|
|
4058
4070
|
const request = {
|
|
4059
4071
|
// 'instrument_id': market['id'],
|
|
@@ -4079,7 +4091,7 @@ class okx extends okx$1 {
|
|
|
4079
4091
|
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
4080
4092
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4081
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)
|
|
4082
|
-
* @returns {object} a [ledger structure]{@link https://
|
|
4094
|
+
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
4083
4095
|
*/
|
|
4084
4096
|
await this.loadMarkets();
|
|
4085
4097
|
let paginate = false;
|
|
@@ -4377,7 +4389,7 @@ class okx extends okx$1 {
|
|
|
4377
4389
|
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-deposit-address
|
|
4378
4390
|
* @param {string} code unified currency code of the currency for the deposit address
|
|
4379
4391
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4380
|
-
* @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
|
|
4381
4393
|
*/
|
|
4382
4394
|
await this.loadMarkets();
|
|
4383
4395
|
const currency = this.currency(code);
|
|
@@ -4419,7 +4431,7 @@ class okx extends okx$1 {
|
|
|
4419
4431
|
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-deposit-address
|
|
4420
4432
|
* @param {string} code unified currency code
|
|
4421
4433
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4422
|
-
* @returns {object} an [address structure]{@link https://
|
|
4434
|
+
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
4423
4435
|
*/
|
|
4424
4436
|
const rawNetwork = this.safeStringUpper(params, 'network');
|
|
4425
4437
|
const networks = this.safeValue(this.options, 'networks', {});
|
|
@@ -4463,7 +4475,7 @@ class okx extends okx$1 {
|
|
|
4463
4475
|
* @param {string} address the address to withdraw to
|
|
4464
4476
|
* @param {string} tag
|
|
4465
4477
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4466
|
-
* @returns {object} a [transaction structure]{@link https://
|
|
4478
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
4467
4479
|
*/
|
|
4468
4480
|
[tag, params] = this.handleWithdrawTagAndParams(tag, params);
|
|
4469
4481
|
this.checkAddress(address);
|
|
@@ -4543,7 +4555,7 @@ class okx extends okx$1 {
|
|
|
4543
4555
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4544
4556
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4545
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)
|
|
4546
|
-
* @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}
|
|
4547
4559
|
*/
|
|
4548
4560
|
await this.loadMarkets();
|
|
4549
4561
|
let paginate = false;
|
|
@@ -4621,7 +4633,7 @@ class okx extends okx$1 {
|
|
|
4621
4633
|
* @param {string} id deposit id
|
|
4622
4634
|
* @param {string} code filter by currency code
|
|
4623
4635
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4624
|
-
* @returns {object} a [transaction structure]{@link https://
|
|
4636
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
4625
4637
|
*/
|
|
4626
4638
|
await this.loadMarkets();
|
|
4627
4639
|
const request = {
|
|
@@ -4649,7 +4661,7 @@ class okx extends okx$1 {
|
|
|
4649
4661
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4650
4662
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4651
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)
|
|
4652
|
-
* @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}
|
|
4653
4665
|
*/
|
|
4654
4666
|
await this.loadMarkets();
|
|
4655
4667
|
let paginate = false;
|
|
@@ -4719,7 +4731,7 @@ class okx extends okx$1 {
|
|
|
4719
4731
|
* @param {string} id withdrawal id
|
|
4720
4732
|
* @param {string} code unified currency code of the currency withdrawn, default is undefined
|
|
4721
4733
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4722
|
-
* @returns {object} a [transaction structure]{@link https://
|
|
4734
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
4723
4735
|
*/
|
|
4724
4736
|
await this.loadMarkets();
|
|
4725
4737
|
const request = {
|
|
@@ -4899,7 +4911,7 @@ class okx extends okx$1 {
|
|
|
4899
4911
|
* @param {string} symbol unified market symbol
|
|
4900
4912
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4901
4913
|
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
4902
|
-
* @returns {object} a [leverage structure]{@link https://
|
|
4914
|
+
* @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
|
|
4903
4915
|
*/
|
|
4904
4916
|
await this.loadMarkets();
|
|
4905
4917
|
let marginMode = undefined;
|
|
@@ -4941,7 +4953,7 @@ class okx extends okx$1 {
|
|
|
4941
4953
|
* @param {string} symbol unified market symbol of the market the position is held in, default is undefined
|
|
4942
4954
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4943
4955
|
* @param {string} [params.instType] MARGIN, SWAP, FUTURES, OPTION
|
|
4944
|
-
* @returns {object} a [position structure]{@link https://
|
|
4956
|
+
* @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
4945
4957
|
*/
|
|
4946
4958
|
await this.loadMarkets();
|
|
4947
4959
|
const market = this.market(symbol);
|
|
@@ -5017,7 +5029,7 @@ class okx extends okx$1 {
|
|
|
5017
5029
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
5018
5030
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
5019
5031
|
* @param {string} [params.instType] MARGIN, SWAP, FUTURES, OPTION
|
|
5020
|
-
* @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}
|
|
5021
5033
|
*/
|
|
5022
5034
|
await this.loadMarkets();
|
|
5023
5035
|
const request = {
|
|
@@ -5251,7 +5263,7 @@ class okx extends okx$1 {
|
|
|
5251
5263
|
* @param {string} fromAccount account to transfer from
|
|
5252
5264
|
* @param {string} toAccount account to transfer to
|
|
5253
5265
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
5254
|
-
* @returns {object} a [transfer structure]{@link https://
|
|
5266
|
+
* @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
5255
5267
|
*/
|
|
5256
5268
|
await this.loadMarkets();
|
|
5257
5269
|
const currency = this.currency(code);
|
|
@@ -5425,7 +5437,7 @@ class okx extends okx$1 {
|
|
|
5425
5437
|
* @param {int} [since] the earliest time in ms to fetch transfers for
|
|
5426
5438
|
* @param {int} [limit] the maximum number of transfers structures to retrieve
|
|
5427
5439
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
5428
|
-
* @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}
|
|
5429
5441
|
*/
|
|
5430
5442
|
await this.loadMarkets();
|
|
5431
5443
|
let currency = undefined;
|
|
@@ -5590,7 +5602,7 @@ class okx extends okx$1 {
|
|
|
5590
5602
|
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate
|
|
5591
5603
|
* @param {string} symbol unified market symbol
|
|
5592
5604
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
5593
|
-
* @returns {object} a [funding rate structure]{@link https://
|
|
5605
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
5594
5606
|
*/
|
|
5595
5607
|
await this.loadMarkets();
|
|
5596
5608
|
const market = this.market(symbol);
|
|
@@ -5631,7 +5643,7 @@ class okx extends okx$1 {
|
|
|
5631
5643
|
* @param {int} [since] the earliest time in ms to fetch funding history for
|
|
5632
5644
|
* @param {int} [limit] the maximum number of funding history structures to retrieve
|
|
5633
5645
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
5634
|
-
* @returns {object} a [funding history structure]{@link https://
|
|
5646
|
+
* @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
|
|
5635
5647
|
*/
|
|
5636
5648
|
await this.loadMarkets();
|
|
5637
5649
|
const request = {
|
|
@@ -5793,7 +5805,9 @@ class okx extends okx$1 {
|
|
|
5793
5805
|
* @param {string} [params.posSide] 'long' or 'short' for isolated margin long/short mode on futures and swap markets
|
|
5794
5806
|
* @returns {object} response from the exchange
|
|
5795
5807
|
*/
|
|
5796
|
-
|
|
5808
|
+
if (symbol === undefined) {
|
|
5809
|
+
throw new errors.ArgumentsRequired(this.id + ' setLeverage() requires a symbol argument');
|
|
5810
|
+
}
|
|
5797
5811
|
// WARNING: THIS WILL INCREASE LIQUIDATION PRICE FOR OPEN ISOLATED LONG POSITIONS
|
|
5798
5812
|
// AND DECREASE LIQUIDATION PRICE FOR OPEN ISOLATED SHORT POSITIONS
|
|
5799
5813
|
if ((leverage < 1) || (leverage > 125)) {
|
|
@@ -5887,7 +5901,9 @@ class okx extends okx$1 {
|
|
|
5887
5901
|
* @param {int} [params.leverage] leverage
|
|
5888
5902
|
* @returns {object} response from the exchange
|
|
5889
5903
|
*/
|
|
5890
|
-
|
|
5904
|
+
if (symbol === undefined) {
|
|
5905
|
+
throw new errors.ArgumentsRequired(this.id + ' setMarginMode() requires a symbol argument');
|
|
5906
|
+
}
|
|
5891
5907
|
// WARNING: THIS WILL INCREASE LIQUIDATION PRICE FOR OPEN ISOLATED LONG POSITIONS
|
|
5892
5908
|
// AND DECREASE LIQUIDATION PRICE FOR OPEN ISOLATED SHORT POSITIONS
|
|
5893
5909
|
marginMode = marginMode.toLowerCase();
|
|
@@ -5923,14 +5939,14 @@ class okx extends okx$1 {
|
|
|
5923
5939
|
//
|
|
5924
5940
|
return response;
|
|
5925
5941
|
}
|
|
5926
|
-
async
|
|
5942
|
+
async fetchCrossBorrowRates(params = {}) {
|
|
5927
5943
|
/**
|
|
5928
5944
|
* @method
|
|
5929
|
-
* @name okx#
|
|
5945
|
+
* @name okx#fetchCrossBorrowRates
|
|
5930
5946
|
* @description fetch the borrow interest rates of all currencies
|
|
5931
5947
|
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-interest-rate
|
|
5932
5948
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
5933
|
-
* @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}
|
|
5934
5950
|
*/
|
|
5935
5951
|
await this.loadMarkets();
|
|
5936
5952
|
const response = await this.privateGetAccountInterestRate(params);
|
|
@@ -5946,32 +5962,22 @@ class okx extends okx$1 {
|
|
|
5946
5962
|
// ],
|
|
5947
5963
|
// }
|
|
5948
5964
|
//
|
|
5949
|
-
const
|
|
5950
|
-
const
|
|
5951
|
-
const rates = {};
|
|
5965
|
+
const data = this.safeValue(response, 'data', []);
|
|
5966
|
+
const rates = [];
|
|
5952
5967
|
for (let i = 0; i < data.length; i++) {
|
|
5953
|
-
|
|
5954
|
-
const code = this.safeCurrencyCode(this.safeString(rate, 'ccy'));
|
|
5955
|
-
rates[code] = {
|
|
5956
|
-
'currency': code,
|
|
5957
|
-
'rate': this.safeNumber(rate, 'interestRate'),
|
|
5958
|
-
'period': 86400000,
|
|
5959
|
-
'timestamp': timestamp,
|
|
5960
|
-
'datetime': this.iso8601(timestamp),
|
|
5961
|
-
'info': rate,
|
|
5962
|
-
};
|
|
5968
|
+
rates.push(this.parseBorrowRate(data[i]));
|
|
5963
5969
|
}
|
|
5964
5970
|
return rates;
|
|
5965
5971
|
}
|
|
5966
|
-
async
|
|
5972
|
+
async fetchCrossBorrowRate(code, params = {}) {
|
|
5967
5973
|
/**
|
|
5968
5974
|
* @method
|
|
5969
|
-
* @name okx#
|
|
5975
|
+
* @name okx#fetchCrossBorrowRate
|
|
5970
5976
|
* @description fetch the rate of interest to borrow a currency for margin trading
|
|
5971
5977
|
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-interest-rate
|
|
5972
5978
|
* @param {string} code unified currency code
|
|
5973
5979
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
5974
|
-
* @returns {object} a [borrow rate structure]{@link https://
|
|
5980
|
+
* @returns {object} a [borrow rate structure]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
|
|
5975
5981
|
*/
|
|
5976
5982
|
await this.loadMarkets();
|
|
5977
5983
|
const currency = this.currency(code);
|
|
@@ -6067,7 +6073,7 @@ class okx extends okx$1 {
|
|
|
6067
6073
|
* @param {int} [since] timestamp in ms of the earliest borrowRate, default is undefined
|
|
6068
6074
|
* @param {int} [limit] max number of borrow rate prices to return, default is undefined
|
|
6069
6075
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
6070
|
-
* @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
|
|
6071
6077
|
*/
|
|
6072
6078
|
await this.loadMarkets();
|
|
6073
6079
|
const request = {
|
|
@@ -6108,9 +6114,9 @@ class okx extends okx$1 {
|
|
|
6108
6114
|
* @see https://www.okx.com/docs-v5/en/#financial-product-savings-get-public-borrow-history-public
|
|
6109
6115
|
* @param {string} code unified currency code
|
|
6110
6116
|
* @param {int} [since] timestamp for the earliest borrow rate
|
|
6111
|
-
* @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
|
|
6112
6118
|
* @param {object} [params] extra parameters specific to the exchange api endpoint
|
|
6113
|
-
* @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}
|
|
6114
6120
|
*/
|
|
6115
6121
|
await this.loadMarkets();
|
|
6116
6122
|
const currency = this.currency(code);
|
|
@@ -6201,7 +6207,7 @@ class okx extends okx$1 {
|
|
|
6201
6207
|
* @param {string} symbol unified market symbol
|
|
6202
6208
|
* @param {float} amount the amount of margin to remove
|
|
6203
6209
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
6204
|
-
* @returns {object} a [margin structure]{@link https://
|
|
6210
|
+
* @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=reduce-margin-structure}
|
|
6205
6211
|
*/
|
|
6206
6212
|
return await this.modifyMarginHelper(symbol, amount, 'reduce', params);
|
|
6207
6213
|
}
|
|
@@ -6214,7 +6220,7 @@ class okx extends okx$1 {
|
|
|
6214
6220
|
* @param {string} symbol unified market symbol
|
|
6215
6221
|
* @param {float} amount amount of margin to add
|
|
6216
6222
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
6217
|
-
* @returns {object} a [margin structure]{@link https://
|
|
6223
|
+
* @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=add-margin-structure}
|
|
6218
6224
|
*/
|
|
6219
6225
|
return await this.modifyMarginHelper(symbol, amount, 'add', params);
|
|
6220
6226
|
}
|
|
@@ -6227,7 +6233,7 @@ class okx extends okx$1 {
|
|
|
6227
6233
|
* @param {string} symbol unified market symbol
|
|
6228
6234
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
6229
6235
|
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
6230
|
-
* @returns {object} a [leverage tiers structure]{@link https://
|
|
6236
|
+
* @returns {object} a [leverage tiers structure]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}
|
|
6231
6237
|
*/
|
|
6232
6238
|
await this.loadMarkets();
|
|
6233
6239
|
const market = this.market(symbol);
|
|
@@ -6325,11 +6331,11 @@ class okx extends okx$1 {
|
|
|
6325
6331
|
* @param {string} code the unified currency code for the currency of the interest
|
|
6326
6332
|
* @param {string} symbol the market symbol of an isolated margin market, if undefined, the interest for cross margin markets is returned
|
|
6327
6333
|
* @param {int} [since] timestamp in ms of the earliest time to receive interest records for
|
|
6328
|
-
* @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
|
|
6329
6335
|
* @param {object} [params] exchange specific parameters
|
|
6330
6336
|
* @param {int} [params.type] Loan type 1 - VIP loans 2 - Market loans *Default is Market loans*
|
|
6331
6337
|
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
6332
|
-
* @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}
|
|
6333
6339
|
*/
|
|
6334
6340
|
await this.loadMarkets();
|
|
6335
6341
|
let marginMode = undefined;
|
|
@@ -6407,7 +6413,7 @@ class okx extends okx$1 {
|
|
|
6407
6413
|
* @param {float} amount the amount to borrow
|
|
6408
6414
|
* @param {string} symbol not used by okx.borrowMargin ()
|
|
6409
6415
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
6410
|
-
* @returns {object} a [margin loan structure]{@link https://
|
|
6416
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
6411
6417
|
*/
|
|
6412
6418
|
await this.loadMarkets();
|
|
6413
6419
|
const currency = this.currency(code);
|
|
@@ -6451,7 +6457,7 @@ class okx extends okx$1 {
|
|
|
6451
6457
|
* @param {float} amount the amount to repay
|
|
6452
6458
|
* @param {string} symbol not used by okx.repayMargin ()
|
|
6453
6459
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
6454
|
-
* @returns {object} a [margin loan structure]{@link https://
|
|
6460
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
6455
6461
|
*/
|
|
6456
6462
|
await this.loadMarkets();
|
|
6457
6463
|
const currency = this.currency(code);
|
|
@@ -6516,7 +6522,7 @@ class okx extends okx$1 {
|
|
|
6516
6522
|
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-open-interest
|
|
6517
6523
|
* @param {string} symbol Unified CCXT market symbol
|
|
6518
6524
|
* @param {object} [params] exchange specific parameters
|
|
6519
|
-
* @returns {object} an open interest structure{@link https://
|
|
6525
|
+
* @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
6520
6526
|
*/
|
|
6521
6527
|
await this.loadMarkets();
|
|
6522
6528
|
const market = this.market(symbol);
|
|
@@ -6562,7 +6568,7 @@ class okx extends okx$1 {
|
|
|
6562
6568
|
* @param {int} [limit] Not used by okx, but parsed internally by CCXT
|
|
6563
6569
|
* @param {object} [params] Exchange specific parameters
|
|
6564
6570
|
* @param {int} [params.until] The time in ms of the latest record to retrieve as a unix timestamp
|
|
6565
|
-
* @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}
|
|
6566
6572
|
*/
|
|
6567
6573
|
const options = this.safeValue(this.options, 'fetchOpenInterestHistory', {});
|
|
6568
6574
|
const timeframes = this.safeValue(options, 'timeframes', {});
|
|
@@ -6693,7 +6699,7 @@ class okx extends okx$1 {
|
|
|
6693
6699
|
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-currencies
|
|
6694
6700
|
* @param {string[]|undefined} codes list of unified currency codes
|
|
6695
6701
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
6696
|
-
* @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}
|
|
6697
6703
|
*/
|
|
6698
6704
|
await this.loadMarkets();
|
|
6699
6705
|
const response = await this.privateGetAssetCurrencies(params);
|
|
@@ -6814,11 +6820,13 @@ class okx extends okx$1 {
|
|
|
6814
6820
|
* @param {int} [since] timestamp in ms
|
|
6815
6821
|
* @param {int} [limit] number of records
|
|
6816
6822
|
* @param {object} [params] exchange specific params
|
|
6817
|
-
* @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}
|
|
6818
6824
|
*/
|
|
6819
|
-
|
|
6825
|
+
if (symbol === undefined) {
|
|
6826
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchSettlementHistory() requires a symbol argument');
|
|
6827
|
+
}
|
|
6820
6828
|
await this.loadMarkets();
|
|
6821
|
-
const market =
|
|
6829
|
+
const market = this.market(symbol);
|
|
6822
6830
|
let type = undefined;
|
|
6823
6831
|
[type, params] = this.handleMarketTypeAndParams('fetchSettlementHistory', market, params);
|
|
6824
6832
|
if (type !== 'future' && type !== 'option') {
|
|
@@ -6911,7 +6919,7 @@ class okx extends okx$1 {
|
|
|
6911
6919
|
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-underlying
|
|
6912
6920
|
* @param {object} [params] exchange specific params
|
|
6913
6921
|
* @param {string} [params.type] the contract market type, 'option', 'swap' or 'future', the default is 'option'
|
|
6914
|
-
* @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}
|
|
6915
6923
|
*/
|
|
6916
6924
|
await this.loadMarkets();
|
|
6917
6925
|
let marketType = undefined;
|
|
@@ -6949,7 +6957,7 @@ class okx extends okx$1 {
|
|
|
6949
6957
|
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-option-market-data
|
|
6950
6958
|
* @param {string} symbol unified symbol of the market to fetch greeks for
|
|
6951
6959
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
6952
|
-
* @returns {object} a [greeks structure]{@link https://
|
|
6960
|
+
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
6953
6961
|
*/
|
|
6954
6962
|
await this.loadMarkets();
|
|
6955
6963
|
const market = this.market(symbol);
|