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/js/src/okx.js
CHANGED
|
@@ -50,14 +50,13 @@ export default class okx extends Exchange {
|
|
|
50
50
|
'fetchBalance': true,
|
|
51
51
|
'fetchBidsAsks': undefined,
|
|
52
52
|
'fetchBorrowInterest': true,
|
|
53
|
-
'fetchBorrowRate': true,
|
|
54
53
|
'fetchBorrowRateHistories': true,
|
|
55
54
|
'fetchBorrowRateHistory': true,
|
|
56
|
-
'fetchBorrowRates': true,
|
|
57
|
-
'fetchBorrowRatesPerSymbol': false,
|
|
58
55
|
'fetchCanceledOrders': true,
|
|
59
56
|
'fetchClosedOrder': undefined,
|
|
60
57
|
'fetchClosedOrders': true,
|
|
58
|
+
'fetchCrossBorrowRate': true,
|
|
59
|
+
'fetchCrossBorrowRates': true,
|
|
61
60
|
'fetchCurrencies': true,
|
|
62
61
|
'fetchDeposit': true,
|
|
63
62
|
'fetchDepositAddress': true,
|
|
@@ -73,6 +72,8 @@ export default class okx extends Exchange {
|
|
|
73
72
|
'fetchFundingRates': false,
|
|
74
73
|
'fetchGreeks': true,
|
|
75
74
|
'fetchIndexOHLCV': true,
|
|
75
|
+
'fetchIsolatedBorrowRate': false,
|
|
76
|
+
'fetchIsolatedBorrowRates': false,
|
|
76
77
|
'fetchL3OrderBook': false,
|
|
77
78
|
'fetchLedger': true,
|
|
78
79
|
'fetchLedgerEntry': undefined,
|
|
@@ -184,6 +185,7 @@ export default class okx extends Exchange {
|
|
|
184
185
|
'market/open-oracle': 50,
|
|
185
186
|
'market/exchange-rate': 20,
|
|
186
187
|
'market/index-components': 1,
|
|
188
|
+
'public/economic-calendar': 50,
|
|
187
189
|
'market/block-tickers': 1,
|
|
188
190
|
'market/block-ticker': 1,
|
|
189
191
|
'public/block-trades': 1,
|
|
@@ -315,7 +317,6 @@ export default class okx extends Exchange {
|
|
|
315
317
|
'asset/subaccount/bills': 5 / 3,
|
|
316
318
|
'asset/subaccount/managed-subaccount-bills': 5 / 3,
|
|
317
319
|
'users/entrust-subaccount-list': 10,
|
|
318
|
-
'users/partner/if-rebate': 1,
|
|
319
320
|
'account/subaccount/interest-limits': 4,
|
|
320
321
|
// grid trading
|
|
321
322
|
'tradingBot/grid/orders-algo-pending': 1,
|
|
@@ -362,6 +363,9 @@ export default class okx extends Exchange {
|
|
|
362
363
|
'finance/sfp/dcd/orders': 2,
|
|
363
364
|
'broker/fd/rebate-per-orders': 300,
|
|
364
365
|
'broker/fd/if-rebate': 5,
|
|
366
|
+
// affiliate
|
|
367
|
+
'affiliate/invitee/detail': 1,
|
|
368
|
+
'users/partner/if-rebate': 1,
|
|
365
369
|
},
|
|
366
370
|
'post': {
|
|
367
371
|
// rfq
|
|
@@ -1163,7 +1167,7 @@ export default class okx extends Exchange {
|
|
|
1163
1167
|
* @description the latest known information on the availability of the exchange API
|
|
1164
1168
|
* @see https://www.okx.com/docs-v5/en/#status-get-status
|
|
1165
1169
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
1166
|
-
* @returns {object} a [status structure]{@link https://
|
|
1170
|
+
* @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
|
|
1167
1171
|
*/
|
|
1168
1172
|
const response = await this.publicGetSystemStatus(params);
|
|
1169
1173
|
//
|
|
@@ -1235,7 +1239,7 @@ export default class okx extends Exchange {
|
|
|
1235
1239
|
* @description fetch all the accounts associated with a profile
|
|
1236
1240
|
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-account-configuration
|
|
1237
1241
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
1238
|
-
* @returns {object} a dictionary of [account structures]{@link https://
|
|
1242
|
+
* @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
|
|
1239
1243
|
*/
|
|
1240
1244
|
const response = await this.privateGetAccountConfig(params);
|
|
1241
1245
|
//
|
|
@@ -1656,7 +1660,7 @@ export default class okx extends Exchange {
|
|
|
1656
1660
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
1657
1661
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
1658
1662
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
1659
|
-
* @returns {object} A dictionary of [order book structures]{@link https://
|
|
1663
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
1660
1664
|
*/
|
|
1661
1665
|
await this.loadMarkets();
|
|
1662
1666
|
const market = this.market(symbol);
|
|
@@ -1757,7 +1761,7 @@ export default class okx extends Exchange {
|
|
|
1757
1761
|
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-ticker
|
|
1758
1762
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
1759
1763
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
1760
|
-
* @returns {object} a [ticker structure]{@link https://
|
|
1764
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1761
1765
|
*/
|
|
1762
1766
|
await this.loadMarkets();
|
|
1763
1767
|
const market = this.market(symbol);
|
|
@@ -1848,7 +1852,7 @@ export default class okx extends Exchange {
|
|
|
1848
1852
|
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
|
|
1849
1853
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
1850
1854
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
1851
|
-
* @returns {object} a dictionary of [ticker structures]{@link https://
|
|
1855
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1852
1856
|
*/
|
|
1853
1857
|
await this.loadMarkets();
|
|
1854
1858
|
symbols = this.marketSymbols(symbols);
|
|
@@ -1965,7 +1969,7 @@ export default class okx extends Exchange {
|
|
|
1965
1969
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
1966
1970
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
1967
1971
|
* @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://
|
|
1972
|
+
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
1969
1973
|
*/
|
|
1970
1974
|
await this.loadMarkets();
|
|
1971
1975
|
let paginate = false;
|
|
@@ -2174,12 +2178,14 @@ export default class okx extends Exchange {
|
|
|
2174
2178
|
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate-history
|
|
2175
2179
|
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
2176
2180
|
* @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://
|
|
2181
|
+
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} to fetch
|
|
2178
2182
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
2179
2183
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
2180
|
-
* @returns {object[]} a list of [funding rate structures]{@link https://
|
|
2184
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
|
|
2181
2185
|
*/
|
|
2182
|
-
|
|
2186
|
+
if (symbol === undefined) {
|
|
2187
|
+
throw new ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
|
|
2188
|
+
}
|
|
2183
2189
|
await this.loadMarkets();
|
|
2184
2190
|
let paginate = false;
|
|
2185
2191
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
|
|
@@ -2317,7 +2323,7 @@ export default class okx extends Exchange {
|
|
|
2317
2323
|
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-fee-rates
|
|
2318
2324
|
* @param {string} symbol unified market symbol
|
|
2319
2325
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
2320
|
-
* @returns {object} a [fee structure]{@link https://
|
|
2326
|
+
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
2321
2327
|
*/
|
|
2322
2328
|
await this.loadMarkets();
|
|
2323
2329
|
const market = this.market(symbol);
|
|
@@ -2367,7 +2373,7 @@ export default class okx extends Exchange {
|
|
|
2367
2373
|
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-balance
|
|
2368
2374
|
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-balance
|
|
2369
2375
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
2370
|
-
* @returns {object} a [balance structure]{@link https://
|
|
2376
|
+
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
2371
2377
|
*/
|
|
2372
2378
|
await this.loadMarkets();
|
|
2373
2379
|
const [marketType, query] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
|
|
@@ -2618,7 +2624,7 @@ export default class okx extends Exchange {
|
|
|
2618
2624
|
else if (fok) {
|
|
2619
2625
|
request['ordType'] = 'fok';
|
|
2620
2626
|
}
|
|
2621
|
-
|
|
2627
|
+
if (stopLossDefined || takeProfitDefined) {
|
|
2622
2628
|
if (stopLossDefined) {
|
|
2623
2629
|
const stopLossTriggerPrice = this.safeValueN(stopLoss, ['triggerPrice', 'stopPrice', 'slTriggerPx']);
|
|
2624
2630
|
if (stopLossTriggerPrice === undefined) {
|
|
@@ -2762,7 +2768,7 @@ export default class okx extends Exchange {
|
|
|
2762
2768
|
* @param {float} [params.stopLoss.price] used for stop loss limit orders, not used for stop loss market price orders
|
|
2763
2769
|
* @param {string} [params.stopLoss.type] 'market' or 'limit' used to specify the stop loss price type
|
|
2764
2770
|
* @param {string} [params.positionSide] if position mode is one-way: set to 'net', if position mode is hedge-mode: set to 'long' or 'short'
|
|
2765
|
-
* @returns {object} an [order structure]{@link https://
|
|
2771
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2766
2772
|
*/
|
|
2767
2773
|
await this.loadMarkets();
|
|
2768
2774
|
const market = this.market(symbol);
|
|
@@ -2805,7 +2811,7 @@ export default class okx extends Exchange {
|
|
|
2805
2811
|
* @description create a list of trade orders
|
|
2806
2812
|
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-multiple-orders
|
|
2807
2813
|
* @param {array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
|
|
2808
|
-
* @returns {object} an [order structure]{@link https://
|
|
2814
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2809
2815
|
*/
|
|
2810
2816
|
await this.loadMarkets();
|
|
2811
2817
|
const ordersRequests = [];
|
|
@@ -2932,7 +2938,7 @@ export default class okx extends Exchange {
|
|
|
2932
2938
|
* @param {float} [params.takeProfit.triggerPrice] take profit trigger price
|
|
2933
2939
|
* @param {float} [params.takeProfit.price] used for take profit limit orders, not used for take profit market price orders
|
|
2934
2940
|
* @param {string} [params.takeProfit.type] 'market' or 'limit' used to specify the take profit price type
|
|
2935
|
-
* @returns {object} an [order structure]{@link https://
|
|
2941
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2936
2942
|
*/
|
|
2937
2943
|
await this.loadMarkets();
|
|
2938
2944
|
const market = this.market(symbol);
|
|
@@ -2969,9 +2975,11 @@ export default class okx extends Exchange {
|
|
|
2969
2975
|
* @param {string} id order id
|
|
2970
2976
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
2971
2977
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
2972
|
-
* @returns {object} An [order structure]{@link https://
|
|
2978
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2973
2979
|
*/
|
|
2974
|
-
|
|
2980
|
+
if (symbol === undefined) {
|
|
2981
|
+
throw new ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
2982
|
+
}
|
|
2975
2983
|
const stop = this.safeValue(params, 'stop');
|
|
2976
2984
|
if (stop) {
|
|
2977
2985
|
const orderInner = await this.cancelOrders([id], symbol, params);
|
|
@@ -3023,10 +3031,12 @@ export default class okx extends Exchange {
|
|
|
3023
3031
|
* @param {string[]} ids order ids
|
|
3024
3032
|
* @param {string} symbol unified market symbol
|
|
3025
3033
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
3026
|
-
* @returns {object} an list of [order structures]{@link https://
|
|
3034
|
+
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3027
3035
|
*/
|
|
3028
3036
|
// TODO : the original endpoint signature differs, according to that you can skip individual symbol and assign ids in batch. At this moment, `params` is not being used too.
|
|
3029
|
-
|
|
3037
|
+
if (symbol === undefined) {
|
|
3038
|
+
throw new ArgumentsRequired(this.id + ' cancelOrders() requires a symbol argument');
|
|
3039
|
+
}
|
|
3030
3040
|
await this.loadMarkets();
|
|
3031
3041
|
const market = this.market(symbol);
|
|
3032
3042
|
const request = [];
|
|
@@ -3335,9 +3345,11 @@ export default class okx extends Exchange {
|
|
|
3335
3345
|
* @param {string} id the order id
|
|
3336
3346
|
* @param {string} symbol unified market symbol
|
|
3337
3347
|
* @param {object} [params] extra and exchange specific parameters
|
|
3338
|
-
* @returns [an order structure]{@link https://
|
|
3348
|
+
* @returns [an order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3339
3349
|
*/
|
|
3340
|
-
|
|
3350
|
+
if (symbol === undefined) {
|
|
3351
|
+
throw new ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
|
|
3352
|
+
}
|
|
3341
3353
|
await this.loadMarkets();
|
|
3342
3354
|
const market = this.market(symbol);
|
|
3343
3355
|
const request = {
|
|
@@ -3487,7 +3499,7 @@ export default class okx extends Exchange {
|
|
|
3487
3499
|
* @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
|
3488
3500
|
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
3489
3501
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
3490
|
-
* @returns {Order[]} a list of [order structures]{@link https://
|
|
3502
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3491
3503
|
*/
|
|
3492
3504
|
await this.loadMarkets();
|
|
3493
3505
|
let paginate = false;
|
|
@@ -3642,7 +3654,7 @@ export default class okx extends Exchange {
|
|
|
3642
3654
|
* @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
|
3643
3655
|
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
3644
3656
|
* @param {int} [params.until] timestamp in ms to fetch orders for
|
|
3645
|
-
* @returns {object} a list of [order structures]{@link https://
|
|
3657
|
+
* @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3646
3658
|
*/
|
|
3647
3659
|
await this.loadMarkets();
|
|
3648
3660
|
const request = {
|
|
@@ -3819,7 +3831,7 @@ export default class okx extends Exchange {
|
|
|
3819
3831
|
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
3820
3832
|
* @param {int} [params.until] timestamp in ms to fetch orders for
|
|
3821
3833
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
3822
|
-
* @returns {Order[]} a list of [order structures]{@link https://
|
|
3834
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3823
3835
|
*/
|
|
3824
3836
|
await this.loadMarkets();
|
|
3825
3837
|
let paginate = false;
|
|
@@ -3988,7 +4000,7 @@ export default class okx extends Exchange {
|
|
|
3988
4000
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
3989
4001
|
* @param {int} [params.until] Timestamp in ms of the latest time to retrieve trades for
|
|
3990
4002
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
3991
|
-
* @returns {Trade[]} a list of [trade structures]{@link https://
|
|
4003
|
+
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
3992
4004
|
*/
|
|
3993
4005
|
await this.loadMarkets();
|
|
3994
4006
|
let paginate = false;
|
|
@@ -4056,7 +4068,7 @@ export default class okx extends Exchange {
|
|
|
4056
4068
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
4057
4069
|
* @param {int} [limit] the maximum number of trades to retrieve
|
|
4058
4070
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4059
|
-
* @returns {object[]} a list of [trade structures]{@link https://
|
|
4071
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
4060
4072
|
*/
|
|
4061
4073
|
const request = {
|
|
4062
4074
|
// 'instrument_id': market['id'],
|
|
@@ -4082,7 +4094,7 @@ export default class okx extends Exchange {
|
|
|
4082
4094
|
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
4083
4095
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4084
4096
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
4085
|
-
* @returns {object} a [ledger structure]{@link https://
|
|
4097
|
+
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
4086
4098
|
*/
|
|
4087
4099
|
await this.loadMarkets();
|
|
4088
4100
|
let paginate = false;
|
|
@@ -4380,7 +4392,7 @@ export default class okx extends Exchange {
|
|
|
4380
4392
|
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-deposit-address
|
|
4381
4393
|
* @param {string} code unified currency code of the currency for the deposit address
|
|
4382
4394
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4383
|
-
* @returns {object} a dictionary of [address structures]{@link https://
|
|
4395
|
+
* @returns {object} a dictionary of [address structures]{@link https://docs.ccxt.com/#/?id=address-structure} indexed by the network
|
|
4384
4396
|
*/
|
|
4385
4397
|
await this.loadMarkets();
|
|
4386
4398
|
const currency = this.currency(code);
|
|
@@ -4422,7 +4434,7 @@ export default class okx extends Exchange {
|
|
|
4422
4434
|
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-deposit-address
|
|
4423
4435
|
* @param {string} code unified currency code
|
|
4424
4436
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4425
|
-
* @returns {object} an [address structure]{@link https://
|
|
4437
|
+
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
4426
4438
|
*/
|
|
4427
4439
|
const rawNetwork = this.safeStringUpper(params, 'network');
|
|
4428
4440
|
const networks = this.safeValue(this.options, 'networks', {});
|
|
@@ -4466,7 +4478,7 @@ export default class okx extends Exchange {
|
|
|
4466
4478
|
* @param {string} address the address to withdraw to
|
|
4467
4479
|
* @param {string} tag
|
|
4468
4480
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4469
|
-
* @returns {object} a [transaction structure]{@link https://
|
|
4481
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
4470
4482
|
*/
|
|
4471
4483
|
[tag, params] = this.handleWithdrawTagAndParams(tag, params);
|
|
4472
4484
|
this.checkAddress(address);
|
|
@@ -4546,7 +4558,7 @@ export default class okx extends Exchange {
|
|
|
4546
4558
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4547
4559
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4548
4560
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
4549
|
-
* @returns {object[]} a list of [transaction structures]{@link https://
|
|
4561
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
4550
4562
|
*/
|
|
4551
4563
|
await this.loadMarkets();
|
|
4552
4564
|
let paginate = false;
|
|
@@ -4624,7 +4636,7 @@ export default class okx extends Exchange {
|
|
|
4624
4636
|
* @param {string} id deposit id
|
|
4625
4637
|
* @param {string} code filter by currency code
|
|
4626
4638
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4627
|
-
* @returns {object} a [transaction structure]{@link https://
|
|
4639
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
4628
4640
|
*/
|
|
4629
4641
|
await this.loadMarkets();
|
|
4630
4642
|
const request = {
|
|
@@ -4652,7 +4664,7 @@ export default class okx extends Exchange {
|
|
|
4652
4664
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4653
4665
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4654
4666
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
4655
|
-
* @returns {object[]} a list of [transaction structures]{@link https://
|
|
4667
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
4656
4668
|
*/
|
|
4657
4669
|
await this.loadMarkets();
|
|
4658
4670
|
let paginate = false;
|
|
@@ -4722,7 +4734,7 @@ export default class okx extends Exchange {
|
|
|
4722
4734
|
* @param {string} id withdrawal id
|
|
4723
4735
|
* @param {string} code unified currency code of the currency withdrawn, default is undefined
|
|
4724
4736
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4725
|
-
* @returns {object} a [transaction structure]{@link https://
|
|
4737
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
4726
4738
|
*/
|
|
4727
4739
|
await this.loadMarkets();
|
|
4728
4740
|
const request = {
|
|
@@ -4902,7 +4914,7 @@ export default class okx extends Exchange {
|
|
|
4902
4914
|
* @param {string} symbol unified market symbol
|
|
4903
4915
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4904
4916
|
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
4905
|
-
* @returns {object} a [leverage structure]{@link https://
|
|
4917
|
+
* @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
|
|
4906
4918
|
*/
|
|
4907
4919
|
await this.loadMarkets();
|
|
4908
4920
|
let marginMode = undefined;
|
|
@@ -4944,7 +4956,7 @@ export default class okx extends Exchange {
|
|
|
4944
4956
|
* @param {string} symbol unified market symbol of the market the position is held in, default is undefined
|
|
4945
4957
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
4946
4958
|
* @param {string} [params.instType] MARGIN, SWAP, FUTURES, OPTION
|
|
4947
|
-
* @returns {object} a [position structure]{@link https://
|
|
4959
|
+
* @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
4948
4960
|
*/
|
|
4949
4961
|
await this.loadMarkets();
|
|
4950
4962
|
const market = this.market(symbol);
|
|
@@ -5020,7 +5032,7 @@ export default class okx extends Exchange {
|
|
|
5020
5032
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
5021
5033
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
5022
5034
|
* @param {string} [params.instType] MARGIN, SWAP, FUTURES, OPTION
|
|
5023
|
-
* @returns {object[]} a list of [position structure]{@link https://
|
|
5035
|
+
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
5024
5036
|
*/
|
|
5025
5037
|
await this.loadMarkets();
|
|
5026
5038
|
const request = {
|
|
@@ -5254,7 +5266,7 @@ export default class okx extends Exchange {
|
|
|
5254
5266
|
* @param {string} fromAccount account to transfer from
|
|
5255
5267
|
* @param {string} toAccount account to transfer to
|
|
5256
5268
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
5257
|
-
* @returns {object} a [transfer structure]{@link https://
|
|
5269
|
+
* @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
5258
5270
|
*/
|
|
5259
5271
|
await this.loadMarkets();
|
|
5260
5272
|
const currency = this.currency(code);
|
|
@@ -5428,7 +5440,7 @@ export default class okx extends Exchange {
|
|
|
5428
5440
|
* @param {int} [since] the earliest time in ms to fetch transfers for
|
|
5429
5441
|
* @param {int} [limit] the maximum number of transfers structures to retrieve
|
|
5430
5442
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
5431
|
-
* @returns {object[]} a list of [transfer structures]{@link https://
|
|
5443
|
+
* @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
5432
5444
|
*/
|
|
5433
5445
|
await this.loadMarkets();
|
|
5434
5446
|
let currency = undefined;
|
|
@@ -5593,7 +5605,7 @@ export default class okx extends Exchange {
|
|
|
5593
5605
|
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate
|
|
5594
5606
|
* @param {string} symbol unified market symbol
|
|
5595
5607
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
5596
|
-
* @returns {object} a [funding rate structure]{@link https://
|
|
5608
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
5597
5609
|
*/
|
|
5598
5610
|
await this.loadMarkets();
|
|
5599
5611
|
const market = this.market(symbol);
|
|
@@ -5634,7 +5646,7 @@ export default class okx extends Exchange {
|
|
|
5634
5646
|
* @param {int} [since] the earliest time in ms to fetch funding history for
|
|
5635
5647
|
* @param {int} [limit] the maximum number of funding history structures to retrieve
|
|
5636
5648
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
5637
|
-
* @returns {object} a [funding history structure]{@link https://
|
|
5649
|
+
* @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
|
|
5638
5650
|
*/
|
|
5639
5651
|
await this.loadMarkets();
|
|
5640
5652
|
const request = {
|
|
@@ -5796,7 +5808,9 @@ export default class okx extends Exchange {
|
|
|
5796
5808
|
* @param {string} [params.posSide] 'long' or 'short' for isolated margin long/short mode on futures and swap markets
|
|
5797
5809
|
* @returns {object} response from the exchange
|
|
5798
5810
|
*/
|
|
5799
|
-
|
|
5811
|
+
if (symbol === undefined) {
|
|
5812
|
+
throw new ArgumentsRequired(this.id + ' setLeverage() requires a symbol argument');
|
|
5813
|
+
}
|
|
5800
5814
|
// WARNING: THIS WILL INCREASE LIQUIDATION PRICE FOR OPEN ISOLATED LONG POSITIONS
|
|
5801
5815
|
// AND DECREASE LIQUIDATION PRICE FOR OPEN ISOLATED SHORT POSITIONS
|
|
5802
5816
|
if ((leverage < 1) || (leverage > 125)) {
|
|
@@ -5890,7 +5904,9 @@ export default class okx extends Exchange {
|
|
|
5890
5904
|
* @param {int} [params.leverage] leverage
|
|
5891
5905
|
* @returns {object} response from the exchange
|
|
5892
5906
|
*/
|
|
5893
|
-
|
|
5907
|
+
if (symbol === undefined) {
|
|
5908
|
+
throw new ArgumentsRequired(this.id + ' setMarginMode() requires a symbol argument');
|
|
5909
|
+
}
|
|
5894
5910
|
// WARNING: THIS WILL INCREASE LIQUIDATION PRICE FOR OPEN ISOLATED LONG POSITIONS
|
|
5895
5911
|
// AND DECREASE LIQUIDATION PRICE FOR OPEN ISOLATED SHORT POSITIONS
|
|
5896
5912
|
marginMode = marginMode.toLowerCase();
|
|
@@ -5926,14 +5942,14 @@ export default class okx extends Exchange {
|
|
|
5926
5942
|
//
|
|
5927
5943
|
return response;
|
|
5928
5944
|
}
|
|
5929
|
-
async
|
|
5945
|
+
async fetchCrossBorrowRates(params = {}) {
|
|
5930
5946
|
/**
|
|
5931
5947
|
* @method
|
|
5932
|
-
* @name okx#
|
|
5948
|
+
* @name okx#fetchCrossBorrowRates
|
|
5933
5949
|
* @description fetch the borrow interest rates of all currencies
|
|
5934
5950
|
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-interest-rate
|
|
5935
5951
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
5936
|
-
* @returns {object} a list of [borrow rate structures]{@link https://
|
|
5952
|
+
* @returns {object} a list of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
|
|
5937
5953
|
*/
|
|
5938
5954
|
await this.loadMarkets();
|
|
5939
5955
|
const response = await this.privateGetAccountInterestRate(params);
|
|
@@ -5949,32 +5965,22 @@ export default class okx extends Exchange {
|
|
|
5949
5965
|
// ],
|
|
5950
5966
|
// }
|
|
5951
5967
|
//
|
|
5952
|
-
const
|
|
5953
|
-
const
|
|
5954
|
-
const rates = {};
|
|
5968
|
+
const data = this.safeValue(response, 'data', []);
|
|
5969
|
+
const rates = [];
|
|
5955
5970
|
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
|
-
};
|
|
5971
|
+
rates.push(this.parseBorrowRate(data[i]));
|
|
5966
5972
|
}
|
|
5967
5973
|
return rates;
|
|
5968
5974
|
}
|
|
5969
|
-
async
|
|
5975
|
+
async fetchCrossBorrowRate(code, params = {}) {
|
|
5970
5976
|
/**
|
|
5971
5977
|
* @method
|
|
5972
|
-
* @name okx#
|
|
5978
|
+
* @name okx#fetchCrossBorrowRate
|
|
5973
5979
|
* @description fetch the rate of interest to borrow a currency for margin trading
|
|
5974
5980
|
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-interest-rate
|
|
5975
5981
|
* @param {string} code unified currency code
|
|
5976
5982
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
5977
|
-
* @returns {object} a [borrow rate structure]{@link https://
|
|
5983
|
+
* @returns {object} a [borrow rate structure]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
|
|
5978
5984
|
*/
|
|
5979
5985
|
await this.loadMarkets();
|
|
5980
5986
|
const currency = this.currency(code);
|
|
@@ -6070,7 +6076,7 @@ export default class okx extends Exchange {
|
|
|
6070
6076
|
* @param {int} [since] timestamp in ms of the earliest borrowRate, default is undefined
|
|
6071
6077
|
* @param {int} [limit] max number of borrow rate prices to return, default is undefined
|
|
6072
6078
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
6073
|
-
* @returns {object} a dictionary of [borrow rate structures]{@link https://
|
|
6079
|
+
* @returns {object} a dictionary of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure} indexed by the market symbol
|
|
6074
6080
|
*/
|
|
6075
6081
|
await this.loadMarkets();
|
|
6076
6082
|
const request = {
|
|
@@ -6111,9 +6117,9 @@ export default class okx extends Exchange {
|
|
|
6111
6117
|
* @see https://www.okx.com/docs-v5/en/#financial-product-savings-get-public-borrow-history-public
|
|
6112
6118
|
* @param {string} code unified currency code
|
|
6113
6119
|
* @param {int} [since] timestamp for the earliest borrow rate
|
|
6114
|
-
* @param {int} [limit] the maximum number of [borrow rate structures]{@link https://
|
|
6120
|
+
* @param {int} [limit] the maximum number of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure} to retrieve
|
|
6115
6121
|
* @param {object} [params] extra parameters specific to the exchange api endpoint
|
|
6116
|
-
* @returns {object[]} an array of [borrow rate structures]{@link https://
|
|
6122
|
+
* @returns {object[]} an array of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
|
|
6117
6123
|
*/
|
|
6118
6124
|
await this.loadMarkets();
|
|
6119
6125
|
const currency = this.currency(code);
|
|
@@ -6204,7 +6210,7 @@ export default class okx extends Exchange {
|
|
|
6204
6210
|
* @param {string} symbol unified market symbol
|
|
6205
6211
|
* @param {float} amount the amount of margin to remove
|
|
6206
6212
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
6207
|
-
* @returns {object} a [margin structure]{@link https://
|
|
6213
|
+
* @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=reduce-margin-structure}
|
|
6208
6214
|
*/
|
|
6209
6215
|
return await this.modifyMarginHelper(symbol, amount, 'reduce', params);
|
|
6210
6216
|
}
|
|
@@ -6217,7 +6223,7 @@ export default class okx extends Exchange {
|
|
|
6217
6223
|
* @param {string} symbol unified market symbol
|
|
6218
6224
|
* @param {float} amount amount of margin to add
|
|
6219
6225
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
6220
|
-
* @returns {object} a [margin structure]{@link https://
|
|
6226
|
+
* @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=add-margin-structure}
|
|
6221
6227
|
*/
|
|
6222
6228
|
return await this.modifyMarginHelper(symbol, amount, 'add', params);
|
|
6223
6229
|
}
|
|
@@ -6230,7 +6236,7 @@ export default class okx extends Exchange {
|
|
|
6230
6236
|
* @param {string} symbol unified market symbol
|
|
6231
6237
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
6232
6238
|
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
6233
|
-
* @returns {object} a [leverage tiers structure]{@link https://
|
|
6239
|
+
* @returns {object} a [leverage tiers structure]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}
|
|
6234
6240
|
*/
|
|
6235
6241
|
await this.loadMarkets();
|
|
6236
6242
|
const market = this.market(symbol);
|
|
@@ -6328,11 +6334,11 @@ export default class okx extends Exchange {
|
|
|
6328
6334
|
* @param {string} code the unified currency code for the currency of the interest
|
|
6329
6335
|
* @param {string} symbol the market symbol of an isolated margin market, if undefined, the interest for cross margin markets is returned
|
|
6330
6336
|
* @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://
|
|
6337
|
+
* @param {int} [limit] the number of [borrow interest structures]{@link https://docs.ccxt.com/#/?id=borrow-interest-structure} to retrieve
|
|
6332
6338
|
* @param {object} [params] exchange specific parameters
|
|
6333
6339
|
* @param {int} [params.type] Loan type 1 - VIP loans 2 - Market loans *Default is Market loans*
|
|
6334
6340
|
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
6335
|
-
* @returns {object[]} An list of [borrow interest structures]{@link https://
|
|
6341
|
+
* @returns {object[]} An list of [borrow interest structures]{@link https://docs.ccxt.com/#/?id=borrow-interest-structure}
|
|
6336
6342
|
*/
|
|
6337
6343
|
await this.loadMarkets();
|
|
6338
6344
|
let marginMode = undefined;
|
|
@@ -6410,7 +6416,7 @@ export default class okx extends Exchange {
|
|
|
6410
6416
|
* @param {float} amount the amount to borrow
|
|
6411
6417
|
* @param {string} symbol not used by okx.borrowMargin ()
|
|
6412
6418
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
6413
|
-
* @returns {object} a [margin loan structure]{@link https://
|
|
6419
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
6414
6420
|
*/
|
|
6415
6421
|
await this.loadMarkets();
|
|
6416
6422
|
const currency = this.currency(code);
|
|
@@ -6454,7 +6460,7 @@ export default class okx extends Exchange {
|
|
|
6454
6460
|
* @param {float} amount the amount to repay
|
|
6455
6461
|
* @param {string} symbol not used by okx.repayMargin ()
|
|
6456
6462
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
6457
|
-
* @returns {object} a [margin loan structure]{@link https://
|
|
6463
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
6458
6464
|
*/
|
|
6459
6465
|
await this.loadMarkets();
|
|
6460
6466
|
const currency = this.currency(code);
|
|
@@ -6519,7 +6525,7 @@ export default class okx extends Exchange {
|
|
|
6519
6525
|
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-open-interest
|
|
6520
6526
|
* @param {string} symbol Unified CCXT market symbol
|
|
6521
6527
|
* @param {object} [params] exchange specific parameters
|
|
6522
|
-
* @returns {object} an open interest structure{@link https://
|
|
6528
|
+
* @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
6523
6529
|
*/
|
|
6524
6530
|
await this.loadMarkets();
|
|
6525
6531
|
const market = this.market(symbol);
|
|
@@ -6565,7 +6571,7 @@ export default class okx extends Exchange {
|
|
|
6565
6571
|
* @param {int} [limit] Not used by okx, but parsed internally by CCXT
|
|
6566
6572
|
* @param {object} [params] Exchange specific parameters
|
|
6567
6573
|
* @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://
|
|
6574
|
+
* @returns An array of [open interest structures]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
6569
6575
|
*/
|
|
6570
6576
|
const options = this.safeValue(this.options, 'fetchOpenInterestHistory', {});
|
|
6571
6577
|
const timeframes = this.safeValue(options, 'timeframes', {});
|
|
@@ -6696,7 +6702,7 @@ export default class okx extends Exchange {
|
|
|
6696
6702
|
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-currencies
|
|
6697
6703
|
* @param {string[]|undefined} codes list of unified currency codes
|
|
6698
6704
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
6699
|
-
* @returns {object[]} a list of [fees structures]{@link https://
|
|
6705
|
+
* @returns {object[]} a list of [fees structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
6700
6706
|
*/
|
|
6701
6707
|
await this.loadMarkets();
|
|
6702
6708
|
const response = await this.privateGetAssetCurrencies(params);
|
|
@@ -6817,11 +6823,13 @@ export default class okx extends Exchange {
|
|
|
6817
6823
|
* @param {int} [since] timestamp in ms
|
|
6818
6824
|
* @param {int} [limit] number of records
|
|
6819
6825
|
* @param {object} [params] exchange specific params
|
|
6820
|
-
* @returns {object[]} a list of [settlement history objects]{@link https://
|
|
6826
|
+
* @returns {object[]} a list of [settlement history objects]{@link https://docs.ccxt.com/#/?id=settlement-history-structure}
|
|
6821
6827
|
*/
|
|
6822
|
-
|
|
6828
|
+
if (symbol === undefined) {
|
|
6829
|
+
throw new ArgumentsRequired(this.id + ' fetchSettlementHistory() requires a symbol argument');
|
|
6830
|
+
}
|
|
6823
6831
|
await this.loadMarkets();
|
|
6824
|
-
const market =
|
|
6832
|
+
const market = this.market(symbol);
|
|
6825
6833
|
let type = undefined;
|
|
6826
6834
|
[type, params] = this.handleMarketTypeAndParams('fetchSettlementHistory', market, params);
|
|
6827
6835
|
if (type !== 'future' && type !== 'option') {
|
|
@@ -6914,7 +6922,7 @@ export default class okx extends Exchange {
|
|
|
6914
6922
|
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-underlying
|
|
6915
6923
|
* @param {object} [params] exchange specific params
|
|
6916
6924
|
* @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://
|
|
6925
|
+
* @returns {object[]} a list of [underlying assets]{@link https://docs.ccxt.com/#/?id=underlying-assets-structure}
|
|
6918
6926
|
*/
|
|
6919
6927
|
await this.loadMarkets();
|
|
6920
6928
|
let marketType = undefined;
|
|
@@ -6952,7 +6960,7 @@ export default class okx extends Exchange {
|
|
|
6952
6960
|
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-option-market-data
|
|
6953
6961
|
* @param {string} symbol unified symbol of the market to fetch greeks for
|
|
6954
6962
|
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
6955
|
-
* @returns {object} a [greeks structure]{@link https://
|
|
6963
|
+
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
6956
6964
|
*/
|
|
6957
6965
|
await this.loadMarkets();
|
|
6958
6966
|
const market = this.market(symbol);
|