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/js/src/okx.js
CHANGED
|
@@ -1267,15 +1267,15 @@ export default class okx extends Exchange {
|
|
|
1267
1267
|
}
|
|
1268
1268
|
return super.safeMarket(marketId, market, delimiter, marketType);
|
|
1269
1269
|
}
|
|
1270
|
+
/**
|
|
1271
|
+
* @method
|
|
1272
|
+
* @name okx#fetchStatus
|
|
1273
|
+
* @description the latest known information on the availability of the exchange API
|
|
1274
|
+
* @see https://www.okx.com/docs-v5/en/#status-get-status
|
|
1275
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1276
|
+
* @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
|
|
1277
|
+
*/
|
|
1270
1278
|
async fetchStatus(params = {}) {
|
|
1271
|
-
/**
|
|
1272
|
-
* @method
|
|
1273
|
-
* @name okx#fetchStatus
|
|
1274
|
-
* @description the latest known information on the availability of the exchange API
|
|
1275
|
-
* @see https://www.okx.com/docs-v5/en/#status-get-status
|
|
1276
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1277
|
-
* @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
|
|
1278
|
-
*/
|
|
1279
1279
|
const response = await this.publicGetSystemStatus(params);
|
|
1280
1280
|
//
|
|
1281
1281
|
// Note, if there is no maintenance around, the 'data' array is empty
|
|
@@ -1326,15 +1326,15 @@ export default class okx extends Exchange {
|
|
|
1326
1326
|
}
|
|
1327
1327
|
return update;
|
|
1328
1328
|
}
|
|
1329
|
+
/**
|
|
1330
|
+
* @method
|
|
1331
|
+
* @name okx#fetchTime
|
|
1332
|
+
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
1333
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-system-time
|
|
1334
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1335
|
+
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
1336
|
+
*/
|
|
1329
1337
|
async fetchTime(params = {}) {
|
|
1330
|
-
/**
|
|
1331
|
-
* @method
|
|
1332
|
-
* @name okx#fetchTime
|
|
1333
|
-
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
1334
|
-
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-system-time
|
|
1335
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1336
|
-
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
1337
|
-
*/
|
|
1338
1338
|
const response = await this.publicGetPublicTime(params);
|
|
1339
1339
|
//
|
|
1340
1340
|
// {
|
|
@@ -1349,15 +1349,15 @@ export default class okx extends Exchange {
|
|
|
1349
1349
|
const first = this.safeDict(data, 0, {});
|
|
1350
1350
|
return this.safeInteger(first, 'ts');
|
|
1351
1351
|
}
|
|
1352
|
+
/**
|
|
1353
|
+
* @method
|
|
1354
|
+
* @name okx#fetchAccounts
|
|
1355
|
+
* @description fetch all the accounts associated with a profile
|
|
1356
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-account-configuration
|
|
1357
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1358
|
+
* @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
|
|
1359
|
+
*/
|
|
1352
1360
|
async fetchAccounts(params = {}) {
|
|
1353
|
-
/**
|
|
1354
|
-
* @method
|
|
1355
|
-
* @name okx#fetchAccounts
|
|
1356
|
-
* @description fetch all the accounts associated with a profile
|
|
1357
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-account-configuration
|
|
1358
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1359
|
-
* @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
|
|
1360
|
-
*/
|
|
1361
1361
|
const response = await this.privateGetAccountConfig(params);
|
|
1362
1362
|
//
|
|
1363
1363
|
// {
|
|
@@ -1394,15 +1394,15 @@ export default class okx extends Exchange {
|
|
|
1394
1394
|
}
|
|
1395
1395
|
return result;
|
|
1396
1396
|
}
|
|
1397
|
+
/**
|
|
1398
|
+
* @method
|
|
1399
|
+
* @name okx#fetchMarkets
|
|
1400
|
+
* @description retrieves data on all markets for okx
|
|
1401
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-instruments
|
|
1402
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1403
|
+
* @returns {object[]} an array of objects representing market data
|
|
1404
|
+
*/
|
|
1397
1405
|
async fetchMarkets(params = {}) {
|
|
1398
|
-
/**
|
|
1399
|
-
* @method
|
|
1400
|
-
* @name okx#fetchMarkets
|
|
1401
|
-
* @description retrieves data on all markets for okx
|
|
1402
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-instruments
|
|
1403
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1404
|
-
* @returns {object[]} an array of objects representing market data
|
|
1405
|
-
*/
|
|
1406
1406
|
const types = this.safeList(this.options, 'fetchMarkets', []);
|
|
1407
1407
|
let promises = [];
|
|
1408
1408
|
let result = [];
|
|
@@ -1619,15 +1619,15 @@ export default class okx extends Exchange {
|
|
|
1619
1619
|
const dataResponse = this.safeList(response, 'data', []);
|
|
1620
1620
|
return this.parseMarkets(dataResponse);
|
|
1621
1621
|
}
|
|
1622
|
+
/**
|
|
1623
|
+
* @method
|
|
1624
|
+
* @name okx#fetchCurrencies
|
|
1625
|
+
* @description fetches all available currencies on an exchange
|
|
1626
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-currencies
|
|
1627
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1628
|
+
* @returns {object} an associative dictionary of currencies
|
|
1629
|
+
*/
|
|
1622
1630
|
async fetchCurrencies(params = {}) {
|
|
1623
|
-
/**
|
|
1624
|
-
* @method
|
|
1625
|
-
* @name okx#fetchCurrencies
|
|
1626
|
-
* @description fetches all available currencies on an exchange
|
|
1627
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-currencies
|
|
1628
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1629
|
-
* @returns {object} an associative dictionary of currencies
|
|
1630
|
-
*/
|
|
1631
1631
|
// this endpoint requires authentication
|
|
1632
1632
|
// while fetchCurrencies is a public API method by design
|
|
1633
1633
|
// therefore we check the keys here
|
|
@@ -1760,18 +1760,18 @@ export default class okx extends Exchange {
|
|
|
1760
1760
|
}
|
|
1761
1761
|
return result;
|
|
1762
1762
|
}
|
|
1763
|
+
/**
|
|
1764
|
+
* @method
|
|
1765
|
+
* @name okx#fetchOrderBook
|
|
1766
|
+
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
1767
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-order-book
|
|
1768
|
+
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
1769
|
+
* @param {int} [limit] the maximum amount of order book entries to return
|
|
1770
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1771
|
+
* @param {string} [params.method] 'publicGetMarketBooksFull' or 'publicGetMarketBooks' default is 'publicGetMarketBooks'
|
|
1772
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
1773
|
+
*/
|
|
1763
1774
|
async fetchOrderBook(symbol, limit = undefined, params = {}) {
|
|
1764
|
-
/**
|
|
1765
|
-
* @method
|
|
1766
|
-
* @name okx#fetchOrderBook
|
|
1767
|
-
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
1768
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-order-book
|
|
1769
|
-
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
1770
|
-
* @param {int} [limit] the maximum amount of order book entries to return
|
|
1771
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1772
|
-
* @param {string} [params.method] 'publicGetMarketBooksFull' or 'publicGetMarketBooks' default is 'publicGetMarketBooks'
|
|
1773
|
-
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
1774
|
-
*/
|
|
1775
1775
|
await this.loadMarkets();
|
|
1776
1776
|
const market = this.market(symbol);
|
|
1777
1777
|
const request = {
|
|
@@ -1893,16 +1893,16 @@ export default class okx extends Exchange {
|
|
|
1893
1893
|
'info': ticker,
|
|
1894
1894
|
}, market);
|
|
1895
1895
|
}
|
|
1896
|
+
/**
|
|
1897
|
+
* @method
|
|
1898
|
+
* @name okx#fetchTicker
|
|
1899
|
+
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
1900
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-ticker
|
|
1901
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
1902
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1903
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1904
|
+
*/
|
|
1896
1905
|
async fetchTicker(symbol, params = {}) {
|
|
1897
|
-
/**
|
|
1898
|
-
* @method
|
|
1899
|
-
* @name okx#fetchTicker
|
|
1900
|
-
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
1901
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-ticker
|
|
1902
|
-
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
1903
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1904
|
-
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1905
|
-
*/
|
|
1906
1906
|
await this.loadMarkets();
|
|
1907
1907
|
const market = this.market(symbol);
|
|
1908
1908
|
const request = {
|
|
@@ -1939,16 +1939,16 @@ export default class okx extends Exchange {
|
|
|
1939
1939
|
const first = this.safeDict(data, 0, {});
|
|
1940
1940
|
return this.parseTicker(first, market);
|
|
1941
1941
|
}
|
|
1942
|
+
/**
|
|
1943
|
+
* @method
|
|
1944
|
+
* @name okx#fetchTickers
|
|
1945
|
+
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
1946
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
|
|
1947
|
+
* @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
1948
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1949
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1950
|
+
*/
|
|
1942
1951
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
1943
|
-
/**
|
|
1944
|
-
* @method
|
|
1945
|
-
* @name okx#fetchTickers
|
|
1946
|
-
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
1947
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
|
|
1948
|
-
* @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
1949
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1950
|
-
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1951
|
-
*/
|
|
1952
1952
|
await this.loadMarkets();
|
|
1953
1953
|
symbols = this.marketSymbols(symbols);
|
|
1954
1954
|
const market = this.getMarketFromSymbols(symbols);
|
|
@@ -1997,16 +1997,16 @@ export default class okx extends Exchange {
|
|
|
1997
1997
|
const tickers = this.safeList(response, 'data', []);
|
|
1998
1998
|
return this.parseTickers(tickers, symbols);
|
|
1999
1999
|
}
|
|
2000
|
+
/**
|
|
2001
|
+
* @method
|
|
2002
|
+
* @name okx#fetchMarkPrice
|
|
2003
|
+
* @description fetches mark price for the market
|
|
2004
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-mark-price
|
|
2005
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
2006
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2007
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
2008
|
+
*/
|
|
2000
2009
|
async fetchMarkPrice(symbol, params = {}) {
|
|
2001
|
-
/**
|
|
2002
|
-
* @method
|
|
2003
|
-
* @name okx#fetchMarkPrice
|
|
2004
|
-
* @description fetches mark price for the market
|
|
2005
|
-
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-mark-price
|
|
2006
|
-
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
2007
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2008
|
-
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
2009
|
-
*/
|
|
2010
2010
|
await this.loadMarkets();
|
|
2011
2011
|
const market = this.market(symbol);
|
|
2012
2012
|
const request = {
|
|
@@ -2030,16 +2030,16 @@ export default class okx extends Exchange {
|
|
|
2030
2030
|
const data = this.safeList(response, 'data');
|
|
2031
2031
|
return this.parseTicker(this.safeDict(data, 0), market);
|
|
2032
2032
|
}
|
|
2033
|
+
/**
|
|
2034
|
+
* @method
|
|
2035
|
+
* @name okx#fetchMarkPrices
|
|
2036
|
+
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
2037
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-mark-price
|
|
2038
|
+
* @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
2039
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2040
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
2041
|
+
*/
|
|
2033
2042
|
async fetchMarkPrices(symbols = undefined, params = {}) {
|
|
2034
|
-
/**
|
|
2035
|
-
* @method
|
|
2036
|
-
* @name okx#fetchMarkPrices
|
|
2037
|
-
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
2038
|
-
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-mark-price
|
|
2039
|
-
* @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
2040
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2041
|
-
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
2042
|
-
*/
|
|
2043
2043
|
await this.loadMarkets();
|
|
2044
2044
|
symbols = this.marketSymbols(symbols);
|
|
2045
2045
|
const market = this.getMarketFromSymbols(symbols);
|
|
@@ -2155,20 +2155,20 @@ export default class okx extends Exchange {
|
|
|
2155
2155
|
'fee': fee,
|
|
2156
2156
|
}, market);
|
|
2157
2157
|
}
|
|
2158
|
+
/**
|
|
2159
|
+
* @method
|
|
2160
|
+
* @name okx#fetchTrades
|
|
2161
|
+
* @description get the list of most recent trades for a particular symbol
|
|
2162
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-trades
|
|
2163
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-option-trades
|
|
2164
|
+
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
2165
|
+
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
2166
|
+
* @param {int} [limit] the maximum amount of trades to fetch
|
|
2167
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2168
|
+
* @param {boolean} [params.paginate] *only applies to publicGetMarketHistoryTrades* default false, when true will automatically paginate by calling this endpoint multiple times
|
|
2169
|
+
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
2170
|
+
*/
|
|
2158
2171
|
async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
2159
|
-
/**
|
|
2160
|
-
* @method
|
|
2161
|
-
* @name okx#fetchTrades
|
|
2162
|
-
* @description get the list of most recent trades for a particular symbol
|
|
2163
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-trades
|
|
2164
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-option-trades
|
|
2165
|
-
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
2166
|
-
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
2167
|
-
* @param {int} [limit] the maximum amount of trades to fetch
|
|
2168
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2169
|
-
* @param {boolean} [params.paginate] *only applies to publicGetMarketHistoryTrades* default false, when true will automatically paginate by calling this endpoint multiple times
|
|
2170
|
-
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
2171
|
-
*/
|
|
2172
2172
|
await this.loadMarkets();
|
|
2173
2173
|
let paginate = false;
|
|
2174
2174
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchTrades', 'paginate');
|
|
@@ -2259,27 +2259,27 @@ export default class okx extends Exchange {
|
|
|
2259
2259
|
this.safeNumber(ohlcv, volumeIndex),
|
|
2260
2260
|
];
|
|
2261
2261
|
}
|
|
2262
|
+
/**
|
|
2263
|
+
* @method
|
|
2264
|
+
* @name okx#fetchOHLCV
|
|
2265
|
+
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
2266
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-candlesticks
|
|
2267
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-candlesticks-history
|
|
2268
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-mark-price-candlesticks
|
|
2269
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-mark-price-candlesticks-history
|
|
2270
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-index-candlesticks
|
|
2271
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-index-candlesticks-history
|
|
2272
|
+
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
2273
|
+
* @param {string} timeframe the length of time each candle represents
|
|
2274
|
+
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
2275
|
+
* @param {int} [limit] the maximum amount of candles to fetch
|
|
2276
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2277
|
+
* @param {string} [params.price] "mark" or "index" for mark price and index price candles
|
|
2278
|
+
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
2279
|
+
* @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)
|
|
2280
|
+
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
2281
|
+
*/
|
|
2262
2282
|
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
2263
|
-
/**
|
|
2264
|
-
* @method
|
|
2265
|
-
* @name okx#fetchOHLCV
|
|
2266
|
-
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
2267
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-candlesticks
|
|
2268
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-candlesticks-history
|
|
2269
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-mark-price-candlesticks
|
|
2270
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-mark-price-candlesticks-history
|
|
2271
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-index-candlesticks
|
|
2272
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-market-data-get-index-candlesticks-history
|
|
2273
|
-
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
2274
|
-
* @param {string} timeframe the length of time each candle represents
|
|
2275
|
-
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
2276
|
-
* @param {int} [limit] the maximum amount of candles to fetch
|
|
2277
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2278
|
-
* @param {string} [params.price] "mark" or "index" for mark price and index price candles
|
|
2279
|
-
* @param {int} [params.until] timestamp in ms of the latest candle to fetch
|
|
2280
|
-
* @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)
|
|
2281
|
-
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
2282
|
-
*/
|
|
2283
2283
|
await this.loadMarkets();
|
|
2284
2284
|
const market = this.market(symbol);
|
|
2285
2285
|
let paginate = false;
|
|
@@ -2366,19 +2366,19 @@ export default class okx extends Exchange {
|
|
|
2366
2366
|
const data = this.safeList(response, 'data', []);
|
|
2367
2367
|
return this.parseOHLCVs(data, market, timeframe, since, limit);
|
|
2368
2368
|
}
|
|
2369
|
+
/**
|
|
2370
|
+
* @method
|
|
2371
|
+
* @name okx#fetchFundingRateHistory
|
|
2372
|
+
* @description fetches historical funding rate prices
|
|
2373
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate-history
|
|
2374
|
+
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
2375
|
+
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
|
|
2376
|
+
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} to fetch
|
|
2377
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2378
|
+
* @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)
|
|
2379
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
|
|
2380
|
+
*/
|
|
2369
2381
|
async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
2370
|
-
/**
|
|
2371
|
-
* @method
|
|
2372
|
-
* @name okx#fetchFundingRateHistory
|
|
2373
|
-
* @description fetches historical funding rate prices
|
|
2374
|
-
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate-history
|
|
2375
|
-
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
|
|
2376
|
-
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
|
|
2377
|
-
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} to fetch
|
|
2378
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2379
|
-
* @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)
|
|
2380
|
-
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
|
|
2381
|
-
*/
|
|
2382
2382
|
if (symbol === undefined) {
|
|
2383
2383
|
throw new ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
|
|
2384
2384
|
}
|
|
@@ -2513,16 +2513,16 @@ export default class okx extends Exchange {
|
|
|
2513
2513
|
'tierBased': undefined,
|
|
2514
2514
|
};
|
|
2515
2515
|
}
|
|
2516
|
+
/**
|
|
2517
|
+
* @method
|
|
2518
|
+
* @name okx#fetchTradingFee
|
|
2519
|
+
* @description fetch the trading fees for a market
|
|
2520
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-fee-rates
|
|
2521
|
+
* @param {string} symbol unified market symbol
|
|
2522
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2523
|
+
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
2524
|
+
*/
|
|
2516
2525
|
async fetchTradingFee(symbol, params = {}) {
|
|
2517
|
-
/**
|
|
2518
|
-
* @method
|
|
2519
|
-
* @name okx#fetchTradingFee
|
|
2520
|
-
* @description fetch the trading fees for a market
|
|
2521
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-fee-rates
|
|
2522
|
-
* @param {string} symbol unified market symbol
|
|
2523
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2524
|
-
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
2525
|
-
*/
|
|
2526
2526
|
await this.loadMarkets();
|
|
2527
2527
|
const market = this.market(symbol);
|
|
2528
2528
|
const request = {
|
|
@@ -2563,17 +2563,17 @@ export default class okx extends Exchange {
|
|
|
2563
2563
|
const first = this.safeDict(data, 0, {});
|
|
2564
2564
|
return this.parseTradingFee(first, market);
|
|
2565
2565
|
}
|
|
2566
|
+
/**
|
|
2567
|
+
* @method
|
|
2568
|
+
* @name okx#fetchBalance
|
|
2569
|
+
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
2570
|
+
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-balance
|
|
2571
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-balance
|
|
2572
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2573
|
+
* @param {string} [params.type] wallet type, ['funding' or 'trading'] default is 'trading'
|
|
2574
|
+
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
2575
|
+
*/
|
|
2566
2576
|
async fetchBalance(params = {}) {
|
|
2567
|
-
/**
|
|
2568
|
-
* @method
|
|
2569
|
-
* @name okx#fetchBalance
|
|
2570
|
-
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
2571
|
-
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-balance
|
|
2572
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-balance
|
|
2573
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2574
|
-
* @param {string} [params.type] wallet type, ['funding' or 'trading'] default is 'trading'
|
|
2575
|
-
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
2576
|
-
*/
|
|
2577
2577
|
await this.loadMarkets();
|
|
2578
2578
|
const [marketType, query] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
|
|
2579
2579
|
const request = {
|
|
@@ -2690,17 +2690,17 @@ export default class okx extends Exchange {
|
|
|
2690
2690
|
//
|
|
2691
2691
|
return this.parseBalanceByType(marketType, response);
|
|
2692
2692
|
}
|
|
2693
|
+
/**
|
|
2694
|
+
* @method
|
|
2695
|
+
* @name okx#createMarketBuyOrderWithCost
|
|
2696
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
|
|
2697
|
+
* @description create a market buy order by providing the symbol and cost
|
|
2698
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
2699
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
2700
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2701
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2702
|
+
*/
|
|
2693
2703
|
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
2694
|
-
/**
|
|
2695
|
-
* @method
|
|
2696
|
-
* @name okx#createMarketBuyOrderWithCost
|
|
2697
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
|
|
2698
|
-
* @description create a market buy order by providing the symbol and cost
|
|
2699
|
-
* @param {string} symbol unified symbol of the market to create an order in
|
|
2700
|
-
* @param {float} cost how much you want to trade in units of the quote currency
|
|
2701
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2702
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2703
|
-
*/
|
|
2704
2704
|
await this.loadMarkets();
|
|
2705
2705
|
const market = this.market(symbol);
|
|
2706
2706
|
if (!market['spot']) {
|
|
@@ -2710,17 +2710,17 @@ export default class okx extends Exchange {
|
|
|
2710
2710
|
params['tgtCcy'] = 'quote_ccy';
|
|
2711
2711
|
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
2712
2712
|
}
|
|
2713
|
+
/**
|
|
2714
|
+
* @method
|
|
2715
|
+
* @name okx#createMarketSellOrderWithCost
|
|
2716
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
|
|
2717
|
+
* @description create a market buy order by providing the symbol and cost
|
|
2718
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
2719
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
2720
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2721
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2722
|
+
*/
|
|
2713
2723
|
async createMarketSellOrderWithCost(symbol, cost, params = {}) {
|
|
2714
|
-
/**
|
|
2715
|
-
* @method
|
|
2716
|
-
* @name okx#createMarketSellOrderWithCost
|
|
2717
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
|
|
2718
|
-
* @description create a market buy order by providing the symbol and cost
|
|
2719
|
-
* @param {string} symbol unified symbol of the market to create an order in
|
|
2720
|
-
* @param {float} cost how much you want to trade in units of the quote currency
|
|
2721
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2722
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2723
|
-
*/
|
|
2724
2724
|
await this.loadMarkets();
|
|
2725
2725
|
const market = this.market(symbol);
|
|
2726
2726
|
if (!market['spot']) {
|
|
@@ -3013,36 +3013,36 @@ export default class okx extends Exchange {
|
|
|
3013
3013
|
}
|
|
3014
3014
|
return this.extend(request, params);
|
|
3015
3015
|
}
|
|
3016
|
+
/**
|
|
3017
|
+
* @method
|
|
3018
|
+
* @name okx#createOrder
|
|
3019
|
+
* @description create a trade order
|
|
3020
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
|
|
3021
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-multiple-orders
|
|
3022
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-place-algo-order
|
|
3023
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
3024
|
+
* @param {string} type 'market' or 'limit'
|
|
3025
|
+
* @param {string} side 'buy' or 'sell'
|
|
3026
|
+
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
3027
|
+
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
3028
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3029
|
+
* @param {bool} [params.reduceOnly] a mark to reduce the position size for margin, swap and future orders
|
|
3030
|
+
* @param {bool} [params.postOnly] true to place a post only order
|
|
3031
|
+
* @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)
|
|
3032
|
+
* @param {float} [params.takeProfit.triggerPrice] take profit trigger price
|
|
3033
|
+
* @param {float} [params.takeProfit.price] used for take profit limit orders, not used for take profit market price orders
|
|
3034
|
+
* @param {string} [params.takeProfit.type] 'market' or 'limit' used to specify the take profit price type
|
|
3035
|
+
* @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)
|
|
3036
|
+
* @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
|
|
3037
|
+
* @param {float} [params.stopLoss.price] used for stop loss limit orders, not used for stop loss market price orders
|
|
3038
|
+
* @param {string} [params.stopLoss.type] 'market' or 'limit' used to specify the stop loss price type
|
|
3039
|
+
* @param {string} [params.positionSide] if position mode is one-way: set to 'net', if position mode is hedge-mode: set to 'long' or 'short'
|
|
3040
|
+
* @param {string} [params.trailingPercent] the percent to trail away from the current market price
|
|
3041
|
+
* @param {string} [params.tpOrdKind] 'condition' or 'limit', the default is 'condition'
|
|
3042
|
+
* @param {bool} [params.hedged] *swap and future only* true for hedged mode, false for one way mode
|
|
3043
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3044
|
+
*/
|
|
3016
3045
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
3017
|
-
/**
|
|
3018
|
-
* @method
|
|
3019
|
-
* @name okx#createOrder
|
|
3020
|
-
* @description create a trade order
|
|
3021
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
|
|
3022
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-multiple-orders
|
|
3023
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-place-algo-order
|
|
3024
|
-
* @param {string} symbol unified symbol of the market to create an order in
|
|
3025
|
-
* @param {string} type 'market' or 'limit'
|
|
3026
|
-
* @param {string} side 'buy' or 'sell'
|
|
3027
|
-
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
3028
|
-
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
3029
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3030
|
-
* @param {bool} [params.reduceOnly] a mark to reduce the position size for margin, swap and future orders
|
|
3031
|
-
* @param {bool} [params.postOnly] true to place a post only order
|
|
3032
|
-
* @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)
|
|
3033
|
-
* @param {float} [params.takeProfit.triggerPrice] take profit trigger price
|
|
3034
|
-
* @param {float} [params.takeProfit.price] used for take profit limit orders, not used for take profit market price orders
|
|
3035
|
-
* @param {string} [params.takeProfit.type] 'market' or 'limit' used to specify the take profit price type
|
|
3036
|
-
* @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)
|
|
3037
|
-
* @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
|
|
3038
|
-
* @param {float} [params.stopLoss.price] used for stop loss limit orders, not used for stop loss market price orders
|
|
3039
|
-
* @param {string} [params.stopLoss.type] 'market' or 'limit' used to specify the stop loss price type
|
|
3040
|
-
* @param {string} [params.positionSide] if position mode is one-way: set to 'net', if position mode is hedge-mode: set to 'long' or 'short'
|
|
3041
|
-
* @param {string} [params.trailingPercent] the percent to trail away from the current market price
|
|
3042
|
-
* @param {string} [params.tpOrdKind] 'condition' or 'limit', the default is 'condition'
|
|
3043
|
-
* @param {bool} [params.hedged] *swap and future only* true for hedged mode, false for one way mode
|
|
3044
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3045
|
-
*/
|
|
3046
3046
|
await this.loadMarkets();
|
|
3047
3047
|
const market = this.market(symbol);
|
|
3048
3048
|
let request = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
@@ -3077,15 +3077,16 @@ export default class okx extends Exchange {
|
|
|
3077
3077
|
order['side'] = side;
|
|
3078
3078
|
return order;
|
|
3079
3079
|
}
|
|
3080
|
+
/**
|
|
3081
|
+
* @method
|
|
3082
|
+
* @name okx#createOrders
|
|
3083
|
+
* @description create a list of trade orders
|
|
3084
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-multiple-orders
|
|
3085
|
+
* @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
|
|
3086
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3087
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3088
|
+
*/
|
|
3080
3089
|
async createOrders(orders, params = {}) {
|
|
3081
|
-
/**
|
|
3082
|
-
* @method
|
|
3083
|
-
* @name okx#createOrders
|
|
3084
|
-
* @description create a list of trade orders
|
|
3085
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-multiple-orders
|
|
3086
|
-
* @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
|
|
3087
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3088
|
-
*/
|
|
3089
3090
|
await this.loadMarkets();
|
|
3090
3091
|
const ordersRequests = [];
|
|
3091
3092
|
for (let i = 0; i < orders.length; i++) {
|
|
@@ -3223,38 +3224,38 @@ export default class okx extends Exchange {
|
|
|
3223
3224
|
params = this.omit(params, ['clOrdId', 'clientOrderId', 'takeProfitPrice', 'stopLossPrice', 'stopLoss', 'takeProfit']);
|
|
3224
3225
|
return this.extend(request, params);
|
|
3225
3226
|
}
|
|
3227
|
+
/**
|
|
3228
|
+
* @method
|
|
3229
|
+
* @name okx#editOrder
|
|
3230
|
+
* @description edit a trade order
|
|
3231
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-amend-order
|
|
3232
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-amend-algo-order
|
|
3233
|
+
* @param {string} id order id
|
|
3234
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
3235
|
+
* @param {string} type 'market' or 'limit'
|
|
3236
|
+
* @param {string} side 'buy' or 'sell'
|
|
3237
|
+
* @param {float} amount how much of the currency you want to trade in units of the base currency
|
|
3238
|
+
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
3239
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3240
|
+
* @param {string} [params.clientOrderId] client order id, uses id if not passed
|
|
3241
|
+
* @param {float} [params.stopLossPrice] stop loss trigger price
|
|
3242
|
+
* @param {float} [params.newSlOrdPx] the stop loss order price, set to stopLossPrice if the type is market
|
|
3243
|
+
* @param {string} [params.newSlTriggerPxType] 'last', 'index' or 'mark' used to specify the stop loss trigger price type, default is 'last'
|
|
3244
|
+
* @param {float} [params.takeProfitPrice] take profit trigger price
|
|
3245
|
+
* @param {float} [params.newTpOrdPx] the take profit order price, set to takeProfitPrice if the type is market
|
|
3246
|
+
* @param {string} [params.newTpTriggerPxType] 'last', 'index' or 'mark' used to specify the take profit trigger price type, default is 'last'
|
|
3247
|
+
* @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
|
|
3248
|
+
* @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
|
|
3249
|
+
* @param {float} [params.stopLoss.price] used for stop loss limit orders, not used for stop loss market price orders
|
|
3250
|
+
* @param {string} [params.stopLoss.type] 'market' or 'limit' used to specify the stop loss price type
|
|
3251
|
+
* @param {object} [params.takeProfit] *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered
|
|
3252
|
+
* @param {float} [params.takeProfit.triggerPrice] take profit trigger price
|
|
3253
|
+
* @param {float} [params.takeProfit.price] used for take profit limit orders, not used for take profit market price orders
|
|
3254
|
+
* @param {string} [params.takeProfit.type] 'market' or 'limit' used to specify the take profit price type
|
|
3255
|
+
* @param {string} [params.newTpOrdKind] 'condition' or 'limit', the default is 'condition'
|
|
3256
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3257
|
+
*/
|
|
3226
3258
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
3227
|
-
/**
|
|
3228
|
-
* @method
|
|
3229
|
-
* @name okx#editOrder
|
|
3230
|
-
* @description edit a trade order
|
|
3231
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-amend-order
|
|
3232
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-amend-algo-order
|
|
3233
|
-
* @param {string} id order id
|
|
3234
|
-
* @param {string} symbol unified symbol of the market to create an order in
|
|
3235
|
-
* @param {string} type 'market' or 'limit'
|
|
3236
|
-
* @param {string} side 'buy' or 'sell'
|
|
3237
|
-
* @param {float} amount how much of the currency you want to trade in units of the base currency
|
|
3238
|
-
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
3239
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3240
|
-
* @param {string} [params.clientOrderId] client order id, uses id if not passed
|
|
3241
|
-
* @param {float} [params.stopLossPrice] stop loss trigger price
|
|
3242
|
-
* @param {float} [params.newSlOrdPx] the stop loss order price, set to stopLossPrice if the type is market
|
|
3243
|
-
* @param {string} [params.newSlTriggerPxType] 'last', 'index' or 'mark' used to specify the stop loss trigger price type, default is 'last'
|
|
3244
|
-
* @param {float} [params.takeProfitPrice] take profit trigger price
|
|
3245
|
-
* @param {float} [params.newTpOrdPx] the take profit order price, set to takeProfitPrice if the type is market
|
|
3246
|
-
* @param {string} [params.newTpTriggerPxType] 'last', 'index' or 'mark' used to specify the take profit trigger price type, default is 'last'
|
|
3247
|
-
* @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
|
|
3248
|
-
* @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
|
|
3249
|
-
* @param {float} [params.stopLoss.price] used for stop loss limit orders, not used for stop loss market price orders
|
|
3250
|
-
* @param {string} [params.stopLoss.type] 'market' or 'limit' used to specify the stop loss price type
|
|
3251
|
-
* @param {object} [params.takeProfit] *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered
|
|
3252
|
-
* @param {float} [params.takeProfit.triggerPrice] take profit trigger price
|
|
3253
|
-
* @param {float} [params.takeProfit.price] used for take profit limit orders, not used for take profit market price orders
|
|
3254
|
-
* @param {string} [params.takeProfit.type] 'market' or 'limit' used to specify the take profit price type
|
|
3255
|
-
* @param {string} [params.newTpOrdKind] 'condition' or 'limit', the default is 'condition'
|
|
3256
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3257
|
-
*/
|
|
3258
3259
|
await this.loadMarkets();
|
|
3259
3260
|
const market = this.market(symbol);
|
|
3260
3261
|
const request = this.editOrderRequest(id, symbol, type, side, amount, price, params);
|
|
@@ -3291,20 +3292,20 @@ export default class okx extends Exchange {
|
|
|
3291
3292
|
order['side'] = side;
|
|
3292
3293
|
return order;
|
|
3293
3294
|
}
|
|
3295
|
+
/**
|
|
3296
|
+
* @method
|
|
3297
|
+
* @name okx#cancelOrder
|
|
3298
|
+
* @description cancels an open order
|
|
3299
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-order
|
|
3300
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-cancel-algo-order
|
|
3301
|
+
* @param {string} id order id
|
|
3302
|
+
* @param {string} symbol unified symbol of the market the order was made in
|
|
3303
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3304
|
+
* @param {boolean} [params.trigger] true if trigger orders
|
|
3305
|
+
* @param {boolean} [params.trailing] set to true if you want to cancel a trailing order
|
|
3306
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3307
|
+
*/
|
|
3294
3308
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
3295
|
-
/**
|
|
3296
|
-
* @method
|
|
3297
|
-
* @name okx#cancelOrder
|
|
3298
|
-
* @description cancels an open order
|
|
3299
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-order
|
|
3300
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-cancel-algo-order
|
|
3301
|
-
* @param {string} id order id
|
|
3302
|
-
* @param {string} symbol unified symbol of the market the order was made in
|
|
3303
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3304
|
-
* @param {boolean} [params.trigger] true if trigger orders
|
|
3305
|
-
* @param {boolean} [params.trailing] set to true if you want to cancel a trailing order
|
|
3306
|
-
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3307
|
-
*/
|
|
3308
3309
|
if (symbol === undefined) {
|
|
3309
3310
|
throw new ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
3310
3311
|
}
|
|
@@ -3350,20 +3351,20 @@ export default class okx extends Exchange {
|
|
|
3350
3351
|
return ids;
|
|
3351
3352
|
}
|
|
3352
3353
|
}
|
|
3354
|
+
/**
|
|
3355
|
+
* @method
|
|
3356
|
+
* @name okx#cancelOrders
|
|
3357
|
+
* @description cancel multiple orders
|
|
3358
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-multiple-orders
|
|
3359
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-cancel-algo-order
|
|
3360
|
+
* @param {string[]} ids order ids
|
|
3361
|
+
* @param {string} symbol unified market symbol
|
|
3362
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3363
|
+
* @param {boolean} [params.trigger] whether the order is a stop/trigger order
|
|
3364
|
+
* @param {boolean} [params.trailing] set to true if you want to cancel trailing orders
|
|
3365
|
+
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3366
|
+
*/
|
|
3353
3367
|
async cancelOrders(ids, symbol = undefined, params = {}) {
|
|
3354
|
-
/**
|
|
3355
|
-
* @method
|
|
3356
|
-
* @name okx#cancelOrders
|
|
3357
|
-
* @description cancel multiple orders
|
|
3358
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-multiple-orders
|
|
3359
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-cancel-algo-order
|
|
3360
|
-
* @param {string[]} ids order ids
|
|
3361
|
-
* @param {string} symbol unified market symbol
|
|
3362
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3363
|
-
* @param {boolean} [params.trigger] whether the order is a stop/trigger order
|
|
3364
|
-
* @param {boolean} [params.trailing] set to true if you want to cancel trailing orders
|
|
3365
|
-
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3366
|
-
*/
|
|
3367
3368
|
// 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.
|
|
3368
3369
|
if (symbol === undefined) {
|
|
3369
3370
|
throw new ArgumentsRequired(this.id + ' cancelOrders() requires a symbol argument');
|
|
@@ -3453,19 +3454,19 @@ export default class okx extends Exchange {
|
|
|
3453
3454
|
const ordersData = this.safeList(response, 'data', []);
|
|
3454
3455
|
return this.parseOrders(ordersData, market, undefined, undefined, params);
|
|
3455
3456
|
}
|
|
3457
|
+
/**
|
|
3458
|
+
* @method
|
|
3459
|
+
* @name okx#cancelOrdersForSymbols
|
|
3460
|
+
* @description cancel multiple orders for multiple symbols
|
|
3461
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-multiple-orders
|
|
3462
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-cancel-algo-order
|
|
3463
|
+
* @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"}]
|
|
3464
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3465
|
+
* @param {boolean} [params.trigger] whether the order is a stop/trigger order
|
|
3466
|
+
* @param {boolean} [params.trailing] set to true if you want to cancel trailing orders
|
|
3467
|
+
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3468
|
+
*/
|
|
3456
3469
|
async cancelOrdersForSymbols(orders, params = {}) {
|
|
3457
|
-
/**
|
|
3458
|
-
* @method
|
|
3459
|
-
* @name okx#cancelOrdersForSymbols
|
|
3460
|
-
* @description cancel multiple orders for multiple symbols
|
|
3461
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-multiple-orders
|
|
3462
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-cancel-algo-order
|
|
3463
|
-
* @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"}]
|
|
3464
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3465
|
-
* @param {boolean} [params.trigger] whether the order is a stop/trigger order
|
|
3466
|
-
* @param {boolean} [params.trailing] set to true if you want to cancel trailing orders
|
|
3467
|
-
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3468
|
-
*/
|
|
3469
3470
|
await this.loadMarkets();
|
|
3470
3471
|
const request = [];
|
|
3471
3472
|
const options = this.safeDict(this.options, 'cancelOrders', {});
|
|
@@ -3535,16 +3536,16 @@ export default class okx extends Exchange {
|
|
|
3535
3536
|
const ordersData = this.safeList(response, 'data', []);
|
|
3536
3537
|
return this.parseOrders(ordersData, undefined, undefined, undefined, params);
|
|
3537
3538
|
}
|
|
3539
|
+
/**
|
|
3540
|
+
* @method
|
|
3541
|
+
* @name okx#cancelAllOrdersAfter
|
|
3542
|
+
* @description dead man's switch, cancel all orders after the given timeout
|
|
3543
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-all-after
|
|
3544
|
+
* @param {number} timeout time in milliseconds, 0 represents cancel the timer
|
|
3545
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3546
|
+
* @returns {object} the api result
|
|
3547
|
+
*/
|
|
3538
3548
|
async cancelAllOrdersAfter(timeout, params = {}) {
|
|
3539
|
-
/**
|
|
3540
|
-
* @method
|
|
3541
|
-
* @name okx#cancelAllOrdersAfter
|
|
3542
|
-
* @description dead man's switch, cancel all orders after the given timeout
|
|
3543
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-all-after
|
|
3544
|
-
* @param {number} timeout time in milliseconds, 0 represents cancel the timer
|
|
3545
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3546
|
-
* @returns {object} the api result
|
|
3547
|
-
*/
|
|
3548
3549
|
await this.loadMarkets();
|
|
3549
3550
|
const request = {
|
|
3550
3551
|
'timeOut': (timeout > 0) ? this.parseToInt(timeout / 1000) : 0,
|
|
@@ -3784,19 +3785,19 @@ export default class okx extends Exchange {
|
|
|
3784
3785
|
'reduceOnly': reduceOnly,
|
|
3785
3786
|
}, market);
|
|
3786
3787
|
}
|
|
3788
|
+
/**
|
|
3789
|
+
* @method
|
|
3790
|
+
* @name okx#fetchOrder
|
|
3791
|
+
* @description fetch an order by the id
|
|
3792
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-details
|
|
3793
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-details
|
|
3794
|
+
* @param {string} id the order id
|
|
3795
|
+
* @param {string} symbol unified market symbol
|
|
3796
|
+
* @param {object} [params] extra and exchange specific parameters
|
|
3797
|
+
* @param {boolean} [params.trigger] true if fetching trigger orders
|
|
3798
|
+
* @returns [an order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3799
|
+
*/
|
|
3787
3800
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
3788
|
-
/**
|
|
3789
|
-
* @method
|
|
3790
|
-
* @name okx#fetchOrder
|
|
3791
|
-
* @description fetch an order by the id
|
|
3792
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-details
|
|
3793
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-details
|
|
3794
|
-
* @param {string} id the order id
|
|
3795
|
-
* @param {string} symbol unified market symbol
|
|
3796
|
-
* @param {object} [params] extra and exchange specific parameters
|
|
3797
|
-
* @param {boolean} [params.trigger] true if fetching trigger orders
|
|
3798
|
-
* @returns [an order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3799
|
-
*/
|
|
3800
3801
|
if (symbol === undefined) {
|
|
3801
3802
|
throw new ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
|
|
3802
3803
|
}
|
|
@@ -3938,24 +3939,24 @@ export default class okx extends Exchange {
|
|
|
3938
3939
|
const order = this.safeDict(data, 0);
|
|
3939
3940
|
return this.parseOrder(order, market);
|
|
3940
3941
|
}
|
|
3942
|
+
/**
|
|
3943
|
+
* @method
|
|
3944
|
+
* @name okx#fetchOpenOrders
|
|
3945
|
+
* @description fetch all unfilled currently open orders
|
|
3946
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-list
|
|
3947
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-list
|
|
3948
|
+
* @param {string} symbol unified market symbol
|
|
3949
|
+
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
3950
|
+
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
3951
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3952
|
+
* @param {bool} [params.stop] True if fetching trigger or conditional orders
|
|
3953
|
+
* @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
|
3954
|
+
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
3955
|
+
* @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)
|
|
3956
|
+
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
|
|
3957
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3958
|
+
*/
|
|
3941
3959
|
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
3942
|
-
/**
|
|
3943
|
-
* @method
|
|
3944
|
-
* @name okx#fetchOpenOrders
|
|
3945
|
-
* @description fetch all unfilled currently open orders
|
|
3946
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-list
|
|
3947
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-list
|
|
3948
|
-
* @param {string} symbol unified market symbol
|
|
3949
|
-
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
3950
|
-
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
3951
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3952
|
-
* @param {bool} [params.stop] True if fetching trigger or conditional orders
|
|
3953
|
-
* @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
|
3954
|
-
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
3955
|
-
* @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)
|
|
3956
|
-
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
|
|
3957
|
-
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3958
|
-
*/
|
|
3959
3960
|
await this.loadMarkets();
|
|
3960
3961
|
let paginate = false;
|
|
3961
3962
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchOpenOrders', 'paginate');
|
|
@@ -4102,24 +4103,24 @@ export default class okx extends Exchange {
|
|
|
4102
4103
|
const data = this.safeList(response, 'data', []);
|
|
4103
4104
|
return this.parseOrders(data, market, since, limit);
|
|
4104
4105
|
}
|
|
4106
|
+
/**
|
|
4107
|
+
* @method
|
|
4108
|
+
* @name okx#fetchCanceledOrders
|
|
4109
|
+
* @description fetches information on multiple canceled orders made by the user
|
|
4110
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-history-last-7-days
|
|
4111
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-history
|
|
4112
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
4113
|
+
* @param {int} [since] timestamp in ms of the earliest order, default is undefined
|
|
4114
|
+
* @param {int} [limit] max number of orders to return, default is undefined
|
|
4115
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4116
|
+
* @param {bool} [params.stop] True if fetching trigger or conditional orders
|
|
4117
|
+
* @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
|
4118
|
+
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
4119
|
+
* @param {int} [params.until] timestamp in ms to fetch orders for
|
|
4120
|
+
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
|
|
4121
|
+
* @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4122
|
+
*/
|
|
4105
4123
|
async fetchCanceledOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4106
|
-
/**
|
|
4107
|
-
* @method
|
|
4108
|
-
* @name okx#fetchCanceledOrders
|
|
4109
|
-
* @description fetches information on multiple canceled orders made by the user
|
|
4110
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-history-last-7-days
|
|
4111
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-history
|
|
4112
|
-
* @param {string} symbol unified market symbol of the market orders were made in
|
|
4113
|
-
* @param {int} [since] timestamp in ms of the earliest order, default is undefined
|
|
4114
|
-
* @param {int} [limit] max number of orders to return, default is undefined
|
|
4115
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4116
|
-
* @param {bool} [params.stop] True if fetching trigger or conditional orders
|
|
4117
|
-
* @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
|
4118
|
-
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
4119
|
-
* @param {int} [params.until] timestamp in ms to fetch orders for
|
|
4120
|
-
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
|
|
4121
|
-
* @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4122
|
-
*/
|
|
4123
4124
|
await this.loadMarkets();
|
|
4124
4125
|
const request = {
|
|
4125
4126
|
// 'instType': type.toUpperCase (), // SPOT, MARGIN, SWAP, FUTURES, OPTION
|
|
@@ -4289,27 +4290,27 @@ export default class okx extends Exchange {
|
|
|
4289
4290
|
const data = this.safeList(response, 'data', []);
|
|
4290
4291
|
return this.parseOrders(data, market, since, limit);
|
|
4291
4292
|
}
|
|
4293
|
+
/**
|
|
4294
|
+
* @method
|
|
4295
|
+
* @name okx#fetchClosedOrders
|
|
4296
|
+
* @description fetches information on multiple closed orders made by the user
|
|
4297
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-history-last-7-days
|
|
4298
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-history
|
|
4299
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-history-last-3-months
|
|
4300
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
4301
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
4302
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
4303
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4304
|
+
* @param {bool} [params.trigger] True if fetching trigger or conditional orders
|
|
4305
|
+
* @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
|
4306
|
+
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
4307
|
+
* @param {int} [params.until] timestamp in ms to fetch orders for
|
|
4308
|
+
* @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)
|
|
4309
|
+
* @param {string} [params.method] method to be used, either 'privateGetTradeOrdersHistory', 'privateGetTradeOrdersHistoryArchive' or 'privateGetTradeOrdersAlgoHistory' default is 'privateGetTradeOrdersHistory'
|
|
4310
|
+
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
|
|
4311
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4312
|
+
*/
|
|
4292
4313
|
async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4293
|
-
/**
|
|
4294
|
-
* @method
|
|
4295
|
-
* @name okx#fetchClosedOrders
|
|
4296
|
-
* @description fetches information on multiple closed orders made by the user
|
|
4297
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-history-last-7-days
|
|
4298
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-history
|
|
4299
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-history-last-3-months
|
|
4300
|
-
* @param {string} symbol unified market symbol of the market orders were made in
|
|
4301
|
-
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
4302
|
-
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
4303
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4304
|
-
* @param {bool} [params.trigger] True if fetching trigger or conditional orders
|
|
4305
|
-
* @param {string} [params.ordType] "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
|
4306
|
-
* @param {string} [params.algoId] Algo ID "'433845797218942976'"
|
|
4307
|
-
* @param {int} [params.until] timestamp in ms to fetch orders for
|
|
4308
|
-
* @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)
|
|
4309
|
-
* @param {string} [params.method] method to be used, either 'privateGetTradeOrdersHistory', 'privateGetTradeOrdersHistoryArchive' or 'privateGetTradeOrdersAlgoHistory' default is 'privateGetTradeOrdersHistory'
|
|
4310
|
-
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
|
|
4311
|
-
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4312
|
-
*/
|
|
4313
4314
|
await this.loadMarkets();
|
|
4314
4315
|
let paginate = false;
|
|
4315
4316
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchClosedOrders', 'paginate');
|
|
@@ -4478,20 +4479,20 @@ export default class okx extends Exchange {
|
|
|
4478
4479
|
const data = this.safeList(response, 'data', []);
|
|
4479
4480
|
return this.parseOrders(data, market, since, limit);
|
|
4480
4481
|
}
|
|
4482
|
+
/**
|
|
4483
|
+
* @method
|
|
4484
|
+
* @name okx#fetchMyTrades
|
|
4485
|
+
* @description fetch all trades made by the user
|
|
4486
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-transaction-details-last-3-months
|
|
4487
|
+
* @param {string} symbol unified market symbol
|
|
4488
|
+
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
4489
|
+
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
4490
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4491
|
+
* @param {int} [params.until] Timestamp in ms of the latest time to retrieve trades for
|
|
4492
|
+
* @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)
|
|
4493
|
+
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
4494
|
+
*/
|
|
4481
4495
|
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4482
|
-
/**
|
|
4483
|
-
* @method
|
|
4484
|
-
* @name okx#fetchMyTrades
|
|
4485
|
-
* @description fetch all trades made by the user
|
|
4486
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-transaction-details-last-3-months
|
|
4487
|
-
* @param {string} symbol unified market symbol
|
|
4488
|
-
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
4489
|
-
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
4490
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4491
|
-
* @param {int} [params.until] Timestamp in ms of the latest time to retrieve trades for
|
|
4492
|
-
* @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)
|
|
4493
|
-
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
4494
|
-
*/
|
|
4495
4496
|
await this.loadMarkets();
|
|
4496
4497
|
let paginate = false;
|
|
4497
4498
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
|
|
@@ -4550,19 +4551,19 @@ export default class okx extends Exchange {
|
|
|
4550
4551
|
const data = this.safeList(response, 'data', []);
|
|
4551
4552
|
return this.parseTrades(data, market, since, limit, query);
|
|
4552
4553
|
}
|
|
4554
|
+
/**
|
|
4555
|
+
* @method
|
|
4556
|
+
* @name okx#fetchOrderTrades
|
|
4557
|
+
* @description fetch all the trades made from a single order
|
|
4558
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-transaction-details-last-3-months
|
|
4559
|
+
* @param {string} id order id
|
|
4560
|
+
* @param {string} symbol unified market symbol
|
|
4561
|
+
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
4562
|
+
* @param {int} [limit] the maximum number of trades to retrieve
|
|
4563
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4564
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
4565
|
+
*/
|
|
4553
4566
|
async fetchOrderTrades(id, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4554
|
-
/**
|
|
4555
|
-
* @method
|
|
4556
|
-
* @name okx#fetchOrderTrades
|
|
4557
|
-
* @description fetch all the trades made from a single order
|
|
4558
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-transaction-details-last-3-months
|
|
4559
|
-
* @param {string} id order id
|
|
4560
|
-
* @param {string} symbol unified market symbol
|
|
4561
|
-
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
4562
|
-
* @param {int} [limit] the maximum number of trades to retrieve
|
|
4563
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4564
|
-
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
4565
|
-
*/
|
|
4566
4567
|
const request = {
|
|
4567
4568
|
// 'instrument_id': market['id'],
|
|
4568
4569
|
'ordId': id,
|
|
@@ -4572,23 +4573,23 @@ export default class okx extends Exchange {
|
|
|
4572
4573
|
};
|
|
4573
4574
|
return await this.fetchMyTrades(symbol, since, limit, this.extend(request, params));
|
|
4574
4575
|
}
|
|
4576
|
+
/**
|
|
4577
|
+
* @method
|
|
4578
|
+
* @name okx#fetchLedger
|
|
4579
|
+
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
4580
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-bills-details-last-7-days
|
|
4581
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-bills-details-last-3-months
|
|
4582
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-asset-bills-details
|
|
4583
|
+
* @param {string} [code] unified currency code, default is undefined
|
|
4584
|
+
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
4585
|
+
* @param {int} [limit] max number of ledger entries to return, default is undefined
|
|
4586
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4587
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
4588
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4589
|
+
* @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)
|
|
4590
|
+
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
4591
|
+
*/
|
|
4575
4592
|
async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4576
|
-
/**
|
|
4577
|
-
* @method
|
|
4578
|
-
* @name okx#fetchLedger
|
|
4579
|
-
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
|
|
4580
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-bills-details-last-7-days
|
|
4581
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-bills-details-last-3-months
|
|
4582
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-asset-bills-details
|
|
4583
|
-
* @param {string} [code] unified currency code, default is undefined
|
|
4584
|
-
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
4585
|
-
* @param {int} [limit] max number of ledger entries to return, default is undefined
|
|
4586
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4587
|
-
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
4588
|
-
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4589
|
-
* @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)
|
|
4590
|
-
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
4591
|
-
*/
|
|
4592
4593
|
await this.loadMarkets();
|
|
4593
4594
|
let paginate = false;
|
|
4594
4595
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
|
|
@@ -4878,16 +4879,16 @@ export default class okx extends Exchange {
|
|
|
4878
4879
|
'tag': tag,
|
|
4879
4880
|
};
|
|
4880
4881
|
}
|
|
4882
|
+
/**
|
|
4883
|
+
* @method
|
|
4884
|
+
* @name okx#fetchDepositAddressesByNetwork
|
|
4885
|
+
* @description fetch a dictionary of addresses for a currency, indexed by network
|
|
4886
|
+
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-deposit-address
|
|
4887
|
+
* @param {string} code unified currency code of the currency for the deposit address
|
|
4888
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4889
|
+
* @returns {object} a dictionary of [address structures]{@link https://docs.ccxt.com/#/?id=address-structure} indexed by the network
|
|
4890
|
+
*/
|
|
4881
4891
|
async fetchDepositAddressesByNetwork(code, params = {}) {
|
|
4882
|
-
/**
|
|
4883
|
-
* @method
|
|
4884
|
-
* @name okx#fetchDepositAddressesByNetwork
|
|
4885
|
-
* @description fetch a dictionary of addresses for a currency, indexed by network
|
|
4886
|
-
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-deposit-address
|
|
4887
|
-
* @param {string} code unified currency code of the currency for the deposit address
|
|
4888
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4889
|
-
* @returns {object} a dictionary of [address structures]{@link https://docs.ccxt.com/#/?id=address-structure} indexed by the network
|
|
4890
|
-
*/
|
|
4891
4892
|
await this.loadMarkets();
|
|
4892
4893
|
const currency = this.currency(code);
|
|
4893
4894
|
const request = {
|
|
@@ -4920,17 +4921,17 @@ export default class okx extends Exchange {
|
|
|
4920
4921
|
const parsed = this.parseDepositAddresses(filtered, [currency['code']], false);
|
|
4921
4922
|
return this.indexBy(parsed, 'network');
|
|
4922
4923
|
}
|
|
4924
|
+
/**
|
|
4925
|
+
* @method
|
|
4926
|
+
* @name okx#fetchDepositAddress
|
|
4927
|
+
* @description fetch the deposit address for a currency associated with this account
|
|
4928
|
+
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-deposit-address
|
|
4929
|
+
* @param {string} code unified currency code
|
|
4930
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4931
|
+
* @param {string} [params.network] the network name for the deposit address
|
|
4932
|
+
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
4933
|
+
*/
|
|
4923
4934
|
async fetchDepositAddress(code, params = {}) {
|
|
4924
|
-
/**
|
|
4925
|
-
* @method
|
|
4926
|
-
* @name okx#fetchDepositAddress
|
|
4927
|
-
* @description fetch the deposit address for a currency associated with this account
|
|
4928
|
-
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-deposit-address
|
|
4929
|
-
* @param {string} code unified currency code
|
|
4930
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4931
|
-
* @param {string} [params.network] the network name for the deposit address
|
|
4932
|
-
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
4933
|
-
*/
|
|
4934
4935
|
await this.loadMarkets();
|
|
4935
4936
|
const rawNetwork = this.safeStringUpper(params, 'network');
|
|
4936
4937
|
params = this.omit(params, 'network');
|
|
@@ -4953,19 +4954,19 @@ export default class okx extends Exchange {
|
|
|
4953
4954
|
const first = this.safeString(keys, 0);
|
|
4954
4955
|
return this.safeDict(response, first);
|
|
4955
4956
|
}
|
|
4957
|
+
/**
|
|
4958
|
+
* @method
|
|
4959
|
+
* @name okx#withdraw
|
|
4960
|
+
* @description make a withdrawal
|
|
4961
|
+
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-withdrawal
|
|
4962
|
+
* @param {string} code unified currency code
|
|
4963
|
+
* @param {float} amount the amount to withdraw
|
|
4964
|
+
* @param {string} address the address to withdraw to
|
|
4965
|
+
* @param {string} tag
|
|
4966
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4967
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
4968
|
+
*/
|
|
4956
4969
|
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
4957
|
-
/**
|
|
4958
|
-
* @method
|
|
4959
|
-
* @name okx#withdraw
|
|
4960
|
-
* @description make a withdrawal
|
|
4961
|
-
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-withdrawal
|
|
4962
|
-
* @param {string} code unified currency code
|
|
4963
|
-
* @param {float} amount the amount to withdraw
|
|
4964
|
-
* @param {string} address the address to withdraw to
|
|
4965
|
-
* @param {string} tag
|
|
4966
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4967
|
-
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
4968
|
-
*/
|
|
4969
4970
|
[tag, params] = this.handleWithdrawTagAndParams(tag, params);
|
|
4970
4971
|
this.checkAddress(address);
|
|
4971
4972
|
await this.loadMarkets();
|
|
@@ -5016,20 +5017,20 @@ export default class okx extends Exchange {
|
|
|
5016
5017
|
const transaction = this.safeDict(data, 0);
|
|
5017
5018
|
return this.parseTransaction(transaction, currency);
|
|
5018
5019
|
}
|
|
5020
|
+
/**
|
|
5021
|
+
* @method
|
|
5022
|
+
* @name okx#fetchDeposits
|
|
5023
|
+
* @description fetch all deposits made to an account
|
|
5024
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-deposit-history
|
|
5025
|
+
* @param {string} code unified currency code
|
|
5026
|
+
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
5027
|
+
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
5028
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5029
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
5030
|
+
* @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)
|
|
5031
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5032
|
+
*/
|
|
5019
5033
|
async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
5020
|
-
/**
|
|
5021
|
-
* @method
|
|
5022
|
-
* @name okx#fetchDeposits
|
|
5023
|
-
* @description fetch all deposits made to an account
|
|
5024
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-deposit-history
|
|
5025
|
-
* @param {string} code unified currency code
|
|
5026
|
-
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
5027
|
-
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
5028
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5029
|
-
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
5030
|
-
* @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)
|
|
5031
|
-
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5032
|
-
*/
|
|
5033
5034
|
await this.loadMarkets();
|
|
5034
5035
|
let paginate = false;
|
|
5035
5036
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchDeposits', 'paginate');
|
|
@@ -5097,17 +5098,17 @@ export default class okx extends Exchange {
|
|
|
5097
5098
|
const data = this.safeList(response, 'data', []);
|
|
5098
5099
|
return this.parseTransactions(data, currency, since, limit, params);
|
|
5099
5100
|
}
|
|
5101
|
+
/**
|
|
5102
|
+
* @method
|
|
5103
|
+
* @name okx#fetchDeposit
|
|
5104
|
+
* @description fetch data on a currency deposit via the deposit id
|
|
5105
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-deposit-history
|
|
5106
|
+
* @param {string} id deposit id
|
|
5107
|
+
* @param {string} code filter by currency code
|
|
5108
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5109
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5110
|
+
*/
|
|
5100
5111
|
async fetchDeposit(id, code = undefined, params = {}) {
|
|
5101
|
-
/**
|
|
5102
|
-
* @method
|
|
5103
|
-
* @name okx#fetchDeposit
|
|
5104
|
-
* @description fetch data on a currency deposit via the deposit id
|
|
5105
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-deposit-history
|
|
5106
|
-
* @param {string} id deposit id
|
|
5107
|
-
* @param {string} code filter by currency code
|
|
5108
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5109
|
-
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5110
|
-
*/
|
|
5111
5112
|
await this.loadMarkets();
|
|
5112
5113
|
const request = {
|
|
5113
5114
|
'depId': id,
|
|
@@ -5122,20 +5123,20 @@ export default class okx extends Exchange {
|
|
|
5122
5123
|
const deposit = this.safeDict(data, 0, {});
|
|
5123
5124
|
return this.parseTransaction(deposit, currency);
|
|
5124
5125
|
}
|
|
5126
|
+
/**
|
|
5127
|
+
* @method
|
|
5128
|
+
* @name okx#fetchWithdrawals
|
|
5129
|
+
* @description fetch all withdrawals made from an account
|
|
5130
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-withdrawal-history
|
|
5131
|
+
* @param {string} code unified currency code
|
|
5132
|
+
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
5133
|
+
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
5134
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5135
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
5136
|
+
* @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)
|
|
5137
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5138
|
+
*/
|
|
5125
5139
|
async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
5126
|
-
/**
|
|
5127
|
-
* @method
|
|
5128
|
-
* @name okx#fetchWithdrawals
|
|
5129
|
-
* @description fetch all withdrawals made from an account
|
|
5130
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-withdrawal-history
|
|
5131
|
-
* @param {string} code unified currency code
|
|
5132
|
-
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
5133
|
-
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
5134
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5135
|
-
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
5136
|
-
* @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)
|
|
5137
|
-
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5138
|
-
*/
|
|
5139
5140
|
await this.loadMarkets();
|
|
5140
5141
|
let paginate = false;
|
|
5141
5142
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'paginate');
|
|
@@ -5195,17 +5196,17 @@ export default class okx extends Exchange {
|
|
|
5195
5196
|
const data = this.safeList(response, 'data', []);
|
|
5196
5197
|
return this.parseTransactions(data, currency, since, limit, params);
|
|
5197
5198
|
}
|
|
5199
|
+
/**
|
|
5200
|
+
* @method
|
|
5201
|
+
* @name okx#fetchWithdrawal
|
|
5202
|
+
* @description fetch data on a currency withdrawal via the withdrawal id
|
|
5203
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-withdrawal-history
|
|
5204
|
+
* @param {string} id withdrawal id
|
|
5205
|
+
* @param {string} code unified currency code of the currency withdrawn, default is undefined
|
|
5206
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5207
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5208
|
+
*/
|
|
5198
5209
|
async fetchWithdrawal(id, code = undefined, params = {}) {
|
|
5199
|
-
/**
|
|
5200
|
-
* @method
|
|
5201
|
-
* @name okx#fetchWithdrawal
|
|
5202
|
-
* @description fetch data on a currency withdrawal via the withdrawal id
|
|
5203
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-withdrawal-history
|
|
5204
|
-
* @param {string} id withdrawal id
|
|
5205
|
-
* @param {string} code unified currency code of the currency withdrawn, default is undefined
|
|
5206
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5207
|
-
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5208
|
-
*/
|
|
5209
5210
|
await this.loadMarkets();
|
|
5210
5211
|
const request = {
|
|
5211
5212
|
'wdId': id,
|
|
@@ -5383,17 +5384,17 @@ export default class okx extends Exchange {
|
|
|
5383
5384
|
},
|
|
5384
5385
|
};
|
|
5385
5386
|
}
|
|
5387
|
+
/**
|
|
5388
|
+
* @method
|
|
5389
|
+
* @name okx#fetchLeverage
|
|
5390
|
+
* @description fetch the set leverage for a market
|
|
5391
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-leverage
|
|
5392
|
+
* @param {string} symbol unified market symbol
|
|
5393
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5394
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
5395
|
+
* @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
|
|
5396
|
+
*/
|
|
5386
5397
|
async fetchLeverage(symbol, params = {}) {
|
|
5387
|
-
/**
|
|
5388
|
-
* @method
|
|
5389
|
-
* @name okx#fetchLeverage
|
|
5390
|
-
* @description fetch the set leverage for a market
|
|
5391
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-leverage
|
|
5392
|
-
* @param {string} symbol unified market symbol
|
|
5393
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5394
|
-
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
5395
|
-
* @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
|
|
5396
|
-
*/
|
|
5397
5398
|
await this.loadMarkets();
|
|
5398
5399
|
let marginMode = undefined;
|
|
5399
5400
|
[marginMode, params] = this.handleMarginModeAndParams('fetchLeverage', params);
|
|
@@ -5455,17 +5456,17 @@ export default class okx extends Exchange {
|
|
|
5455
5456
|
'shortLeverage': shortLeverage,
|
|
5456
5457
|
};
|
|
5457
5458
|
}
|
|
5459
|
+
/**
|
|
5460
|
+
* @method
|
|
5461
|
+
* @name okx#fetchPosition
|
|
5462
|
+
* @description fetch data on a single open contract trade position
|
|
5463
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-positions
|
|
5464
|
+
* @param {string} symbol unified market symbol of the market the position is held in, default is undefined
|
|
5465
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5466
|
+
* @param {string} [params.instType] MARGIN, SWAP, FUTURES, OPTION
|
|
5467
|
+
* @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
5468
|
+
*/
|
|
5458
5469
|
async fetchPosition(symbol, params = {}) {
|
|
5459
|
-
/**
|
|
5460
|
-
* @method
|
|
5461
|
-
* @name okx#fetchPosition
|
|
5462
|
-
* @description fetch data on a single open contract trade position
|
|
5463
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-positions
|
|
5464
|
-
* @param {string} symbol unified market symbol of the market the position is held in, default is undefined
|
|
5465
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5466
|
-
* @param {string} [params.instType] MARGIN, SWAP, FUTURES, OPTION
|
|
5467
|
-
* @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
5468
|
-
*/
|
|
5469
5470
|
await this.loadMarkets();
|
|
5470
5471
|
const market = this.market(symbol);
|
|
5471
5472
|
const [type, query] = this.handleMarketTypeAndParams('fetchPosition', market, params);
|
|
@@ -5531,18 +5532,18 @@ export default class okx extends Exchange {
|
|
|
5531
5532
|
}
|
|
5532
5533
|
return this.parsePosition(position, market);
|
|
5533
5534
|
}
|
|
5535
|
+
/**
|
|
5536
|
+
* @method
|
|
5537
|
+
* @name okx#fetchPositions
|
|
5538
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-positions
|
|
5539
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-positions-history history
|
|
5540
|
+
* @description fetch all open positions
|
|
5541
|
+
* @param {string[]|undefined} symbols list of unified market symbols
|
|
5542
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5543
|
+
* @param {string} [params.instType] MARGIN, SWAP, FUTURES, OPTION
|
|
5544
|
+
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
5545
|
+
*/
|
|
5534
5546
|
async fetchPositions(symbols = undefined, params = {}) {
|
|
5535
|
-
/**
|
|
5536
|
-
* @method
|
|
5537
|
-
* @name okx#fetchPositions
|
|
5538
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-positions
|
|
5539
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-positions-history history
|
|
5540
|
-
* @description fetch all open positions
|
|
5541
|
-
* @param {string[]|undefined} symbols list of unified market symbols
|
|
5542
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5543
|
-
* @param {string} [params.instType] MARGIN, SWAP, FUTURES, OPTION
|
|
5544
|
-
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
5545
|
-
*/
|
|
5546
5547
|
await this.loadMarkets();
|
|
5547
5548
|
const request = {
|
|
5548
5549
|
// 'instType': 'MARGIN', // optional string, MARGIN, SWAP, FUTURES, OPTION
|
|
@@ -5623,17 +5624,17 @@ export default class okx extends Exchange {
|
|
|
5623
5624
|
}
|
|
5624
5625
|
return this.filterByArrayPositions(result, 'symbol', this.marketSymbols(symbols), false);
|
|
5625
5626
|
}
|
|
5627
|
+
/**
|
|
5628
|
+
* @method
|
|
5629
|
+
* @name okx#fetchPositions
|
|
5630
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-positions
|
|
5631
|
+
* @description fetch all open positions for specific symbol
|
|
5632
|
+
* @param {string} symbol unified market symbol
|
|
5633
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5634
|
+
* @param {string} [params.instType] MARGIN (if needed)
|
|
5635
|
+
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
5636
|
+
*/
|
|
5626
5637
|
async fetchPositionsForSymbol(symbol, params = {}) {
|
|
5627
|
-
/**
|
|
5628
|
-
* @method
|
|
5629
|
-
* @name okx#fetchPositions
|
|
5630
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-positions
|
|
5631
|
-
* @description fetch all open positions for specific symbol
|
|
5632
|
-
* @param {string} symbol unified market symbol
|
|
5633
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5634
|
-
* @param {string} [params.instType] MARGIN (if needed)
|
|
5635
|
-
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
5636
|
-
*/
|
|
5637
5638
|
return await this.fetchPositions([symbol], params);
|
|
5638
5639
|
}
|
|
5639
5640
|
parsePosition(position, market = undefined) {
|
|
@@ -5809,19 +5810,19 @@ export default class okx extends Exchange {
|
|
|
5809
5810
|
'takeProfitPrice': undefined,
|
|
5810
5811
|
});
|
|
5811
5812
|
}
|
|
5813
|
+
/**
|
|
5814
|
+
* @method
|
|
5815
|
+
* @name okx#transfer
|
|
5816
|
+
* @description transfer currency internally between wallets on the same account
|
|
5817
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-funds-transfer
|
|
5818
|
+
* @param {string} code unified currency code
|
|
5819
|
+
* @param {float} amount amount to transfer
|
|
5820
|
+
* @param {string} fromAccount account to transfer from
|
|
5821
|
+
* @param {string} toAccount account to transfer to
|
|
5822
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5823
|
+
* @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
5824
|
+
*/
|
|
5812
5825
|
async transfer(code, amount, fromAccount, toAccount, params = {}) {
|
|
5813
|
-
/**
|
|
5814
|
-
* @method
|
|
5815
|
-
* @name okx#transfer
|
|
5816
|
-
* @description transfer currency internally between wallets on the same account
|
|
5817
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-funds-transfer
|
|
5818
|
-
* @param {string} code unified currency code
|
|
5819
|
-
* @param {float} amount amount to transfer
|
|
5820
|
-
* @param {string} fromAccount account to transfer from
|
|
5821
|
-
* @param {string} toAccount account to transfer to
|
|
5822
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5823
|
-
* @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
5824
|
-
*/
|
|
5825
5826
|
await this.loadMarkets();
|
|
5826
5827
|
const currency = this.currency(code);
|
|
5827
5828
|
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
@@ -5984,18 +5985,18 @@ export default class okx extends Exchange {
|
|
|
5984
5985
|
const transfer = this.safeDict(data, 0);
|
|
5985
5986
|
return this.parseTransfer(transfer);
|
|
5986
5987
|
}
|
|
5988
|
+
/**
|
|
5989
|
+
* @method
|
|
5990
|
+
* @name okx#fetchTransfers
|
|
5991
|
+
* @description fetch a history of internal transfers made on an account
|
|
5992
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months
|
|
5993
|
+
* @param {string} code unified currency code of the currency transferred
|
|
5994
|
+
* @param {int} [since] the earliest time in ms to fetch transfers for
|
|
5995
|
+
* @param {int} [limit] the maximum number of transfers structures to retrieve
|
|
5996
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5997
|
+
* @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
5998
|
+
*/
|
|
5987
5999
|
async fetchTransfers(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
5988
|
-
/**
|
|
5989
|
-
* @method
|
|
5990
|
-
* @name okx#fetchTransfers
|
|
5991
|
-
* @description fetch a history of internal transfers made on an account
|
|
5992
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months
|
|
5993
|
-
* @param {string} code unified currency code of the currency transferred
|
|
5994
|
-
* @param {int} [since] the earliest time in ms to fetch transfers for
|
|
5995
|
-
* @param {int} [limit] the maximum number of transfers structures to retrieve
|
|
5996
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5997
|
-
* @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
5998
|
-
*/
|
|
5999
6000
|
await this.loadMarkets();
|
|
6000
6001
|
let currency = undefined;
|
|
6001
6002
|
const request = {
|
|
@@ -6181,28 +6182,28 @@ export default class okx extends Exchange {
|
|
|
6181
6182
|
};
|
|
6182
6183
|
return this.safeString(intervals, interval, interval);
|
|
6183
6184
|
}
|
|
6185
|
+
/**
|
|
6186
|
+
* @method
|
|
6187
|
+
* @name okx#fetchFundingInterval
|
|
6188
|
+
* @description fetch the current funding rate interval
|
|
6189
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate
|
|
6190
|
+
* @param {string} symbol unified market symbol
|
|
6191
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6192
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
6193
|
+
*/
|
|
6184
6194
|
async fetchFundingInterval(symbol, params = {}) {
|
|
6185
|
-
/**
|
|
6186
|
-
* @method
|
|
6187
|
-
* @name okx#fetchFundingInterval
|
|
6188
|
-
* @description fetch the current funding rate interval
|
|
6189
|
-
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate
|
|
6190
|
-
* @param {string} symbol unified market symbol
|
|
6191
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6192
|
-
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
6193
|
-
*/
|
|
6194
6195
|
return await this.fetchFundingRate(symbol, params);
|
|
6195
6196
|
}
|
|
6197
|
+
/**
|
|
6198
|
+
* @method
|
|
6199
|
+
* @name okx#fetchFundingRate
|
|
6200
|
+
* @description fetch the current funding rate
|
|
6201
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate
|
|
6202
|
+
* @param {string} symbol unified market symbol
|
|
6203
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6204
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
6205
|
+
*/
|
|
6196
6206
|
async fetchFundingRate(symbol, params = {}) {
|
|
6197
|
-
/**
|
|
6198
|
-
* @method
|
|
6199
|
-
* @name okx#fetchFundingRate
|
|
6200
|
-
* @description fetch the current funding rate
|
|
6201
|
-
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate
|
|
6202
|
-
* @param {string} symbol unified market symbol
|
|
6203
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6204
|
-
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
6205
|
-
*/
|
|
6206
6207
|
await this.loadMarkets();
|
|
6207
6208
|
const market = this.market(symbol);
|
|
6208
6209
|
if (!market['swap']) {
|
|
@@ -6232,18 +6233,18 @@ export default class okx extends Exchange {
|
|
|
6232
6233
|
const entry = this.safeDict(data, 0, {});
|
|
6233
6234
|
return this.parseFundingRate(entry, market);
|
|
6234
6235
|
}
|
|
6236
|
+
/**
|
|
6237
|
+
* @method
|
|
6238
|
+
* @name okx#fetchFundingHistory
|
|
6239
|
+
* @description fetch the history of funding payments paid and received on this account
|
|
6240
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months
|
|
6241
|
+
* @param {string} symbol unified market symbol
|
|
6242
|
+
* @param {int} [since] the earliest time in ms to fetch funding history for
|
|
6243
|
+
* @param {int} [limit] the maximum number of funding history structures to retrieve
|
|
6244
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6245
|
+
* @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
|
|
6246
|
+
*/
|
|
6235
6247
|
async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
6236
|
-
/**
|
|
6237
|
-
* @method
|
|
6238
|
-
* @name okx#fetchFundingHistory
|
|
6239
|
-
* @description fetch the history of funding payments paid and received on this account
|
|
6240
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months
|
|
6241
|
-
* @param {string} symbol unified market symbol
|
|
6242
|
-
* @param {int} [since] the earliest time in ms to fetch funding history for
|
|
6243
|
-
* @param {int} [limit] the maximum number of funding history structures to retrieve
|
|
6244
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6245
|
-
* @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
|
|
6246
|
-
*/
|
|
6247
6248
|
await this.loadMarkets();
|
|
6248
6249
|
const request = {
|
|
6249
6250
|
// 'instType': 'SPOT', // SPOT, MARGIN, SWAP, FUTURES, OPTION
|
|
@@ -6391,19 +6392,19 @@ export default class okx extends Exchange {
|
|
|
6391
6392
|
const sorted = this.sortBy(result, 'timestamp');
|
|
6392
6393
|
return this.filterBySymbolSinceLimit(sorted, symbol, since, limit);
|
|
6393
6394
|
}
|
|
6395
|
+
/**
|
|
6396
|
+
* @method
|
|
6397
|
+
* @name okx#setLeverage
|
|
6398
|
+
* @description set the level of leverage for a market
|
|
6399
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-account-set-leverage
|
|
6400
|
+
* @param {float} leverage the rate of leverage
|
|
6401
|
+
* @param {string} symbol unified market symbol
|
|
6402
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6403
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
6404
|
+
* @param {string} [params.posSide] 'long' or 'short' for isolated margin long/short mode on futures and swap markets
|
|
6405
|
+
* @returns {object} response from the exchange
|
|
6406
|
+
*/
|
|
6394
6407
|
async setLeverage(leverage, symbol = undefined, params = {}) {
|
|
6395
|
-
/**
|
|
6396
|
-
* @method
|
|
6397
|
-
* @name okx#setLeverage
|
|
6398
|
-
* @description set the level of leverage for a market
|
|
6399
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-account-set-leverage
|
|
6400
|
-
* @param {float} leverage the rate of leverage
|
|
6401
|
-
* @param {string} symbol unified market symbol
|
|
6402
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6403
|
-
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
6404
|
-
* @param {string} [params.posSide] 'long' or 'short' for isolated margin long/short mode on futures and swap markets
|
|
6405
|
-
* @returns {object} response from the exchange
|
|
6406
|
-
*/
|
|
6407
6408
|
if (symbol === undefined) {
|
|
6408
6409
|
throw new ArgumentsRequired(this.id + ' setLeverage() requires a symbol argument');
|
|
6409
6410
|
}
|
|
@@ -6453,17 +6454,17 @@ export default class okx extends Exchange {
|
|
|
6453
6454
|
//
|
|
6454
6455
|
return response;
|
|
6455
6456
|
}
|
|
6457
|
+
/**
|
|
6458
|
+
* @method
|
|
6459
|
+
* @name okx#fetchPositionMode
|
|
6460
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-account-configuration
|
|
6461
|
+
* @description fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets
|
|
6462
|
+
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
6463
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6464
|
+
* @param {string} [params.accountId] if you have multiple accounts, you must specify the account id to fetch the position mode
|
|
6465
|
+
* @returns {object} an object detailing whether the market is in hedged or one-way mode
|
|
6466
|
+
*/
|
|
6456
6467
|
async fetchPositionMode(symbol = undefined, params = {}) {
|
|
6457
|
-
/**
|
|
6458
|
-
* @method
|
|
6459
|
-
* @name okx#fetchPositionMode
|
|
6460
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-account-configuration
|
|
6461
|
-
* @description fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets
|
|
6462
|
-
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
6463
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6464
|
-
* @param {string} [param.accountId] if you have multiple accounts, you must specify the account id to fetch the position mode
|
|
6465
|
-
* @returns {object} an object detailing whether the market is in hedged or one-way mode
|
|
6466
|
-
*/
|
|
6467
6468
|
const accounts = await this.fetchAccounts();
|
|
6468
6469
|
const length = accounts.length;
|
|
6469
6470
|
let selectedAccount = undefined;
|
|
@@ -6489,17 +6490,17 @@ export default class okx extends Exchange {
|
|
|
6489
6490
|
'hedged': isHedged,
|
|
6490
6491
|
};
|
|
6491
6492
|
}
|
|
6493
|
+
/**
|
|
6494
|
+
* @method
|
|
6495
|
+
* @name okx#setPositionMode
|
|
6496
|
+
* @description set hedged to true or false for a market
|
|
6497
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-set-position-mode
|
|
6498
|
+
* @param {bool} hedged set to true to use long_short_mode, false for net_mode
|
|
6499
|
+
* @param {string} symbol not used by okx setPositionMode
|
|
6500
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6501
|
+
* @returns {object} response from the exchange
|
|
6502
|
+
*/
|
|
6492
6503
|
async setPositionMode(hedged, symbol = undefined, params = {}) {
|
|
6493
|
-
/**
|
|
6494
|
-
* @method
|
|
6495
|
-
* @name okx#setPositionMode
|
|
6496
|
-
* @description set hedged to true or false for a market
|
|
6497
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-set-position-mode
|
|
6498
|
-
* @param {bool} hedged set to true to use long_short_mode, false for net_mode
|
|
6499
|
-
* @param {string} symbol not used by okx setPositionMode
|
|
6500
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6501
|
-
* @returns {object} response from the exchange
|
|
6502
|
-
*/
|
|
6503
6504
|
let hedgeMode = undefined;
|
|
6504
6505
|
if (hedged) {
|
|
6505
6506
|
hedgeMode = 'long_short_mode';
|
|
@@ -6524,18 +6525,18 @@ export default class okx extends Exchange {
|
|
|
6524
6525
|
//
|
|
6525
6526
|
return response;
|
|
6526
6527
|
}
|
|
6528
|
+
/**
|
|
6529
|
+
* @method
|
|
6530
|
+
* @name okx#setMarginMode
|
|
6531
|
+
* @description set margin mode to 'cross' or 'isolated'
|
|
6532
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-set-leverage
|
|
6533
|
+
* @param {string} marginMode 'cross' or 'isolated'
|
|
6534
|
+
* @param {string} symbol unified market symbol
|
|
6535
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6536
|
+
* @param {int} [params.leverage] leverage
|
|
6537
|
+
* @returns {object} response from the exchange
|
|
6538
|
+
*/
|
|
6527
6539
|
async setMarginMode(marginMode, symbol = undefined, params = {}) {
|
|
6528
|
-
/**
|
|
6529
|
-
* @method
|
|
6530
|
-
* @name okx#setMarginMode
|
|
6531
|
-
* @description set margin mode to 'cross' or 'isolated'
|
|
6532
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-set-leverage
|
|
6533
|
-
* @param {string} marginMode 'cross' or 'isolated'
|
|
6534
|
-
* @param {string} symbol unified market symbol
|
|
6535
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6536
|
-
* @param {int} [params.leverage] leverage
|
|
6537
|
-
* @returns {object} response from the exchange
|
|
6538
|
-
*/
|
|
6539
6540
|
if (symbol === undefined) {
|
|
6540
6541
|
throw new ArgumentsRequired(this.id + ' setMarginMode() requires a symbol argument');
|
|
6541
6542
|
}
|
|
@@ -6574,15 +6575,15 @@ export default class okx extends Exchange {
|
|
|
6574
6575
|
//
|
|
6575
6576
|
return response;
|
|
6576
6577
|
}
|
|
6578
|
+
/**
|
|
6579
|
+
* @method
|
|
6580
|
+
* @name okx#fetchCrossBorrowRates
|
|
6581
|
+
* @description fetch the borrow interest rates of all currencies
|
|
6582
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-interest-rate
|
|
6583
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6584
|
+
* @returns {object} a list of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
|
|
6585
|
+
*/
|
|
6577
6586
|
async fetchCrossBorrowRates(params = {}) {
|
|
6578
|
-
/**
|
|
6579
|
-
* @method
|
|
6580
|
-
* @name okx#fetchCrossBorrowRates
|
|
6581
|
-
* @description fetch the borrow interest rates of all currencies
|
|
6582
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-interest-rate
|
|
6583
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6584
|
-
* @returns {object} a list of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
|
|
6585
|
-
*/
|
|
6586
6587
|
await this.loadMarkets();
|
|
6587
6588
|
const response = await this.privateGetAccountInterestRate(params);
|
|
6588
6589
|
//
|
|
@@ -6604,16 +6605,16 @@ export default class okx extends Exchange {
|
|
|
6604
6605
|
}
|
|
6605
6606
|
return rates;
|
|
6606
6607
|
}
|
|
6608
|
+
/**
|
|
6609
|
+
* @method
|
|
6610
|
+
* @name okx#fetchCrossBorrowRate
|
|
6611
|
+
* @description fetch the rate of interest to borrow a currency for margin trading
|
|
6612
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-interest-rate
|
|
6613
|
+
* @param {string} code unified currency code
|
|
6614
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6615
|
+
* @returns {object} a [borrow rate structure]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
|
|
6616
|
+
*/
|
|
6607
6617
|
async fetchCrossBorrowRate(code, params = {}) {
|
|
6608
|
-
/**
|
|
6609
|
-
* @method
|
|
6610
|
-
* @name okx#fetchCrossBorrowRate
|
|
6611
|
-
* @description fetch the rate of interest to borrow a currency for margin trading
|
|
6612
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-interest-rate
|
|
6613
|
-
* @param {string} code unified currency code
|
|
6614
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6615
|
-
* @returns {object} a [borrow rate structure]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
|
|
6616
|
-
*/
|
|
6617
6618
|
await this.loadMarkets();
|
|
6618
6619
|
const currency = this.currency(code);
|
|
6619
6620
|
const request = {
|
|
@@ -6688,18 +6689,18 @@ export default class okx extends Exchange {
|
|
|
6688
6689
|
}
|
|
6689
6690
|
return borrowRateHistories;
|
|
6690
6691
|
}
|
|
6692
|
+
/**
|
|
6693
|
+
* @method
|
|
6694
|
+
* @name okx#fetchBorrowRateHistories
|
|
6695
|
+
* @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
|
|
6696
|
+
* @see https://www.okx.com/docs-v5/en/#financial-product-savings-get-public-borrow-history-public
|
|
6697
|
+
* @param {string[]|undefined} codes list of unified currency codes, default is undefined
|
|
6698
|
+
* @param {int} [since] timestamp in ms of the earliest borrowRate, default is undefined
|
|
6699
|
+
* @param {int} [limit] max number of borrow rate prices to return, default is undefined
|
|
6700
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6701
|
+
* @returns {object} a dictionary of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure} indexed by the market symbol
|
|
6702
|
+
*/
|
|
6691
6703
|
async fetchBorrowRateHistories(codes = undefined, since = undefined, limit = undefined, params = {}) {
|
|
6692
|
-
/**
|
|
6693
|
-
* @method
|
|
6694
|
-
* @name okx#fetchBorrowRateHistories
|
|
6695
|
-
* @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
|
|
6696
|
-
* @see https://www.okx.com/docs-v5/en/#financial-product-savings-get-public-borrow-history-public
|
|
6697
|
-
* @param {string[]|undefined} codes list of unified currency codes, default is undefined
|
|
6698
|
-
* @param {int} [since] timestamp in ms of the earliest borrowRate, default is undefined
|
|
6699
|
-
* @param {int} [limit] max number of borrow rate prices to return, default is undefined
|
|
6700
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6701
|
-
* @returns {object} a dictionary of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure} indexed by the market symbol
|
|
6702
|
-
*/
|
|
6703
6704
|
await this.loadMarkets();
|
|
6704
6705
|
const request = {
|
|
6705
6706
|
// 'ccy': currency['id'],
|
|
@@ -6731,18 +6732,18 @@ export default class okx extends Exchange {
|
|
|
6731
6732
|
const data = this.safeList(response, 'data', []);
|
|
6732
6733
|
return this.parseBorrowRateHistories(data, codes, since, limit);
|
|
6733
6734
|
}
|
|
6735
|
+
/**
|
|
6736
|
+
* @method
|
|
6737
|
+
* @name okx#fetchBorrowRateHistory
|
|
6738
|
+
* @description retrieves a history of a currencies borrow interest rate at specific time slots
|
|
6739
|
+
* @see https://www.okx.com/docs-v5/en/#financial-product-savings-get-public-borrow-history-public
|
|
6740
|
+
* @param {string} code unified currency code
|
|
6741
|
+
* @param {int} [since] timestamp for the earliest borrow rate
|
|
6742
|
+
* @param {int} [limit] the maximum number of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure} to retrieve
|
|
6743
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6744
|
+
* @returns {object[]} an array of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
|
|
6745
|
+
*/
|
|
6734
6746
|
async fetchBorrowRateHistory(code, since = undefined, limit = undefined, params = {}) {
|
|
6735
|
-
/**
|
|
6736
|
-
* @method
|
|
6737
|
-
* @name okx#fetchBorrowRateHistory
|
|
6738
|
-
* @description retrieves a history of a currencies borrow interest rate at specific time slots
|
|
6739
|
-
* @see https://www.okx.com/docs-v5/en/#financial-product-savings-get-public-borrow-history-public
|
|
6740
|
-
* @param {string} code unified currency code
|
|
6741
|
-
* @param {int} [since] timestamp for the earliest borrow rate
|
|
6742
|
-
* @param {int} [limit] the maximum number of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure} to retrieve
|
|
6743
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6744
|
-
* @returns {object[]} an array of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
|
|
6745
|
-
*/
|
|
6746
6747
|
await this.loadMarkets();
|
|
6747
6748
|
const currency = this.currency(code);
|
|
6748
6749
|
const request = {
|
|
@@ -6883,43 +6884,43 @@ export default class okx extends Exchange {
|
|
|
6883
6884
|
'datetime': this.iso8601(timestamp),
|
|
6884
6885
|
};
|
|
6885
6886
|
}
|
|
6887
|
+
/**
|
|
6888
|
+
* @method
|
|
6889
|
+
* @name okx#reduceMargin
|
|
6890
|
+
* @description remove margin from a position
|
|
6891
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-increase-decrease-margin
|
|
6892
|
+
* @param {string} symbol unified market symbol
|
|
6893
|
+
* @param {float} amount the amount of margin to remove
|
|
6894
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6895
|
+
* @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=reduce-margin-structure}
|
|
6896
|
+
*/
|
|
6886
6897
|
async reduceMargin(symbol, amount, params = {}) {
|
|
6887
|
-
/**
|
|
6888
|
-
* @method
|
|
6889
|
-
* @name okx#reduceMargin
|
|
6890
|
-
* @description remove margin from a position
|
|
6891
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-increase-decrease-margin
|
|
6892
|
-
* @param {string} symbol unified market symbol
|
|
6893
|
-
* @param {float} amount the amount of margin to remove
|
|
6894
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6895
|
-
* @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=reduce-margin-structure}
|
|
6896
|
-
*/
|
|
6897
6898
|
return await this.modifyMarginHelper(symbol, amount, 'reduce', params);
|
|
6898
6899
|
}
|
|
6900
|
+
/**
|
|
6901
|
+
* @method
|
|
6902
|
+
* @name okx#addMargin
|
|
6903
|
+
* @description add margin
|
|
6904
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-increase-decrease-margin
|
|
6905
|
+
* @param {string} symbol unified market symbol
|
|
6906
|
+
* @param {float} amount amount of margin to add
|
|
6907
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6908
|
+
* @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=add-margin-structure}
|
|
6909
|
+
*/
|
|
6899
6910
|
async addMargin(symbol, amount, params = {}) {
|
|
6900
|
-
/**
|
|
6901
|
-
* @method
|
|
6902
|
-
* @name okx#addMargin
|
|
6903
|
-
* @description add margin
|
|
6904
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-increase-decrease-margin
|
|
6905
|
-
* @param {string} symbol unified market symbol
|
|
6906
|
-
* @param {float} amount amount of margin to add
|
|
6907
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6908
|
-
* @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=add-margin-structure}
|
|
6909
|
-
*/
|
|
6910
6911
|
return await this.modifyMarginHelper(symbol, amount, 'add', params);
|
|
6911
6912
|
}
|
|
6913
|
+
/**
|
|
6914
|
+
* @method
|
|
6915
|
+
* @name okx#fetchMarketLeverageTiers
|
|
6916
|
+
* @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
|
|
6917
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-position-tiers
|
|
6918
|
+
* @param {string} symbol unified market symbol
|
|
6919
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6920
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
6921
|
+
* @returns {object} a [leverage tiers structure]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}
|
|
6922
|
+
*/
|
|
6912
6923
|
async fetchMarketLeverageTiers(symbol, params = {}) {
|
|
6913
|
-
/**
|
|
6914
|
-
* @method
|
|
6915
|
-
* @name okx#fetchMarketLeverageTiers
|
|
6916
|
-
* @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
|
|
6917
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-position-tiers
|
|
6918
|
-
* @param {string} symbol unified market symbol
|
|
6919
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6920
|
-
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
6921
|
-
* @returns {object} a [leverage tiers structure]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}
|
|
6922
|
-
*/
|
|
6923
6924
|
await this.loadMarkets();
|
|
6924
6925
|
const market = this.market(symbol);
|
|
6925
6926
|
const type = market['spot'] ? 'MARGIN' : this.convertToInstrumentType(market['type']);
|
|
@@ -6995,8 +6996,10 @@ export default class okx extends Exchange {
|
|
|
6995
6996
|
const tiers = [];
|
|
6996
6997
|
for (let i = 0; i < info.length; i++) {
|
|
6997
6998
|
const tier = info[i];
|
|
6999
|
+
const marketId = this.safeString(tier, 'instId');
|
|
6998
7000
|
tiers.push({
|
|
6999
7001
|
'tier': this.safeInteger(tier, 'tier'),
|
|
7002
|
+
'symbol': this.safeSymbol(marketId, market),
|
|
7000
7003
|
'currency': market['quote'],
|
|
7001
7004
|
'minNotional': this.safeNumber(tier, 'minSz'),
|
|
7002
7005
|
'maxNotional': this.safeNumber(tier, 'maxSz'),
|
|
@@ -7007,21 +7010,21 @@ export default class okx extends Exchange {
|
|
|
7007
7010
|
}
|
|
7008
7011
|
return tiers;
|
|
7009
7012
|
}
|
|
7013
|
+
/**
|
|
7014
|
+
* @method
|
|
7015
|
+
* @name okx#fetchBorrowInterest
|
|
7016
|
+
* @description fetch the interest owed by the user for borrowing currency for margin trading
|
|
7017
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-interest-accrued-data
|
|
7018
|
+
* @param {string} code the unified currency code for the currency of the interest
|
|
7019
|
+
* @param {string} symbol the market symbol of an isolated margin market, if undefined, the interest for cross margin markets is returned
|
|
7020
|
+
* @param {int} [since] timestamp in ms of the earliest time to receive interest records for
|
|
7021
|
+
* @param {int} [limit] the number of [borrow interest structures]{@link https://docs.ccxt.com/#/?id=borrow-interest-structure} to retrieve
|
|
7022
|
+
* @param {object} [params] exchange specific parameters
|
|
7023
|
+
* @param {int} [params.type] Loan type 1 - VIP loans 2 - Market loans *Default is Market loans*
|
|
7024
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
7025
|
+
* @returns {object[]} An list of [borrow interest structures]{@link https://docs.ccxt.com/#/?id=borrow-interest-structure}
|
|
7026
|
+
*/
|
|
7010
7027
|
async fetchBorrowInterest(code = undefined, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
7011
|
-
/**
|
|
7012
|
-
* @method
|
|
7013
|
-
* @name okx#fetchBorrowInterest
|
|
7014
|
-
* @description fetch the interest owed by the user for borrowing currency for margin trading
|
|
7015
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-account-get-interest-accrued-data
|
|
7016
|
-
* @param {string} code the unified currency code for the currency of the interest
|
|
7017
|
-
* @param {string} symbol the market symbol of an isolated margin market, if undefined, the interest for cross margin markets is returned
|
|
7018
|
-
* @param {int} [since] timestamp in ms of the earliest time to receive interest records for
|
|
7019
|
-
* @param {int} [limit] the number of [borrow interest structures]{@link https://docs.ccxt.com/#/?id=borrow-interest-structure} to retrieve
|
|
7020
|
-
* @param {object} [params] exchange specific parameters
|
|
7021
|
-
* @param {int} [params.type] Loan type 1 - VIP loans 2 - Market loans *Default is Market loans*
|
|
7022
|
-
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
7023
|
-
* @returns {object[]} An list of [borrow interest structures]{@link https://docs.ccxt.com/#/?id=borrow-interest-structure}
|
|
7024
|
-
*/
|
|
7025
7028
|
await this.loadMarkets();
|
|
7026
7029
|
let marginMode = undefined;
|
|
7027
7030
|
[marginMode, params] = this.handleMarginModeAndParams('fetchBorrowInterest', params);
|
|
@@ -7088,17 +7091,17 @@ export default class okx extends Exchange {
|
|
|
7088
7091
|
'datetime': this.iso8601(timestamp),
|
|
7089
7092
|
};
|
|
7090
7093
|
}
|
|
7094
|
+
/**
|
|
7095
|
+
* @method
|
|
7096
|
+
* @name okx#borrowCrossMargin
|
|
7097
|
+
* @description create a loan to borrow margin (need to be VIP 5 and above)
|
|
7098
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-vip-loans-borrow-and-repay
|
|
7099
|
+
* @param {string} code unified currency code of the currency to borrow
|
|
7100
|
+
* @param {float} amount the amount to borrow
|
|
7101
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7102
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
7103
|
+
*/
|
|
7091
7104
|
async borrowCrossMargin(code, amount, params = {}) {
|
|
7092
|
-
/**
|
|
7093
|
-
* @method
|
|
7094
|
-
* @name okx#borrowCrossMargin
|
|
7095
|
-
* @description create a loan to borrow margin (need to be VIP 5 and above)
|
|
7096
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-vip-loans-borrow-and-repay
|
|
7097
|
-
* @param {string} code unified currency code of the currency to borrow
|
|
7098
|
-
* @param {float} amount the amount to borrow
|
|
7099
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7100
|
-
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
7101
|
-
*/
|
|
7102
7105
|
await this.loadMarkets();
|
|
7103
7106
|
const currency = this.currency(code);
|
|
7104
7107
|
const request = {
|
|
@@ -7126,18 +7129,18 @@ export default class okx extends Exchange {
|
|
|
7126
7129
|
const loan = this.safeDict(data, 0, {});
|
|
7127
7130
|
return this.parseMarginLoan(loan, currency);
|
|
7128
7131
|
}
|
|
7132
|
+
/**
|
|
7133
|
+
* @method
|
|
7134
|
+
* @name okx#repayCrossMargin
|
|
7135
|
+
* @description repay borrowed margin and interest
|
|
7136
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-vip-loans-borrow-and-repay
|
|
7137
|
+
* @param {string} code unified currency code of the currency to repay
|
|
7138
|
+
* @param {float} amount the amount to repay
|
|
7139
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7140
|
+
* @param {string} [params.id] the order ID of borrowing, it is necessary while repaying
|
|
7141
|
+
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
7142
|
+
*/
|
|
7129
7143
|
async repayCrossMargin(code, amount, params = {}) {
|
|
7130
|
-
/**
|
|
7131
|
-
* @method
|
|
7132
|
-
* @name okx#repayCrossMargin
|
|
7133
|
-
* @description repay borrowed margin and interest
|
|
7134
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-vip-loans-borrow-and-repay
|
|
7135
|
-
* @param {string} code unified currency code of the currency to repay
|
|
7136
|
-
* @param {float} amount the amount to repay
|
|
7137
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7138
|
-
* @param {string} [params.id] the order ID of borrowing, it is necessary while repaying
|
|
7139
|
-
* @returns {object} a [margin loan structure]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
7140
|
-
*/
|
|
7141
7144
|
await this.loadMarkets();
|
|
7142
7145
|
const id = this.safeString2(params, 'id', 'ordId');
|
|
7143
7146
|
params = this.omit(params, 'id');
|
|
@@ -7194,16 +7197,16 @@ export default class okx extends Exchange {
|
|
|
7194
7197
|
'info': info,
|
|
7195
7198
|
};
|
|
7196
7199
|
}
|
|
7200
|
+
/**
|
|
7201
|
+
* @method
|
|
7202
|
+
* @name okx#fetchOpenInterest
|
|
7203
|
+
* @description Retrieves the open interest of a currency
|
|
7204
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-open-interest
|
|
7205
|
+
* @param {string} symbol Unified CCXT market symbol
|
|
7206
|
+
* @param {object} [params] exchange specific parameters
|
|
7207
|
+
* @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
7208
|
+
*/
|
|
7197
7209
|
async fetchOpenInterest(symbol, params = {}) {
|
|
7198
|
-
/**
|
|
7199
|
-
* @method
|
|
7200
|
-
* @name okx#fetchOpenInterest
|
|
7201
|
-
* @description Retrieves the open interest of a currency
|
|
7202
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-open-interest
|
|
7203
|
-
* @param {string} symbol Unified CCXT market symbol
|
|
7204
|
-
* @param {object} [params] exchange specific parameters
|
|
7205
|
-
* @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
7206
|
-
*/
|
|
7207
7210
|
await this.loadMarkets();
|
|
7208
7211
|
const market = this.market(symbol);
|
|
7209
7212
|
if (!market['contract']) {
|
|
@@ -7235,21 +7238,21 @@ export default class okx extends Exchange {
|
|
|
7235
7238
|
const data = this.safeList(response, 'data', []);
|
|
7236
7239
|
return this.parseOpenInterest(data[0], market);
|
|
7237
7240
|
}
|
|
7241
|
+
/**
|
|
7242
|
+
* @method
|
|
7243
|
+
* @name okx#fetchOpenInterestHistory
|
|
7244
|
+
* @description Retrieves the open interest history of a currency
|
|
7245
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-contracts-open-interest-and-volume
|
|
7246
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-options-open-interest-and-volume
|
|
7247
|
+
* @param {string} symbol Unified CCXT currency code or unified symbol
|
|
7248
|
+
* @param {string} timeframe "5m", "1h", or "1d" for option only "1d" or "8h"
|
|
7249
|
+
* @param {int} [since] The time in ms of the earliest record to retrieve as a unix timestamp
|
|
7250
|
+
* @param {int} [limit] Not used by okx, but parsed internally by CCXT
|
|
7251
|
+
* @param {object} [params] Exchange specific parameters
|
|
7252
|
+
* @param {int} [params.until] The time in ms of the latest record to retrieve as a unix timestamp
|
|
7253
|
+
* @returns An array of [open interest structures]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
7254
|
+
*/
|
|
7238
7255
|
async fetchOpenInterestHistory(symbol, timeframe = '1d', since = undefined, limit = undefined, params = {}) {
|
|
7239
|
-
/**
|
|
7240
|
-
* @method
|
|
7241
|
-
* @name okx#fetchOpenInterestHistory
|
|
7242
|
-
* @description Retrieves the open interest history of a currency
|
|
7243
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-contracts-open-interest-and-volume
|
|
7244
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-options-open-interest-and-volume
|
|
7245
|
-
* @param {string} symbol Unified CCXT currency code or unified symbol
|
|
7246
|
-
* @param {string} timeframe "5m", "1h", or "1d" for option only "1d" or "8h"
|
|
7247
|
-
* @param {int} [since] The time in ms of the earliest record to retrieve as a unix timestamp
|
|
7248
|
-
* @param {int} [limit] Not used by okx, but parsed internally by CCXT
|
|
7249
|
-
* @param {object} [params] Exchange specific parameters
|
|
7250
|
-
* @param {int} [params.until] The time in ms of the latest record to retrieve as a unix timestamp
|
|
7251
|
-
* @returns An array of [open interest structures]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
7252
|
-
*/
|
|
7253
7256
|
const options = this.safeDict(this.options, 'fetchOpenInterestHistory', {});
|
|
7254
7257
|
const timeframes = this.safeDict(options, 'timeframes', {});
|
|
7255
7258
|
timeframe = this.safeString(timeframes, timeframe, timeframe);
|
|
@@ -7372,16 +7375,16 @@ export default class okx extends Exchange {
|
|
|
7372
7375
|
this.headers = this.omit(this.headers, 'x-simulated-trading');
|
|
7373
7376
|
}
|
|
7374
7377
|
}
|
|
7378
|
+
/**
|
|
7379
|
+
* @method
|
|
7380
|
+
* @name okx#fetchDepositWithdrawFees
|
|
7381
|
+
* @description fetch deposit and withdraw fees
|
|
7382
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-currencies
|
|
7383
|
+
* @param {string[]|undefined} codes list of unified currency codes
|
|
7384
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7385
|
+
* @returns {object[]} a list of [fees structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
7386
|
+
*/
|
|
7375
7387
|
async fetchDepositWithdrawFees(codes = undefined, params = {}) {
|
|
7376
|
-
/**
|
|
7377
|
-
* @method
|
|
7378
|
-
* @name okx#fetchDepositWithdrawFees
|
|
7379
|
-
* @description fetch deposit and withdraw fees
|
|
7380
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-funding-get-currencies
|
|
7381
|
-
* @param {string[]|undefined} codes list of unified currency codes
|
|
7382
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7383
|
-
* @returns {object[]} a list of [fees structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
7384
|
-
*/
|
|
7385
7388
|
await this.loadMarkets();
|
|
7386
7389
|
const response = await this.privateGetAssetCurrencies(params);
|
|
7387
7390
|
//
|
|
@@ -7494,18 +7497,18 @@ export default class okx extends Exchange {
|
|
|
7494
7497
|
}
|
|
7495
7498
|
return depositWithdrawFees;
|
|
7496
7499
|
}
|
|
7500
|
+
/**
|
|
7501
|
+
* @method
|
|
7502
|
+
* @name okx#fetchSettlementHistory
|
|
7503
|
+
* @description fetches historical settlement records
|
|
7504
|
+
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-delivery-exercise-history
|
|
7505
|
+
* @param {string} symbol unified market symbol to fetch the settlement history for
|
|
7506
|
+
* @param {int} [since] timestamp in ms
|
|
7507
|
+
* @param {int} [limit] number of records
|
|
7508
|
+
* @param {object} [params] exchange specific params
|
|
7509
|
+
* @returns {object[]} a list of [settlement history objects]{@link https://docs.ccxt.com/#/?id=settlement-history-structure}
|
|
7510
|
+
*/
|
|
7497
7511
|
async fetchSettlementHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
7498
|
-
/**
|
|
7499
|
-
* @method
|
|
7500
|
-
* @name okx#fetchSettlementHistory
|
|
7501
|
-
* @description fetches historical settlement records
|
|
7502
|
-
* @see https://www.okx.com/docs-v5/en/#rest-api-public-data-get-delivery-exercise-history
|
|
7503
|
-
* @param {string} symbol unified market symbol to fetch the settlement history for
|
|
7504
|
-
* @param {int} [since] timestamp in ms
|
|
7505
|
-
* @param {int} [limit] number of records
|
|
7506
|
-
* @param {object} [params] exchange specific params
|
|
7507
|
-
* @returns {object[]} a list of [settlement history objects]{@link https://docs.ccxt.com/#/?id=settlement-history-structure}
|
|
7508
|
-
*/
|
|
7509
7512
|
if (symbol === undefined) {
|
|
7510
7513
|
throw new ArgumentsRequired(this.id + ' fetchSettlementHistory() requires a symbol argument');
|
|
7511
7514
|
}
|
|
@@ -7595,16 +7598,16 @@ export default class okx extends Exchange {
|
|
|
7595
7598
|
}
|
|
7596
7599
|
return result;
|
|
7597
7600
|
}
|
|
7601
|
+
/**
|
|
7602
|
+
* @method
|
|
7603
|
+
* @name okx#fetchUnderlyingAssets
|
|
7604
|
+
* @description fetches the market ids of underlying assets for a specific contract market type
|
|
7605
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-underlying
|
|
7606
|
+
* @param {object} [params] exchange specific params
|
|
7607
|
+
* @param {string} [params.type] the contract market type, 'option', 'swap' or 'future', the default is 'option'
|
|
7608
|
+
* @returns {object[]} a list of [underlying assets]{@link https://docs.ccxt.com/#/?id=underlying-assets-structure}
|
|
7609
|
+
*/
|
|
7598
7610
|
async fetchUnderlyingAssets(params = {}) {
|
|
7599
|
-
/**
|
|
7600
|
-
* @method
|
|
7601
|
-
* @name okx#fetchUnderlyingAssets
|
|
7602
|
-
* @description fetches the market ids of underlying assets for a specific contract market type
|
|
7603
|
-
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-underlying
|
|
7604
|
-
* @param {object} [params] exchange specific params
|
|
7605
|
-
* @param {string} [params.type] the contract market type, 'option', 'swap' or 'future', the default is 'option'
|
|
7606
|
-
* @returns {object[]} a list of [underlying assets]{@link https://docs.ccxt.com/#/?id=underlying-assets-structure}
|
|
7607
|
-
*/
|
|
7608
7611
|
await this.loadMarkets();
|
|
7609
7612
|
let marketType = undefined;
|
|
7610
7613
|
[marketType, params] = this.handleMarketTypeAndParams('fetchUnderlyingAssets', undefined, params);
|
|
@@ -7633,16 +7636,16 @@ export default class okx extends Exchange {
|
|
|
7633
7636
|
const underlyings = this.safeList(response, 'data', []);
|
|
7634
7637
|
return underlyings[0];
|
|
7635
7638
|
}
|
|
7639
|
+
/**
|
|
7640
|
+
* @method
|
|
7641
|
+
* @name okx#fetchGreeks
|
|
7642
|
+
* @description fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
|
|
7643
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-option-market-data
|
|
7644
|
+
* @param {string} symbol unified symbol of the market to fetch greeks for
|
|
7645
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7646
|
+
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
7647
|
+
*/
|
|
7636
7648
|
async fetchGreeks(symbol, params = {}) {
|
|
7637
|
-
/**
|
|
7638
|
-
* @method
|
|
7639
|
-
* @name okx#fetchGreeks
|
|
7640
|
-
* @description fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
|
|
7641
|
-
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-option-market-data
|
|
7642
|
-
* @param {string} symbol unified symbol of the market to fetch greeks for
|
|
7643
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7644
|
-
* @returns {object} a [greeks structure]{@link https://docs.ccxt.com/#/?id=greeks-structure}
|
|
7645
|
-
*/
|
|
7646
7649
|
await this.loadMarkets();
|
|
7647
7650
|
const market = this.market(symbol);
|
|
7648
7651
|
const marketId = market['id'];
|
|
@@ -7741,24 +7744,24 @@ export default class okx extends Exchange {
|
|
|
7741
7744
|
'info': greeks,
|
|
7742
7745
|
};
|
|
7743
7746
|
}
|
|
7747
|
+
/**
|
|
7748
|
+
* @method
|
|
7749
|
+
* @name okx#closePosition
|
|
7750
|
+
* @description closes open positions for a market
|
|
7751
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-close-positions
|
|
7752
|
+
* @param {string} symbol Unified CCXT market symbol
|
|
7753
|
+
* @param {string} [side] 'buy' or 'sell', leave as undefined in net mode
|
|
7754
|
+
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
7755
|
+
* @param {string} [params.clientOrderId] a unique identifier for the order
|
|
7756
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated', default is 'cross;
|
|
7757
|
+
* @param {string} [params.code] *required in the case of closing cross MARGIN position for Single-currency margin* margin currency
|
|
7758
|
+
*
|
|
7759
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
7760
|
+
* @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
|
|
7761
|
+
* @param {string} [params.tag] order tag a combination of case-sensitive alphanumerics, all numbers, or all letters of up to 16 characters
|
|
7762
|
+
* @returns {object[]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
7763
|
+
*/
|
|
7744
7764
|
async closePosition(symbol, side = undefined, params = {}) {
|
|
7745
|
-
/**
|
|
7746
|
-
* @method
|
|
7747
|
-
* @name okx#closePosition
|
|
7748
|
-
* @description closes open positions for a market
|
|
7749
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-close-positions
|
|
7750
|
-
* @param {string} symbol Unified CCXT market symbol
|
|
7751
|
-
* @param {string} [side] 'buy' or 'sell', leave as undefined in net mode
|
|
7752
|
-
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
7753
|
-
* @param {string} [params.clientOrderId] a unique identifier for the order
|
|
7754
|
-
* @param {string} [params.marginMode] 'cross' or 'isolated', default is 'cross;
|
|
7755
|
-
* @param {string} [params.code] *required in the case of closing cross MARGIN position for Single-currency margin* margin currency
|
|
7756
|
-
*
|
|
7757
|
-
* EXCHANGE SPECIFIC PARAMETERS
|
|
7758
|
-
* @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
|
|
7759
|
-
* @param {string} [params.tag] order tag a combination of case-sensitive alphanumerics, all numbers, or all letters of up to 16 characters
|
|
7760
|
-
* @returns {object[]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
7761
|
-
*/
|
|
7762
7765
|
await this.loadMarkets();
|
|
7763
7766
|
const market = this.market(symbol);
|
|
7764
7767
|
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
@@ -7809,16 +7812,16 @@ export default class okx extends Exchange {
|
|
|
7809
7812
|
const order = this.safeDict(data, 0);
|
|
7810
7813
|
return this.parseOrder(order, market);
|
|
7811
7814
|
}
|
|
7815
|
+
/**
|
|
7816
|
+
* @method
|
|
7817
|
+
* @name okx#fetchOption
|
|
7818
|
+
* @description fetches option data that is commonly found in an option chain
|
|
7819
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-ticker
|
|
7820
|
+
* @param {string} symbol unified market symbol
|
|
7821
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7822
|
+
* @returns {object} an [option chain structure]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
|
|
7823
|
+
*/
|
|
7812
7824
|
async fetchOption(symbol, params = {}) {
|
|
7813
|
-
/**
|
|
7814
|
-
* @method
|
|
7815
|
-
* @name okx#fetchOption
|
|
7816
|
-
* @description fetches option data that is commonly found in an option chain
|
|
7817
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-ticker
|
|
7818
|
-
* @param {string} symbol unified market symbol
|
|
7819
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7820
|
-
* @returns {object} an [option chain structure]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
|
|
7821
|
-
*/
|
|
7822
7825
|
await this.loadMarkets();
|
|
7823
7826
|
const market = this.market(symbol);
|
|
7824
7827
|
const request = {
|
|
@@ -7855,17 +7858,17 @@ export default class okx extends Exchange {
|
|
|
7855
7858
|
const chain = this.safeDict(result, 0, {});
|
|
7856
7859
|
return this.parseOption(chain, undefined, market);
|
|
7857
7860
|
}
|
|
7861
|
+
/**
|
|
7862
|
+
* @method
|
|
7863
|
+
* @name okx#fetchOptionChain
|
|
7864
|
+
* @description fetches data for an underlying asset that is commonly found in an option chain
|
|
7865
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
|
|
7866
|
+
* @param {string} code base currency to fetch an option chain for
|
|
7867
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7868
|
+
* @param {string} [params.uly] the underlying asset, can be obtained from fetchUnderlyingAssets ()
|
|
7869
|
+
* @returns {object} a list of [option chain structures]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
|
|
7870
|
+
*/
|
|
7858
7871
|
async fetchOptionChain(code, params = {}) {
|
|
7859
|
-
/**
|
|
7860
|
-
* @method
|
|
7861
|
-
* @name okx#fetchOptionChain
|
|
7862
|
-
* @description fetches data for an underlying asset that is commonly found in an option chain
|
|
7863
|
-
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers
|
|
7864
|
-
* @param {string} currency base currency to fetch an option chain for
|
|
7865
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7866
|
-
* @param {string} [params.uly] the underlying asset, can be obtained from fetchUnderlyingAssets ()
|
|
7867
|
-
* @returns {object} a list of [option chain structures]{@link https://docs.ccxt.com/#/?id=option-chain-structure}
|
|
7868
|
-
*/
|
|
7869
7872
|
await this.loadMarkets();
|
|
7870
7873
|
const currency = this.currency(code);
|
|
7871
7874
|
const request = {
|
|
@@ -7946,18 +7949,18 @@ export default class okx extends Exchange {
|
|
|
7946
7949
|
'quoteVolume': undefined,
|
|
7947
7950
|
};
|
|
7948
7951
|
}
|
|
7952
|
+
/**
|
|
7953
|
+
* @method
|
|
7954
|
+
* @name okx#fetchConvertQuote
|
|
7955
|
+
* @description fetch a quote for converting from one currency to another
|
|
7956
|
+
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-estimate-quote
|
|
7957
|
+
* @param {string} fromCode the currency that you want to sell and convert from
|
|
7958
|
+
* @param {string} toCode the currency that you want to buy and convert into
|
|
7959
|
+
* @param {float} [amount] how much you want to trade in units of the from currency
|
|
7960
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7961
|
+
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
7962
|
+
*/
|
|
7949
7963
|
async fetchConvertQuote(fromCode, toCode, amount = undefined, params = {}) {
|
|
7950
|
-
/**
|
|
7951
|
-
* @method
|
|
7952
|
-
* @name okx#fetchConvertQuote
|
|
7953
|
-
* @description fetch a quote for converting from one currency to another
|
|
7954
|
-
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-estimate-quote
|
|
7955
|
-
* @param {string} fromCode the currency that you want to sell and convert from
|
|
7956
|
-
* @param {string} toCode the currency that you want to buy and convert into
|
|
7957
|
-
* @param {float} [amount] how much you want to trade in units of the from currency
|
|
7958
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7959
|
-
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
7960
|
-
*/
|
|
7961
7964
|
await this.loadMarkets();
|
|
7962
7965
|
const request = {
|
|
7963
7966
|
'baseCcy': fromCode.toUpperCase(),
|
|
@@ -7998,19 +8001,19 @@ export default class okx extends Exchange {
|
|
|
7998
8001
|
const toCurrency = this.currency(toCurrencyId);
|
|
7999
8002
|
return this.parseConversion(result, fromCurrency, toCurrency);
|
|
8000
8003
|
}
|
|
8004
|
+
/**
|
|
8005
|
+
* @method
|
|
8006
|
+
* @name okx#createConvertTrade
|
|
8007
|
+
* @description convert from one currency to another
|
|
8008
|
+
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-convert-trade
|
|
8009
|
+
* @param {string} id the id of the trade that you want to make
|
|
8010
|
+
* @param {string} fromCode the currency that you want to sell and convert from
|
|
8011
|
+
* @param {string} toCode the currency that you want to buy and convert into
|
|
8012
|
+
* @param {float} [amount] how much you want to trade in units of the from currency
|
|
8013
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8014
|
+
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
8015
|
+
*/
|
|
8001
8016
|
async createConvertTrade(id, fromCode, toCode, amount = undefined, params = {}) {
|
|
8002
|
-
/**
|
|
8003
|
-
* @method
|
|
8004
|
-
* @name okx#createConvertTrade
|
|
8005
|
-
* @description convert from one currency to another
|
|
8006
|
-
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-convert-trade
|
|
8007
|
-
* @param {string} id the id of the trade that you want to make
|
|
8008
|
-
* @param {string} fromCode the currency that you want to sell and convert from
|
|
8009
|
-
* @param {string} toCode the currency that you want to buy and convert into
|
|
8010
|
-
* @param {float} [amount] how much you want to trade in units of the from currency
|
|
8011
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8012
|
-
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
8013
|
-
*/
|
|
8014
8017
|
await this.loadMarkets();
|
|
8015
8018
|
const request = {
|
|
8016
8019
|
'quoteId': id,
|
|
@@ -8051,17 +8054,17 @@ export default class okx extends Exchange {
|
|
|
8051
8054
|
const toCurrency = this.currency(toCurrencyId);
|
|
8052
8055
|
return this.parseConversion(result, fromCurrency, toCurrency);
|
|
8053
8056
|
}
|
|
8057
|
+
/**
|
|
8058
|
+
* @method
|
|
8059
|
+
* @name okx#fetchConvertTrade
|
|
8060
|
+
* @description fetch the data for a conversion trade
|
|
8061
|
+
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-convert-history
|
|
8062
|
+
* @param {string} id the id of the trade that you want to fetch
|
|
8063
|
+
* @param {string} [code] the unified currency code of the conversion trade
|
|
8064
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8065
|
+
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
8066
|
+
*/
|
|
8054
8067
|
async fetchConvertTrade(id, code = undefined, params = {}) {
|
|
8055
|
-
/**
|
|
8056
|
-
* @method
|
|
8057
|
-
* @name okx#fetchConvertTrade
|
|
8058
|
-
* @description fetch the data for a conversion trade
|
|
8059
|
-
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-convert-history
|
|
8060
|
-
* @param {string} id the id of the trade that you want to fetch
|
|
8061
|
-
* @param {string} [code] the unified currency code of the conversion trade
|
|
8062
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8063
|
-
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
8064
|
-
*/
|
|
8065
8068
|
await this.loadMarkets();
|
|
8066
8069
|
const request = {
|
|
8067
8070
|
'clTReqId': id,
|
|
@@ -8102,19 +8105,19 @@ export default class okx extends Exchange {
|
|
|
8102
8105
|
}
|
|
8103
8106
|
return this.parseConversion(result, fromCurrency, toCurrency);
|
|
8104
8107
|
}
|
|
8108
|
+
/**
|
|
8109
|
+
* @method
|
|
8110
|
+
* @name okx#fetchConvertTradeHistory
|
|
8111
|
+
* @description fetch the users history of conversion trades
|
|
8112
|
+
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-convert-history
|
|
8113
|
+
* @param {string} [code] the unified currency code
|
|
8114
|
+
* @param {int} [since] the earliest time in ms to fetch conversions for
|
|
8115
|
+
* @param {int} [limit] the maximum number of conversion structures to retrieve
|
|
8116
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8117
|
+
* @param {int} [params.until] timestamp in ms of the latest conversion to fetch
|
|
8118
|
+
* @returns {object[]} a list of [conversion structures]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
8119
|
+
*/
|
|
8105
8120
|
async fetchConvertTradeHistory(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
8106
|
-
/**
|
|
8107
|
-
* @method
|
|
8108
|
-
* @name okx#fetchConvertTradeHistory
|
|
8109
|
-
* @description fetch the users history of conversion trades
|
|
8110
|
-
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-convert-history
|
|
8111
|
-
* @param {string} [code] the unified currency code
|
|
8112
|
-
* @param {int} [since] the earliest time in ms to fetch conversions for
|
|
8113
|
-
* @param {int} [limit] the maximum number of conversion structures to retrieve
|
|
8114
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8115
|
-
* @param {int} [params.until] timestamp in ms of the latest conversion to fetch
|
|
8116
|
-
* @returns {object[]} a list of [conversion structures]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
8117
|
-
*/
|
|
8118
8121
|
await this.loadMarkets();
|
|
8119
8122
|
let request = {};
|
|
8120
8123
|
[request, params] = this.handleUntilOption('after', request, params);
|
|
@@ -8220,15 +8223,15 @@ export default class okx extends Exchange {
|
|
|
8220
8223
|
'fee': undefined,
|
|
8221
8224
|
};
|
|
8222
8225
|
}
|
|
8226
|
+
/**
|
|
8227
|
+
* @method
|
|
8228
|
+
* @name okx#fetchConvertCurrencies
|
|
8229
|
+
* @description fetches all available currencies that can be converted
|
|
8230
|
+
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-convert-currencies
|
|
8231
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8232
|
+
* @returns {object} an associative dictionary of currencies
|
|
8233
|
+
*/
|
|
8223
8234
|
async fetchConvertCurrencies(params = {}) {
|
|
8224
|
-
/**
|
|
8225
|
-
* @method
|
|
8226
|
-
* @name okx#fetchConvertCurrencies
|
|
8227
|
-
* @description fetches all available currencies that can be converted
|
|
8228
|
-
* @see https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-convert-currencies
|
|
8229
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8230
|
-
* @returns {object} an associative dictionary of currencies
|
|
8231
|
-
*/
|
|
8232
8235
|
await this.loadMarkets();
|
|
8233
8236
|
const response = await this.privateGetAssetConvertCurrencies(params);
|
|
8234
8237
|
//
|
|
@@ -8321,19 +8324,21 @@ export default class okx extends Exchange {
|
|
|
8321
8324
|
}
|
|
8322
8325
|
return undefined;
|
|
8323
8326
|
}
|
|
8327
|
+
/**
|
|
8328
|
+
* @method
|
|
8329
|
+
* @name okx#fetchMarginAdjustmentHistory
|
|
8330
|
+
* @description fetches the history of margin added or reduced from contract isolated positions
|
|
8331
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-7-days
|
|
8332
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months
|
|
8333
|
+
* @param {string} [symbol] not used by okx fetchMarginAdjustmentHistory
|
|
8334
|
+
* @param {string} [type] "add" or "reduce"
|
|
8335
|
+
* @param {int} [since] the earliest time in ms to fetch margin adjustment history for
|
|
8336
|
+
* @param {int} [limit] the maximum number of entries to retrieve
|
|
8337
|
+
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
8338
|
+
* @param {boolean} [params.auto] true if fetching auto margin increases
|
|
8339
|
+
* @returns {object[]} a list of [margin structures]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
8340
|
+
*/
|
|
8324
8341
|
async fetchMarginAdjustmentHistory(symbol = undefined, type = undefined, since = undefined, limit = undefined, params = {}) {
|
|
8325
|
-
/**
|
|
8326
|
-
* @method
|
|
8327
|
-
* @name okx#fetchMarginAdjustmentHistory
|
|
8328
|
-
* @description fetches the history of margin added or reduced from contract isolated positions
|
|
8329
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-7-days
|
|
8330
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months
|
|
8331
|
-
* @param {string} [symbol] not used by okx fetchMarginAdjustmentHistory
|
|
8332
|
-
* @param {string} [type] "add" or "reduce"
|
|
8333
|
-
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
8334
|
-
* @param {boolean} [params.auto] true if fetching auto margin increases
|
|
8335
|
-
* @returns {object[]} a list of [margin structures]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
8336
|
-
*/
|
|
8337
8342
|
await this.loadMarkets();
|
|
8338
8343
|
const auto = this.safeBool(params, 'auto');
|
|
8339
8344
|
if (type === undefined) {
|
|
@@ -8423,26 +8428,26 @@ export default class okx extends Exchange {
|
|
|
8423
8428
|
const modifications = this.parseMarginModifications(data);
|
|
8424
8429
|
return this.filterBySymbolSinceLimit(modifications, symbol, since, limit);
|
|
8425
8430
|
}
|
|
8431
|
+
/**
|
|
8432
|
+
* @method
|
|
8433
|
+
* @name okx#fetchPositionsHistory
|
|
8434
|
+
* @description fetches historical positions
|
|
8435
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-positions-history
|
|
8436
|
+
* @param {string} [symbols] unified market symbols
|
|
8437
|
+
* @param {int} [since] timestamp in ms of the earliest position to fetch
|
|
8438
|
+
* @param {int} [limit] the maximum amount of records to fetch, default=100, max=100
|
|
8439
|
+
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
8440
|
+
* @param {string} [params.marginMode] "cross" or "isolated"
|
|
8441
|
+
*
|
|
8442
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
8443
|
+
* @param {string} [params.instType] margin, swap, futures or option
|
|
8444
|
+
* @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
|
|
8445
|
+
* @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
|
|
8446
|
+
* @param {string} [params.before] timestamp in ms of the earliest position to fetch based on the last update time of the position
|
|
8447
|
+
* @param {string} [params.after] timestamp in ms of the latest position to fetch based on the last update time of the position
|
|
8448
|
+
* @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
8449
|
+
*/
|
|
8426
8450
|
async fetchPositionsHistory(symbols = undefined, since = undefined, limit = undefined, params = {}) {
|
|
8427
|
-
/**
|
|
8428
|
-
* @method
|
|
8429
|
-
* @name okx#fetchPositionsHistory
|
|
8430
|
-
* @description fetches historical positions
|
|
8431
|
-
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-positions-history
|
|
8432
|
-
* @param {string} [symbols] unified market symbols
|
|
8433
|
-
* @param {int} [since] timestamp in ms of the earliest position to fetch
|
|
8434
|
-
* @param {int} [limit] the maximum amount of records to fetch, default=100, max=100
|
|
8435
|
-
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
8436
|
-
* @param {string} [params.marginMode] "cross" or "isolated"
|
|
8437
|
-
*
|
|
8438
|
-
* EXCHANGE SPECIFIC PARAMETERS
|
|
8439
|
-
* @param {string} [params.instType] margin, swap, futures or option
|
|
8440
|
-
* @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
|
|
8441
|
-
* @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
|
|
8442
|
-
* @param {string} [params.before] timestamp in ms of the earliest position to fetch based on the last update time of the position
|
|
8443
|
-
* @param {string} [params.after] timestamp in ms of the latest position to fetch based on the last update time of the position
|
|
8444
|
-
* @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
8445
|
-
*/
|
|
8446
8451
|
await this.loadMarkets();
|
|
8447
8452
|
const marginMode = this.safeString(params, 'marginMode');
|
|
8448
8453
|
const instType = this.safeStringUpper(params, 'instType');
|
|
@@ -8504,20 +8509,20 @@ export default class okx extends Exchange {
|
|
|
8504
8509
|
const positions = this.parsePositions(data, symbols, params);
|
|
8505
8510
|
return this.filterBySinceLimit(positions, since, limit);
|
|
8506
8511
|
}
|
|
8512
|
+
/**
|
|
8513
|
+
* @method
|
|
8514
|
+
* @name okx#fetchLongShortRatioHistory
|
|
8515
|
+
* @description fetches the long short ratio history for a unified market symbol
|
|
8516
|
+
* @see https://www.okx.com/docs-v5/en/#trading-statistics-rest-api-get-contract-long-short-ratio
|
|
8517
|
+
* @param {string} symbol unified symbol of the market to fetch the long short ratio for
|
|
8518
|
+
* @param {string} [timeframe] the period for the ratio
|
|
8519
|
+
* @param {int} [since] the earliest time in ms to fetch ratios for
|
|
8520
|
+
* @param {int} [limit] the maximum number of long short ratio structures to retrieve
|
|
8521
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8522
|
+
* @param {int} [params.until] timestamp in ms of the latest ratio to fetch
|
|
8523
|
+
* @returns {object[]} an array of [long short ratio structures]{@link https://docs.ccxt.com/#/?id=long-short-ratio-structure}
|
|
8524
|
+
*/
|
|
8507
8525
|
async fetchLongShortRatioHistory(symbol = undefined, timeframe = undefined, since = undefined, limit = undefined, params = {}) {
|
|
8508
|
-
/**
|
|
8509
|
-
* @method
|
|
8510
|
-
* @name okx#fetchLongShortRatioHistory
|
|
8511
|
-
* @description fetches the long short ratio history for a unified market symbol
|
|
8512
|
-
* @see https://www.okx.com/docs-v5/en/#trading-statistics-rest-api-get-contract-long-short-ratio
|
|
8513
|
-
* @param {string} symbol unified symbol of the market to fetch the long short ratio for
|
|
8514
|
-
* @param {string} [timeframe] the period for the ratio
|
|
8515
|
-
* @param {int} [since] the earliest time in ms to fetch ratios for
|
|
8516
|
-
* @param {int} [limit] the maximum number of long short ratio structures to retrieve
|
|
8517
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8518
|
-
* @param {int} [params.until] timestamp in ms of the latest ratio to fetch
|
|
8519
|
-
* @returns {object[]} an array of [long short ratio structures]{@link https://docs.ccxt.com/#/?id=long-short-ratio-structure}
|
|
8520
|
-
*/
|
|
8521
8526
|
await this.loadMarkets();
|
|
8522
8527
|
const market = this.market(symbol);
|
|
8523
8528
|
const request = {
|