ccxt 4.4.30 → 4.4.32
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/README.md +9 -3
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ace.js +123 -123
- package/dist/cjs/src/alpaca.js +237 -237
- package/dist/cjs/src/ascendex.js +342 -341
- package/dist/cjs/src/bigone.js +242 -242
- package/dist/cjs/src/binance.js +1339 -1291
- package/dist/cjs/src/bingx.js +639 -639
- package/dist/cjs/src/bit2c.js +111 -111
- package/dist/cjs/src/bitbank.js +142 -142
- package/dist/cjs/src/bitbns.js +140 -140
- package/dist/cjs/src/bitfinex.js +231 -231
- package/dist/cjs/src/bitfinex2.js +403 -403
- package/dist/cjs/src/bitflyer.js +184 -184
- package/dist/cjs/src/bitget.js +848 -846
- package/dist/cjs/src/bithumb.js +125 -124
- package/dist/cjs/src/bitmart.js +525 -525
- package/dist/cjs/src/bitmex.js +317 -317
- package/dist/cjs/src/bitopro.js +221 -221
- package/dist/cjs/src/bitrue.js +315 -315
- package/dist/cjs/src/bitso.js +220 -220
- package/dist/cjs/src/bitstamp.js +251 -251
- package/dist/cjs/src/bitteam.js +183 -183
- package/dist/cjs/src/bitvavo.js +247 -251
- package/dist/cjs/src/bl3p.js +82 -82
- package/dist/cjs/src/blockchaincom.js +211 -211
- package/dist/cjs/src/blofin.js +332 -331
- package/dist/cjs/src/btcalpha.js +166 -166
- package/dist/cjs/src/btcbox.js +108 -108
- package/dist/cjs/src/btcmarkets.js +198 -198
- package/dist/cjs/src/btcturk.js +124 -124
- package/dist/cjs/src/bybit.js +906 -900
- package/dist/cjs/src/cex.js +227 -226
- package/dist/cjs/src/coinbase.js +481 -481
- package/dist/cjs/src/coinbaseexchange.js +274 -274
- package/dist/cjs/src/coinbaseinternational.js +304 -304
- package/dist/cjs/src/coincatch.js +650 -650
- package/dist/cjs/src/coincheck.js +113 -113
- package/dist/cjs/src/coinex.js +611 -601
- package/dist/cjs/src/coinlist.js +304 -303
- package/dist/cjs/src/coinmate.js +162 -161
- package/dist/cjs/src/coinmetro.js +187 -187
- package/dist/cjs/src/coinone.js +124 -123
- package/dist/cjs/src/coinsph.js +237 -237
- package/dist/cjs/src/coinspot.js +82 -82
- package/dist/cjs/src/cryptocom.js +342 -341
- package/dist/cjs/src/currencycom.js +225 -224
- package/dist/cjs/src/delta.js +320 -320
- package/dist/cjs/src/deribit.js +411 -408
- package/dist/cjs/src/digifinex.js +432 -431
- package/dist/cjs/src/exmo.js +328 -327
- package/dist/cjs/src/gate.js +830 -791
- package/dist/cjs/src/gemini.js +199 -198
- package/dist/cjs/src/hashkey.js +520 -517
- package/dist/cjs/src/hitbtc.js +465 -462
- package/dist/cjs/src/hollaex.js +253 -252
- package/dist/cjs/src/htx.js +791 -848
- package/dist/cjs/src/huobijp.js +219 -218
- package/dist/cjs/src/hyperliquid.js +421 -417
- package/dist/cjs/src/idex.js +238 -237
- package/dist/cjs/src/independentreserve.js +133 -132
- package/dist/cjs/src/indodax.js +177 -171
- package/dist/cjs/src/kraken.js +381 -377
- package/dist/cjs/src/krakenfutures.js +285 -279
- package/dist/cjs/src/kucoin.js +632 -622
- package/dist/cjs/src/kucoinfutures.js +533 -457
- package/dist/cjs/src/kuna.js +283 -282
- package/dist/cjs/src/latoken.js +211 -210
- package/dist/cjs/src/lbank.js +268 -267
- package/dist/cjs/src/luno.js +174 -173
- package/dist/cjs/src/lykke.js +172 -171
- package/dist/cjs/src/mercado.js +123 -122
- package/dist/cjs/src/mexc.js +650 -646
- package/dist/cjs/src/ndax.js +229 -228
- package/dist/cjs/src/novadax.js +230 -229
- package/dist/cjs/src/oceanex.js +187 -186
- package/dist/cjs/src/okcoin.js +286 -285
- package/dist/cjs/src/okx.js +909 -904
- package/dist/cjs/src/onetrading.js +218 -218
- package/dist/cjs/src/oxfun.js +335 -334
- package/dist/cjs/src/p2b.js +154 -154
- package/dist/cjs/src/paradex.js +249 -244
- package/dist/cjs/src/paymium.js +101 -101
- package/dist/cjs/src/phemex.js +388 -390
- package/dist/cjs/src/poloniex.js +270 -270
- package/dist/cjs/src/poloniexfutures.js +250 -250
- package/dist/cjs/src/pro/alpaca.js +64 -64
- package/dist/cjs/src/pro/ascendex.js +64 -64
- package/dist/cjs/src/pro/binance.js +546 -543
- package/dist/cjs/src/pro/bingx.js +116 -116
- package/dist/cjs/src/pro/bitfinex.js +42 -42
- package/dist/cjs/src/pro/bitfinex2.js +66 -66
- package/dist/cjs/src/pro/bitget.js +188 -181
- package/dist/cjs/src/pro/bithumb.js +40 -40
- package/dist/cjs/src/pro/bitmart.js +121 -119
- package/dist/cjs/src/pro/bitmex.js +135 -133
- package/dist/cjs/src/pro/bitopro.js +49 -49
- package/dist/cjs/src/pro/bitrue.js +19 -19
- package/dist/cjs/src/pro/bitstamp.js +29 -29
- package/dist/cjs/src/pro/bitvavo.js +299 -301
- package/dist/cjs/src/pro/blockchaincom.js +62 -62
- package/dist/cjs/src/pro/blofin.js +132 -130
- package/dist/cjs/src/pro/bybit.js +317 -313
- package/dist/cjs/src/pro/cex.js +168 -168
- package/dist/cjs/src/pro/coinbase.js +93 -91
- package/dist/cjs/src/pro/coinbaseexchange.js +95 -95
- package/dist/cjs/src/pro/coinbaseinternational.js +111 -111
- package/dist/cjs/src/pro/coincatch.js +150 -143
- package/dist/cjs/src/pro/coincheck.js +21 -21
- package/dist/cjs/src/pro/coinex.js +110 -110
- package/dist/cjs/src/pro/coinone.js +30 -30
- package/dist/cjs/src/pro/cryptocom.js +227 -227
- package/dist/cjs/src/pro/currencycom.js +45 -45
- package/dist/cjs/src/pro/deribit.js +127 -127
- package/dist/cjs/src/pro/exmo.js +66 -66
- package/dist/cjs/src/pro/gate.js +287 -283
- package/dist/cjs/src/pro/gemini.js +74 -74
- package/dist/cjs/src/pro/hashkey.js +87 -85
- package/dist/cjs/src/pro/hitbtc.js +190 -190
- package/dist/cjs/src/pro/hollaex.js +51 -51
- package/dist/cjs/src/pro/htx.js +96 -94
- package/dist/cjs/src/pro/huobijp.js +38 -38
- package/dist/cjs/src/pro/hyperliquid.js +151 -150
- package/dist/cjs/src/pro/idex.js +48 -48
- package/dist/cjs/src/pro/independentreserve.js +19 -19
- package/dist/cjs/src/pro/kraken.js +167 -167
- package/dist/cjs/src/pro/krakenfutures.js +137 -138
- package/dist/cjs/src/pro/kucoin.js +167 -168
- package/dist/cjs/src/pro/kucoinfutures.js +147 -147
- package/dist/cjs/src/pro/lbank.js +95 -95
- package/dist/cjs/src/pro/luno.js +21 -21
- package/dist/cjs/src/pro/mexc.js +102 -103
- package/dist/cjs/src/pro/ndax.js +42 -42
- package/dist/cjs/src/pro/okcoin.js +61 -61
- package/dist/cjs/src/pro/okx.js +332 -330
- package/dist/cjs/src/pro/onetrading.js +71 -71
- package/dist/cjs/src/pro/oxfun.js +193 -191
- package/dist/cjs/src/pro/p2b.js +77 -77
- package/dist/cjs/src/pro/paradex.js +39 -39
- package/dist/cjs/src/pro/phemex.js +94 -94
- package/dist/cjs/src/pro/poloniex.js +171 -171
- package/dist/cjs/src/pro/poloniexfutures.js +62 -62
- package/dist/cjs/src/pro/probit.js +63 -63
- package/dist/cjs/src/pro/upbit.js +80 -80
- package/dist/cjs/src/pro/vertex.js +65 -63
- package/dist/cjs/src/pro/wazirx.js +70 -70
- package/dist/cjs/src/pro/whitebit.js +83 -83
- package/dist/cjs/src/pro/woo.js +106 -104
- package/dist/cjs/src/pro/woofipro.js +105 -103
- package/dist/cjs/src/pro/xt.js +119 -119
- package/dist/cjs/src/probit.js +229 -229
- package/dist/cjs/src/timex.js +198 -197
- package/dist/cjs/src/tokocrypto.js +214 -213
- package/dist/cjs/src/tradeogre.js +92 -91
- package/dist/cjs/src/upbit.js +243 -242
- package/dist/cjs/src/vertex.js +258 -258
- package/dist/cjs/src/wavesexchange.js +176 -172
- package/dist/cjs/src/wazirx.js +168 -168
- package/dist/cjs/src/whitebit.js +361 -361
- package/dist/cjs/src/woo.js +571 -572
- package/dist/cjs/src/woofipro.js +392 -391
- package/dist/cjs/src/xt.js +436 -435
- package/dist/cjs/src/yobit.js +159 -158
- package/dist/cjs/src/zaif.js +103 -103
- package/dist/cjs/src/zonda.js +168 -168
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/ace.d.ts +123 -0
- package/js/src/ace.js +123 -123
- package/js/src/alpaca.d.ts +237 -0
- package/js/src/alpaca.js +237 -237
- package/js/src/ascendex.d.ts +339 -0
- package/js/src/ascendex.js +342 -341
- package/js/src/base/types.d.ts +1 -0
- package/js/src/bigone.d.ts +242 -0
- package/js/src/bigone.js +242 -242
- package/js/src/binance.d.ts +1306 -0
- package/js/src/binance.js +1339 -1291
- package/js/src/bingx.d.ts +639 -0
- package/js/src/bingx.js +639 -639
- package/js/src/bit2c.d.ts +111 -0
- package/js/src/bit2c.js +111 -111
- package/js/src/bitbank.d.ts +142 -0
- package/js/src/bitbank.js +142 -142
- package/js/src/bitbns.d.ts +140 -0
- package/js/src/bitbns.js +140 -140
- package/js/src/bitfinex.d.ts +231 -0
- package/js/src/bitfinex.js +231 -231
- package/js/src/bitfinex2.d.ts +403 -0
- package/js/src/bitfinex2.js +403 -403
- package/js/src/bitflyer.d.ts +184 -0
- package/js/src/bitflyer.js +184 -184
- package/js/src/bitget.d.ts +846 -0
- package/js/src/bitget.js +848 -846
- package/js/src/bithumb.d.ts +125 -0
- package/js/src/bithumb.js +125 -124
- package/js/src/bitmart.d.ts +525 -0
- package/js/src/bitmart.js +525 -525
- package/js/src/bitmex.d.ts +317 -0
- package/js/src/bitmex.js +317 -317
- package/js/src/bitopro.d.ts +221 -0
- package/js/src/bitopro.js +221 -221
- package/js/src/bitrue.d.ts +315 -0
- package/js/src/bitrue.js +315 -315
- package/js/src/bitso.d.ts +220 -0
- package/js/src/bitso.js +220 -220
- package/js/src/bitstamp.d.ts +251 -0
- package/js/src/bitstamp.js +251 -251
- package/js/src/bitteam.d.ts +183 -0
- package/js/src/bitteam.js +183 -183
- package/js/src/bitvavo.d.ts +247 -0
- package/js/src/bitvavo.js +247 -251
- package/js/src/bl3p.d.ts +82 -0
- package/js/src/bl3p.js +82 -82
- package/js/src/blockchaincom.d.ts +211 -0
- package/js/src/blockchaincom.js +211 -211
- package/js/src/blofin.d.ts +332 -0
- package/js/src/blofin.js +332 -331
- package/js/src/btcalpha.d.ts +166 -0
- package/js/src/btcalpha.js +166 -166
- package/js/src/btcbox.d.ts +108 -0
- package/js/src/btcbox.js +108 -108
- package/js/src/btcmarkets.d.ts +198 -0
- package/js/src/btcmarkets.js +198 -198
- package/js/src/btcturk.d.ts +124 -0
- package/js/src/btcturk.js +124 -124
- package/js/src/bybit.d.ts +906 -1
- package/js/src/bybit.js +906 -900
- package/js/src/cex.d.ts +227 -0
- package/js/src/cex.js +227 -226
- package/js/src/coinbase.d.ts +481 -0
- package/js/src/coinbase.js +481 -481
- package/js/src/coinbaseexchange.d.ts +274 -0
- package/js/src/coinbaseexchange.js +274 -274
- package/js/src/coinbaseinternational.d.ts +304 -0
- package/js/src/coinbaseinternational.js +304 -304
- package/js/src/coincatch.d.ts +646 -0
- package/js/src/coincatch.js +650 -650
- package/js/src/coincheck.d.ts +113 -0
- package/js/src/coincheck.js +113 -113
- package/js/src/coinex.d.ts +603 -0
- package/js/src/coinex.js +611 -601
- package/js/src/coinlist.d.ts +304 -0
- package/js/src/coinlist.js +304 -303
- package/js/src/coinmate.d.ts +162 -0
- package/js/src/coinmate.js +162 -161
- package/js/src/coinmetro.d.ts +187 -0
- package/js/src/coinmetro.js +187 -187
- package/js/src/coinone.d.ts +124 -0
- package/js/src/coinone.js +124 -123
- package/js/src/coinsph.d.ts +237 -0
- package/js/src/coinsph.js +237 -237
- package/js/src/coinspot.d.ts +82 -0
- package/js/src/coinspot.js +82 -82
- package/js/src/cryptocom.d.ts +342 -0
- package/js/src/cryptocom.js +342 -341
- package/js/src/currencycom.d.ts +225 -0
- package/js/src/currencycom.js +225 -224
- package/js/src/delta.d.ts +320 -0
- package/js/src/delta.js +320 -320
- package/js/src/deribit.d.ts +411 -0
- package/js/src/deribit.js +411 -408
- package/js/src/digifinex.d.ts +430 -0
- package/js/src/digifinex.js +432 -431
- package/js/src/exmo.d.ts +328 -0
- package/js/src/exmo.js +328 -327
- package/js/src/gate.d.ts +803 -1
- package/js/src/gate.js +830 -791
- package/js/src/gemini.d.ts +199 -0
- package/js/src/gemini.js +199 -198
- package/js/src/hashkey.d.ts +516 -0
- package/js/src/hashkey.js +520 -517
- package/js/src/hitbtc.d.ts +465 -0
- package/js/src/hitbtc.js +465 -462
- package/js/src/hollaex.d.ts +253 -0
- package/js/src/hollaex.js +253 -252
- package/js/src/htx.d.ts +765 -2
- package/js/src/htx.js +791 -848
- package/js/src/huobijp.d.ts +219 -0
- package/js/src/huobijp.js +219 -218
- package/js/src/hyperliquid.d.ts +419 -0
- package/js/src/hyperliquid.js +421 -417
- package/js/src/idex.d.ts +238 -0
- package/js/src/idex.js +238 -237
- package/js/src/independentreserve.d.ts +133 -0
- package/js/src/independentreserve.js +133 -132
- package/js/src/indodax.d.ts +171 -0
- package/js/src/indodax.js +177 -171
- package/js/src/kraken.d.ts +381 -0
- package/js/src/kraken.js +381 -377
- package/js/src/krakenfutures.d.ts +282 -0
- package/js/src/krakenfutures.js +285 -279
- package/js/src/kucoin.d.ts +613 -0
- package/js/src/kucoin.js +632 -622
- package/js/src/kucoinfutures.d.ts +441 -0
- package/js/src/kucoinfutures.js +533 -457
- package/js/src/kuna.d.ts +283 -0
- package/js/src/kuna.js +283 -282
- package/js/src/latoken.d.ts +211 -0
- package/js/src/latoken.js +211 -210
- package/js/src/lbank.d.ts +268 -0
- package/js/src/lbank.js +268 -267
- package/js/src/luno.d.ts +174 -0
- package/js/src/luno.js +174 -173
- package/js/src/lykke.d.ts +172 -0
- package/js/src/lykke.js +172 -171
- package/js/src/mercado.d.ts +123 -0
- package/js/src/mercado.js +123 -122
- package/js/src/mexc.d.ts +647 -0
- package/js/src/mexc.js +650 -646
- package/js/src/ndax.d.ts +229 -0
- package/js/src/ndax.js +229 -228
- package/js/src/novadax.d.ts +230 -0
- package/js/src/novadax.js +230 -229
- package/js/src/oceanex.d.ts +187 -0
- package/js/src/oceanex.js +187 -186
- package/js/src/okcoin.d.ts +286 -0
- package/js/src/okcoin.js +286 -285
- package/js/src/okx.d.ts +907 -0
- package/js/src/okx.js +909 -904
- package/js/src/onetrading.d.ts +218 -0
- package/js/src/onetrading.js +218 -218
- package/js/src/oxfun.d.ts +336 -3
- package/js/src/oxfun.js +335 -334
- package/js/src/p2b.d.ts +154 -0
- package/js/src/p2b.js +154 -154
- package/js/src/paradex.d.ts +241 -0
- package/js/src/paradex.js +249 -244
- package/js/src/paymium.d.ts +101 -0
- package/js/src/paymium.js +101 -101
- package/js/src/phemex.d.ts +366 -0
- package/js/src/phemex.js +388 -390
- package/js/src/poloniex.d.ts +270 -0
- package/js/src/poloniex.js +270 -270
- package/js/src/poloniexfutures.d.ts +250 -0
- package/js/src/poloniexfutures.js +250 -250
- package/js/src/pro/alpaca.d.ts +64 -0
- package/js/src/pro/alpaca.js +64 -64
- package/js/src/pro/ascendex.d.ts +64 -0
- package/js/src/pro/ascendex.js +64 -64
- package/js/src/pro/binance.d.ts +546 -0
- package/js/src/pro/binance.js +546 -543
- package/js/src/pro/bingx.d.ts +116 -0
- package/js/src/pro/bingx.js +116 -116
- package/js/src/pro/bitfinex.d.ts +42 -0
- package/js/src/pro/bitfinex.js +42 -42
- package/js/src/pro/bitfinex2.d.ts +66 -0
- package/js/src/pro/bitfinex2.js +66 -66
- package/js/src/pro/bitget.d.ts +187 -0
- package/js/src/pro/bitget.js +188 -181
- package/js/src/pro/bithumb.d.ts +40 -0
- package/js/src/pro/bithumb.js +40 -40
- package/js/src/pro/bitmart.d.ts +121 -0
- package/js/src/pro/bitmart.js +121 -119
- package/js/src/pro/bitmex.d.ts +135 -0
- package/js/src/pro/bitmex.js +135 -133
- package/js/src/pro/bitopro.d.ts +49 -0
- package/js/src/pro/bitopro.js +49 -49
- package/js/src/pro/bitrue.d.ts +19 -0
- package/js/src/pro/bitrue.js +19 -19
- package/js/src/pro/bitstamp.d.ts +29 -0
- package/js/src/pro/bitstamp.js +29 -29
- package/js/src/pro/bitvavo.d.ts +254 -1
- package/js/src/pro/bitvavo.js +299 -301
- package/js/src/pro/blockchaincom.d.ts +62 -0
- package/js/src/pro/blockchaincom.js +62 -62
- package/js/src/pro/blofin.d.ts +132 -0
- package/js/src/pro/blofin.js +132 -130
- package/js/src/pro/bybit.d.ts +317 -0
- package/js/src/pro/bybit.js +317 -313
- package/js/src/pro/cex.d.ts +168 -0
- package/js/src/pro/cex.js +168 -168
- package/js/src/pro/coinbase.d.ts +93 -0
- package/js/src/pro/coinbase.js +93 -91
- package/js/src/pro/coinbaseexchange.d.ts +95 -0
- package/js/src/pro/coinbaseexchange.js +95 -95
- package/js/src/pro/coinbaseinternational.d.ts +111 -0
- package/js/src/pro/coinbaseinternational.js +111 -111
- package/js/src/pro/coincatch.d.ts +150 -0
- package/js/src/pro/coincatch.js +150 -143
- package/js/src/pro/coincheck.d.ts +21 -0
- package/js/src/pro/coincheck.js +21 -21
- package/js/src/pro/coinex.d.ts +110 -0
- package/js/src/pro/coinex.js +110 -110
- package/js/src/pro/coinone.d.ts +30 -0
- package/js/src/pro/coinone.js +30 -30
- package/js/src/pro/cryptocom.d.ts +227 -0
- package/js/src/pro/cryptocom.js +227 -227
- package/js/src/pro/currencycom.d.ts +45 -0
- package/js/src/pro/currencycom.js +45 -45
- package/js/src/pro/deribit.d.ts +127 -0
- package/js/src/pro/deribit.js +127 -127
- package/js/src/pro/exmo.d.ts +66 -0
- package/js/src/pro/exmo.js +66 -66
- package/js/src/pro/gate.d.ts +287 -0
- package/js/src/pro/gate.js +287 -283
- package/js/src/pro/gemini.d.ts +74 -0
- package/js/src/pro/gemini.js +74 -74
- package/js/src/pro/hashkey.d.ts +87 -0
- package/js/src/pro/hashkey.js +87 -85
- package/js/src/pro/hitbtc.d.ts +190 -0
- package/js/src/pro/hitbtc.js +190 -190
- package/js/src/pro/hollaex.d.ts +51 -0
- package/js/src/pro/hollaex.js +51 -51
- package/js/src/pro/htx.d.ts +96 -0
- package/js/src/pro/htx.js +96 -94
- package/js/src/pro/huobijp.d.ts +38 -0
- package/js/src/pro/huobijp.js +38 -38
- package/js/src/pro/hyperliquid.d.ts +151 -0
- package/js/src/pro/hyperliquid.js +151 -150
- package/js/src/pro/idex.d.ts +48 -0
- package/js/src/pro/idex.js +48 -48
- package/js/src/pro/independentreserve.d.ts +19 -0
- package/js/src/pro/independentreserve.js +19 -19
- package/js/src/pro/kraken.d.ts +167 -0
- package/js/src/pro/kraken.js +167 -167
- package/js/src/pro/krakenfutures.d.ts +137 -0
- package/js/src/pro/krakenfutures.js +137 -138
- package/js/src/pro/kucoin.d.ts +167 -0
- package/js/src/pro/kucoin.js +167 -168
- package/js/src/pro/kucoinfutures.d.ts +147 -0
- package/js/src/pro/kucoinfutures.js +147 -147
- package/js/src/pro/lbank.d.ts +95 -0
- package/js/src/pro/lbank.js +95 -95
- package/js/src/pro/luno.d.ts +21 -0
- package/js/src/pro/luno.js +21 -21
- package/js/src/pro/mexc.d.ts +101 -0
- package/js/src/pro/mexc.js +102 -103
- package/js/src/pro/ndax.d.ts +42 -0
- package/js/src/pro/ndax.js +42 -42
- package/js/src/pro/okcoin.d.ts +61 -0
- package/js/src/pro/okcoin.js +61 -61
- package/js/src/pro/okx.d.ts +332 -0
- package/js/src/pro/okx.js +332 -330
- package/js/src/pro/onetrading.d.ts +71 -0
- package/js/src/pro/onetrading.js +71 -71
- package/js/src/pro/oxfun.d.ts +193 -0
- package/js/src/pro/oxfun.js +193 -191
- package/js/src/pro/p2b.d.ts +77 -0
- package/js/src/pro/p2b.js +77 -77
- package/js/src/pro/paradex.d.ts +39 -0
- package/js/src/pro/paradex.js +39 -39
- package/js/src/pro/phemex.d.ts +94 -0
- package/js/src/pro/phemex.js +94 -94
- package/js/src/pro/poloniex.d.ts +171 -0
- package/js/src/pro/poloniex.js +171 -171
- package/js/src/pro/poloniexfutures.d.ts +62 -0
- package/js/src/pro/poloniexfutures.js +62 -62
- package/js/src/pro/probit.d.ts +63 -0
- package/js/src/pro/probit.js +63 -63
- package/js/src/pro/upbit.d.ts +80 -0
- package/js/src/pro/upbit.js +80 -80
- package/js/src/pro/vertex.d.ts +65 -0
- package/js/src/pro/vertex.js +65 -63
- package/js/src/pro/wazirx.d.ts +70 -0
- package/js/src/pro/wazirx.js +70 -70
- package/js/src/pro/whitebit.d.ts +83 -0
- package/js/src/pro/whitebit.js +83 -83
- package/js/src/pro/woo.d.ts +106 -0
- package/js/src/pro/woo.js +106 -104
- package/js/src/pro/woofipro.d.ts +105 -0
- package/js/src/pro/woofipro.js +105 -103
- package/js/src/pro/xt.d.ts +119 -0
- package/js/src/pro/xt.js +119 -119
- package/js/src/probit.d.ts +229 -0
- package/js/src/probit.js +229 -229
- package/js/src/timex.d.ts +198 -0
- package/js/src/timex.js +198 -197
- package/js/src/tokocrypto.d.ts +214 -0
- package/js/src/tokocrypto.js +214 -213
- package/js/src/tradeogre.d.ts +92 -0
- package/js/src/tradeogre.js +92 -91
- package/js/src/upbit.d.ts +243 -0
- package/js/src/upbit.js +243 -242
- package/js/src/vertex.d.ts +258 -0
- package/js/src/vertex.js +258 -258
- package/js/src/wavesexchange.d.ts +176 -0
- package/js/src/wavesexchange.js +176 -172
- package/js/src/wazirx.d.ts +168 -0
- package/js/src/wazirx.js +168 -168
- package/js/src/whitebit.d.ts +361 -0
- package/js/src/whitebit.js +361 -361
- package/js/src/woo.d.ts +571 -0
- package/js/src/woo.js +571 -572
- package/js/src/woofipro.d.ts +392 -0
- package/js/src/woofipro.js +392 -391
- package/js/src/xt.d.ts +439 -4
- package/js/src/xt.js +436 -435
- package/js/src/yobit.d.ts +159 -0
- package/js/src/yobit.js +159 -158
- package/js/src/zaif.d.ts +103 -0
- package/js/src/zaif.js +103 -103
- package/js/src/zonda.d.ts +168 -0
- package/js/src/zonda.js +168 -168
- package/package.json +1 -1
package/dist/cjs/src/okx.js
CHANGED
|
@@ -1264,15 +1264,15 @@ class okx extends okx$1 {
|
|
|
1264
1264
|
}
|
|
1265
1265
|
return super.safeMarket(marketId, market, delimiter, marketType);
|
|
1266
1266
|
}
|
|
1267
|
+
/**
|
|
1268
|
+
* @method
|
|
1269
|
+
* @name okx#fetchStatus
|
|
1270
|
+
* @description the latest known information on the availability of the exchange API
|
|
1271
|
+
* @see https://www.okx.com/docs-v5/en/#status-get-status
|
|
1272
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1273
|
+
* @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
|
|
1274
|
+
*/
|
|
1267
1275
|
async fetchStatus(params = {}) {
|
|
1268
|
-
/**
|
|
1269
|
-
* @method
|
|
1270
|
-
* @name okx#fetchStatus
|
|
1271
|
-
* @description the latest known information on the availability of the exchange API
|
|
1272
|
-
* @see https://www.okx.com/docs-v5/en/#status-get-status
|
|
1273
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1274
|
-
* @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
|
|
1275
|
-
*/
|
|
1276
1276
|
const response = await this.publicGetSystemStatus(params);
|
|
1277
1277
|
//
|
|
1278
1278
|
// Note, if there is no maintenance around, the 'data' array is empty
|
|
@@ -1323,15 +1323,15 @@ class okx extends okx$1 {
|
|
|
1323
1323
|
}
|
|
1324
1324
|
return update;
|
|
1325
1325
|
}
|
|
1326
|
+
/**
|
|
1327
|
+
* @method
|
|
1328
|
+
* @name okx#fetchTime
|
|
1329
|
+
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
1330
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-system-time
|
|
1331
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1332
|
+
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
1333
|
+
*/
|
|
1326
1334
|
async fetchTime(params = {}) {
|
|
1327
|
-
/**
|
|
1328
|
-
* @method
|
|
1329
|
-
* @name okx#fetchTime
|
|
1330
|
-
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
1331
|
-
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-system-time
|
|
1332
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1333
|
-
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
1334
|
-
*/
|
|
1335
1335
|
const response = await this.publicGetPublicTime(params);
|
|
1336
1336
|
//
|
|
1337
1337
|
// {
|
|
@@ -1346,15 +1346,15 @@ class okx extends okx$1 {
|
|
|
1346
1346
|
const first = this.safeDict(data, 0, {});
|
|
1347
1347
|
return this.safeInteger(first, 'ts');
|
|
1348
1348
|
}
|
|
1349
|
+
/**
|
|
1350
|
+
* @method
|
|
1351
|
+
* @name okx#fetchAccounts
|
|
1352
|
+
* @description fetch all the accounts associated with a profile
|
|
1353
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-account-configuration
|
|
1354
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1355
|
+
* @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
|
|
1356
|
+
*/
|
|
1349
1357
|
async fetchAccounts(params = {}) {
|
|
1350
|
-
/**
|
|
1351
|
-
* @method
|
|
1352
|
-
* @name okx#fetchAccounts
|
|
1353
|
-
* @description fetch all the accounts associated with a profile
|
|
1354
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-account-configuration
|
|
1355
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1356
|
-
* @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
|
|
1357
|
-
*/
|
|
1358
1358
|
const response = await this.privateGetAccountConfig(params);
|
|
1359
1359
|
//
|
|
1360
1360
|
// {
|
|
@@ -1391,15 +1391,15 @@ class okx extends okx$1 {
|
|
|
1391
1391
|
}
|
|
1392
1392
|
return result;
|
|
1393
1393
|
}
|
|
1394
|
+
/**
|
|
1395
|
+
* @method
|
|
1396
|
+
* @name okx#fetchMarkets
|
|
1397
|
+
* @description retrieves data on all markets for okx
|
|
1398
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-instruments
|
|
1399
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1400
|
+
* @returns {object[]} an array of objects representing market data
|
|
1401
|
+
*/
|
|
1394
1402
|
async fetchMarkets(params = {}) {
|
|
1395
|
-
/**
|
|
1396
|
-
* @method
|
|
1397
|
-
* @name okx#fetchMarkets
|
|
1398
|
-
* @description retrieves data on all markets for okx
|
|
1399
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-instruments
|
|
1400
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1401
|
-
* @returns {object[]} an array of objects representing market data
|
|
1402
|
-
*/
|
|
1403
1403
|
const types = this.safeList(this.options, 'fetchMarkets', []);
|
|
1404
1404
|
let promises = [];
|
|
1405
1405
|
let result = [];
|
|
@@ -1616,15 +1616,15 @@ class okx extends okx$1 {
|
|
|
1616
1616
|
const dataResponse = this.safeList(response, 'data', []);
|
|
1617
1617
|
return this.parseMarkets(dataResponse);
|
|
1618
1618
|
}
|
|
1619
|
+
/**
|
|
1620
|
+
* @method
|
|
1621
|
+
* @name okx#fetchCurrencies
|
|
1622
|
+
* @description fetches all available currencies on an exchange
|
|
1623
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-currencies
|
|
1624
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1625
|
+
* @returns {object} an associative dictionary of currencies
|
|
1626
|
+
*/
|
|
1619
1627
|
async fetchCurrencies(params = {}) {
|
|
1620
|
-
/**
|
|
1621
|
-
* @method
|
|
1622
|
-
* @name okx#fetchCurrencies
|
|
1623
|
-
* @description fetches all available currencies on an exchange
|
|
1624
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-currencies
|
|
1625
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1626
|
-
* @returns {object} an associative dictionary of currencies
|
|
1627
|
-
*/
|
|
1628
1628
|
// this endpoint requires authentication
|
|
1629
1629
|
// while fetchCurrencies is a public API method by design
|
|
1630
1630
|
// therefore we check the keys here
|
|
@@ -1757,18 +1757,18 @@ class okx extends okx$1 {
|
|
|
1757
1757
|
}
|
|
1758
1758
|
return result;
|
|
1759
1759
|
}
|
|
1760
|
+
/**
|
|
1761
|
+
* @method
|
|
1762
|
+
* @name okx#fetchOrderBook
|
|
1763
|
+
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
1764
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-order-book
|
|
1765
|
+
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
1766
|
+
* @param {int} [limit] the maximum amount of order book entries to return
|
|
1767
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1768
|
+
* @param {string} [params.method] 'publicGetMarketBooksFull' or 'publicGetMarketBooks' default is 'publicGetMarketBooks'
|
|
1769
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
1770
|
+
*/
|
|
1760
1771
|
async fetchOrderBook(symbol, limit = undefined, params = {}) {
|
|
1761
|
-
/**
|
|
1762
|
-
* @method
|
|
1763
|
-
* @name okx#fetchOrderBook
|
|
1764
|
-
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
1765
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-order-book
|
|
1766
|
-
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
1767
|
-
* @param {int} [limit] the maximum amount of order book entries to return
|
|
1768
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1769
|
-
* @param {string} [params.method] 'publicGetMarketBooksFull' or 'publicGetMarketBooks' default is 'publicGetMarketBooks'
|
|
1770
|
-
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
1771
|
-
*/
|
|
1772
1772
|
await this.loadMarkets();
|
|
1773
1773
|
const market = this.market(symbol);
|
|
1774
1774
|
const request = {
|
|
@@ -1890,16 +1890,16 @@ class okx extends okx$1 {
|
|
|
1890
1890
|
'info': ticker,
|
|
1891
1891
|
}, market);
|
|
1892
1892
|
}
|
|
1893
|
+
/**
|
|
1894
|
+
* @method
|
|
1895
|
+
* @name okx#fetchTicker
|
|
1896
|
+
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
1897
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-ticker
|
|
1898
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
1899
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1900
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1901
|
+
*/
|
|
1893
1902
|
async fetchTicker(symbol, params = {}) {
|
|
1894
|
-
/**
|
|
1895
|
-
* @method
|
|
1896
|
-
* @name okx#fetchTicker
|
|
1897
|
-
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
1898
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-ticker
|
|
1899
|
-
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
1900
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1901
|
-
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1902
|
-
*/
|
|
1903
1903
|
await this.loadMarkets();
|
|
1904
1904
|
const market = this.market(symbol);
|
|
1905
1905
|
const request = {
|
|
@@ -1936,16 +1936,16 @@ class okx extends okx$1 {
|
|
|
1936
1936
|
const first = this.safeDict(data, 0, {});
|
|
1937
1937
|
return this.parseTicker(first, market);
|
|
1938
1938
|
}
|
|
1939
|
+
/**
|
|
1940
|
+
* @method
|
|
1941
|
+
* @name okx#fetchTickers
|
|
1942
|
+
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
1943
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
|
|
1944
|
+
* @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
1945
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1946
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1947
|
+
*/
|
|
1939
1948
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
1940
|
-
/**
|
|
1941
|
-
* @method
|
|
1942
|
-
* @name okx#fetchTickers
|
|
1943
|
-
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
1944
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
|
|
1945
|
-
* @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
1946
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1947
|
-
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1948
|
-
*/
|
|
1949
1949
|
await this.loadMarkets();
|
|
1950
1950
|
symbols = this.marketSymbols(symbols);
|
|
1951
1951
|
const market = this.getMarketFromSymbols(symbols);
|
|
@@ -1994,16 +1994,16 @@ class okx extends okx$1 {
|
|
|
1994
1994
|
const tickers = this.safeList(response, 'data', []);
|
|
1995
1995
|
return this.parseTickers(tickers, symbols);
|
|
1996
1996
|
}
|
|
1997
|
+
/**
|
|
1998
|
+
* @method
|
|
1999
|
+
* @name okx#fetchMarkPrice
|
|
2000
|
+
* @description fetches mark price for the market
|
|
2001
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-mark-price
|
|
2002
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
2003
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2004
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
2005
|
+
*/
|
|
1997
2006
|
async fetchMarkPrice(symbol, params = {}) {
|
|
1998
|
-
/**
|
|
1999
|
-
* @method
|
|
2000
|
-
* @name okx#fetchMarkPrice
|
|
2001
|
-
* @description fetches mark price for the market
|
|
2002
|
-
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-mark-price
|
|
2003
|
-
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
2004
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2005
|
-
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
2006
|
-
*/
|
|
2007
2007
|
await this.loadMarkets();
|
|
2008
2008
|
const market = this.market(symbol);
|
|
2009
2009
|
const request = {
|
|
@@ -2027,16 +2027,16 @@ class okx extends okx$1 {
|
|
|
2027
2027
|
const data = this.safeList(response, 'data');
|
|
2028
2028
|
return this.parseTicker(this.safeDict(data, 0), market);
|
|
2029
2029
|
}
|
|
2030
|
+
/**
|
|
2031
|
+
* @method
|
|
2032
|
+
* @name okx#fetchMarkPrices
|
|
2033
|
+
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
2034
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-mark-price
|
|
2035
|
+
* @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
2036
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2037
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
2038
|
+
*/
|
|
2030
2039
|
async fetchMarkPrices(symbols = undefined, params = {}) {
|
|
2031
|
-
/**
|
|
2032
|
-
* @method
|
|
2033
|
-
* @name okx#fetchMarkPrices
|
|
2034
|
-
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
2035
|
-
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-mark-price
|
|
2036
|
-
* @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
2037
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2038
|
-
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
2039
|
-
*/
|
|
2040
2040
|
await this.loadMarkets();
|
|
2041
2041
|
symbols = this.marketSymbols(symbols);
|
|
2042
2042
|
const market = this.getMarketFromSymbols(symbols);
|
|
@@ -2152,20 +2152,20 @@ class okx extends okx$1 {
|
|
|
2152
2152
|
'fee': fee,
|
|
2153
2153
|
}, market);
|
|
2154
2154
|
}
|
|
2155
|
+
/**
|
|
2156
|
+
* @method
|
|
2157
|
+
* @name okx#fetchTrades
|
|
2158
|
+
* @description get the list of most recent trades for a particular symbol
|
|
2159
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-trades
|
|
2160
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-option-trades
|
|
2161
|
+
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
2162
|
+
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
2163
|
+
* @param {int} [limit] the maximum amount of trades to fetch
|
|
2164
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2165
|
+
* @param {boolean} [params.paginate] *only applies to publicGetMarketHistoryTrades* default false, when true will automatically paginate by calling this endpoint multiple times
|
|
2166
|
+
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
2167
|
+
*/
|
|
2155
2168
|
async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
2156
|
-
/**
|
|
2157
|
-
* @method
|
|
2158
|
-
* @name okx#fetchTrades
|
|
2159
|
-
* @description get the list of most recent trades for a particular symbol
|
|
2160
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-trades
|
|
2161
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-option-trades
|
|
2162
|
-
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
2163
|
-
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
2164
|
-
* @param {int} [limit] the maximum amount of trades to fetch
|
|
2165
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2166
|
-
* @param {boolean} [params.paginate] *only applies to publicGetMarketHistoryTrades* default false, when true will automatically paginate by calling this endpoint multiple times
|
|
2167
|
-
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
2168
|
-
*/
|
|
2169
2169
|
await this.loadMarkets();
|
|
2170
2170
|
let paginate = false;
|
|
2171
2171
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchTrades', 'paginate');
|
|
@@ -2256,27 +2256,27 @@ class okx extends okx$1 {
|
|
|
2256
2256
|
this.safeNumber(ohlcv, volumeIndex),
|
|
2257
2257
|
];
|
|
2258
2258
|
}
|
|
2259
|
+
/**
|
|
2260
|
+
* @method
|
|
2261
|
+
* @name okx#fetchOHLCV
|
|
2262
|
+
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
2263
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-candlesticks
|
|
2264
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-candlesticks-history
|
|
2265
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-mark-price-candlesticks
|
|
2266
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-mark-price-candlesticks-history
|
|
2267
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-index-candlesticks
|
|
2268
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-index-candlesticks-history
|
|
2269
|
+
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
2270
|
+
* @param {string} timeframe the length of time each candle represents
|
|
2271
|
+
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
2272
|
+
* @param {int} [limit] the maximum amount of candles to fetch
|
|
2273
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2274
|
+
* @param {string} [params.price] "mark" or "index" for mark price and index price candles
|
|
2275
|
+
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
2276
|
+
* @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)
|
|
2277
|
+
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
2278
|
+
*/
|
|
2259
2279
|
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
2260
|
-
/**
|
|
2261
|
-
* @method
|
|
2262
|
-
* @name okx#fetchOHLCV
|
|
2263
|
-
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
2264
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-candlesticks
|
|
2265
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-candlesticks-history
|
|
2266
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-mark-price-candlesticks
|
|
2267
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-mark-price-candlesticks-history
|
|
2268
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-index-candlesticks
|
|
2269
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-index-candlesticks-history
|
|
2270
|
-
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
2271
|
-
* @param {string} timeframe the length of time each candle represents
|
|
2272
|
-
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
2273
|
-
* @param {int} [limit] the maximum amount of candles to fetch
|
|
2274
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2275
|
-
* @param {string} [params.price] "mark" or "index" for mark price and index price candles
|
|
2276
|
-
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
2277
|
-
* @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)
|
|
2278
|
-
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
2279
|
-
*/
|
|
2280
2280
|
await this.loadMarkets();
|
|
2281
2281
|
const market = this.market(symbol);
|
|
2282
2282
|
let paginate = false;
|
|
@@ -2363,19 +2363,19 @@ class okx extends okx$1 {
|
|
|
2363
2363
|
const data = this.safeList(response, 'data', []);
|
|
2364
2364
|
return this.parseOHLCVs(data, market, timeframe, since, limit);
|
|
2365
2365
|
}
|
|
2366
|
+
/**
|
|
2367
|
+
* @method
|
|
2368
|
+
* @name okx#fetchFundingRateHistory
|
|
2369
|
+
* @description fetches historical funding rate prices
|
|
2370
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate-history
|
|
2371
|
+
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
2372
|
+
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
|
|
2373
|
+
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} to fetch
|
|
2374
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2375
|
+
* @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)
|
|
2376
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
|
|
2377
|
+
*/
|
|
2366
2378
|
async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
2367
|
-
/**
|
|
2368
|
-
* @method
|
|
2369
|
-
* @name okx#fetchFundingRateHistory
|
|
2370
|
-
* @description fetches historical funding rate prices
|
|
2371
|
-
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate-history
|
|
2372
|
-
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
2373
|
-
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
|
|
2374
|
-
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} to fetch
|
|
2375
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2376
|
-
* @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)
|
|
2377
|
-
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
|
|
2378
|
-
*/
|
|
2379
2379
|
if (symbol === undefined) {
|
|
2380
2380
|
throw new errors.ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
|
|
2381
2381
|
}
|
|
@@ -2510,16 +2510,16 @@ class okx extends okx$1 {
|
|
|
2510
2510
|
'tierBased': undefined,
|
|
2511
2511
|
};
|
|
2512
2512
|
}
|
|
2513
|
+
/**
|
|
2514
|
+
* @method
|
|
2515
|
+
* @name okx#fetchTradingFee
|
|
2516
|
+
* @description fetch the trading fees for a market
|
|
2517
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-fee-rates
|
|
2518
|
+
* @param {string} symbol unified market symbol
|
|
2519
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2520
|
+
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
2521
|
+
*/
|
|
2513
2522
|
async fetchTradingFee(symbol, params = {}) {
|
|
2514
|
-
/**
|
|
2515
|
-
* @method
|
|
2516
|
-
* @name okx#fetchTradingFee
|
|
2517
|
-
* @description fetch the trading fees for a market
|
|
2518
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-fee-rates
|
|
2519
|
-
* @param {string} symbol unified market symbol
|
|
2520
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2521
|
-
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
2522
|
-
*/
|
|
2523
2523
|
await this.loadMarkets();
|
|
2524
2524
|
const market = this.market(symbol);
|
|
2525
2525
|
const request = {
|
|
@@ -2560,17 +2560,17 @@ class okx extends okx$1 {
|
|
|
2560
2560
|
const first = this.safeDict(data, 0, {});
|
|
2561
2561
|
return this.parseTradingFee(first, market);
|
|
2562
2562
|
}
|
|
2563
|
+
/**
|
|
2564
|
+
* @method
|
|
2565
|
+
* @name okx#fetchBalance
|
|
2566
|
+
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
2567
|
+
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-balance
|
|
2568
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-balance
|
|
2569
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2570
|
+
* @param {string} [params.type] wallet type, ['funding' or 'trading'] default is 'trading'
|
|
2571
|
+
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
2572
|
+
*/
|
|
2563
2573
|
async fetchBalance(params = {}) {
|
|
2564
|
-
/**
|
|
2565
|
-
* @method
|
|
2566
|
-
* @name okx#fetchBalance
|
|
2567
|
-
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
2568
|
-
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-balance
|
|
2569
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-balance
|
|
2570
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2571
|
-
* @param {string} [params.type] wallet type, ['funding' or 'trading'] default is 'trading'
|
|
2572
|
-
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
2573
|
-
*/
|
|
2574
2574
|
await this.loadMarkets();
|
|
2575
2575
|
const [marketType, query] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
|
|
2576
2576
|
const request = {
|
|
@@ -2687,17 +2687,17 @@ class okx extends okx$1 {
|
|
|
2687
2687
|
//
|
|
2688
2688
|
return this.parseBalanceByType(marketType, response);
|
|
2689
2689
|
}
|
|
2690
|
+
/**
|
|
2691
|
+
* @method
|
|
2692
|
+
* @name okx#createMarketBuyOrderWithCost
|
|
2693
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
|
|
2694
|
+
* @description create a market buy order by providing the symbol and cost
|
|
2695
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
2696
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
2697
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2698
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2699
|
+
*/
|
|
2690
2700
|
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
2691
|
-
/**
|
|
2692
|
-
* @method
|
|
2693
|
-
* @name okx#createMarketBuyOrderWithCost
|
|
2694
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
|
|
2695
|
-
* @description create a market buy order by providing the symbol and cost
|
|
2696
|
-
* @param {string} symbol unified symbol of the market to create an order in
|
|
2697
|
-
* @param {float} cost how much you want to trade in units of the quote currency
|
|
2698
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2699
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2700
|
-
*/
|
|
2701
2701
|
await this.loadMarkets();
|
|
2702
2702
|
const market = this.market(symbol);
|
|
2703
2703
|
if (!market['spot']) {
|
|
@@ -2707,17 +2707,17 @@ class okx extends okx$1 {
|
|
|
2707
2707
|
params['tgtCcy'] = 'quote_ccy';
|
|
2708
2708
|
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
2709
2709
|
}
|
|
2710
|
+
/**
|
|
2711
|
+
* @method
|
|
2712
|
+
* @name okx#createMarketSellOrderWithCost
|
|
2713
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
|
|
2714
|
+
* @description create a market buy order by providing the symbol and cost
|
|
2715
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
2716
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
2717
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2718
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2719
|
+
*/
|
|
2710
2720
|
async createMarketSellOrderWithCost(symbol, cost, params = {}) {
|
|
2711
|
-
/**
|
|
2712
|
-
* @method
|
|
2713
|
-
* @name okx#createMarketSellOrderWithCost
|
|
2714
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
|
|
2715
|
-
* @description create a market buy order by providing the symbol and cost
|
|
2716
|
-
* @param {string} symbol unified symbol of the market to create an order in
|
|
2717
|
-
* @param {float} cost how much you want to trade in units of the quote currency
|
|
2718
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2719
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2720
|
-
*/
|
|
2721
2721
|
await this.loadMarkets();
|
|
2722
2722
|
const market = this.market(symbol);
|
|
2723
2723
|
if (!market['spot']) {
|
|
@@ -3010,36 +3010,36 @@ class okx extends okx$1 {
|
|
|
3010
3010
|
}
|
|
3011
3011
|
return this.extend(request, params);
|
|
3012
3012
|
}
|
|
3013
|
+
/**
|
|
3014
|
+
* @method
|
|
3015
|
+
* @name okx#createOrder
|
|
3016
|
+
* @description create a trade order
|
|
3017
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
|
|
3018
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-multiple-orders
|
|
3019
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-place-algo-order
|
|
3020
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
3021
|
+
* @param {string} type 'market' or 'limit'
|
|
3022
|
+
* @param {string} side 'buy' or 'sell'
|
|
3023
|
+
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
3024
|
+
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
3025
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3026
|
+
* @param {bool} [params.reduceOnly] a mark to reduce the position size for margin, swap and future orders
|
|
3027
|
+
* @param {bool} [params.postOnly] true to place a post only order
|
|
3028
|
+
* @param {object} [params.takeProfit] *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered (perpetual swap markets only)
|
|
3029
|
+
* @param {float} [params.takeProfit.triggerPrice] take profit trigger price
|
|
3030
|
+
* @param {float} [params.takeProfit.price] used for take profit limit orders, not used for take profit market price orders
|
|
3031
|
+
* @param {string} [params.takeProfit.type] 'market' or 'limit' used to specify the take profit price type
|
|
3032
|
+
* @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered (perpetual swap markets only)
|
|
3033
|
+
* @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
|
|
3034
|
+
* @param {float} [params.stopLoss.price] used for stop loss limit orders, not used for stop loss market price orders
|
|
3035
|
+
* @param {string} [params.stopLoss.type] 'market' or 'limit' used to specify the stop loss price type
|
|
3036
|
+
* @param {string} [params.positionSide] if position mode is one-way: set to 'net', if position mode is hedge-mode: set to 'long' or 'short'
|
|
3037
|
+
* @param {string} [params.trailingPercent] the percent to trail away from the current market price
|
|
3038
|
+
* @param {string} [params.tpOrdKind] 'condition' or 'limit', the default is 'condition'
|
|
3039
|
+
* @param {bool} [params.hedged] *swap and future only* true for hedged mode, false for one way mode
|
|
3040
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3041
|
+
*/
|
|
3013
3042
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
3014
|
-
/**
|
|
3015
|
-
* @method
|
|
3016
|
-
* @name okx#createOrder
|
|
3017
|
-
* @description create a trade order
|
|
3018
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
|
|
3019
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-multiple-orders
|
|
3020
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-place-algo-order
|
|
3021
|
-
* @param {string} symbol unified symbol of the market to create an order in
|
|
3022
|
-
* @param {string} type 'market' or 'limit'
|
|
3023
|
-
* @param {string} side 'buy' or 'sell'
|
|
3024
|
-
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
3025
|
-
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
3026
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3027
|
-
* @param {bool} [params.reduceOnly] a mark to reduce the position size for margin, swap and future orders
|
|
3028
|
-
* @param {bool} [params.postOnly] true to place a post only order
|
|
3029
|
-
* @param {object} [params.takeProfit] *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered (perpetual swap markets only)
|
|
3030
|
-
* @param {float} [params.takeProfit.triggerPrice] take profit trigger price
|
|
3031
|
-
* @param {float} [params.takeProfit.price] used for take profit limit orders, not used for take profit market price orders
|
|
3032
|
-
* @param {string} [params.takeProfit.type] 'market' or 'limit' used to specify the take profit price type
|
|
3033
|
-
* @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered (perpetual swap markets only)
|
|
3034
|
-
* @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
|
|
3035
|
-
* @param {float} [params.stopLoss.price] used for stop loss limit orders, not used for stop loss market price orders
|
|
3036
|
-
* @param {string} [params.stopLoss.type] 'market' or 'limit' used to specify the stop loss price type
|
|
3037
|
-
* @param {string} [params.positionSide] if position mode is one-way: set to 'net', if position mode is hedge-mode: set to 'long' or 'short'
|
|
3038
|
-
* @param {string} [params.trailingPercent] the percent to trail away from the current market price
|
|
3039
|
-
* @param {string} [params.tpOrdKind] 'condition' or 'limit', the default is 'condition'
|
|
3040
|
-
* @param {bool} [params.hedged] *swap and future only* true for hedged mode, false for one way mode
|
|
3041
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3042
|
-
*/
|
|
3043
3043
|
await this.loadMarkets();
|
|
3044
3044
|
const market = this.market(symbol);
|
|
3045
3045
|
let request = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
@@ -3074,15 +3074,16 @@ class okx extends okx$1 {
|
|
|
3074
3074
|
order['side'] = side;
|
|
3075
3075
|
return order;
|
|
3076
3076
|
}
|
|
3077
|
+
/**
|
|
3078
|
+
* @method
|
|
3079
|
+
* @name okx#createOrders
|
|
3080
|
+
* @description create a list of trade orders
|
|
3081
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-multiple-orders
|
|
3082
|
+
* @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
|
|
3083
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3084
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3085
|
+
*/
|
|
3077
3086
|
async createOrders(orders, params = {}) {
|
|
3078
|
-
/**
|
|
3079
|
-
* @method
|
|
3080
|
-
* @name okx#createOrders
|
|
3081
|
-
* @description create a list of trade orders
|
|
3082
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-multiple-orders
|
|
3083
|
-
* @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
|
|
3084
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3085
|
-
*/
|
|
3086
3087
|
await this.loadMarkets();
|
|
3087
3088
|
const ordersRequests = [];
|
|
3088
3089
|
for (let i = 0; i < orders.length; i++) {
|
|
@@ -3220,38 +3221,38 @@ class okx extends okx$1 {
|
|
|
3220
3221
|
params = this.omit(params, ['clOrdId', 'clientOrderId', 'takeProfitPrice', 'stopLossPrice', 'stopLoss', 'takeProfit']);
|
|
3221
3222
|
return this.extend(request, params);
|
|
3222
3223
|
}
|
|
3224
|
+
/**
|
|
3225
|
+
* @method
|
|
3226
|
+
* @name okx#editOrder
|
|
3227
|
+
* @description edit a trade order
|
|
3228
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-amend-order
|
|
3229
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-amend-algo-order
|
|
3230
|
+
* @param {string} id order id
|
|
3231
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
3232
|
+
* @param {string} type 'market' or 'limit'
|
|
3233
|
+
* @param {string} side 'buy' or 'sell'
|
|
3234
|
+
* @param {float} amount how much of the currency you want to trade in units of the base currency
|
|
3235
|
+
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
3236
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3237
|
+
* @param {string} [params.clientOrderId] client order id, uses id if not passed
|
|
3238
|
+
* @param {float} [params.stopLossPrice] stop loss trigger price
|
|
3239
|
+
* @param {float} [params.newSlOrdPx] the stop loss order price, set to stopLossPrice if the type is market
|
|
3240
|
+
* @param {string} [params.newSlTriggerPxType] 'last', 'index' or 'mark' used to specify the stop loss trigger price type, default is 'last'
|
|
3241
|
+
* @param {float} [params.takeProfitPrice] take profit trigger price
|
|
3242
|
+
* @param {float} [params.newTpOrdPx] the take profit order price, set to takeProfitPrice if the type is market
|
|
3243
|
+
* @param {string} [params.newTpTriggerPxType] 'last', 'index' or 'mark' used to specify the take profit trigger price type, default is 'last'
|
|
3244
|
+
* @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
|
|
3245
|
+
* @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
|
|
3246
|
+
* @param {float} [params.stopLoss.price] used for stop loss limit orders, not used for stop loss market price orders
|
|
3247
|
+
* @param {string} [params.stopLoss.type] 'market' or 'limit' used to specify the stop loss price type
|
|
3248
|
+
* @param {object} [params.takeProfit] *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered
|
|
3249
|
+
* @param {float} [params.takeProfit.triggerPrice] take profit trigger price
|
|
3250
|
+
* @param {float} [params.takeProfit.price] used for take profit limit orders, not used for take profit market price orders
|
|
3251
|
+
* @param {string} [params.takeProfit.type] 'market' or 'limit' used to specify the take profit price type
|
|
3252
|
+
* @param {string} [params.newTpOrdKind] 'condition' or 'limit', the default is 'condition'
|
|
3253
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3254
|
+
*/
|
|
3223
3255
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
3224
|
-
/**
|
|
3225
|
-
* @method
|
|
3226
|
-
* @name okx#editOrder
|
|
3227
|
-
* @description edit a trade order
|
|
3228
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-amend-order
|
|
3229
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-amend-algo-order
|
|
3230
|
-
* @param {string} id order id
|
|
3231
|
-
* @param {string} symbol unified symbol of the market to create an order in
|
|
3232
|
-
* @param {string} type 'market' or 'limit'
|
|
3233
|
-
* @param {string} side 'buy' or 'sell'
|
|
3234
|
-
* @param {float} amount how much of the currency you want to trade in units of the base currency
|
|
3235
|
-
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
3236
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3237
|
-
* @param {string} [params.clientOrderId] client order id, uses id if not passed
|
|
3238
|
-
* @param {float} [params.stopLossPrice] stop loss trigger price
|
|
3239
|
-
* @param {float} [params.newSlOrdPx] the stop loss order price, set to stopLossPrice if the type is market
|
|
3240
|
-
* @param {string} [params.newSlTriggerPxType] 'last', 'index' or 'mark' used to specify the stop loss trigger price type, default is 'last'
|
|
3241
|
-
* @param {float} [params.takeProfitPrice] take profit trigger price
|
|
3242
|
-
* @param {float} [params.newTpOrdPx] the take profit order price, set to takeProfitPrice if the type is market
|
|
3243
|
-
* @param {string} [params.newTpTriggerPxType] 'last', 'index' or 'mark' used to specify the take profit trigger price type, default is 'last'
|
|
3244
|
-
* @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
|
|
3245
|
-
* @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
|
|
3246
|
-
* @param {float} [params.stopLoss.price] used for stop loss limit orders, not used for stop loss market price orders
|
|
3247
|
-
* @param {string} [params.stopLoss.type] 'market' or 'limit' used to specify the stop loss price type
|
|
3248
|
-
* @param {object} [params.takeProfit] *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered
|
|
3249
|
-
* @param {float} [params.takeProfit.triggerPrice] take profit trigger price
|
|
3250
|
-
* @param {float} [params.takeProfit.price] used for take profit limit orders, not used for take profit market price orders
|
|
3251
|
-
* @param {string} [params.takeProfit.type] 'market' or 'limit' used to specify the take profit price type
|
|
3252
|
-
* @param {string} [params.newTpOrdKind] 'condition' or 'limit', the default is 'condition'
|
|
3253
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3254
|
-
*/
|
|
3255
3256
|
await this.loadMarkets();
|
|
3256
3257
|
const market = this.market(symbol);
|
|
3257
3258
|
const request = this.editOrderRequest(id, symbol, type, side, amount, price, params);
|
|
@@ -3288,20 +3289,20 @@ class okx extends okx$1 {
|
|
|
3288
3289
|
order['side'] = side;
|
|
3289
3290
|
return order;
|
|
3290
3291
|
}
|
|
3292
|
+
/**
|
|
3293
|
+
* @method
|
|
3294
|
+
* @name okx#cancelOrder
|
|
3295
|
+
* @description cancels an open order
|
|
3296
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-order
|
|
3297
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-cancel-algo-order
|
|
3298
|
+
* @param {string} id order id
|
|
3299
|
+
* @param {string} symbol unified symbol of the market the order was made in
|
|
3300
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3301
|
+
* @param {boolean} [params.trigger] true if trigger orders
|
|
3302
|
+
* @param {boolean} [params.trailing] set to true if you want to cancel a trailing order
|
|
3303
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3304
|
+
*/
|
|
3291
3305
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
3292
|
-
/**
|
|
3293
|
-
* @method
|
|
3294
|
-
* @name okx#cancelOrder
|
|
3295
|
-
* @description cancels an open order
|
|
3296
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-order
|
|
3297
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-cancel-algo-order
|
|
3298
|
-
* @param {string} id order id
|
|
3299
|
-
* @param {string} symbol unified symbol of the market the order was made in
|
|
3300
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3301
|
-
* @param {boolean} [params.trigger] true if trigger orders
|
|
3302
|
-
* @param {boolean} [params.trailing] set to true if you want to cancel a trailing order
|
|
3303
|
-
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3304
|
-
*/
|
|
3305
3306
|
if (symbol === undefined) {
|
|
3306
3307
|
throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
3307
3308
|
}
|
|
@@ -3347,20 +3348,20 @@ class okx extends okx$1 {
|
|
|
3347
3348
|
return ids;
|
|
3348
3349
|
}
|
|
3349
3350
|
}
|
|
3351
|
+
/**
|
|
3352
|
+
* @method
|
|
3353
|
+
* @name okx#cancelOrders
|
|
3354
|
+
* @description cancel multiple orders
|
|
3355
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-multiple-orders
|
|
3356
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-cancel-algo-order
|
|
3357
|
+
* @param {string[]} ids order ids
|
|
3358
|
+
* @param {string} symbol unified market symbol
|
|
3359
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3360
|
+
* @param {boolean} [params.trigger] whether the order is a stop/trigger order
|
|
3361
|
+
* @param {boolean} [params.trailing] set to true if you want to cancel trailing orders
|
|
3362
|
+
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3363
|
+
*/
|
|
3350
3364
|
async cancelOrders(ids, symbol = undefined, params = {}) {
|
|
3351
|
-
/**
|
|
3352
|
-
* @method
|
|
3353
|
-
* @name okx#cancelOrders
|
|
3354
|
-
* @description cancel multiple orders
|
|
3355
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-multiple-orders
|
|
3356
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-cancel-algo-order
|
|
3357
|
-
* @param {string[]} ids order ids
|
|
3358
|
-
* @param {string} symbol unified market symbol
|
|
3359
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3360
|
-
* @param {boolean} [params.trigger] whether the order is a stop/trigger order
|
|
3361
|
-
* @param {boolean} [params.trailing] set to true if you want to cancel trailing orders
|
|
3362
|
-
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3363
|
-
*/
|
|
3364
3365
|
// 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.
|
|
3365
3366
|
if (symbol === undefined) {
|
|
3366
3367
|
throw new errors.ArgumentsRequired(this.id + ' cancelOrders() requires a symbol argument');
|
|
@@ -3450,19 +3451,19 @@ class okx extends okx$1 {
|
|
|
3450
3451
|
const ordersData = this.safeList(response, 'data', []);
|
|
3451
3452
|
return this.parseOrders(ordersData, market, undefined, undefined, params);
|
|
3452
3453
|
}
|
|
3454
|
+
/**
|
|
3455
|
+
* @method
|
|
3456
|
+
* @name okx#cancelOrdersForSymbols
|
|
3457
|
+
* @description cancel multiple orders for multiple symbols
|
|
3458
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-multiple-orders
|
|
3459
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-cancel-algo-order
|
|
3460
|
+
* @param {CancellationRequest[]} orders each order should contain the parameters required by cancelOrder namely id and symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}]
|
|
3461
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3462
|
+
* @param {boolean} [params.trigger] whether the order is a stop/trigger order
|
|
3463
|
+
* @param {boolean} [params.trailing] set to true if you want to cancel trailing orders
|
|
3464
|
+
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3465
|
+
*/
|
|
3453
3466
|
async cancelOrdersForSymbols(orders, params = {}) {
|
|
3454
|
-
/**
|
|
3455
|
-
* @method
|
|
3456
|
-
* @name okx#cancelOrdersForSymbols
|
|
3457
|
-
* @description cancel multiple orders for multiple symbols
|
|
3458
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-multiple-orders
|
|
3459
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-cancel-algo-order
|
|
3460
|
-
* @param {CancellationRequest[]} orders each order should contain the parameters required by cancelOrder namely id and symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}]
|
|
3461
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3462
|
-
* @param {boolean} [params.trigger] whether the order is a stop/trigger order
|
|
3463
|
-
* @param {boolean} [params.trailing] set to true if you want to cancel trailing orders
|
|
3464
|
-
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3465
|
-
*/
|
|
3466
3467
|
await this.loadMarkets();
|
|
3467
3468
|
const request = [];
|
|
3468
3469
|
const options = this.safeDict(this.options, 'cancelOrders', {});
|
|
@@ -3532,16 +3533,16 @@ class okx extends okx$1 {
|
|
|
3532
3533
|
const ordersData = this.safeList(response, 'data', []);
|
|
3533
3534
|
return this.parseOrders(ordersData, undefined, undefined, undefined, params);
|
|
3534
3535
|
}
|
|
3536
|
+
/**
|
|
3537
|
+
* @method
|
|
3538
|
+
* @name okx#cancelAllOrdersAfter
|
|
3539
|
+
* @description dead man's switch, cancel all orders after the given timeout
|
|
3540
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-all-after
|
|
3541
|
+
* @param {number} timeout time in milliseconds, 0 represents cancel the timer
|
|
3542
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3543
|
+
* @returns {object} the api result
|
|
3544
|
+
*/
|
|
3535
3545
|
async cancelAllOrdersAfter(timeout, params = {}) {
|
|
3536
|
-
/**
|
|
3537
|
-
* @method
|
|
3538
|
-
* @name okx#cancelAllOrdersAfter
|
|
3539
|
-
* @description dead man's switch, cancel all orders after the given timeout
|
|
3540
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-all-after
|
|
3541
|
-
* @param {number} timeout time in milliseconds, 0 represents cancel the timer
|
|
3542
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3543
|
-
* @returns {object} the api result
|
|
3544
|
-
*/
|
|
3545
3546
|
await this.loadMarkets();
|
|
3546
3547
|
const request = {
|
|
3547
3548
|
'timeOut': (timeout > 0) ? this.parseToInt(timeout / 1000) : 0,
|
|
@@ -3781,19 +3782,19 @@ class okx extends okx$1 {
|
|
|
3781
3782
|
'reduceOnly': reduceOnly,
|
|
3782
3783
|
}, market);
|
|
3783
3784
|
}
|
|
3785
|
+
/**
|
|
3786
|
+
* @method
|
|
3787
|
+
* @name okx#fetchOrder
|
|
3788
|
+
* @description fetch an order by the id
|
|
3789
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-details
|
|
3790
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-details
|
|
3791
|
+
* @param {string} id the order id
|
|
3792
|
+
* @param {string} symbol unified market symbol
|
|
3793
|
+
* @param {object} [params] extra and exchange specific parameters
|
|
3794
|
+
* @param {boolean} [params.trigger] true if fetching trigger orders
|
|
3795
|
+
* @returns [an order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3796
|
+
*/
|
|
3784
3797
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
3785
|
-
/**
|
|
3786
|
-
* @method
|
|
3787
|
-
* @name okx#fetchOrder
|
|
3788
|
-
* @description fetch an order by the id
|
|
3789
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-details
|
|
3790
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-details
|
|
3791
|
-
* @param {string} id the order id
|
|
3792
|
-
* @param {string} symbol unified market symbol
|
|
3793
|
-
* @param {object} [params] extra and exchange specific parameters
|
|
3794
|
-
* @param {boolean} [params.trigger] true if fetching trigger orders
|
|
3795
|
-
* @returns [an order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3796
|
-
*/
|
|
3797
3798
|
if (symbol === undefined) {
|
|
3798
3799
|
throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
|
|
3799
3800
|
}
|
|
@@ -3935,24 +3936,24 @@ class okx extends okx$1 {
|
|
|
3935
3936
|
const order = this.safeDict(data, 0);
|
|
3936
3937
|
return this.parseOrder(order, market);
|
|
3937
3938
|
}
|
|
3939
|
+
/**
|
|
3940
|
+
* @method
|
|
3941
|
+
* @name okx#fetchOpenOrders
|
|
3942
|
+
* @description fetch all unfilled currently open orders
|
|
3943
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-list
|
|
3944
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-list
|
|
3945
|
+
* @param {string} symbol unified market symbol
|
|
3946
|
+
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
3947
|
+
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
3948
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3949
|
+
* @param {bool} [params.stop] True if fetching trigger or conditional orders
|
|
3950
|
+
* @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
|
3951
|
+
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
3952
|
+
* @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)
|
|
3953
|
+
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
|
|
3954
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3955
|
+
*/
|
|
3938
3956
|
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
3939
|
-
/**
|
|
3940
|
-
* @method
|
|
3941
|
-
* @name okx#fetchOpenOrders
|
|
3942
|
-
* @description fetch all unfilled currently open orders
|
|
3943
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-list
|
|
3944
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-list
|
|
3945
|
-
* @param {string} symbol unified market symbol
|
|
3946
|
-
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
3947
|
-
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
3948
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3949
|
-
* @param {bool} [params.stop] True if fetching trigger or conditional orders
|
|
3950
|
-
* @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
|
3951
|
-
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
3952
|
-
* @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)
|
|
3953
|
-
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
|
|
3954
|
-
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3955
|
-
*/
|
|
3956
3957
|
await this.loadMarkets();
|
|
3957
3958
|
let paginate = false;
|
|
3958
3959
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchOpenOrders', 'paginate');
|
|
@@ -4099,24 +4100,24 @@ class okx extends okx$1 {
|
|
|
4099
4100
|
const data = this.safeList(response, 'data', []);
|
|
4100
4101
|
return this.parseOrders(data, market, since, limit);
|
|
4101
4102
|
}
|
|
4103
|
+
/**
|
|
4104
|
+
* @method
|
|
4105
|
+
* @name okx#fetchCanceledOrders
|
|
4106
|
+
* @description fetches information on multiple canceled orders made by the user
|
|
4107
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-history-last-7-days
|
|
4108
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-history
|
|
4109
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
4110
|
+
* @param {int} [since] timestamp in ms of the earliest order, default is undefined
|
|
4111
|
+
* @param {int} [limit] max number of orders to return, default is undefined
|
|
4112
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4113
|
+
* @param {bool} [params.stop] True if fetching trigger or conditional orders
|
|
4114
|
+
* @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
|
4115
|
+
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
4116
|
+
* @param {int} [params.until] timestamp in ms to fetch orders for
|
|
4117
|
+
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
|
|
4118
|
+
* @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4119
|
+
*/
|
|
4102
4120
|
async fetchCanceledOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4103
|
-
/**
|
|
4104
|
-
* @method
|
|
4105
|
-
* @name okx#fetchCanceledOrders
|
|
4106
|
-
* @description fetches information on multiple canceled orders made by the user
|
|
4107
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-history-last-7-days
|
|
4108
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-history
|
|
4109
|
-
* @param {string} symbol unified market symbol of the market orders were made in
|
|
4110
|
-
* @param {int} [since] timestamp in ms of the earliest order, default is undefined
|
|
4111
|
-
* @param {int} [limit] max number of orders to return, default is undefined
|
|
4112
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4113
|
-
* @param {bool} [params.stop] True if fetching trigger or conditional orders
|
|
4114
|
-
* @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
|
4115
|
-
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
4116
|
-
* @param {int} [params.until] timestamp in ms to fetch orders for
|
|
4117
|
-
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
|
|
4118
|
-
* @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4119
|
-
*/
|
|
4120
4121
|
await this.loadMarkets();
|
|
4121
4122
|
const request = {
|
|
4122
4123
|
// 'instType': type.toUpperCase (), // SPOT, MARGIN, SWAP, FUTURES, OPTION
|
|
@@ -4286,27 +4287,27 @@ class okx extends okx$1 {
|
|
|
4286
4287
|
const data = this.safeList(response, 'data', []);
|
|
4287
4288
|
return this.parseOrders(data, market, since, limit);
|
|
4288
4289
|
}
|
|
4290
|
+
/**
|
|
4291
|
+
* @method
|
|
4292
|
+
* @name okx#fetchClosedOrders
|
|
4293
|
+
* @description fetches information on multiple closed orders made by the user
|
|
4294
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-history-last-7-days
|
|
4295
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-history
|
|
4296
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-history-last-3-months
|
|
4297
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
4298
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
4299
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
4300
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4301
|
+
* @param {bool} [params.trigger] True if fetching trigger or conditional orders
|
|
4302
|
+
* @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
|
4303
|
+
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
4304
|
+
* @param {int} [params.until] timestamp in ms to fetch orders for
|
|
4305
|
+
* @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)
|
|
4306
|
+
* @param {string} [params.method] method to be used, either 'privateGetTradeOrdersHistory', 'privateGetTradeOrdersHistoryArchive' or 'privateGetTradeOrdersAlgoHistory' default is 'privateGetTradeOrdersHistory'
|
|
4307
|
+
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
|
|
4308
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4309
|
+
*/
|
|
4289
4310
|
async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4290
|
-
/**
|
|
4291
|
-
* @method
|
|
4292
|
-
* @name okx#fetchClosedOrders
|
|
4293
|
-
* @description fetches information on multiple closed orders made by the user
|
|
4294
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-history-last-7-days
|
|
4295
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-history
|
|
4296
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-history-last-3-months
|
|
4297
|
-
* @param {string} symbol unified market symbol of the market orders were made in
|
|
4298
|
-
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
4299
|
-
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
4300
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4301
|
-
* @param {bool} [params.trigger] True if fetching trigger or conditional orders
|
|
4302
|
-
* @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
|
4303
|
-
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
4304
|
-
* @param {int} [params.until] timestamp in ms to fetch orders for
|
|
4305
|
-
* @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)
|
|
4306
|
-
* @param {string} [params.method] method to be used, either 'privateGetTradeOrdersHistory', 'privateGetTradeOrdersHistoryArchive' or 'privateGetTradeOrdersAlgoHistory' default is 'privateGetTradeOrdersHistory'
|
|
4307
|
-
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
|
|
4308
|
-
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4309
|
-
*/
|
|
4310
4311
|
await this.loadMarkets();
|
|
4311
4312
|
let paginate = false;
|
|
4312
4313
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchClosedOrders', 'paginate');
|
|
@@ -4475,20 +4476,20 @@ class okx extends okx$1 {
|
|
|
4475
4476
|
const data = this.safeList(response, 'data', []);
|
|
4476
4477
|
return this.parseOrders(data, market, since, limit);
|
|
4477
4478
|
}
|
|
4479
|
+
/**
|
|
4480
|
+
* @method
|
|
4481
|
+
* @name okx#fetchMyTrades
|
|
4482
|
+
* @description fetch all trades made by the user
|
|
4483
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-transaction-details-last-3-months
|
|
4484
|
+
* @param {string} symbol unified market symbol
|
|
4485
|
+
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
4486
|
+
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
4487
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4488
|
+
* @param {int} [params.until] Timestamp in ms of the latest time to retrieve trades for
|
|
4489
|
+
* @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)
|
|
4490
|
+
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
4491
|
+
*/
|
|
4478
4492
|
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4479
|
-
/**
|
|
4480
|
-
* @method
|
|
4481
|
-
* @name okx#fetchMyTrades
|
|
4482
|
-
* @description fetch all trades made by the user
|
|
4483
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-transaction-details-last-3-months
|
|
4484
|
-
* @param {string} symbol unified market symbol
|
|
4485
|
-
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
4486
|
-
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
4487
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4488
|
-
* @param {int} [params.until] Timestamp in ms of the latest time to retrieve trades for
|
|
4489
|
-
* @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)
|
|
4490
|
-
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
4491
|
-
*/
|
|
4492
4493
|
await this.loadMarkets();
|
|
4493
4494
|
let paginate = false;
|
|
4494
4495
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
|
|
@@ -4547,19 +4548,19 @@ class okx extends okx$1 {
|
|
|
4547
4548
|
const data = this.safeList(response, 'data', []);
|
|
4548
4549
|
return this.parseTrades(data, market, since, limit, query);
|
|
4549
4550
|
}
|
|
4551
|
+
/**
|
|
4552
|
+
* @method
|
|
4553
|
+
* @name okx#fetchOrderTrades
|
|
4554
|
+
* @description fetch all the trades made from a single order
|
|
4555
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-transaction-details-last-3-months
|
|
4556
|
+
* @param {string} id order id
|
|
4557
|
+
* @param {string} symbol unified market symbol
|
|
4558
|
+
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
4559
|
+
* @param {int} [limit] the maximum number of trades to retrieve
|
|
4560
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4561
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
4562
|
+
*/
|
|
4550
4563
|
async fetchOrderTrades(id, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4551
|
-
/**
|
|
4552
|
-
* @method
|
|
4553
|
-
* @name okx#fetchOrderTrades
|
|
4554
|
-
* @description fetch all the trades made from a single order
|
|
4555
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-transaction-details-last-3-months
|
|
4556
|
-
* @param {string} id order id
|
|
4557
|
-
* @param {string} symbol unified market symbol
|
|
4558
|
-
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
4559
|
-
* @param {int} [limit] the maximum number of trades to retrieve
|
|
4560
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4561
|
-
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
4562
|
-
*/
|
|
4563
4564
|
const request = {
|
|
4564
4565
|
// 'instrument_id': market['id'],
|
|
4565
4566
|
'ordId': id,
|
|
@@ -4569,23 +4570,23 @@ class okx extends okx$1 {
|
|
|
4569
4570
|
};
|
|
4570
4571
|
return await this.fetchMyTrades(symbol, since, limit, this.extend(request, params));
|
|
4571
4572
|
}
|
|
4573
|
+
/**
|
|
4574
|
+
* @method
|
|
4575
|
+
* @name okx#fetchLedger
|
|
4576
|
+
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
4577
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-bills-details-last-7-days
|
|
4578
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-bills-details-last-3-months
|
|
4579
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-asset-bills-details
|
|
4580
|
+
* @param {string} [code] unified currency code, default is undefined
|
|
4581
|
+
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
4582
|
+
* @param {int} [limit] max number of ledger entries to return, default is undefined
|
|
4583
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4584
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
4585
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4586
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
4587
|
+
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
4588
|
+
*/
|
|
4572
4589
|
async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4573
|
-
/**
|
|
4574
|
-
* @method
|
|
4575
|
-
* @name okx#fetchLedger
|
|
4576
|
-
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
4577
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-bills-details-last-7-days
|
|
4578
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-bills-details-last-3-months
|
|
4579
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-asset-bills-details
|
|
4580
|
-
* @param {string} [code] unified currency code, default is undefined
|
|
4581
|
-
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
4582
|
-
* @param {int} [limit] max number of ledger entries to return, default is undefined
|
|
4583
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4584
|
-
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
4585
|
-
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4586
|
-
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
4587
|
-
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
4588
|
-
*/
|
|
4589
4590
|
await this.loadMarkets();
|
|
4590
4591
|
let paginate = false;
|
|
4591
4592
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
|
|
@@ -4875,16 +4876,16 @@ class okx extends okx$1 {
|
|
|
4875
4876
|
'tag': tag,
|
|
4876
4877
|
};
|
|
4877
4878
|
}
|
|
4879
|
+
/**
|
|
4880
|
+
* @method
|
|
4881
|
+
* @name okx#fetchDepositAddressesByNetwork
|
|
4882
|
+
* @description fetch a dictionary of addresses for a currency, indexed by network
|
|
4883
|
+
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-deposit-address
|
|
4884
|
+
* @param {string} code unified currency code of the currency for the deposit address
|
|
4885
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4886
|
+
* @returns {object} a dictionary of [address structures]{@link https://docs.ccxt.com/#/?id=address-structure} indexed by the network
|
|
4887
|
+
*/
|
|
4878
4888
|
async fetchDepositAddressesByNetwork(code, params = {}) {
|
|
4879
|
-
/**
|
|
4880
|
-
* @method
|
|
4881
|
-
* @name okx#fetchDepositAddressesByNetwork
|
|
4882
|
-
* @description fetch a dictionary of addresses for a currency, indexed by network
|
|
4883
|
-
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-deposit-address
|
|
4884
|
-
* @param {string} code unified currency code of the currency for the deposit address
|
|
4885
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4886
|
-
* @returns {object} a dictionary of [address structures]{@link https://docs.ccxt.com/#/?id=address-structure} indexed by the network
|
|
4887
|
-
*/
|
|
4888
4889
|
await this.loadMarkets();
|
|
4889
4890
|
const currency = this.currency(code);
|
|
4890
4891
|
const request = {
|
|
@@ -4917,17 +4918,17 @@ class okx extends okx$1 {
|
|
|
4917
4918
|
const parsed = this.parseDepositAddresses(filtered, [currency['code']], false);
|
|
4918
4919
|
return this.indexBy(parsed, 'network');
|
|
4919
4920
|
}
|
|
4921
|
+
/**
|
|
4922
|
+
* @method
|
|
4923
|
+
* @name okx#fetchDepositAddress
|
|
4924
|
+
* @description fetch the deposit address for a currency associated with this account
|
|
4925
|
+
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-deposit-address
|
|
4926
|
+
* @param {string} code unified currency code
|
|
4927
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4928
|
+
* @param {string} [params.network] the network name for the deposit address
|
|
4929
|
+
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
4930
|
+
*/
|
|
4920
4931
|
async fetchDepositAddress(code, params = {}) {
|
|
4921
|
-
/**
|
|
4922
|
-
* @method
|
|
4923
|
-
* @name okx#fetchDepositAddress
|
|
4924
|
-
* @description fetch the deposit address for a currency associated with this account
|
|
4925
|
-
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-deposit-address
|
|
4926
|
-
* @param {string} code unified currency code
|
|
4927
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4928
|
-
* @param {string} [params.network] the network name for the deposit address
|
|
4929
|
-
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
4930
|
-
*/
|
|
4931
4932
|
await this.loadMarkets();
|
|
4932
4933
|
const rawNetwork = this.safeStringUpper(params, 'network');
|
|
4933
4934
|
params = this.omit(params, 'network');
|
|
@@ -4950,19 +4951,19 @@ class okx extends okx$1 {
|
|
|
4950
4951
|
const first = this.safeString(keys, 0);
|
|
4951
4952
|
return this.safeDict(response, first);
|
|
4952
4953
|
}
|
|
4954
|
+
/**
|
|
4955
|
+
* @method
|
|
4956
|
+
* @name okx#withdraw
|
|
4957
|
+
* @description make a withdrawal
|
|
4958
|
+
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-withdrawal
|
|
4959
|
+
* @param {string} code unified currency code
|
|
4960
|
+
* @param {float} amount the amount to withdraw
|
|
4961
|
+
* @param {string} address the address to withdraw to
|
|
4962
|
+
* @param {string} tag
|
|
4963
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4964
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
4965
|
+
*/
|
|
4953
4966
|
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
4954
|
-
/**
|
|
4955
|
-
* @method
|
|
4956
|
-
* @name okx#withdraw
|
|
4957
|
-
* @description make a withdrawal
|
|
4958
|
-
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-withdrawal
|
|
4959
|
-
* @param {string} code unified currency code
|
|
4960
|
-
* @param {float} amount the amount to withdraw
|
|
4961
|
-
* @param {string} address the address to withdraw to
|
|
4962
|
-
* @param {string} tag
|
|
4963
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4964
|
-
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
4965
|
-
*/
|
|
4966
4967
|
[tag, params] = this.handleWithdrawTagAndParams(tag, params);
|
|
4967
4968
|
this.checkAddress(address);
|
|
4968
4969
|
await this.loadMarkets();
|
|
@@ -5013,20 +5014,20 @@ class okx extends okx$1 {
|
|
|
5013
5014
|
const transaction = this.safeDict(data, 0);
|
|
5014
5015
|
return this.parseTransaction(transaction, currency);
|
|
5015
5016
|
}
|
|
5017
|
+
/**
|
|
5018
|
+
* @method
|
|
5019
|
+
* @name okx#fetchDeposits
|
|
5020
|
+
* @description fetch all deposits made to an account
|
|
5021
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-deposit-history
|
|
5022
|
+
* @param {string} code unified currency code
|
|
5023
|
+
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
5024
|
+
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
5025
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5026
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
5027
|
+
* @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)
|
|
5028
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5029
|
+
*/
|
|
5016
5030
|
async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
5017
|
-
/**
|
|
5018
|
-
* @method
|
|
5019
|
-
* @name okx#fetchDeposits
|
|
5020
|
-
* @description fetch all deposits made to an account
|
|
5021
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-deposit-history
|
|
5022
|
-
* @param {string} code unified currency code
|
|
5023
|
-
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
5024
|
-
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
5025
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5026
|
-
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
5027
|
-
* @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)
|
|
5028
|
-
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5029
|
-
*/
|
|
5030
5031
|
await this.loadMarkets();
|
|
5031
5032
|
let paginate = false;
|
|
5032
5033
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchDeposits', 'paginate');
|
|
@@ -5094,17 +5095,17 @@ class okx extends okx$1 {
|
|
|
5094
5095
|
const data = this.safeList(response, 'data', []);
|
|
5095
5096
|
return this.parseTransactions(data, currency, since, limit, params);
|
|
5096
5097
|
}
|
|
5098
|
+
/**
|
|
5099
|
+
* @method
|
|
5100
|
+
* @name okx#fetchDeposit
|
|
5101
|
+
* @description fetch data on a currency deposit via the deposit id
|
|
5102
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-deposit-history
|
|
5103
|
+
* @param {string} id deposit id
|
|
5104
|
+
* @param {string} code filter by currency code
|
|
5105
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5106
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5107
|
+
*/
|
|
5097
5108
|
async fetchDeposit(id, code = undefined, params = {}) {
|
|
5098
|
-
/**
|
|
5099
|
-
* @method
|
|
5100
|
-
* @name okx#fetchDeposit
|
|
5101
|
-
* @description fetch data on a currency deposit via the deposit id
|
|
5102
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-deposit-history
|
|
5103
|
-
* @param {string} id deposit id
|
|
5104
|
-
* @param {string} code filter by currency code
|
|
5105
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5106
|
-
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5107
|
-
*/
|
|
5108
5109
|
await this.loadMarkets();
|
|
5109
5110
|
const request = {
|
|
5110
5111
|
'depId': id,
|
|
@@ -5119,20 +5120,20 @@ class okx extends okx$1 {
|
|
|
5119
5120
|
const deposit = this.safeDict(data, 0, {});
|
|
5120
5121
|
return this.parseTransaction(deposit, currency);
|
|
5121
5122
|
}
|
|
5123
|
+
/**
|
|
5124
|
+
* @method
|
|
5125
|
+
* @name okx#fetchWithdrawals
|
|
5126
|
+
* @description fetch all withdrawals made from an account
|
|
5127
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-withdrawal-history
|
|
5128
|
+
* @param {string} code unified currency code
|
|
5129
|
+
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
5130
|
+
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
5131
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5132
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
5133
|
+
* @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)
|
|
5134
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5135
|
+
*/
|
|
5122
5136
|
async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
5123
|
-
/**
|
|
5124
|
-
* @method
|
|
5125
|
-
* @name okx#fetchWithdrawals
|
|
5126
|
-
* @description fetch all withdrawals made from an account
|
|
5127
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-withdrawal-history
|
|
5128
|
-
* @param {string} code unified currency code
|
|
5129
|
-
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
5130
|
-
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
5131
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5132
|
-
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
5133
|
-
* @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)
|
|
5134
|
-
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5135
|
-
*/
|
|
5136
5137
|
await this.loadMarkets();
|
|
5137
5138
|
let paginate = false;
|
|
5138
5139
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'paginate');
|
|
@@ -5192,17 +5193,17 @@ class okx extends okx$1 {
|
|
|
5192
5193
|
const data = this.safeList(response, 'data', []);
|
|
5193
5194
|
return this.parseTransactions(data, currency, since, limit, params);
|
|
5194
5195
|
}
|
|
5196
|
+
/**
|
|
5197
|
+
* @method
|
|
5198
|
+
* @name okx#fetchWithdrawal
|
|
5199
|
+
* @description fetch data on a currency withdrawal via the withdrawal id
|
|
5200
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-withdrawal-history
|
|
5201
|
+
* @param {string} id withdrawal id
|
|
5202
|
+
* @param {string} code unified currency code of the currency withdrawn, default is undefined
|
|
5203
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5204
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5205
|
+
*/
|
|
5195
5206
|
async fetchWithdrawal(id, code = undefined, params = {}) {
|
|
5196
|
-
/**
|
|
5197
|
-
* @method
|
|
5198
|
-
* @name okx#fetchWithdrawal
|
|
5199
|
-
* @description fetch data on a currency withdrawal via the withdrawal id
|
|
5200
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-withdrawal-history
|
|
5201
|
-
* @param {string} id withdrawal id
|
|
5202
|
-
* @param {string} code unified currency code of the currency withdrawn, default is undefined
|
|
5203
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5204
|
-
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5205
|
-
*/
|
|
5206
5207
|
await this.loadMarkets();
|
|
5207
5208
|
const request = {
|
|
5208
5209
|
'wdId': id,
|
|
@@ -5380,17 +5381,17 @@ class okx extends okx$1 {
|
|
|
5380
5381
|
},
|
|
5381
5382
|
};
|
|
5382
5383
|
}
|
|
5384
|
+
/**
|
|
5385
|
+
* @method
|
|
5386
|
+
* @name okx#fetchLeverage
|
|
5387
|
+
* @description fetch the set leverage for a market
|
|
5388
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-leverage
|
|
5389
|
+
* @param {string} symbol unified market symbol
|
|
5390
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5391
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
5392
|
+
* @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
|
|
5393
|
+
*/
|
|
5383
5394
|
async fetchLeverage(symbol, params = {}) {
|
|
5384
|
-
/**
|
|
5385
|
-
* @method
|
|
5386
|
-
* @name okx#fetchLeverage
|
|
5387
|
-
* @description fetch the set leverage for a market
|
|
5388
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-leverage
|
|
5389
|
-
* @param {string} symbol unified market symbol
|
|
5390
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5391
|
-
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
5392
|
-
* @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
|
|
5393
|
-
*/
|
|
5394
5395
|
await this.loadMarkets();
|
|
5395
5396
|
let marginMode = undefined;
|
|
5396
5397
|
[marginMode, params] = this.handleMarginModeAndParams('fetchLeverage', params);
|
|
@@ -5452,17 +5453,17 @@ class okx extends okx$1 {
|
|
|
5452
5453
|
'shortLeverage': shortLeverage,
|
|
5453
5454
|
};
|
|
5454
5455
|
}
|
|
5456
|
+
/**
|
|
5457
|
+
* @method
|
|
5458
|
+
* @name okx#fetchPosition
|
|
5459
|
+
* @description fetch data on a single open contract trade position
|
|
5460
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-positions
|
|
5461
|
+
* @param {string} symbol unified market symbol of the market the position is held in, default is undefined
|
|
5462
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5463
|
+
* @param {string} [params.instType] MARGIN, SWAP, FUTURES, OPTION
|
|
5464
|
+
* @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
5465
|
+
*/
|
|
5455
5466
|
async fetchPosition(symbol, params = {}) {
|
|
5456
|
-
/**
|
|
5457
|
-
* @method
|
|
5458
|
-
* @name okx#fetchPosition
|
|
5459
|
-
* @description fetch data on a single open contract trade position
|
|
5460
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-positions
|
|
5461
|
-
* @param {string} symbol unified market symbol of the market the position is held in, default is undefined
|
|
5462
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5463
|
-
* @param {string} [params.instType] MARGIN, SWAP, FUTURES, OPTION
|
|
5464
|
-
* @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
5465
|
-
*/
|
|
5466
5467
|
await this.loadMarkets();
|
|
5467
5468
|
const market = this.market(symbol);
|
|
5468
5469
|
const [type, query] = this.handleMarketTypeAndParams('fetchPosition', market, params);
|
|
@@ -5528,18 +5529,18 @@ class okx extends okx$1 {
|
|
|
5528
5529
|
}
|
|
5529
5530
|
return this.parsePosition(position, market);
|
|
5530
5531
|
}
|
|
5532
|
+
/**
|
|
5533
|
+
* @method
|
|
5534
|
+
* @name okx#fetchPositions
|
|
5535
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-positions
|
|
5536
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-positions-history history
|
|
5537
|
+
* @description fetch all open positions
|
|
5538
|
+
* @param {string[]|undefined} symbols list of unified market symbols
|
|
5539
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5540
|
+
* @param {string} [params.instType] MARGIN, SWAP, FUTURES, OPTION
|
|
5541
|
+
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
5542
|
+
*/
|
|
5531
5543
|
async fetchPositions(symbols = undefined, params = {}) {
|
|
5532
|
-
/**
|
|
5533
|
-
* @method
|
|
5534
|
-
* @name okx#fetchPositions
|
|
5535
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-positions
|
|
5536
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-positions-history history
|
|
5537
|
-
* @description fetch all open positions
|
|
5538
|
-
* @param {string[]|undefined} symbols list of unified market symbols
|
|
5539
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5540
|
-
* @param {string} [params.instType] MARGIN, SWAP, FUTURES, OPTION
|
|
5541
|
-
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
5542
|
-
*/
|
|
5543
5544
|
await this.loadMarkets();
|
|
5544
5545
|
const request = {
|
|
5545
5546
|
// 'instType': 'MARGIN', // optional string, MARGIN, SWAP, FUTURES, OPTION
|
|
@@ -5620,17 +5621,17 @@ class okx extends okx$1 {
|
|
|
5620
5621
|
}
|
|
5621
5622
|
return this.filterByArrayPositions(result, 'symbol', this.marketSymbols(symbols), false);
|
|
5622
5623
|
}
|
|
5624
|
+
/**
|
|
5625
|
+
* @method
|
|
5626
|
+
* @name okx#fetchPositions
|
|
5627
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-positions
|
|
5628
|
+
* @description fetch all open positions for specific symbol
|
|
5629
|
+
* @param {string} symbol unified market symbol
|
|
5630
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5631
|
+
* @param {string} [params.instType] MARGIN (if needed)
|
|
5632
|
+
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
5633
|
+
*/
|
|
5623
5634
|
async fetchPositionsForSymbol(symbol, params = {}) {
|
|
5624
|
-
/**
|
|
5625
|
-
* @method
|
|
5626
|
-
* @name okx#fetchPositions
|
|
5627
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-positions
|
|
5628
|
-
* @description fetch all open positions for specific symbol
|
|
5629
|
-
* @param {string} symbol unified market symbol
|
|
5630
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5631
|
-
* @param {string} [params.instType] MARGIN (if needed)
|
|
5632
|
-
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
5633
|
-
*/
|
|
5634
5635
|
return await this.fetchPositions([symbol], params);
|
|
5635
5636
|
}
|
|
5636
5637
|
parsePosition(position, market = undefined) {
|
|
@@ -5806,19 +5807,19 @@ class okx extends okx$1 {
|
|
|
5806
5807
|
'takeProfitPrice': undefined,
|
|
5807
5808
|
});
|
|
5808
5809
|
}
|
|
5810
|
+
/**
|
|
5811
|
+
* @method
|
|
5812
|
+
* @name okx#transfer
|
|
5813
|
+
* @description transfer currency internally between wallets on the same account
|
|
5814
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-funds-transfer
|
|
5815
|
+
* @param {string} code unified currency code
|
|
5816
|
+
* @param {float} amount amount to transfer
|
|
5817
|
+
* @param {string} fromAccount account to transfer from
|
|
5818
|
+
* @param {string} toAccount account to transfer to
|
|
5819
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5820
|
+
* @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
5821
|
+
*/
|
|
5809
5822
|
async transfer(code, amount, fromAccount, toAccount, params = {}) {
|
|
5810
|
-
/**
|
|
5811
|
-
* @method
|
|
5812
|
-
* @name okx#transfer
|
|
5813
|
-
* @description transfer currency internally between wallets on the same account
|
|
5814
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-funds-transfer
|
|
5815
|
-
* @param {string} code unified currency code
|
|
5816
|
-
* @param {float} amount amount to transfer
|
|
5817
|
-
* @param {string} fromAccount account to transfer from
|
|
5818
|
-
* @param {string} toAccount account to transfer to
|
|
5819
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5820
|
-
* @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
5821
|
-
*/
|
|
5822
5823
|
await this.loadMarkets();
|
|
5823
5824
|
const currency = this.currency(code);
|
|
5824
5825
|
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
@@ -5981,18 +5982,18 @@ class okx extends okx$1 {
|
|
|
5981
5982
|
const transfer = this.safeDict(data, 0);
|
|
5982
5983
|
return this.parseTransfer(transfer);
|
|
5983
5984
|
}
|
|
5985
|
+
/**
|
|
5986
|
+
* @method
|
|
5987
|
+
* @name okx#fetchTransfers
|
|
5988
|
+
* @description fetch a history of internal transfers made on an account
|
|
5989
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months
|
|
5990
|
+
* @param {string} code unified currency code of the currency transferred
|
|
5991
|
+
* @param {int} [since] the earliest time in ms to fetch transfers for
|
|
5992
|
+
* @param {int} [limit] the maximum number of transfers structures to retrieve
|
|
5993
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5994
|
+
* @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
5995
|
+
*/
|
|
5984
5996
|
async fetchTransfers(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
5985
|
-
/**
|
|
5986
|
-
* @method
|
|
5987
|
-
* @name okx#fetchTransfers
|
|
5988
|
-
* @description fetch a history of internal transfers made on an account
|
|
5989
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months
|
|
5990
|
-
* @param {string} code unified currency code of the currency transferred
|
|
5991
|
-
* @param {int} [since] the earliest time in ms to fetch transfers for
|
|
5992
|
-
* @param {int} [limit] the maximum number of transfers structures to retrieve
|
|
5993
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5994
|
-
* @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
5995
|
-
*/
|
|
5996
5997
|
await this.loadMarkets();
|
|
5997
5998
|
let currency = undefined;
|
|
5998
5999
|
const request = {
|
|
@@ -6178,28 +6179,28 @@ class okx extends okx$1 {
|
|
|
6178
6179
|
};
|
|
6179
6180
|
return this.safeString(intervals, interval, interval);
|
|
6180
6181
|
}
|
|
6182
|
+
/**
|
|
6183
|
+
* @method
|
|
6184
|
+
* @name okx#fetchFundingInterval
|
|
6185
|
+
* @description fetch the current funding rate interval
|
|
6186
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate
|
|
6187
|
+
* @param {string} symbol unified market symbol
|
|
6188
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6189
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
6190
|
+
*/
|
|
6181
6191
|
async fetchFundingInterval(symbol, params = {}) {
|
|
6182
|
-
/**
|
|
6183
|
-
* @method
|
|
6184
|
-
* @name okx#fetchFundingInterval
|
|
6185
|
-
* @description fetch the current funding rate interval
|
|
6186
|
-
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate
|
|
6187
|
-
* @param {string} symbol unified market symbol
|
|
6188
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6189
|
-
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
6190
|
-
*/
|
|
6191
6192
|
return await this.fetchFundingRate(symbol, params);
|
|
6192
6193
|
}
|
|
6194
|
+
/**
|
|
6195
|
+
* @method
|
|
6196
|
+
* @name okx#fetchFundingRate
|
|
6197
|
+
* @description fetch the current funding rate
|
|
6198
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate
|
|
6199
|
+
* @param {string} symbol unified market symbol
|
|
6200
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6201
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
6202
|
+
*/
|
|
6193
6203
|
async fetchFundingRate(symbol, params = {}) {
|
|
6194
|
-
/**
|
|
6195
|
-
* @method
|
|
6196
|
-
* @name okx#fetchFundingRate
|
|
6197
|
-
* @description fetch the current funding rate
|
|
6198
|
-
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate
|
|
6199
|
-
* @param {string} symbol unified market symbol
|
|
6200
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6201
|
-
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
6202
|
-
*/
|
|
6203
6204
|
await this.loadMarkets();
|
|
6204
6205
|
const market = this.market(symbol);
|
|
6205
6206
|
if (!market['swap']) {
|
|
@@ -6229,18 +6230,18 @@ class okx extends okx$1 {
|
|
|
6229
6230
|
const entry = this.safeDict(data, 0, {});
|
|
6230
6231
|
return this.parseFundingRate(entry, market);
|
|
6231
6232
|
}
|
|
6233
|
+
/**
|
|
6234
|
+
* @method
|
|
6235
|
+
* @name okx#fetchFundingHistory
|
|
6236
|
+
* @description fetch the history of funding payments paid and received on this account
|
|
6237
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months
|
|
6238
|
+
* @param {string} symbol unified market symbol
|
|
6239
|
+
* @param {int} [since] the earliest time in ms to fetch funding history for
|
|
6240
|
+
* @param {int} [limit] the maximum number of funding history structures to retrieve
|
|
6241
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6242
|
+
* @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
|
|
6243
|
+
*/
|
|
6232
6244
|
async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
6233
|
-
/**
|
|
6234
|
-
* @method
|
|
6235
|
-
* @name okx#fetchFundingHistory
|
|
6236
|
-
* @description fetch the history of funding payments paid and received on this account
|
|
6237
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months
|
|
6238
|
-
* @param {string} symbol unified market symbol
|
|
6239
|
-
* @param {int} [since] the earliest time in ms to fetch funding history for
|
|
6240
|
-
* @param {int} [limit] the maximum number of funding history structures to retrieve
|
|
6241
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6242
|
-
* @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
|
|
6243
|
-
*/
|
|
6244
6245
|
await this.loadMarkets();
|
|
6245
6246
|
const request = {
|
|
6246
6247
|
// 'instType': 'SPOT', // SPOT, MARGIN, SWAP, FUTURES, OPTION
|
|
@@ -6388,19 +6389,19 @@ class okx extends okx$1 {
|
|
|
6388
6389
|
const sorted = this.sortBy(result, 'timestamp');
|
|
6389
6390
|
return this.filterBySymbolSinceLimit(sorted, symbol, since, limit);
|
|
6390
6391
|
}
|
|
6392
|
+
/**
|
|
6393
|
+
* @method
|
|
6394
|
+
* @name okx#setLeverage
|
|
6395
|
+
* @description set the level of leverage for a market
|
|
6396
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-account-set-leverage
|
|
6397
|
+
* @param {float} leverage the rate of leverage
|
|
6398
|
+
* @param {string} symbol unified market symbol
|
|
6399
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6400
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
6401
|
+
* @param {string} [params.posSide] 'long' or 'short' for isolated margin long/short mode on futures and swap markets
|
|
6402
|
+
* @returns {object} response from the exchange
|
|
6403
|
+
*/
|
|
6391
6404
|
async setLeverage(leverage, symbol = undefined, params = {}) {
|
|
6392
|
-
/**
|
|
6393
|
-
* @method
|
|
6394
|
-
* @name okx#setLeverage
|
|
6395
|
-
* @description set the level of leverage for a market
|
|
6396
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-account-set-leverage
|
|
6397
|
-
* @param {float} leverage the rate of leverage
|
|
6398
|
-
* @param {string} symbol unified market symbol
|
|
6399
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6400
|
-
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
6401
|
-
* @param {string} [params.posSide] 'long' or 'short' for isolated margin long/short mode on futures and swap markets
|
|
6402
|
-
* @returns {object} response from the exchange
|
|
6403
|
-
*/
|
|
6404
6405
|
if (symbol === undefined) {
|
|
6405
6406
|
throw new errors.ArgumentsRequired(this.id + ' setLeverage() requires a symbol argument');
|
|
6406
6407
|
}
|
|
@@ -6450,17 +6451,17 @@ class okx extends okx$1 {
|
|
|
6450
6451
|
//
|
|
6451
6452
|
return response;
|
|
6452
6453
|
}
|
|
6454
|
+
/**
|
|
6455
|
+
* @method
|
|
6456
|
+
* @name okx#fetchPositionMode
|
|
6457
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-account-configuration
|
|
6458
|
+
* @description fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets
|
|
6459
|
+
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
6460
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6461
|
+
* @param {string} [params.accountId] if you have multiple accounts, you must specify the account id to fetch the position mode
|
|
6462
|
+
* @returns {object} an object detailing whether the market is in hedged or one-way mode
|
|
6463
|
+
*/
|
|
6453
6464
|
async fetchPositionMode(symbol = undefined, params = {}) {
|
|
6454
|
-
/**
|
|
6455
|
-
* @method
|
|
6456
|
-
* @name okx#fetchPositionMode
|
|
6457
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-account-configuration
|
|
6458
|
-
* @description fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets
|
|
6459
|
-
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
6460
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6461
|
-
* @param {string} [param.accountId] if you have multiple accounts, you must specify the account id to fetch the position mode
|
|
6462
|
-
* @returns {object} an object detailing whether the market is in hedged or one-way mode
|
|
6463
|
-
*/
|
|
6464
6465
|
const accounts = await this.fetchAccounts();
|
|
6465
6466
|
const length = accounts.length;
|
|
6466
6467
|
let selectedAccount = undefined;
|
|
@@ -6486,17 +6487,17 @@ class okx extends okx$1 {
|
|
|
6486
6487
|
'hedged': isHedged,
|
|
6487
6488
|
};
|
|
6488
6489
|
}
|
|
6490
|
+
/**
|
|
6491
|
+
* @method
|
|
6492
|
+
* @name okx#setPositionMode
|
|
6493
|
+
* @description set hedged to true or false for a market
|
|
6494
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-set-position-mode
|
|
6495
|
+
* @param {bool} hedged set to true to use long_short_mode, false for net_mode
|
|
6496
|
+
* @param {string} symbol not used by okx setPositionMode
|
|
6497
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6498
|
+
* @returns {object} response from the exchange
|
|
6499
|
+
*/
|
|
6489
6500
|
async setPositionMode(hedged, symbol = undefined, params = {}) {
|
|
6490
|
-
/**
|
|
6491
|
-
* @method
|
|
6492
|
-
* @name okx#setPositionMode
|
|
6493
|
-
* @description set hedged to true or false for a market
|
|
6494
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-set-position-mode
|
|
6495
|
-
* @param {bool} hedged set to true to use long_short_mode, false for net_mode
|
|
6496
|
-
* @param {string} symbol not used by okx setPositionMode
|
|
6497
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6498
|
-
* @returns {object} response from the exchange
|
|
6499
|
-
*/
|
|
6500
6501
|
let hedgeMode = undefined;
|
|
6501
6502
|
if (hedged) {
|
|
6502
6503
|
hedgeMode = 'long_short_mode';
|
|
@@ -6521,18 +6522,18 @@ class okx extends okx$1 {
|
|
|
6521
6522
|
//
|
|
6522
6523
|
return response;
|
|
6523
6524
|
}
|
|
6525
|
+
/**
|
|
6526
|
+
* @method
|
|
6527
|
+
* @name okx#setMarginMode
|
|
6528
|
+
* @description set margin mode to 'cross' or 'isolated'
|
|
6529
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-set-leverage
|
|
6530
|
+
* @param {string} marginMode 'cross' or 'isolated'
|
|
6531
|
+
* @param {string} symbol unified market symbol
|
|
6532
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6533
|
+
* @param {int} [params.leverage] leverage
|
|
6534
|
+
* @returns {object} response from the exchange
|
|
6535
|
+
*/
|
|
6524
6536
|
async setMarginMode(marginMode, symbol = undefined, params = {}) {
|
|
6525
|
-
/**
|
|
6526
|
-
* @method
|
|
6527
|
-
* @name okx#setMarginMode
|
|
6528
|
-
* @description set margin mode to 'cross' or 'isolated'
|
|
6529
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-set-leverage
|
|
6530
|
-
* @param {string} marginMode 'cross' or 'isolated'
|
|
6531
|
-
* @param {string} symbol unified market symbol
|
|
6532
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6533
|
-
* @param {int} [params.leverage] leverage
|
|
6534
|
-
* @returns {object} response from the exchange
|
|
6535
|
-
*/
|
|
6536
6537
|
if (symbol === undefined) {
|
|
6537
6538
|
throw new errors.ArgumentsRequired(this.id + ' setMarginMode() requires a symbol argument');
|
|
6538
6539
|
}
|
|
@@ -6571,15 +6572,15 @@ class okx extends okx$1 {
|
|
|
6571
6572
|
//
|
|
6572
6573
|
return response;
|
|
6573
6574
|
}
|
|
6575
|
+
/**
|
|
6576
|
+
* @method
|
|
6577
|
+
* @name okx#fetchCrossBorrowRates
|
|
6578
|
+
* @description fetch the borrow interest rates of all currencies
|
|
6579
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-interest-rate
|
|
6580
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6581
|
+
* @returns {object} a list of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
|
|
6582
|
+
*/
|
|
6574
6583
|
async fetchCrossBorrowRates(params = {}) {
|
|
6575
|
-
/**
|
|
6576
|
-
* @method
|
|
6577
|
-
* @name okx#fetchCrossBorrowRates
|
|
6578
|
-
* @description fetch the borrow interest rates of all currencies
|
|
6579
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-interest-rate
|
|
6580
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6581
|
-
* @returns {object} a list of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
|
|
6582
|
-
*/
|
|
6583
6584
|
await this.loadMarkets();
|
|
6584
6585
|
const response = await this.privateGetAccountInterestRate(params);
|
|
6585
6586
|
//
|
|
@@ -6601,16 +6602,16 @@ class okx extends okx$1 {
|
|
|
6601
6602
|
}
|
|
6602
6603
|
return rates;
|
|
6603
6604
|
}
|
|
6605
|
+
/**
|
|
6606
|
+
* @method
|
|
6607
|
+
* @name okx#fetchCrossBorrowRate
|
|
6608
|
+
* @description fetch the rate of interest to borrow a currency for margin trading
|
|
6609
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-interest-rate
|
|
6610
|
+
* @param {string} code unified currency code
|
|
6611
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6612
|
+
* @returns {object} a [borrow rate structure]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
|
|
6613
|
+
*/
|
|
6604
6614
|
async fetchCrossBorrowRate(code, params = {}) {
|
|
6605
|
-
/**
|
|
6606
|
-
* @method
|
|
6607
|
-
* @name okx#fetchCrossBorrowRate
|
|
6608
|
-
* @description fetch the rate of interest to borrow a currency for margin trading
|
|
6609
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-interest-rate
|
|
6610
|
-
* @param {string} code unified currency code
|
|
6611
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6612
|
-
* @returns {object} a [borrow rate structure]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
|
|
6613
|
-
*/
|
|
6614
6615
|
await this.loadMarkets();
|
|
6615
6616
|
const currency = this.currency(code);
|
|
6616
6617
|
const request = {
|
|
@@ -6685,18 +6686,18 @@ class okx extends okx$1 {
|
|
|
6685
6686
|
}
|
|
6686
6687
|
return borrowRateHistories;
|
|
6687
6688
|
}
|
|
6689
|
+
/**
|
|
6690
|
+
* @method
|
|
6691
|
+
* @name okx#fetchBorrowRateHistories
|
|
6692
|
+
* @description retrieves a history of a multiple currencies borrow interest rate at specific time slots, returns all currencies if no symbols passed, default is undefined
|
|
6693
|
+
* @see https://www.okx.com/docs-v5/en/#financial-product-savings-get-public-borrow-history-public
|
|
6694
|
+
* @param {string[]|undefined} codes list of unified currency codes, default is undefined
|
|
6695
|
+
* @param {int} [since] timestamp in ms of the earliest borrowRate, default is undefined
|
|
6696
|
+
* @param {int} [limit] max number of borrow rate prices to return, default is undefined
|
|
6697
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6698
|
+
* @returns {object} a dictionary of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure} indexed by the market symbol
|
|
6699
|
+
*/
|
|
6688
6700
|
async fetchBorrowRateHistories(codes = undefined, since = undefined, limit = undefined, params = {}) {
|
|
6689
|
-
/**
|
|
6690
|
-
* @method
|
|
6691
|
-
* @name okx#fetchBorrowRateHistories
|
|
6692
|
-
* @description retrieves a history of a multiple currencies borrow interest rate at specific time slots, returns all currencies if no symbols passed, default is undefined
|
|
6693
|
-
* @see https://www.okx.com/docs-v5/en/#financial-product-savings-get-public-borrow-history-public
|
|
6694
|
-
* @param {string[]|undefined} codes list of unified currency codes, default is undefined
|
|
6695
|
-
* @param {int} [since] timestamp in ms of the earliest borrowRate, default is undefined
|
|
6696
|
-
* @param {int} [limit] max number of borrow rate prices to return, default is undefined
|
|
6697
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6698
|
-
* @returns {object} a dictionary of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure} indexed by the market symbol
|
|
6699
|
-
*/
|
|
6700
6701
|
await this.loadMarkets();
|
|
6701
6702
|
const request = {
|
|
6702
6703
|
// 'ccy': currency['id'],
|
|
@@ -6728,18 +6729,18 @@ class okx extends okx$1 {
|
|
|
6728
6729
|
const data = this.safeList(response, 'data', []);
|
|
6729
6730
|
return this.parseBorrowRateHistories(data, codes, since, limit);
|
|
6730
6731
|
}
|
|
6732
|
+
/**
|
|
6733
|
+
* @method
|
|
6734
|
+
* @name okx#fetchBorrowRateHistory
|
|
6735
|
+
* @description retrieves a history of a currencies borrow interest rate at specific time slots
|
|
6736
|
+
* @see https://www.okx.com/docs-v5/en/#financial-product-savings-get-public-borrow-history-public
|
|
6737
|
+
* @param {string} code unified currency code
|
|
6738
|
+
* @param {int} [since] timestamp for the earliest borrow rate
|
|
6739
|
+
* @param {int} [limit] the maximum number of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure} to retrieve
|
|
6740
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6741
|
+
* @returns {object[]} an array of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
|
|
6742
|
+
*/
|
|
6731
6743
|
async fetchBorrowRateHistory(code, since = undefined, limit = undefined, params = {}) {
|
|
6732
|
-
/**
|
|
6733
|
-
* @method
|
|
6734
|
-
* @name okx#fetchBorrowRateHistory
|
|
6735
|
-
* @description retrieves a history of a currencies borrow interest rate at specific time slots
|
|
6736
|
-
* @see https://www.okx.com/docs-v5/en/#financial-product-savings-get-public-borrow-history-public
|
|
6737
|
-
* @param {string} code unified currency code
|
|
6738
|
-
* @param {int} [since] timestamp for the earliest borrow rate
|
|
6739
|
-
* @param {int} [limit] the maximum number of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure} to retrieve
|
|
6740
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6741
|
-
* @returns {object[]} an array of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
|
|
6742
|
-
*/
|
|
6743
6744
|
await this.loadMarkets();
|
|
6744
6745
|
const currency = this.currency(code);
|
|
6745
6746
|
const request = {
|
|
@@ -6880,43 +6881,43 @@ class okx extends okx$1 {
|
|
|
6880
6881
|
'datetime': this.iso8601(timestamp),
|
|
6881
6882
|
};
|
|
6882
6883
|
}
|
|
6884
|
+
/**
|
|
6885
|
+
* @method
|
|
6886
|
+
* @name okx#reduceMargin
|
|
6887
|
+
* @description remove margin from a position
|
|
6888
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-increase-decrease-margin
|
|
6889
|
+
* @param {string} symbol unified market symbol
|
|
6890
|
+
* @param {float} amount the amount of margin to remove
|
|
6891
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6892
|
+
* @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=reduce-margin-structure}
|
|
6893
|
+
*/
|
|
6883
6894
|
async reduceMargin(symbol, amount, params = {}) {
|
|
6884
|
-
/**
|
|
6885
|
-
* @method
|
|
6886
|
-
* @name okx#reduceMargin
|
|
6887
|
-
* @description remove margin from a position
|
|
6888
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-increase-decrease-margin
|
|
6889
|
-
* @param {string} symbol unified market symbol
|
|
6890
|
-
* @param {float} amount the amount of margin to remove
|
|
6891
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6892
|
-
* @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=reduce-margin-structure}
|
|
6893
|
-
*/
|
|
6894
6895
|
return await this.modifyMarginHelper(symbol, amount, 'reduce', params);
|
|
6895
6896
|
}
|
|
6897
|
+
/**
|
|
6898
|
+
* @method
|
|
6899
|
+
* @name okx#addMargin
|
|
6900
|
+
* @description add margin
|
|
6901
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-increase-decrease-margin
|
|
6902
|
+
* @param {string} symbol unified market symbol
|
|
6903
|
+
* @param {float} amount amount of margin to add
|
|
6904
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6905
|
+
* @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=add-margin-structure}
|
|
6906
|
+
*/
|
|
6896
6907
|
async addMargin(symbol, amount, params = {}) {
|
|
6897
|
-
/**
|
|
6898
|
-
* @method
|
|
6899
|
-
* @name okx#addMargin
|
|
6900
|
-
* @description add margin
|
|
6901
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-increase-decrease-margin
|
|
6902
|
-
* @param {string} symbol unified market symbol
|
|
6903
|
-
* @param {float} amount amount of margin to add
|
|
6904
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6905
|
-
* @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=add-margin-structure}
|
|
6906
|
-
*/
|
|
6907
6908
|
return await this.modifyMarginHelper(symbol, amount, 'add', params);
|
|
6908
6909
|
}
|
|
6910
|
+
/**
|
|
6911
|
+
* @method
|
|
6912
|
+
* @name okx#fetchMarketLeverageTiers
|
|
6913
|
+
* @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
|
|
6914
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-position-tiers
|
|
6915
|
+
* @param {string} symbol unified market symbol
|
|
6916
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6917
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
6918
|
+
* @returns {object} a [leverage tiers structure]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}
|
|
6919
|
+
*/
|
|
6909
6920
|
async fetchMarketLeverageTiers(symbol, params = {}) {
|
|
6910
|
-
/**
|
|
6911
|
-
* @method
|
|
6912
|
-
* @name okx#fetchMarketLeverageTiers
|
|
6913
|
-
* @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
|
|
6914
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-position-tiers
|
|
6915
|
-
* @param {string} symbol unified market symbol
|
|
6916
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6917
|
-
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
6918
|
-
* @returns {object} a [leverage tiers structure]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}
|
|
6919
|
-
*/
|
|
6920
6921
|
await this.loadMarkets();
|
|
6921
6922
|
const market = this.market(symbol);
|
|
6922
6923
|
const type = market['spot'] ? 'MARGIN' : this.convertToInstrumentType(market['type']);
|
|
@@ -6992,8 +6993,10 @@ class okx extends okx$1 {
|
|
|
6992
6993
|
const tiers = [];
|
|
6993
6994
|
for (let i = 0; i < info.length; i++) {
|
|
6994
6995
|
const tier = info[i];
|
|
6996
|
+
const marketId = this.safeString(tier, 'instId');
|
|
6995
6997
|
tiers.push({
|
|
6996
6998
|
'tier': this.safeInteger(tier, 'tier'),
|
|
6999
|
+
'symbol': this.safeSymbol(marketId, market),
|
|
6997
7000
|
'currency': market['quote'],
|
|
6998
7001
|
'minNotional': this.safeNumber(tier, 'minSz'),
|
|
6999
7002
|
'maxNotional': this.safeNumber(tier, 'maxSz'),
|
|
@@ -7004,21 +7007,21 @@ class okx extends okx$1 {
|
|
|
7004
7007
|
}
|
|
7005
7008
|
return tiers;
|
|
7006
7009
|
}
|
|
7010
|
+
/**
|
|
7011
|
+
* @method
|
|
7012
|
+
* @name okx#fetchBorrowInterest
|
|
7013
|
+
* @description fetch the interest owed by the user for borrowing currency for margin trading
|
|
7014
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-interest-accrued-data
|
|
7015
|
+
* @param {string} code the unified currency code for the currency of the interest
|
|
7016
|
+
* @param {string} symbol the market symbol of an isolated margin market, if undefined, the interest for cross margin markets is returned
|
|
7017
|
+
* @param {int} [since] timestamp in ms of the earliest time to receive interest records for
|
|
7018
|
+
* @param {int} [limit] the number of [borrow interest structures]{@link https://docs.ccxt.com/#/?id=borrow-interest-structure} to retrieve
|
|
7019
|
+
* @param {object} [params] exchange specific parameters
|
|
7020
|
+
* @param {int} [params.type] Loan type 1 - VIP loans 2 - Market loans *Default is Market loans*
|
|
7021
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
7022
|
+
* @returns {object[]} An list of [borrow interest structures]{@link https://docs.ccxt.com/#/?id=borrow-interest-structure}
|
|
7023
|
+
*/
|
|
7007
7024
|
async fetchBorrowInterest(code = undefined, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
7008
|
-
/**
|
|
7009
|
-
* @method
|
|
7010
|
-
* @name okx#fetchBorrowInterest
|
|
7011
|
-
* @description fetch the interest owed by the user for borrowing currency for margin trading
|
|
7012
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-interest-accrued-data
|
|
7013
|
-
* @param {string} code the unified currency code for the currency of the interest
|
|
7014
|
-
* @param {string} symbol the market symbol of an isolated margin market, if undefined, the interest for cross margin markets is returned
|
|
7015
|
-
* @param {int} [since] timestamp in ms of the earliest time to receive interest records for
|
|
7016
|
-
* @param {int} [limit] the number of [borrow interest structures]{@link https://docs.ccxt.com/#/?id=borrow-interest-structure} to retrieve
|
|
7017
|
-
* @param {object} [params] exchange specific parameters
|
|
7018
|
-
* @param {int} [params.type] Loan type 1 - VIP loans 2 - Market loans *Default is Market loans*
|
|
7019
|
-
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
7020
|
-
* @returns {object[]} An list of [borrow interest structures]{@link https://docs.ccxt.com/#/?id=borrow-interest-structure}
|
|
7021
|
-
*/
|
|
7022
7025
|
await this.loadMarkets();
|
|
7023
7026
|
let marginMode = undefined;
|
|
7024
7027
|
[marginMode, params] = this.handleMarginModeAndParams('fetchBorrowInterest', params);
|
|
@@ -7085,17 +7088,17 @@ class okx extends okx$1 {
|
|
|
7085
7088
|
'datetime': this.iso8601(timestamp),
|
|
7086
7089
|
};
|
|
7087
7090
|
}
|
|
7091
|
+
/**
|
|
7092
|
+
* @method
|
|
7093
|
+
* @name okx#borrowCrossMargin
|
|
7094
|
+
* @description create a loan to borrow margin (need to be VIP 5 and above)
|
|
7095
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-vip-loans-borrow-and-repay
|
|
7096
|
+
* @param {string} code unified currency code of the currency to borrow
|
|
7097
|
+
* @param {float} amount the amount to borrow
|
|
7098
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7099
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
7100
|
+
*/
|
|
7088
7101
|
async borrowCrossMargin(code, amount, params = {}) {
|
|
7089
|
-
/**
|
|
7090
|
-
* @method
|
|
7091
|
-
* @name okx#borrowCrossMargin
|
|
7092
|
-
* @description create a loan to borrow margin (need to be VIP 5 and above)
|
|
7093
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-vip-loans-borrow-and-repay
|
|
7094
|
-
* @param {string} code unified currency code of the currency to borrow
|
|
7095
|
-
* @param {float} amount the amount to borrow
|
|
7096
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7097
|
-
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
7098
|
-
*/
|
|
7099
7102
|
await this.loadMarkets();
|
|
7100
7103
|
const currency = this.currency(code);
|
|
7101
7104
|
const request = {
|
|
@@ -7123,18 +7126,18 @@ class okx extends okx$1 {
|
|
|
7123
7126
|
const loan = this.safeDict(data, 0, {});
|
|
7124
7127
|
return this.parseMarginLoan(loan, currency);
|
|
7125
7128
|
}
|
|
7129
|
+
/**
|
|
7130
|
+
* @method
|
|
7131
|
+
* @name okx#repayCrossMargin
|
|
7132
|
+
* @description repay borrowed margin and interest
|
|
7133
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-vip-loans-borrow-and-repay
|
|
7134
|
+
* @param {string} code unified currency code of the currency to repay
|
|
7135
|
+
* @param {float} amount the amount to repay
|
|
7136
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7137
|
+
* @param {string} [params.id] the order ID of borrowing, it is necessary while repaying
|
|
7138
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
7139
|
+
*/
|
|
7126
7140
|
async repayCrossMargin(code, amount, params = {}) {
|
|
7127
|
-
/**
|
|
7128
|
-
* @method
|
|
7129
|
-
* @name okx#repayCrossMargin
|
|
7130
|
-
* @description repay borrowed margin and interest
|
|
7131
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-vip-loans-borrow-and-repay
|
|
7132
|
-
* @param {string} code unified currency code of the currency to repay
|
|
7133
|
-
* @param {float} amount the amount to repay
|
|
7134
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7135
|
-
* @param {string} [params.id] the order ID of borrowing, it is necessary while repaying
|
|
7136
|
-
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
7137
|
-
*/
|
|
7138
7141
|
await this.loadMarkets();
|
|
7139
7142
|
const id = this.safeString2(params, 'id', 'ordId');
|
|
7140
7143
|
params = this.omit(params, 'id');
|
|
@@ -7191,16 +7194,16 @@ class okx extends okx$1 {
|
|
|
7191
7194
|
'info': info,
|
|
7192
7195
|
};
|
|
7193
7196
|
}
|
|
7197
|
+
/**
|
|
7198
|
+
* @method
|
|
7199
|
+
* @name okx#fetchOpenInterest
|
|
7200
|
+
* @description Retrieves the open interest of a currency
|
|
7201
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-open-interest
|
|
7202
|
+
* @param {string} symbol Unified CCXT market symbol
|
|
7203
|
+
* @param {object} [params] exchange specific parameters
|
|
7204
|
+
* @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
7205
|
+
*/
|
|
7194
7206
|
async fetchOpenInterest(symbol, params = {}) {
|
|
7195
|
-
/**
|
|
7196
|
-
* @method
|
|
7197
|
-
* @name okx#fetchOpenInterest
|
|
7198
|
-
* @description Retrieves the open interest of a currency
|
|
7199
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-open-interest
|
|
7200
|
-
* @param {string} symbol Unified CCXT market symbol
|
|
7201
|
-
* @param {object} [params] exchange specific parameters
|
|
7202
|
-
* @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
7203
|
-
*/
|
|
7204
7207
|
await this.loadMarkets();
|
|
7205
7208
|
const market = this.market(symbol);
|
|
7206
7209
|
if (!market['contract']) {
|
|
@@ -7232,21 +7235,21 @@ class okx extends okx$1 {
|
|
|
7232
7235
|
const data = this.safeList(response, 'data', []);
|
|
7233
7236
|
return this.parseOpenInterest(data[0], market);
|
|
7234
7237
|
}
|
|
7238
|
+
/**
|
|
7239
|
+
* @method
|
|
7240
|
+
* @name okx#fetchOpenInterestHistory
|
|
7241
|
+
* @description Retrieves the open interest history of a currency
|
|
7242
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-contracts-open-interest-and-volume
|
|
7243
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-options-open-interest-and-volume
|
|
7244
|
+
* @param {string} symbol Unified CCXT currency code or unified symbol
|
|
7245
|
+
* @param {string} timeframe "5m", "1h", or "1d" for option only "1d" or "8h"
|
|
7246
|
+
* @param {int} [since] The time in ms of the earliest record to retrieve as a unix timestamp
|
|
7247
|
+
* @param {int} [limit] Not used by okx, but parsed internally by CCXT
|
|
7248
|
+
* @param {object} [params] Exchange specific parameters
|
|
7249
|
+
* @param {int} [params.until] The time in ms of the latest record to retrieve as a unix timestamp
|
|
7250
|
+
* @returns An array of [open interest structures]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
7251
|
+
*/
|
|
7235
7252
|
async fetchOpenInterestHistory(symbol, timeframe = '1d', since = undefined, limit = undefined, params = {}) {
|
|
7236
|
-
/**
|
|
7237
|
-
* @method
|
|
7238
|
-
* @name okx#fetchOpenInterestHistory
|
|
7239
|
-
* @description Retrieves the open interest history of a currency
|
|
7240
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-contracts-open-interest-and-volume
|
|
7241
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-options-open-interest-and-volume
|
|
7242
|
-
* @param {string} symbol Unified CCXT currency code or unified symbol
|
|
7243
|
-
* @param {string} timeframe "5m", "1h", or "1d" for option only "1d" or "8h"
|
|
7244
|
-
* @param {int} [since] The time in ms of the earliest record to retrieve as a unix timestamp
|
|
7245
|
-
* @param {int} [limit] Not used by okx, but parsed internally by CCXT
|
|
7246
|
-
* @param {object} [params] Exchange specific parameters
|
|
7247
|
-
* @param {int} [params.until] The time in ms of the latest record to retrieve as a unix timestamp
|
|
7248
|
-
* @returns An array of [open interest structures]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
7249
|
-
*/
|
|
7250
7253
|
const options = this.safeDict(this.options, 'fetchOpenInterestHistory', {});
|
|
7251
7254
|
const timeframes = this.safeDict(options, 'timeframes', {});
|
|
7252
7255
|
timeframe = this.safeString(timeframes, timeframe, timeframe);
|
|
@@ -7369,16 +7372,16 @@ class okx extends okx$1 {
|
|
|
7369
7372
|
this.headers = this.omit(this.headers, 'x-simulated-trading');
|
|
7370
7373
|
}
|
|
7371
7374
|
}
|
|
7375
|
+
/**
|
|
7376
|
+
* @method
|
|
7377
|
+
* @name okx#fetchDepositWithdrawFees
|
|
7378
|
+
* @description fetch deposit and withdraw fees
|
|
7379
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-currencies
|
|
7380
|
+
* @param {string[]|undefined} codes list of unified currency codes
|
|
7381
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7382
|
+
* @returns {object[]} a list of [fees structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
7383
|
+
*/
|
|
7372
7384
|
async fetchDepositWithdrawFees(codes = undefined, params = {}) {
|
|
7373
|
-
/**
|
|
7374
|
-
* @method
|
|
7375
|
-
* @name okx#fetchDepositWithdrawFees
|
|
7376
|
-
* @description fetch deposit and withdraw fees
|
|
7377
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-currencies
|
|
7378
|
-
* @param {string[]|undefined} codes list of unified currency codes
|
|
7379
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7380
|
-
* @returns {object[]} a list of [fees structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
7381
|
-
*/
|
|
7382
7385
|
await this.loadMarkets();
|
|
7383
7386
|
const response = await this.privateGetAssetCurrencies(params);
|
|
7384
7387
|
//
|
|
@@ -7491,18 +7494,18 @@ class okx extends okx$1 {
|
|
|
7491
7494
|
}
|
|
7492
7495
|
return depositWithdrawFees;
|
|
7493
7496
|
}
|
|
7497
|
+
/**
|
|
7498
|
+
* @method
|
|
7499
|
+
* @name okx#fetchSettlementHistory
|
|
7500
|
+
* @description fetches historical settlement records
|
|
7501
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-delivery-exercise-history
|
|
7502
|
+
* @param {string} symbol unified market symbol to fetch the settlement history for
|
|
7503
|
+
* @param {int} [since] timestamp in ms
|
|
7504
|
+
* @param {int} [limit] number of records
|
|
7505
|
+
* @param {object} [params] exchange specific params
|
|
7506
|
+
* @returns {object[]} a list of [settlement history objects]{@link https://docs.ccxt.com/#/?id=settlement-history-structure}
|
|
7507
|
+
*/
|
|
7494
7508
|
async fetchSettlementHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
7495
|
-
/**
|
|
7496
|
-
* @method
|
|
7497
|
-
* @name okx#fetchSettlementHistory
|
|
7498
|
-
* @description fetches historical settlement records
|
|
7499
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-delivery-exercise-history
|
|
7500
|
-
* @param {string} symbol unified market symbol to fetch the settlement history for
|
|
7501
|
-
* @param {int} [since] timestamp in ms
|
|
7502
|
-
* @param {int} [limit] number of records
|
|
7503
|
-
* @param {object} [params] exchange specific params
|
|
7504
|
-
* @returns {object[]} a list of [settlement history objects]{@link https://docs.ccxt.com/#/?id=settlement-history-structure}
|
|
7505
|
-
*/
|
|
7506
7509
|
if (symbol === undefined) {
|
|
7507
7510
|
throw new errors.ArgumentsRequired(this.id + ' fetchSettlementHistory() requires a symbol argument');
|
|
7508
7511
|
}
|
|
@@ -7592,16 +7595,16 @@ class okx extends okx$1 {
|
|
|
7592
7595
|
}
|
|
7593
7596
|
return result;
|
|
7594
7597
|
}
|
|
7598
|
+
/**
|
|
7599
|
+
* @method
|
|
7600
|
+
* @name okx#fetchUnderlyingAssets
|
|
7601
|
+
* @description fetches the market ids of underlying assets for a specific contract market type
|
|
7602
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-underlying
|
|
7603
|
+
* @param {object} [params] exchange specific params
|
|
7604
|
+
* @param {string} [params.type] the contract market type, 'option', 'swap' or 'future', the default is 'option'
|
|
7605
|
+
* @returns {object[]} a list of [underlying assets]{@link https://docs.ccxt.com/#/?id=underlying-assets-structure}
|
|
7606
|
+
*/
|
|
7595
7607
|
async fetchUnderlyingAssets(params = {}) {
|
|
7596
|
-
/**
|
|
7597
|
-
* @method
|
|
7598
|
-
* @name okx#fetchUnderlyingAssets
|
|
7599
|
-
* @description fetches the market ids of underlying assets for a specific contract market type
|
|
7600
|
-
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-underlying
|
|
7601
|
-
* @param {object} [params] exchange specific params
|
|
7602
|
-
* @param {string} [params.type] the contract market type, 'option', 'swap' or 'future', the default is 'option'
|
|
7603
|
-
* @returns {object[]} a list of [underlying assets]{@link https://docs.ccxt.com/#/?id=underlying-assets-structure}
|
|
7604
|
-
*/
|
|
7605
7608
|
await this.loadMarkets();
|
|
7606
7609
|
let marketType = undefined;
|
|
7607
7610
|
[marketType, params] = this.handleMarketTypeAndParams('fetchUnderlyingAssets', undefined, params);
|
|
@@ -7630,16 +7633,16 @@ class okx extends okx$1 {
|
|
|
7630
7633
|
const underlyings = this.safeList(response, 'data', []);
|
|
7631
7634
|
return underlyings[0];
|
|
7632
7635
|
}
|
|
7636
|
+
/**
|
|
7637
|
+
* @method
|
|
7638
|
+
* @name okx#fetchGreeks
|
|
7639
|
+
* @description fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
|
|
7640
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-option-market-data
|
|
7641
|
+
* @param {string} symbol unified symbol of the market to fetch greeks for
|
|
7642
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7643
|
+
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
7644
|
+
*/
|
|
7633
7645
|
async fetchGreeks(symbol, params = {}) {
|
|
7634
|
-
/**
|
|
7635
|
-
* @method
|
|
7636
|
-
* @name okx#fetchGreeks
|
|
7637
|
-
* @description fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
|
|
7638
|
-
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-option-market-data
|
|
7639
|
-
* @param {string} symbol unified symbol of the market to fetch greeks for
|
|
7640
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7641
|
-
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
7642
|
-
*/
|
|
7643
7646
|
await this.loadMarkets();
|
|
7644
7647
|
const market = this.market(symbol);
|
|
7645
7648
|
const marketId = market['id'];
|
|
@@ -7738,24 +7741,24 @@ class okx extends okx$1 {
|
|
|
7738
7741
|
'info': greeks,
|
|
7739
7742
|
};
|
|
7740
7743
|
}
|
|
7744
|
+
/**
|
|
7745
|
+
* @method
|
|
7746
|
+
* @name okx#closePosition
|
|
7747
|
+
* @description closes open positions for a market
|
|
7748
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-close-positions
|
|
7749
|
+
* @param {string} symbol Unified CCXT market symbol
|
|
7750
|
+
* @param {string} [side] 'buy' or 'sell', leave as undefined in net mode
|
|
7751
|
+
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
7752
|
+
* @param {string} [params.clientOrderId] a unique identifier for the order
|
|
7753
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated', default is 'cross;
|
|
7754
|
+
* @param {string} [params.code] *required in the case of closing cross MARGIN position for Single-currency margin* margin currency
|
|
7755
|
+
*
|
|
7756
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
7757
|
+
* @param {boolean} [params.autoCxl] whether any pending orders for closing out needs to be automatically canceled when close position via a market order. false or true, the default is false
|
|
7758
|
+
* @param {string} [params.tag] order tag a combination of case-sensitive alphanumerics, all numbers, or all letters of up to 16 characters
|
|
7759
|
+
* @returns {object[]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
7760
|
+
*/
|
|
7741
7761
|
async closePosition(symbol, side = undefined, params = {}) {
|
|
7742
|
-
/**
|
|
7743
|
-
* @method
|
|
7744
|
-
* @name okx#closePosition
|
|
7745
|
-
* @description closes open positions for a market
|
|
7746
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-close-positions
|
|
7747
|
-
* @param {string} symbol Unified CCXT market symbol
|
|
7748
|
-
* @param {string} [side] 'buy' or 'sell', leave as undefined in net mode
|
|
7749
|
-
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
7750
|
-
* @param {string} [params.clientOrderId] a unique identifier for the order
|
|
7751
|
-
* @param {string} [params.marginMode] 'cross' or 'isolated', default is 'cross;
|
|
7752
|
-
* @param {string} [params.code] *required in the case of closing cross MARGIN position for Single-currency margin* margin currency
|
|
7753
|
-
*
|
|
7754
|
-
* EXCHANGE SPECIFIC PARAMETERS
|
|
7755
|
-
* @param {boolean} [params.autoCxl] whether any pending orders for closing out needs to be automatically canceled when close position via a market order. false or true, the default is false
|
|
7756
|
-
* @param {string} [params.tag] order tag a combination of case-sensitive alphanumerics, all numbers, or all letters of up to 16 characters
|
|
7757
|
-
* @returns {object[]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
7758
|
-
*/
|
|
7759
7762
|
await this.loadMarkets();
|
|
7760
7763
|
const market = this.market(symbol);
|
|
7761
7764
|
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
@@ -7806,16 +7809,16 @@ class okx extends okx$1 {
|
|
|
7806
7809
|
const order = this.safeDict(data, 0);
|
|
7807
7810
|
return this.parseOrder(order, market);
|
|
7808
7811
|
}
|
|
7812
|
+
/**
|
|
7813
|
+
* @method
|
|
7814
|
+
* @name okx#fetchOption
|
|
7815
|
+
* @description fetches option data that is commonly found in an option chain
|
|
7816
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-ticker
|
|
7817
|
+
* @param {string} symbol unified market symbol
|
|
7818
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7819
|
+
* @returns {object} an [option chain structure]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
|
|
7820
|
+
*/
|
|
7809
7821
|
async fetchOption(symbol, params = {}) {
|
|
7810
|
-
/**
|
|
7811
|
-
* @method
|
|
7812
|
-
* @name okx#fetchOption
|
|
7813
|
-
* @description fetches option data that is commonly found in an option chain
|
|
7814
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-ticker
|
|
7815
|
-
* @param {string} symbol unified market symbol
|
|
7816
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7817
|
-
* @returns {object} an [option chain structure]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
|
|
7818
|
-
*/
|
|
7819
7822
|
await this.loadMarkets();
|
|
7820
7823
|
const market = this.market(symbol);
|
|
7821
7824
|
const request = {
|
|
@@ -7852,17 +7855,17 @@ class okx extends okx$1 {
|
|
|
7852
7855
|
const chain = this.safeDict(result, 0, {});
|
|
7853
7856
|
return this.parseOption(chain, undefined, market);
|
|
7854
7857
|
}
|
|
7858
|
+
/**
|
|
7859
|
+
* @method
|
|
7860
|
+
* @name okx#fetchOptionChain
|
|
7861
|
+
* @description fetches data for an underlying asset that is commonly found in an option chain
|
|
7862
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
|
|
7863
|
+
* @param {string} code base currency to fetch an option chain for
|
|
7864
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7865
|
+
* @param {string} [params.uly] the underlying asset, can be obtained from fetchUnderlyingAssets ()
|
|
7866
|
+
* @returns {object} a list of [option chain structures]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
|
|
7867
|
+
*/
|
|
7855
7868
|
async fetchOptionChain(code, params = {}) {
|
|
7856
|
-
/**
|
|
7857
|
-
* @method
|
|
7858
|
-
* @name okx#fetchOptionChain
|
|
7859
|
-
* @description fetches data for an underlying asset that is commonly found in an option chain
|
|
7860
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
|
|
7861
|
-
* @param {string} currency base currency to fetch an option chain for
|
|
7862
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7863
|
-
* @param {string} [params.uly] the underlying asset, can be obtained from fetchUnderlyingAssets ()
|
|
7864
|
-
* @returns {object} a list of [option chain structures]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
|
|
7865
|
-
*/
|
|
7866
7869
|
await this.loadMarkets();
|
|
7867
7870
|
const currency = this.currency(code);
|
|
7868
7871
|
const request = {
|
|
@@ -7943,18 +7946,18 @@ class okx extends okx$1 {
|
|
|
7943
7946
|
'quoteVolume': undefined,
|
|
7944
7947
|
};
|
|
7945
7948
|
}
|
|
7949
|
+
/**
|
|
7950
|
+
* @method
|
|
7951
|
+
* @name okx#fetchConvertQuote
|
|
7952
|
+
* @description fetch a quote for converting from one currency to another
|
|
7953
|
+
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-estimate-quote
|
|
7954
|
+
* @param {string} fromCode the currency that you want to sell and convert from
|
|
7955
|
+
* @param {string} toCode the currency that you want to buy and convert into
|
|
7956
|
+
* @param {float} [amount] how much you want to trade in units of the from currency
|
|
7957
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7958
|
+
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
7959
|
+
*/
|
|
7946
7960
|
async fetchConvertQuote(fromCode, toCode, amount = undefined, params = {}) {
|
|
7947
|
-
/**
|
|
7948
|
-
* @method
|
|
7949
|
-
* @name okx#fetchConvertQuote
|
|
7950
|
-
* @description fetch a quote for converting from one currency to another
|
|
7951
|
-
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-estimate-quote
|
|
7952
|
-
* @param {string} fromCode the currency that you want to sell and convert from
|
|
7953
|
-
* @param {string} toCode the currency that you want to buy and convert into
|
|
7954
|
-
* @param {float} [amount] how much you want to trade in units of the from currency
|
|
7955
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7956
|
-
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
7957
|
-
*/
|
|
7958
7961
|
await this.loadMarkets();
|
|
7959
7962
|
const request = {
|
|
7960
7963
|
'baseCcy': fromCode.toUpperCase(),
|
|
@@ -7995,19 +7998,19 @@ class okx extends okx$1 {
|
|
|
7995
7998
|
const toCurrency = this.currency(toCurrencyId);
|
|
7996
7999
|
return this.parseConversion(result, fromCurrency, toCurrency);
|
|
7997
8000
|
}
|
|
8001
|
+
/**
|
|
8002
|
+
* @method
|
|
8003
|
+
* @name okx#createConvertTrade
|
|
8004
|
+
* @description convert from one currency to another
|
|
8005
|
+
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-convert-trade
|
|
8006
|
+
* @param {string} id the id of the trade that you want to make
|
|
8007
|
+
* @param {string} fromCode the currency that you want to sell and convert from
|
|
8008
|
+
* @param {string} toCode the currency that you want to buy and convert into
|
|
8009
|
+
* @param {float} [amount] how much you want to trade in units of the from currency
|
|
8010
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8011
|
+
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
8012
|
+
*/
|
|
7998
8013
|
async createConvertTrade(id, fromCode, toCode, amount = undefined, params = {}) {
|
|
7999
|
-
/**
|
|
8000
|
-
* @method
|
|
8001
|
-
* @name okx#createConvertTrade
|
|
8002
|
-
* @description convert from one currency to another
|
|
8003
|
-
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-convert-trade
|
|
8004
|
-
* @param {string} id the id of the trade that you want to make
|
|
8005
|
-
* @param {string} fromCode the currency that you want to sell and convert from
|
|
8006
|
-
* @param {string} toCode the currency that you want to buy and convert into
|
|
8007
|
-
* @param {float} [amount] how much you want to trade in units of the from currency
|
|
8008
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8009
|
-
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
8010
|
-
*/
|
|
8011
8014
|
await this.loadMarkets();
|
|
8012
8015
|
const request = {
|
|
8013
8016
|
'quoteId': id,
|
|
@@ -8048,17 +8051,17 @@ class okx extends okx$1 {
|
|
|
8048
8051
|
const toCurrency = this.currency(toCurrencyId);
|
|
8049
8052
|
return this.parseConversion(result, fromCurrency, toCurrency);
|
|
8050
8053
|
}
|
|
8054
|
+
/**
|
|
8055
|
+
* @method
|
|
8056
|
+
* @name okx#fetchConvertTrade
|
|
8057
|
+
* @description fetch the data for a conversion trade
|
|
8058
|
+
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-convert-history
|
|
8059
|
+
* @param {string} id the id of the trade that you want to fetch
|
|
8060
|
+
* @param {string} [code] the unified currency code of the conversion trade
|
|
8061
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8062
|
+
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
8063
|
+
*/
|
|
8051
8064
|
async fetchConvertTrade(id, code = undefined, params = {}) {
|
|
8052
|
-
/**
|
|
8053
|
-
* @method
|
|
8054
|
-
* @name okx#fetchConvertTrade
|
|
8055
|
-
* @description fetch the data for a conversion trade
|
|
8056
|
-
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-convert-history
|
|
8057
|
-
* @param {string} id the id of the trade that you want to fetch
|
|
8058
|
-
* @param {string} [code] the unified currency code of the conversion trade
|
|
8059
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8060
|
-
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
8061
|
-
*/
|
|
8062
8065
|
await this.loadMarkets();
|
|
8063
8066
|
const request = {
|
|
8064
8067
|
'clTReqId': id,
|
|
@@ -8099,19 +8102,19 @@ class okx extends okx$1 {
|
|
|
8099
8102
|
}
|
|
8100
8103
|
return this.parseConversion(result, fromCurrency, toCurrency);
|
|
8101
8104
|
}
|
|
8105
|
+
/**
|
|
8106
|
+
* @method
|
|
8107
|
+
* @name okx#fetchConvertTradeHistory
|
|
8108
|
+
* @description fetch the users history of conversion trades
|
|
8109
|
+
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-convert-history
|
|
8110
|
+
* @param {string} [code] the unified currency code
|
|
8111
|
+
* @param {int} [since] the earliest time in ms to fetch conversions for
|
|
8112
|
+
* @param {int} [limit] the maximum number of conversion structures to retrieve
|
|
8113
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8114
|
+
* @param {int} [params.until] timestamp in ms of the latest conversion to fetch
|
|
8115
|
+
* @returns {object[]} a list of [conversion structures]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
8116
|
+
*/
|
|
8102
8117
|
async fetchConvertTradeHistory(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
8103
|
-
/**
|
|
8104
|
-
* @method
|
|
8105
|
-
* @name okx#fetchConvertTradeHistory
|
|
8106
|
-
* @description fetch the users history of conversion trades
|
|
8107
|
-
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-convert-history
|
|
8108
|
-
* @param {string} [code] the unified currency code
|
|
8109
|
-
* @param {int} [since] the earliest time in ms to fetch conversions for
|
|
8110
|
-
* @param {int} [limit] the maximum number of conversion structures to retrieve
|
|
8111
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8112
|
-
* @param {int} [params.until] timestamp in ms of the latest conversion to fetch
|
|
8113
|
-
* @returns {object[]} a list of [conversion structures]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
8114
|
-
*/
|
|
8115
8118
|
await this.loadMarkets();
|
|
8116
8119
|
let request = {};
|
|
8117
8120
|
[request, params] = this.handleUntilOption('after', request, params);
|
|
@@ -8217,15 +8220,15 @@ class okx extends okx$1 {
|
|
|
8217
8220
|
'fee': undefined,
|
|
8218
8221
|
};
|
|
8219
8222
|
}
|
|
8223
|
+
/**
|
|
8224
|
+
* @method
|
|
8225
|
+
* @name okx#fetchConvertCurrencies
|
|
8226
|
+
* @description fetches all available currencies that can be converted
|
|
8227
|
+
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-convert-currencies
|
|
8228
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8229
|
+
* @returns {object} an associative dictionary of currencies
|
|
8230
|
+
*/
|
|
8220
8231
|
async fetchConvertCurrencies(params = {}) {
|
|
8221
|
-
/**
|
|
8222
|
-
* @method
|
|
8223
|
-
* @name okx#fetchConvertCurrencies
|
|
8224
|
-
* @description fetches all available currencies that can be converted
|
|
8225
|
-
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-convert-currencies
|
|
8226
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8227
|
-
* @returns {object} an associative dictionary of currencies
|
|
8228
|
-
*/
|
|
8229
8232
|
await this.loadMarkets();
|
|
8230
8233
|
const response = await this.privateGetAssetConvertCurrencies(params);
|
|
8231
8234
|
//
|
|
@@ -8318,19 +8321,21 @@ class okx extends okx$1 {
|
|
|
8318
8321
|
}
|
|
8319
8322
|
return undefined;
|
|
8320
8323
|
}
|
|
8324
|
+
/**
|
|
8325
|
+
* @method
|
|
8326
|
+
* @name okx#fetchMarginAdjustmentHistory
|
|
8327
|
+
* @description fetches the history of margin added or reduced from contract isolated positions
|
|
8328
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-7-days
|
|
8329
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months
|
|
8330
|
+
* @param {string} [symbol] not used by okx fetchMarginAdjustmentHistory
|
|
8331
|
+
* @param {string} [type] "add" or "reduce"
|
|
8332
|
+
* @param {int} [since] the earliest time in ms to fetch margin adjustment history for
|
|
8333
|
+
* @param {int} [limit] the maximum number of entries to retrieve
|
|
8334
|
+
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
8335
|
+
* @param {boolean} [params.auto] true if fetching auto margin increases
|
|
8336
|
+
* @returns {object[]} a list of [margin structures]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
8337
|
+
*/
|
|
8321
8338
|
async fetchMarginAdjustmentHistory(symbol = undefined, type = undefined, since = undefined, limit = undefined, params = {}) {
|
|
8322
|
-
/**
|
|
8323
|
-
* @method
|
|
8324
|
-
* @name okx#fetchMarginAdjustmentHistory
|
|
8325
|
-
* @description fetches the history of margin added or reduced from contract isolated positions
|
|
8326
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-7-days
|
|
8327
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months
|
|
8328
|
-
* @param {string} [symbol] not used by okx fetchMarginAdjustmentHistory
|
|
8329
|
-
* @param {string} [type] "add" or "reduce"
|
|
8330
|
-
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
8331
|
-
* @param {boolean} [params.auto] true if fetching auto margin increases
|
|
8332
|
-
* @returns {object[]} a list of [margin structures]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
8333
|
-
*/
|
|
8334
8339
|
await this.loadMarkets();
|
|
8335
8340
|
const auto = this.safeBool(params, 'auto');
|
|
8336
8341
|
if (type === undefined) {
|
|
@@ -8420,26 +8425,26 @@ class okx extends okx$1 {
|
|
|
8420
8425
|
const modifications = this.parseMarginModifications(data);
|
|
8421
8426
|
return this.filterBySymbolSinceLimit(modifications, symbol, since, limit);
|
|
8422
8427
|
}
|
|
8428
|
+
/**
|
|
8429
|
+
* @method
|
|
8430
|
+
* @name okx#fetchPositionsHistory
|
|
8431
|
+
* @description fetches historical positions
|
|
8432
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-positions-history
|
|
8433
|
+
* @param {string} [symbols] unified market symbols
|
|
8434
|
+
* @param {int} [since] timestamp in ms of the earliest position to fetch
|
|
8435
|
+
* @param {int} [limit] the maximum amount of records to fetch, default=100, max=100
|
|
8436
|
+
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
8437
|
+
* @param {string} [params.marginMode] "cross" or "isolated"
|
|
8438
|
+
*
|
|
8439
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
8440
|
+
* @param {string} [params.instType] margin, swap, futures or option
|
|
8441
|
+
* @param {string} [params.type] the type of latest close position 1: close position partially, 2:close all, 3:liquidation, 4:partial liquidation; 5:adl, is it is the latest type if there are several types for the same position
|
|
8442
|
+
* @param {string} [params.posId] position id, there is attribute expiration, the posid will be expired if it is more than 30 days after the last full close position, then position will use new posid
|
|
8443
|
+
* @param {string} [params.before] timestamp in ms of the earliest position to fetch based on the last update time of the position
|
|
8444
|
+
* @param {string} [params.after] timestamp in ms of the latest position to fetch based on the last update time of the position
|
|
8445
|
+
* @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
8446
|
+
*/
|
|
8423
8447
|
async fetchPositionsHistory(symbols = undefined, since = undefined, limit = undefined, params = {}) {
|
|
8424
|
-
/**
|
|
8425
|
-
* @method
|
|
8426
|
-
* @name okx#fetchPositionsHistory
|
|
8427
|
-
* @description fetches historical positions
|
|
8428
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-positions-history
|
|
8429
|
-
* @param {string} [symbols] unified market symbols
|
|
8430
|
-
* @param {int} [since] timestamp in ms of the earliest position to fetch
|
|
8431
|
-
* @param {int} [limit] the maximum amount of records to fetch, default=100, max=100
|
|
8432
|
-
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
8433
|
-
* @param {string} [params.marginMode] "cross" or "isolated"
|
|
8434
|
-
*
|
|
8435
|
-
* EXCHANGE SPECIFIC PARAMETERS
|
|
8436
|
-
* @param {string} [params.instType] margin, swap, futures or option
|
|
8437
|
-
* @param {string} [params.type] the type of latest close position 1: close position partially, 2:close all, 3:liquidation, 4:partial liquidation; 5:adl, is it is the latest type if there are several types for the same position
|
|
8438
|
-
* @param {string} [params.posId] position id, there is attribute expiration, the posid will be expired if it is more than 30 days after the last full close position, then position will use new posid
|
|
8439
|
-
* @param {string} [params.before] timestamp in ms of the earliest position to fetch based on the last update time of the position
|
|
8440
|
-
* @param {string} [params.after] timestamp in ms of the latest position to fetch based on the last update time of the position
|
|
8441
|
-
* @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
8442
|
-
*/
|
|
8443
8448
|
await this.loadMarkets();
|
|
8444
8449
|
const marginMode = this.safeString(params, 'marginMode');
|
|
8445
8450
|
const instType = this.safeStringUpper(params, 'instType');
|
|
@@ -8501,20 +8506,20 @@ class okx extends okx$1 {
|
|
|
8501
8506
|
const positions = this.parsePositions(data, symbols, params);
|
|
8502
8507
|
return this.filterBySinceLimit(positions, since, limit);
|
|
8503
8508
|
}
|
|
8509
|
+
/**
|
|
8510
|
+
* @method
|
|
8511
|
+
* @name okx#fetchLongShortRatioHistory
|
|
8512
|
+
* @description fetches the long short ratio history for a unified market symbol
|
|
8513
|
+
* @see https://www.okx.com/docs-v5/en/#trading-statistics-rest-api-get-contract-long-short-ratio
|
|
8514
|
+
* @param {string} symbol unified symbol of the market to fetch the long short ratio for
|
|
8515
|
+
* @param {string} [timeframe] the period for the ratio
|
|
8516
|
+
* @param {int} [since] the earliest time in ms to fetch ratios for
|
|
8517
|
+
* @param {int} [limit] the maximum number of long short ratio structures to retrieve
|
|
8518
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8519
|
+
* @param {int} [params.until] timestamp in ms of the latest ratio to fetch
|
|
8520
|
+
* @returns {object[]} an array of [long short ratio structures]{@link https://docs.ccxt.com/#/?id=long-short-ratio-structure}
|
|
8521
|
+
*/
|
|
8504
8522
|
async fetchLongShortRatioHistory(symbol = undefined, timeframe = undefined, since = undefined, limit = undefined, params = {}) {
|
|
8505
|
-
/**
|
|
8506
|
-
* @method
|
|
8507
|
-
* @name okx#fetchLongShortRatioHistory
|
|
8508
|
-
* @description fetches the long short ratio history for a unified market symbol
|
|
8509
|
-
* @see https://www.okx.com/docs-v5/en/#trading-statistics-rest-api-get-contract-long-short-ratio
|
|
8510
|
-
* @param {string} symbol unified symbol of the market to fetch the long short ratio for
|
|
8511
|
-
* @param {string} [timeframe] the period for the ratio
|
|
8512
|
-
* @param {int} [since] the earliest time in ms to fetch ratios for
|
|
8513
|
-
* @param {int} [limit] the maximum number of long short ratio structures to retrieve
|
|
8514
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8515
|
-
* @param {int} [params.until] timestamp in ms of the latest ratio to fetch
|
|
8516
|
-
* @returns {object[]} an array of [long short ratio structures]{@link https://docs.ccxt.com/#/?id=long-short-ratio-structure}
|
|
8517
|
-
*/
|
|
8518
8523
|
await this.loadMarkets();
|
|
8519
8524
|
const market = this.market(symbol);
|
|
8520
8525
|
const request = {
|