ccxt-ir 4.3.46.0.3__py2.py3-none-any.whl → 4.5.0__py2.py3-none-any.whl
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.
- ccxt/__init__.py +39 -35
- ccxt/abantether.py +8 -8
- ccxt/abstract/alpaca.py +4 -0
- ccxt/abstract/apex.py +31 -0
- ccxt/abstract/bigone.py +1 -1
- ccxt/abstract/binance.py +106 -48
- ccxt/abstract/binancecoinm.py +106 -48
- ccxt/abstract/binanceus.py +141 -83
- ccxt/abstract/binanceusdm.py +106 -48
- ccxt/abstract/bingx.py +50 -1
- ccxt/abstract/bitbank.py +5 -0
- ccxt/abstract/bitfinex.py +136 -65
- ccxt/abstract/bitflyer.py +1 -0
- ccxt/abstract/bitget.py +67 -0
- ccxt/abstract/bitmart.py +19 -1
- ccxt/abstract/bitopro.py +1 -0
- ccxt/abstract/bitrue.py +68 -68
- ccxt/abstract/bitstamp.py +1 -0
- ccxt/abstract/blofin.py +30 -0
- ccxt/abstract/btcbox.py +2 -0
- ccxt/abstract/bybit.py +28 -13
- ccxt/abstract/cex.py +28 -29
- ccxt/abstract/coinbaseexchange.py +1 -0
- ccxt/abstract/coinbaseinternational.py +1 -1
- ccxt/abstract/cryptocom.py +16 -0
- ccxt/abstract/cryptomus.py +20 -0
- ccxt/abstract/defx.py +69 -0
- ccxt/abstract/deribit.py +1 -0
- ccxt/abstract/derive.py +117 -0
- ccxt/abstract/digifinex.py +1 -0
- ccxt/abstract/ellipx.py +25 -0
- ccxt/abstract/foxbit.py +26 -0
- ccxt/abstract/gate.py +19 -0
- ccxt/abstract/gateio.py +19 -0
- ccxt/abstract/gemini.py +1 -0
- ccxt/abstract/hibachi.py +26 -0
- ccxt/abstract/hyperliquid.py +1 -1
- ccxt/abstract/independentreserve.py +6 -0
- ccxt/abstract/kraken.py +1 -0
- ccxt/abstract/krakenfutures.py +4 -0
- ccxt/abstract/kucoin.py +10 -0
- ccxt/abstract/kucoinfutures.py +18 -0
- ccxt/abstract/lbank.py +2 -1
- ccxt/abstract/luno.py +1 -0
- ccxt/abstract/mexc.py +2 -0
- ccxt/abstract/modetrade.py +119 -0
- ccxt/abstract/myokx.py +349 -0
- ccxt/abstract/oceanex.py +5 -0
- ccxt/abstract/okx.py +25 -0
- ccxt/abstract/okxus.py +349 -0
- ccxt/abstract/onetrading.py +0 -12
- ccxt/abstract/paradex.py +23 -0
- ccxt/abstract/phemex.py +2 -0
- ccxt/abstract/poloniex.py +36 -0
- ccxt/abstract/tradeogre.py +3 -1
- ccxt/abstract/upbit.py +51 -34
- ccxt/abstract/whitebit.py +16 -0
- ccxt/abstract/woo.py +64 -6
- ccxt/abstract/xt.py +10 -5
- ccxt/afratether.py +7 -7
- ccxt/alpaca.py +828 -51
- ccxt/apex.py +1875 -0
- ccxt/arzinja.py +7 -7
- ccxt/arzplus.py +9 -9
- ccxt/ascendex.py +501 -306
- ccxt/async_support/__init__.py +39 -35
- ccxt/async_support/abantether.py +8 -8
- ccxt/async_support/afratether.py +9 -9
- ccxt/async_support/alpaca.py +828 -51
- ccxt/async_support/apex.py +1875 -0
- ccxt/async_support/arzinja.py +10 -10
- ccxt/async_support/arzplus.py +12 -12
- ccxt/async_support/ascendex.py +502 -306
- ccxt/async_support/base/exchange.py +303 -89
- ccxt/async_support/base/ws/cache.py +9 -3
- ccxt/async_support/base/ws/client.py +173 -38
- ccxt/async_support/base/ws/future.py +25 -37
- ccxt/async_support/bequant.py +5 -3
- ccxt/async_support/bigone.py +279 -144
- ccxt/async_support/binance.py +2347 -1158
- ccxt/async_support/binancecoinm.py +9 -3
- ccxt/async_support/binanceus.py +17 -3
- ccxt/async_support/binanceusdm.py +9 -4
- ccxt/async_support/bingx.py +2962 -920
- ccxt/async_support/bit2c.py +147 -27
- ccxt/async_support/bitbank.py +151 -23
- ccxt/async_support/bitbns.py +104 -30
- ccxt/async_support/bitfinex.py +3291 -1113
- ccxt/async_support/bitflyer.py +202 -27
- ccxt/async_support/bitget.py +3683 -1538
- ccxt/async_support/bithumb.py +195 -38
- ccxt/async_support/bitimen.py +12 -12
- ccxt/async_support/bitir.py +38 -38
- ccxt/async_support/bitmart.py +1288 -350
- ccxt/async_support/bitmex.py +260 -75
- ccxt/async_support/bitopro.py +262 -62
- ccxt/async_support/bitpin.py +17 -16
- ccxt/async_support/bitrue.py +459 -290
- ccxt/async_support/bitso.py +199 -54
- ccxt/async_support/bitstamp.py +230 -96
- ccxt/async_support/bitteam.py +167 -25
- ccxt/async_support/{huobijp.py → bittrade.py} +158 -30
- ccxt/async_support/bitvavo.py +213 -49
- ccxt/async_support/blockchaincom.py +160 -46
- ccxt/async_support/blofin.py +502 -120
- ccxt/async_support/btcalpha.py +169 -31
- ccxt/async_support/btcbox.py +292 -23
- ccxt/async_support/btcmarkets.py +211 -58
- ccxt/async_support/btcturk.py +161 -38
- ccxt/async_support/bybit.py +1775 -1030
- ccxt/async_support/cex.py +1440 -1303
- ccxt/async_support/coinbase.py +724 -212
- ccxt/async_support/coinbaseadvanced.py +2 -1
- ccxt/async_support/coinbaseexchange.py +388 -89
- ccxt/async_support/coinbaseinternational.py +412 -57
- ccxt/async_support/coincatch.py +177 -78
- ccxt/async_support/coincheck.py +135 -19
- ccxt/async_support/coinex.py +606 -232
- ccxt/async_support/coinmate.py +189 -63
- ccxt/async_support/coinmetro.py +195 -54
- ccxt/async_support/coinone.py +158 -51
- ccxt/async_support/coinsph.py +336 -61
- ccxt/async_support/coinspot.py +151 -52
- ccxt/async_support/cryptocom.py +661 -111
- ccxt/async_support/cryptomus.py +1137 -0
- ccxt/async_support/defx.py +2071 -0
- ccxt/async_support/delta.py +299 -99
- ccxt/async_support/deribit.py +348 -126
- ccxt/async_support/derive.py +2572 -0
- ccxt/async_support/digifinex.py +430 -214
- ccxt/async_support/ellipx.py +2029 -0
- ccxt/async_support/eterex.py +10 -10
- ccxt/async_support/excoino.py +31 -31
- ccxt/async_support/exir.py +14 -14
- ccxt/async_support/exmo.py +344 -131
- ccxt/async_support/exnovin.py +10 -10
- ccxt/async_support/farhadexchange.py +12 -12
- ccxt/async_support/fmfwio.py +2 -1
- ccxt/async_support/foxbit.py +1935 -0
- ccxt/async_support/gate.py +1351 -529
- ccxt/async_support/gateio.py +2 -1
- ccxt/async_support/gemini.py +144 -39
- ccxt/async_support/hashkey.py +152 -109
- ccxt/async_support/hibachi.py +2080 -0
- ccxt/async_support/hitbtc.py +395 -167
- ccxt/async_support/hitobit.py +12 -12
- ccxt/async_support/hollaex.py +307 -119
- ccxt/async_support/htx.py +851 -383
- ccxt/async_support/huobi.py +2 -1
- ccxt/async_support/hyperliquid.py +1848 -536
- ccxt/async_support/independentreserve.py +288 -15
- ccxt/async_support/indodax.py +190 -33
- ccxt/async_support/jibitex.py +12 -12
- ccxt/async_support/kraken.py +795 -351
- ccxt/async_support/krakenfutures.py +214 -62
- ccxt/async_support/kucoin.py +715 -396
- ccxt/async_support/kucoinfutures.py +652 -89
- ccxt/async_support/latoken.py +217 -113
- ccxt/async_support/lbank.py +425 -97
- ccxt/async_support/luno.py +382 -35
- ccxt/async_support/mercado.py +113 -6
- ccxt/async_support/mexc.py +874 -437
- ccxt/async_support/modetrade.py +2818 -0
- ccxt/async_support/myokx.py +54 -0
- ccxt/async_support/ndax.py +221 -64
- ccxt/async_support/nobitex.py +31 -37
- ccxt/async_support/novadax.py +190 -34
- ccxt/async_support/oceanex.py +217 -28
- ccxt/async_support/okcoin.py +253 -145
- ccxt/async_support/okexchange.py +11 -11
- ccxt/async_support/okx.py +1088 -351
- ccxt/async_support/okxus.py +54 -0
- ccxt/async_support/ompfinex.py +25 -24
- ccxt/async_support/onetrading.py +213 -392
- ccxt/async_support/oxfun.py +245 -166
- ccxt/async_support/p2b.py +151 -29
- ccxt/async_support/paradex.py +562 -49
- ccxt/async_support/paymium.py +82 -19
- ccxt/async_support/phemex.py +713 -172
- ccxt/async_support/poloniex.py +1602 -283
- ccxt/async_support/probit.py +224 -95
- ccxt/async_support/ramzinex.py +30 -27
- ccxt/async_support/sarmayex.py +9 -9
- ccxt/async_support/sarrafex.py +13 -13
- ccxt/async_support/tabdeal.py +14 -13
- ccxt/async_support/tetherland.py +9 -9
- ccxt/async_support/timex.py +210 -51
- ccxt/async_support/tokocrypto.py +167 -47
- ccxt/async_support/tradeogre.py +266 -31
- ccxt/async_support/twox.py +9 -9
- ccxt/async_support/ubitex.py +12 -12
- ccxt/async_support/upbit.py +568 -165
- ccxt/async_support/vertex.py +160 -32
- ccxt/async_support/wallex.py +12 -12
- ccxt/async_support/wavesexchange.py +165 -30
- ccxt/async_support/whitebit.py +975 -127
- ccxt/async_support/woo.py +1918 -1016
- ccxt/async_support/woofipro.py +433 -141
- ccxt/async_support/xt.py +649 -193
- ccxt/async_support/yobit.py +195 -70
- ccxt/async_support/zaif.py +91 -15
- ccxt/async_support/zonda.py +151 -36
- ccxt/base/decimal_to_precision.py +14 -10
- ccxt/base/errors.py +49 -18
- ccxt/base/exchange.py +1556 -450
- ccxt/base/precise.py +10 -0
- ccxt/base/types.py +114 -6
- ccxt/bequant.py +5 -3
- ccxt/bigone.py +279 -144
- ccxt/binance.py +2347 -1158
- ccxt/binancecoinm.py +9 -3
- ccxt/binanceus.py +17 -3
- ccxt/binanceusdm.py +9 -4
- ccxt/bingx.py +2962 -920
- ccxt/bit2c.py +147 -27
- ccxt/bitbank.py +151 -23
- ccxt/bitbns.py +104 -30
- ccxt/bitfinex.py +3290 -1113
- ccxt/bitflyer.py +202 -27
- ccxt/bitget.py +3683 -1538
- ccxt/bithumb.py +194 -38
- ccxt/bitimen.py +9 -9
- ccxt/bitir.py +35 -35
- ccxt/bitmart.py +1288 -350
- ccxt/bitmex.py +260 -75
- ccxt/bitopro.py +262 -62
- ccxt/bitpin.py +15 -14
- ccxt/bitrue.py +459 -290
- ccxt/bitso.py +199 -54
- ccxt/bitstamp.py +230 -96
- ccxt/bitteam.py +167 -25
- ccxt/{huobijp.py → bittrade.py} +158 -30
- ccxt/bitvavo.py +213 -49
- ccxt/blockchaincom.py +160 -46
- ccxt/blofin.py +502 -120
- ccxt/btcalpha.py +169 -31
- ccxt/btcbox.py +291 -23
- ccxt/btcmarkets.py +211 -58
- ccxt/btcturk.py +161 -38
- ccxt/bybit.py +1775 -1030
- ccxt/cex.py +1439 -1303
- ccxt/coinbase.py +724 -212
- ccxt/coinbaseadvanced.py +2 -1
- ccxt/coinbaseexchange.py +388 -89
- ccxt/coinbaseinternational.py +412 -57
- ccxt/coincatch.py +177 -78
- ccxt/coincheck.py +135 -19
- ccxt/coinex.py +606 -232
- ccxt/coinmate.py +189 -63
- ccxt/coinmetro.py +194 -54
- ccxt/coinone.py +158 -51
- ccxt/coinsph.py +336 -61
- ccxt/coinspot.py +151 -52
- ccxt/cryptocom.py +661 -111
- ccxt/cryptomus.py +1137 -0
- ccxt/defx.py +2070 -0
- ccxt/delta.py +299 -99
- ccxt/deribit.py +348 -126
- ccxt/derive.py +2571 -0
- ccxt/digifinex.py +430 -214
- ccxt/ellipx.py +2029 -0
- ccxt/eterex.py +7 -7
- ccxt/excoino.py +29 -29
- ccxt/exir.py +11 -11
- ccxt/exmo.py +343 -131
- ccxt/exnovin.py +8 -8
- ccxt/farhadexchange.py +10 -10
- ccxt/fmfwio.py +2 -1
- ccxt/foxbit.py +1935 -0
- ccxt/gate.py +1351 -529
- ccxt/gateio.py +2 -1
- ccxt/gemini.py +144 -39
- ccxt/hashkey.py +152 -109
- ccxt/hibachi.py +2079 -0
- ccxt/hitbtc.py +395 -167
- ccxt/hitobit.py +9 -9
- ccxt/hollaex.py +307 -119
- ccxt/htx.py +851 -383
- ccxt/huobi.py +2 -1
- ccxt/hyperliquid.py +1848 -536
- ccxt/independentreserve.py +287 -15
- ccxt/indodax.py +190 -33
- ccxt/jibitex.py +9 -9
- ccxt/kraken.py +794 -351
- ccxt/krakenfutures.py +214 -62
- ccxt/kucoin.py +715 -396
- ccxt/kucoinfutures.py +652 -89
- ccxt/latoken.py +217 -113
- ccxt/lbank.py +425 -97
- ccxt/luno.py +382 -35
- ccxt/mercado.py +113 -6
- ccxt/mexc.py +873 -437
- ccxt/modetrade.py +2818 -0
- ccxt/myokx.py +54 -0
- ccxt/ndax.py +221 -64
- ccxt/nobitex.py +29 -35
- ccxt/novadax.py +190 -34
- ccxt/oceanex.py +217 -28
- ccxt/okcoin.py +253 -145
- ccxt/okexchange.py +9 -9
- ccxt/okx.py +1088 -351
- ccxt/okxus.py +54 -0
- ccxt/ompfinex.py +22 -21
- ccxt/onetrading.py +213 -392
- ccxt/oxfun.py +245 -166
- ccxt/p2b.py +151 -29
- ccxt/paradex.py +562 -49
- ccxt/paymium.py +82 -19
- ccxt/phemex.py +712 -172
- ccxt/poloniex.py +1601 -283
- ccxt/pro/__init__.py +76 -17
- ccxt/pro/alpaca.py +21 -6
- ccxt/pro/apex.py +984 -0
- ccxt/pro/ascendex.py +58 -10
- ccxt/pro/bequant.py +6 -1
- ccxt/pro/binance.py +728 -156
- ccxt/pro/binancecoinm.py +6 -2
- ccxt/pro/binanceus.py +8 -4
- ccxt/pro/binanceusdm.py +7 -2
- ccxt/pro/bingx.py +333 -142
- ccxt/pro/bitfinex.py +727 -262
- ccxt/pro/bitget.py +570 -79
- ccxt/pro/bithumb.py +20 -6
- ccxt/pro/bitmart.py +216 -87
- ccxt/pro/bitmex.py +47 -9
- ccxt/pro/bitopro.py +26 -14
- ccxt/pro/bitrue.py +22 -22
- ccxt/pro/bitstamp.py +54 -21
- ccxt/pro/{huobijp.py → bittrade.py} +7 -6
- ccxt/pro/bitvavo.py +191 -67
- ccxt/pro/blockchaincom.py +21 -8
- ccxt/pro/blofin.py +9 -1
- ccxt/pro/bybit.py +632 -245
- ccxt/pro/cex.py +59 -24
- ccxt/pro/coinbase.py +102 -73
- ccxt/pro/coinbaseadvanced.py +2 -1
- ccxt/pro/coinbaseexchange.py +8 -8
- ccxt/pro/coinbaseinternational.py +181 -25
- ccxt/pro/coincatch.py +6 -7
- ccxt/pro/coincheck.py +11 -6
- ccxt/pro/coinex.py +967 -665
- ccxt/pro/coinone.py +16 -9
- ccxt/pro/cryptocom.py +448 -45
- ccxt/pro/defx.py +831 -0
- ccxt/pro/deribit.py +150 -14
- ccxt/pro/derive.py +704 -0
- ccxt/pro/exmo.py +239 -6
- ccxt/pro/gate.py +623 -65
- ccxt/pro/gateio.py +2 -1
- ccxt/pro/gemini.py +27 -11
- ccxt/pro/hashkey.py +2 -2
- ccxt/pro/hitbtc.py +196 -91
- ccxt/pro/hollaex.py +23 -7
- ccxt/pro/htx.py +51 -14
- ccxt/pro/huobi.py +2 -1
- ccxt/pro/hyperliquid.py +591 -27
- ccxt/pro/independentreserve.py +9 -6
- ccxt/pro/kraken.py +640 -320
- ccxt/pro/krakenfutures.py +62 -35
- ccxt/pro/kucoin.py +267 -46
- ccxt/pro/kucoinfutures.py +165 -21
- ccxt/pro/lbank.py +102 -21
- ccxt/pro/luno.py +12 -8
- ccxt/pro/mexc.py +877 -111
- ccxt/pro/modetrade.py +1271 -0
- ccxt/pro/myokx.py +38 -0
- ccxt/pro/ndax.py +15 -2
- ccxt/pro/okcoin.py +23 -4
- ccxt/pro/okx.py +573 -98
- ccxt/pro/okxus.py +38 -0
- ccxt/pro/onetrading.py +30 -13
- ccxt/pro/oxfun.py +131 -27
- ccxt/pro/p2b.py +88 -22
- ccxt/pro/paradex.py +3 -3
- ccxt/pro/phemex.py +75 -21
- ccxt/pro/poloniex.py +124 -41
- ccxt/pro/probit.py +87 -80
- ccxt/pro/tradeogre.py +272 -0
- ccxt/pro/upbit.py +152 -12
- ccxt/pro/vertex.py +8 -3
- ccxt/pro/whitebit.py +58 -5
- ccxt/pro/woo.py +228 -37
- ccxt/pro/woofipro.py +106 -18
- ccxt/pro/xt.py +111 -5
- ccxt/probit.py +224 -95
- ccxt/protobuf/__init__.py +0 -0
- ccxt/protobuf/mexc/PrivateAccountV3Api_pb2.py +37 -0
- ccxt/protobuf/mexc/PrivateDealsV3Api_pb2.py +37 -0
- ccxt/protobuf/mexc/PrivateOrdersV3Api_pb2.py +37 -0
- ccxt/protobuf/mexc/PublicAggreBookTickerV3Api_pb2.py +37 -0
- ccxt/protobuf/mexc/PublicAggreDealsV3Api_pb2.py +39 -0
- ccxt/protobuf/mexc/PublicAggreDepthsV3Api_pb2.py +39 -0
- ccxt/protobuf/mexc/PublicBookTickerBatchV3Api_pb2.py +38 -0
- ccxt/protobuf/mexc/PublicBookTickerV3Api_pb2.py +37 -0
- ccxt/protobuf/mexc/PublicDealsV3Api_pb2.py +39 -0
- ccxt/protobuf/mexc/PublicIncreaseDepthsBatchV3Api_pb2.py +38 -0
- ccxt/protobuf/mexc/PublicIncreaseDepthsV3Api_pb2.py +39 -0
- ccxt/protobuf/mexc/PublicLimitDepthsV3Api_pb2.py +39 -0
- ccxt/protobuf/mexc/PublicMiniTickerV3Api_pb2.py +37 -0
- ccxt/protobuf/mexc/PublicMiniTickersV3Api_pb2.py +38 -0
- ccxt/protobuf/mexc/PublicSpotKlineV3Api_pb2.py +37 -0
- ccxt/protobuf/mexc/PushDataV3ApiWrapper_pb2.py +52 -0
- ccxt/protobuf/mexc/__init__.py +0 -0
- ccxt/ramzinex.py +28 -25
- ccxt/sarmayex.py +7 -7
- ccxt/sarrafex.py +10 -10
- ccxt/static_dependencies/__init__.py +1 -1
- ccxt/static_dependencies/lark/py.typed +0 -0
- ccxt/static_dependencies/marshmallow/py.typed +0 -0
- ccxt/static_dependencies/marshmallow_dataclass/py.typed +0 -0
- ccxt/static_dependencies/marshmallow_oneofschema/py.typed +0 -0
- ccxt/tabdeal.py +12 -11
- ccxt/test/tests_async.py +261 -57
- ccxt/test/tests_helpers.py +1 -3
- ccxt/test/tests_init.py +4 -3
- ccxt/test/tests_sync.py +261 -57
- ccxt/tetherland.py +7 -7
- ccxt/timex.py +210 -51
- ccxt/tokocrypto.py +167 -47
- ccxt/tradeogre.py +266 -31
- ccxt/twox.py +7 -7
- ccxt/ubitex.py +9 -9
- ccxt/upbit.py +568 -165
- ccxt/vertex.py +160 -32
- ccxt/wallex.py +9 -9
- ccxt/wavesexchange.py +165 -30
- ccxt/whitebit.py +975 -127
- ccxt/woo.py +1917 -1016
- ccxt/woofipro.py +432 -141
- ccxt/xt.py +649 -193
- ccxt/yobit.py +194 -70
- ccxt/zaif.py +91 -15
- ccxt/zonda.py +151 -36
- {ccxt_ir-4.3.46.0.3.dist-info → ccxt_ir-4.5.0.dist-info}/METADATA +225 -73
- ccxt_ir-4.5.0.dist-info/RECORD +743 -0
- {ccxt_ir-4.3.46.0.3.dist-info → ccxt_ir-4.5.0.dist-info}/WHEEL +1 -1
- ccxt/__test__.py +0 -7
- ccxt/abstract/ace.py +0 -15
- ccxt/abstract/bitbay.py +0 -53
- ccxt/abstract/bitcoincom.py +0 -115
- ccxt/abstract/bitfinex2.py +0 -139
- ccxt/abstract/bitpanda.py +0 -35
- ccxt/abstract/bl3p.py +0 -19
- ccxt/abstract/coinlist.py +0 -54
- ccxt/abstract/currencycom.py +0 -68
- ccxt/abstract/hitbtc3.py +0 -115
- ccxt/abstract/idex.py +0 -26
- ccxt/abstract/kuna.py +0 -182
- ccxt/abstract/lykke.py +0 -29
- ccxt/abstract/poloniexfutures.py +0 -48
- ccxt/abstract/wazirx.py +0 -30
- ccxt/ace.py +0 -1012
- ccxt/async_support/ace.py +0 -1012
- ccxt/async_support/base/ws/aiohttp_client.py +0 -125
- ccxt/async_support/base/ws/fast_client.py +0 -96
- ccxt/async_support/bitbay.py +0 -17
- ccxt/async_support/bitcoincom.py +0 -17
- ccxt/async_support/bitfinex2.py +0 -3552
- ccxt/async_support/bitpanda.py +0 -16
- ccxt/async_support/bl3p.py +0 -485
- ccxt/async_support/coinlist.py +0 -2243
- ccxt/async_support/currencycom.py +0 -1950
- ccxt/async_support/hitbtc3.py +0 -16
- ccxt/async_support/idex.py +0 -1766
- ccxt/async_support/kuna.py +0 -1841
- ccxt/async_support/lykke.py +0 -1270
- ccxt/async_support/poloniexfutures.py +0 -1717
- ccxt/async_support/wazirx.py +0 -1224
- ccxt/bitbay.py +0 -17
- ccxt/bitcoincom.py +0 -17
- ccxt/bitfinex2.py +0 -3552
- ccxt/bitpanda.py +0 -16
- ccxt/bl3p.py +0 -485
- ccxt/coinlist.py +0 -2243
- ccxt/currencycom.py +0 -1950
- ccxt/hitbtc3.py +0 -16
- ccxt/idex.py +0 -1766
- ccxt/kuna.py +0 -1841
- ccxt/lykke.py +0 -1270
- ccxt/poloniexfutures.py +0 -1717
- ccxt/pro/bitcoincom.py +0 -34
- ccxt/pro/bitfinex2.py +0 -1083
- ccxt/pro/bitpanda.py +0 -15
- ccxt/pro/currencycom.py +0 -536
- ccxt/pro/idex.py +0 -672
- ccxt/pro/poloniexfutures.py +0 -990
- ccxt/pro/wazirx.py +0 -749
- ccxt/test/base/__init__.py +0 -29
- ccxt/test/base/test_account.py +0 -26
- ccxt/test/base/test_balance.py +0 -56
- ccxt/test/base/test_borrow_interest.py +0 -35
- ccxt/test/base/test_borrow_rate.py +0 -32
- ccxt/test/base/test_calculate_fee.py +0 -51
- ccxt/test/base/test_crypto.py +0 -127
- ccxt/test/base/test_currency.py +0 -76
- ccxt/test/base/test_datetime.py +0 -109
- ccxt/test/base/test_decimal_to_precision.py +0 -392
- ccxt/test/base/test_deep_extend.py +0 -68
- ccxt/test/base/test_deposit_withdrawal.py +0 -50
- ccxt/test/base/test_exchange_datetime_functions.py +0 -76
- ccxt/test/base/test_funding_rate_history.py +0 -29
- ccxt/test/base/test_last_price.py +0 -31
- ccxt/test/base/test_ledger_entry.py +0 -45
- ccxt/test/base/test_ledger_item.py +0 -48
- ccxt/test/base/test_leverage_tier.py +0 -33
- ccxt/test/base/test_liquidation.py +0 -50
- ccxt/test/base/test_margin_mode.py +0 -24
- ccxt/test/base/test_margin_modification.py +0 -35
- ccxt/test/base/test_market.py +0 -193
- ccxt/test/base/test_number.py +0 -411
- ccxt/test/base/test_ohlcv.py +0 -33
- ccxt/test/base/test_open_interest.py +0 -32
- ccxt/test/base/test_order.py +0 -64
- ccxt/test/base/test_order_book.py +0 -69
- ccxt/test/base/test_position.py +0 -60
- ccxt/test/base/test_shared_methods.py +0 -353
- ccxt/test/base/test_status.py +0 -24
- ccxt/test/base/test_throttle.py +0 -126
- ccxt/test/base/test_ticker.py +0 -92
- ccxt/test/base/test_trade.py +0 -47
- ccxt/test/base/test_trading_fee.py +0 -26
- ccxt/test/base/test_transaction.py +0 -39
- ccxt/test/test_async.py +0 -1649
- ccxt/test/test_sync.py +0 -1648
- ccxt/wazirx.py +0 -1224
- ccxt_ir-4.3.46.0.3.dist-info/RECORD +0 -773
- /ccxt/abstract/{huobijp.py → bittrade.py} +0 -0
- {ccxt_ir-4.3.46.0.3.dist-info → ccxt_ir-4.5.0.dist-info/licenses}/LICENSE.txt +0 -0
- {ccxt_ir-4.3.46.0.3.dist-info → ccxt_ir-4.5.0.dist-info}/top_level.txt +0 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
from ccxt.async_support.kucoin import kucoin
|
|
7
7
|
from ccxt.abstract.kucoinfutures import ImplicitAPI
|
|
8
|
-
from ccxt.base.types import Balances, Currency, Int, LeverageTier, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
|
|
8
|
+
from ccxt.base.types import Any, Balances, Currency, DepositAddress, Int, Leverage, LeverageTier, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFeeInterface, Transaction, TransferEntry
|
|
9
9
|
from typing import List
|
|
10
10
|
from ccxt.base.errors import AuthenticationError
|
|
11
11
|
from ccxt.base.errors import PermissionDenied
|
|
@@ -25,7 +25,7 @@ from ccxt.base.precise import Precise
|
|
|
25
25
|
|
|
26
26
|
class kucoinfutures(kucoin, ImplicitAPI):
|
|
27
27
|
|
|
28
|
-
def describe(self):
|
|
28
|
+
def describe(self) -> Any:
|
|
29
29
|
return self.deep_extend(super(kucoinfutures, self).describe(), {
|
|
30
30
|
'id': 'kucoinfutures',
|
|
31
31
|
'name': 'KuCoin Futures',
|
|
@@ -46,12 +46,14 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
46
46
|
'addMargin': True,
|
|
47
47
|
'cancelAllOrders': True,
|
|
48
48
|
'cancelOrder': True,
|
|
49
|
+
'cancelOrders': True,
|
|
49
50
|
'closeAllPositions': False,
|
|
50
51
|
'closePosition': True,
|
|
51
52
|
'closePositions': False,
|
|
52
53
|
'createDepositAddress': True,
|
|
53
54
|
'createOrder': True,
|
|
54
55
|
'createOrders': True,
|
|
56
|
+
'createOrderWithTakeProfitAndStopLoss': True,
|
|
55
57
|
'createReduceOnlyOrder': True,
|
|
56
58
|
'createStopLimitOrder': True,
|
|
57
59
|
'createStopLossOrder': True,
|
|
@@ -61,6 +63,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
61
63
|
'createTriggerOrder': True,
|
|
62
64
|
'fetchAccounts': True,
|
|
63
65
|
'fetchBalance': True,
|
|
66
|
+
'fetchBidsAsks': True,
|
|
64
67
|
'fetchBorrowRateHistories': False,
|
|
65
68
|
'fetchBorrowRateHistory': False,
|
|
66
69
|
'fetchClosedOrders': True,
|
|
@@ -68,10 +71,14 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
68
71
|
'fetchCrossBorrowRates': False,
|
|
69
72
|
'fetchCurrencies': False,
|
|
70
73
|
'fetchDepositAddress': True,
|
|
74
|
+
'fetchDepositAddresses': False,
|
|
75
|
+
'fetchDepositAddressesByNetwork': False,
|
|
71
76
|
'fetchDeposits': True,
|
|
72
77
|
'fetchDepositWithdrawFee': False,
|
|
73
78
|
'fetchDepositWithdrawFees': False,
|
|
74
79
|
'fetchFundingHistory': True,
|
|
80
|
+
'fetchFundingInterval': True,
|
|
81
|
+
'fetchFundingIntervals': False,
|
|
75
82
|
'fetchFundingRate': True,
|
|
76
83
|
'fetchFundingRateHistory': True,
|
|
77
84
|
'fetchIndexOHLCV': False,
|
|
@@ -79,12 +86,14 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
79
86
|
'fetchIsolatedBorrowRates': False,
|
|
80
87
|
'fetchL3OrderBook': True,
|
|
81
88
|
'fetchLedger': True,
|
|
89
|
+
'fetchLeverage': True,
|
|
82
90
|
'fetchLeverageTiers': False,
|
|
83
91
|
'fetchMarginAdjustmentHistory': False,
|
|
84
|
-
'fetchMarginMode':
|
|
92
|
+
'fetchMarginMode': True,
|
|
85
93
|
'fetchMarketLeverageTiers': True,
|
|
86
94
|
'fetchMarkets': True,
|
|
87
95
|
'fetchMarkOHLCV': False,
|
|
96
|
+
'fetchMarkPrice': True,
|
|
88
97
|
'fetchMyTrades': True,
|
|
89
98
|
'fetchOHLCV': True,
|
|
90
99
|
'fetchOpenOrders': True,
|
|
@@ -105,7 +114,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
105
114
|
'fetchTransactionFee': False,
|
|
106
115
|
'fetchWithdrawals': True,
|
|
107
116
|
'setLeverage': False,
|
|
108
|
-
'setMarginMode':
|
|
117
|
+
'setMarginMode': True,
|
|
109
118
|
'transfer': True,
|
|
110
119
|
'withdraw': None,
|
|
111
120
|
},
|
|
@@ -137,6 +146,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
137
146
|
'contracts/{symbol}': 1,
|
|
138
147
|
'contracts/risk-limit/{symbol}': 1,
|
|
139
148
|
'ticker': 1,
|
|
149
|
+
'allTickers': 1,
|
|
140
150
|
'level2/snapshot': 1.33,
|
|
141
151
|
'level2/depth{limit}': 1,
|
|
142
152
|
'level2/message/query': 1,
|
|
@@ -180,12 +190,16 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
180
190
|
'trade-statistics': 1,
|
|
181
191
|
'trade-fees': 1,
|
|
182
192
|
'history-positions': 1,
|
|
193
|
+
'getMaxOpenSize': 1,
|
|
194
|
+
'getCrossUserLeverage': 1,
|
|
195
|
+
'position/getMarginMode': 1,
|
|
183
196
|
},
|
|
184
197
|
'post': {
|
|
185
198
|
'withdrawals': 1,
|
|
186
199
|
'transfer-out': 1, # v2
|
|
187
200
|
'transfer-in': 1,
|
|
188
201
|
'orders': 1.33,
|
|
202
|
+
'st-orders': 1.33,
|
|
189
203
|
'orders/test': 1.33,
|
|
190
204
|
'position/margin/auto-deposit-status': 1,
|
|
191
205
|
'position/margin/deposit-margin': 1,
|
|
@@ -193,6 +207,8 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
193
207
|
'bullet-private': 1,
|
|
194
208
|
'sub/api-key': 1,
|
|
195
209
|
'sub/api-key/update': 1,
|
|
210
|
+
'changeCrossUserLeverage': 1,
|
|
211
|
+
'position/changeMarginMode': 1,
|
|
196
212
|
},
|
|
197
213
|
'delete': {
|
|
198
214
|
'withdrawals/{withdrawalId}': 1,
|
|
@@ -202,6 +218,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
202
218
|
'stopOrders': 1,
|
|
203
219
|
'sub/api-key': 1,
|
|
204
220
|
'orders/client-order/{clientOid}': 1,
|
|
221
|
+
'orders/multi-cancel': 20,
|
|
205
222
|
},
|
|
206
223
|
},
|
|
207
224
|
'webExchange': {
|
|
@@ -241,6 +258,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
241
258
|
'400100': BadRequest, # Parameter Error -- You tried to access the resource with invalid parameters
|
|
242
259
|
'411100': AccountSuspended, # User is frozen -- Please contact us via support center
|
|
243
260
|
'500000': ExchangeNotAvailable, # Internal Server Error -- We had a problem with our server. Try again later.
|
|
261
|
+
'300009': InvalidOrder, # {"msg":"No open positions to close.","code":"300009"}
|
|
244
262
|
},
|
|
245
263
|
'broad': {
|
|
246
264
|
'Position does not exist': OrderNotFound, # {"code":"200000", "msg":"Position does not exist"}
|
|
@@ -325,8 +343,15 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
325
343
|
# endpoint versions
|
|
326
344
|
'versions': {
|
|
327
345
|
'futuresPrivate': {
|
|
346
|
+
'GET': {
|
|
347
|
+
'getMaxOpenSize': 'v2',
|
|
348
|
+
'getCrossUserLeverage': 'v2',
|
|
349
|
+
'position/getMarginMode': 'v2',
|
|
350
|
+
},
|
|
328
351
|
'POST': {
|
|
329
352
|
'transfer-out': 'v2',
|
|
353
|
+
'changeCrossUserLeverage': 'v2',
|
|
354
|
+
'position/changeMarginMode': 'v2',
|
|
330
355
|
},
|
|
331
356
|
},
|
|
332
357
|
'futuresPublic': {
|
|
@@ -345,12 +370,102 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
345
370
|
# 'code': 'BTC',
|
|
346
371
|
# },
|
|
347
372
|
},
|
|
373
|
+
'features': {
|
|
374
|
+
'spot': None,
|
|
375
|
+
'forDerivs': {
|
|
376
|
+
'sandbox': False,
|
|
377
|
+
'createOrder': {
|
|
378
|
+
'marginMode': True,
|
|
379
|
+
'triggerPrice': True,
|
|
380
|
+
'triggerPriceType': {
|
|
381
|
+
'last': True,
|
|
382
|
+
'mark': True,
|
|
383
|
+
'index': True,
|
|
384
|
+
},
|
|
385
|
+
'triggerDirection': True,
|
|
386
|
+
'stopLossPrice': True,
|
|
387
|
+
'takeProfitPrice': True,
|
|
388
|
+
'attachedStopLossTakeProfit': {
|
|
389
|
+
'triggerPriceType': None,
|
|
390
|
+
'price': True,
|
|
391
|
+
},
|
|
392
|
+
'timeInForce': {
|
|
393
|
+
'IOC': True,
|
|
394
|
+
'FOK': False,
|
|
395
|
+
'PO': True,
|
|
396
|
+
'GTD': False,
|
|
397
|
+
},
|
|
398
|
+
'hedged': False,
|
|
399
|
+
'trailing': False,
|
|
400
|
+
'leverage': True, # todo implement
|
|
401
|
+
'marketBuyByCost': True,
|
|
402
|
+
'marketBuyRequiresPrice': False,
|
|
403
|
+
'selfTradePrevention': True, # todo implement
|
|
404
|
+
'iceberg': True,
|
|
405
|
+
},
|
|
406
|
+
'createOrders': {
|
|
407
|
+
'max': 20,
|
|
408
|
+
},
|
|
409
|
+
'fetchMyTrades': {
|
|
410
|
+
'marginMode': True,
|
|
411
|
+
'limit': 1000,
|
|
412
|
+
'daysBack': None,
|
|
413
|
+
'untilDays': 7,
|
|
414
|
+
'symbolRequired': False,
|
|
415
|
+
},
|
|
416
|
+
'fetchOrder': {
|
|
417
|
+
'marginMode': False,
|
|
418
|
+
'trigger': False,
|
|
419
|
+
'trailing': False,
|
|
420
|
+
'symbolRequired': False,
|
|
421
|
+
},
|
|
422
|
+
'fetchOpenOrders': {
|
|
423
|
+
'marginMode': False,
|
|
424
|
+
'limit': 1000,
|
|
425
|
+
'trigger': True,
|
|
426
|
+
'trailing': False,
|
|
427
|
+
'symbolRequired': False,
|
|
428
|
+
},
|
|
429
|
+
'fetchOrders': None,
|
|
430
|
+
'fetchClosedOrders': {
|
|
431
|
+
'marginMode': False,
|
|
432
|
+
'limit': 1000,
|
|
433
|
+
'daysBack': None,
|
|
434
|
+
'daysBackCanceled': None,
|
|
435
|
+
'untilDays': None,
|
|
436
|
+
'trigger': True,
|
|
437
|
+
'trailing': False,
|
|
438
|
+
'symbolRequired': False,
|
|
439
|
+
},
|
|
440
|
+
'fetchOHLCV': {
|
|
441
|
+
'limit': 500,
|
|
442
|
+
},
|
|
443
|
+
},
|
|
444
|
+
'swap': {
|
|
445
|
+
'linear': {
|
|
446
|
+
'extends': 'forDerivs',
|
|
447
|
+
},
|
|
448
|
+
'inverse': {
|
|
449
|
+
'extends': 'forDerivs',
|
|
450
|
+
},
|
|
451
|
+
},
|
|
452
|
+
'future': {
|
|
453
|
+
'linear': {
|
|
454
|
+
'extends': 'forDerivs',
|
|
455
|
+
},
|
|
456
|
+
'inverse': {
|
|
457
|
+
'extends': 'forDerivs',
|
|
458
|
+
},
|
|
459
|
+
},
|
|
460
|
+
},
|
|
348
461
|
})
|
|
349
462
|
|
|
350
463
|
async def fetch_status(self, params={}):
|
|
351
464
|
"""
|
|
352
465
|
the latest known information on the availability of the exchange API
|
|
353
|
-
|
|
466
|
+
|
|
467
|
+
https://www.kucoin.com/docs/rest/futures-trading/market-data/get-service-status
|
|
468
|
+
|
|
354
469
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
355
470
|
:returns dict: a `status structure <https://docs.ccxt.com/#/?id=exchange-status-structure>`
|
|
356
471
|
"""
|
|
@@ -377,7 +492,9 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
377
492
|
async def fetch_markets(self, params={}) -> List[Market]:
|
|
378
493
|
"""
|
|
379
494
|
retrieves data on all markets for kucoinfutures
|
|
380
|
-
|
|
495
|
+
|
|
496
|
+
https://www.kucoin.com/docs/rest/futures-trading/market-data/get-symbols-list
|
|
497
|
+
|
|
381
498
|
:param dict [params]: extra parameters specific to the exchange api endpoint
|
|
382
499
|
:returns dict[]: an array of objects representing market data
|
|
383
500
|
"""
|
|
@@ -532,10 +649,12 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
532
649
|
})
|
|
533
650
|
return result
|
|
534
651
|
|
|
535
|
-
async def fetch_time(self, params={}):
|
|
652
|
+
async def fetch_time(self, params={}) -> Int:
|
|
536
653
|
"""
|
|
537
654
|
fetches the current integer timestamp in milliseconds from the exchange server
|
|
538
|
-
|
|
655
|
+
|
|
656
|
+
https://www.kucoin.com/docs/rest/futures-trading/market-data/get-server-time
|
|
657
|
+
|
|
539
658
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
540
659
|
:returns int: the current integer timestamp in milliseconds from the exchange server
|
|
541
660
|
"""
|
|
@@ -551,7 +670,9 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
551
670
|
async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
|
552
671
|
"""
|
|
553
672
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
554
|
-
|
|
673
|
+
|
|
674
|
+
https://www.kucoin.com/docs/rest/futures-trading/market-data/get-klines
|
|
675
|
+
|
|
555
676
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
|
556
677
|
:param str timeframe: the length of time each candle represents
|
|
557
678
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
|
@@ -621,10 +742,12 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
621
742
|
self.safe_number(ohlcv, 5),
|
|
622
743
|
]
|
|
623
744
|
|
|
624
|
-
async def fetch_deposit_address(self, code: str, params={}):
|
|
745
|
+
async def fetch_deposit_address(self, code: str, params={}) -> DepositAddress:
|
|
625
746
|
"""
|
|
626
747
|
fetch the deposit address for a currency associated with self account
|
|
627
|
-
|
|
748
|
+
|
|
749
|
+
https://www.kucoin.com/docs/rest/funding/deposit/get-deposit-address
|
|
750
|
+
|
|
628
751
|
:param str code: unified currency code
|
|
629
752
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
630
753
|
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
|
|
@@ -653,15 +776,17 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
653
776
|
return {
|
|
654
777
|
'info': response,
|
|
655
778
|
'currency': currencyId,
|
|
779
|
+
'network': self.safe_string(data, 'chain'),
|
|
656
780
|
'address': address,
|
|
657
781
|
'tag': self.safe_string(data, 'memo'),
|
|
658
|
-
'network': self.safe_string(data, 'chain'),
|
|
659
782
|
}
|
|
660
783
|
|
|
661
784
|
async def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
|
662
785
|
"""
|
|
663
786
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
|
664
|
-
|
|
787
|
+
|
|
788
|
+
https://www.kucoin.com/docs/rest/futures-trading/market-data/get-part-order-book-level-2
|
|
789
|
+
|
|
665
790
|
:param str symbol: unified symbol of the market to fetch the order book for
|
|
666
791
|
:param int [limit]: the maximum amount of order book entries to return
|
|
667
792
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -710,7 +835,9 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
710
835
|
async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
|
711
836
|
"""
|
|
712
837
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
713
|
-
|
|
838
|
+
|
|
839
|
+
https://www.kucoin.com/docs/rest/futures-trading/market-data/get-ticker
|
|
840
|
+
|
|
714
841
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
|
715
842
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
716
843
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
|
@@ -741,17 +868,45 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
741
868
|
#
|
|
742
869
|
return self.parse_ticker(response['data'], market)
|
|
743
870
|
|
|
871
|
+
async def fetch_mark_price(self, symbol: str, params={}) -> Ticker:
|
|
872
|
+
"""
|
|
873
|
+
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
874
|
+
|
|
875
|
+
https://www.kucoin.com/docs/rest/futures-trading/market-data/get-current-mark-price
|
|
876
|
+
|
|
877
|
+
:param str symbol: unified symbol of the market to fetch the ticker for
|
|
878
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
879
|
+
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
|
880
|
+
"""
|
|
881
|
+
await self.load_markets()
|
|
882
|
+
market = self.market(symbol)
|
|
883
|
+
request: dict = {
|
|
884
|
+
'symbol': market['id'],
|
|
885
|
+
}
|
|
886
|
+
response = await self.futuresPublicGetMarkPriceSymbolCurrent(self.extend(request, params))
|
|
887
|
+
#
|
|
888
|
+
return self.parse_ticker(response['data'], market)
|
|
889
|
+
|
|
744
890
|
async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
|
745
891
|
"""
|
|
746
892
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
747
|
-
|
|
893
|
+
|
|
894
|
+
https://www.kucoin.com/docs/rest/futures-trading/market-data/get-symbols-list
|
|
895
|
+
|
|
748
896
|
:param str[] [symbols]: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
749
897
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
898
|
+
:param str [params.method]: the method to use, futuresPublicGetAllTickers or futuresPublicGetContractsActive
|
|
750
899
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
|
751
900
|
"""
|
|
752
901
|
await self.load_markets()
|
|
753
902
|
symbols = self.market_symbols(symbols)
|
|
754
|
-
|
|
903
|
+
method = None
|
|
904
|
+
method, params = self.handle_option_and_params(params, 'fetchTickers', 'method', 'futuresPublicGetContractsActive')
|
|
905
|
+
response: dict = None
|
|
906
|
+
if method == 'futuresPublicGetAllTickers':
|
|
907
|
+
response = await self.futuresPublicGetAllTickers(params)
|
|
908
|
+
else:
|
|
909
|
+
response = await self.futuresPublicGetContractsActive(params)
|
|
755
910
|
#
|
|
756
911
|
# {
|
|
757
912
|
# "code": "200000",
|
|
@@ -814,11 +969,19 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
814
969
|
# }
|
|
815
970
|
# }
|
|
816
971
|
#
|
|
817
|
-
data = self.safe_list(response, 'data'
|
|
972
|
+
data = self.safe_list(response, 'data')
|
|
818
973
|
tickers = self.parse_tickers(data, symbols)
|
|
819
974
|
return self.filter_by_array_tickers(tickers, 'symbol', symbols)
|
|
820
975
|
|
|
821
976
|
def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
|
|
977
|
+
#
|
|
978
|
+
# {
|
|
979
|
+
# "symbol": "LTCUSDTM",
|
|
980
|
+
# "granularity": 1000,
|
|
981
|
+
# "timePoint": 1727967339000,
|
|
982
|
+
# "value": 62.37, mark price
|
|
983
|
+
# "indexPrice": 62.37
|
|
984
|
+
# }
|
|
822
985
|
#
|
|
823
986
|
# {
|
|
824
987
|
# "code": "200000",
|
|
@@ -921,13 +1084,29 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
921
1084
|
'average': None,
|
|
922
1085
|
'baseVolume': self.safe_string(ticker, 'volumeOf24h'),
|
|
923
1086
|
'quoteVolume': self.safe_string(ticker, 'turnoverOf24h'),
|
|
1087
|
+
'markPrice': self.safe_string_2(ticker, 'markPrice', 'value'),
|
|
1088
|
+
'indexPrice': self.safe_string(ticker, 'indexPrice'),
|
|
924
1089
|
'info': ticker,
|
|
925
1090
|
}, market)
|
|
926
1091
|
|
|
1092
|
+
async def fetch_bids_asks(self, symbols: Strings = None, params={}):
|
|
1093
|
+
"""
|
|
1094
|
+
fetches the bid and ask price and volume for multiple markets
|
|
1095
|
+
:param str[] [symbols]: unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
|
|
1096
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1097
|
+
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
|
1098
|
+
"""
|
|
1099
|
+
request = {
|
|
1100
|
+
'method': 'futuresPublicGetAllTickers',
|
|
1101
|
+
}
|
|
1102
|
+
return await self.fetch_tickers(symbols, self.extend(request, params))
|
|
1103
|
+
|
|
927
1104
|
async def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
|
928
1105
|
"""
|
|
929
1106
|
fetch the history of funding payments paid and received on self account
|
|
930
|
-
|
|
1107
|
+
|
|
1108
|
+
https://www.kucoin.com/docs/rest/futures-trading/funding-fees/get-funding-history
|
|
1109
|
+
|
|
931
1110
|
:param str symbol: unified market symbol
|
|
932
1111
|
:param int [since]: the earliest time in ms to fetch funding history for
|
|
933
1112
|
:param int [limit]: the maximum number of funding history structures to retrieve
|
|
@@ -992,7 +1171,9 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
992
1171
|
|
|
993
1172
|
async def fetch_position(self, symbol: str, params={}):
|
|
994
1173
|
"""
|
|
995
|
-
|
|
1174
|
+
|
|
1175
|
+
https://docs.kucoin.com/futures/#get-position-details
|
|
1176
|
+
|
|
996
1177
|
fetch data on an open position
|
|
997
1178
|
:param str symbol: unified market symbol of the market the position is held in
|
|
998
1179
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -1051,10 +1232,12 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
1051
1232
|
data = self.safe_dict(response, 'data', {})
|
|
1052
1233
|
return self.parse_position(data, market)
|
|
1053
1234
|
|
|
1054
|
-
async def fetch_positions(self, symbols: Strings = None, params={}):
|
|
1235
|
+
async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
|
1055
1236
|
"""
|
|
1056
1237
|
fetch all open positions
|
|
1057
|
-
|
|
1238
|
+
|
|
1239
|
+
https://docs.kucoin.com/futures/#get-position-list
|
|
1240
|
+
|
|
1058
1241
|
:param str[]|None symbols: list of unified market symbols
|
|
1059
1242
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1060
1243
|
:returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
|
@@ -1113,8 +1296,12 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
1113
1296
|
async def fetch_positions_history(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}):
|
|
1114
1297
|
"""
|
|
1115
1298
|
fetches historical positions
|
|
1116
|
-
|
|
1299
|
+
|
|
1300
|
+
https://www.kucoin.com/docs/rest/futures-trading/positions/get-positions-history
|
|
1301
|
+
|
|
1117
1302
|
:param str[] [symbols]: list of unified market symbols
|
|
1303
|
+
:param int [since]: the earliest time in ms to fetch position history for
|
|
1304
|
+
:param int [limit]: the maximum number of entries to retrieve
|
|
1118
1305
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1119
1306
|
:param int [params.until]: closing end time
|
|
1120
1307
|
:param int [params.pageId]: page id
|
|
@@ -1304,25 +1491,33 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
1304
1491
|
async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
|
1305
1492
|
"""
|
|
1306
1493
|
Create an order on the exchange
|
|
1307
|
-
|
|
1494
|
+
|
|
1495
|
+
https://www.kucoin.com/docs/rest/futures-trading/orders/place-order
|
|
1496
|
+
https://www.kucoin.com/docs/rest/futures-trading/orders/place-take-profit-and-stop-loss-order#http-request
|
|
1497
|
+
|
|
1308
1498
|
:param str symbol: Unified CCXT market symbol
|
|
1309
1499
|
:param str type: 'limit' or 'market'
|
|
1310
1500
|
:param str side: 'buy' or 'sell'
|
|
1311
1501
|
:param float amount: the amount of currency to trade
|
|
1312
|
-
:param float [price]:
|
|
1502
|
+
:param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
1313
1503
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1504
|
+
:param dict [params.takeProfit]: *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered and the triggerPriceType
|
|
1505
|
+
:param dict [params.stopLoss]: *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered and the triggerPriceType
|
|
1314
1506
|
:param float [params.triggerPrice]: The price a trigger order is triggered at
|
|
1315
1507
|
:param float [params.stopLossPrice]: price to trigger stop-loss orders
|
|
1316
1508
|
:param float [params.takeProfitPrice]: price to trigger take-profit orders
|
|
1317
1509
|
:param bool [params.reduceOnly]: A mark to reduce the position size only. Set to False by default. Need to set the position size when reduceOnly is True.
|
|
1318
1510
|
:param str [params.timeInForce]: GTC, GTT, IOC, or FOK, default is GTC, limit orders only
|
|
1319
1511
|
:param str [params.postOnly]: Post only flag, invalid when timeInForce is IOC or FOK
|
|
1320
|
-
|
|
1321
|
-
:param
|
|
1512
|
+
:param float [params.cost]: the cost of the order in units of USDT
|
|
1513
|
+
:param str [params.marginMode]: 'cross' or 'isolated', default is 'isolated'
|
|
1514
|
+
----------------- Exchange Specific Parameters -----------------
|
|
1515
|
+
:param float [params.leverage]: Leverage size of the order(mandatory param in request, default is 1)
|
|
1322
1516
|
:param str [params.clientOid]: client order id, defaults to uuid if not passed
|
|
1323
1517
|
:param str [params.remark]: remark for the order, length cannot exceed 100 utf8 characters
|
|
1324
|
-
:param str [params.stop]: 'up' or 'down', the direction the
|
|
1325
|
-
:param str [params.
|
|
1518
|
+
:param str [params.stop]: 'up' or 'down', the direction the triggerPrice is triggered from, requires triggerPrice. down: Triggers when the price reaches or goes below the triggerPrice. up: Triggers when the price reaches or goes above the triggerPrice.
|
|
1519
|
+
:param str [params.triggerPriceType]: "last", "mark", "index" - defaults to "mark"
|
|
1520
|
+
:param str [params.stopPriceType]: exchange-specific alternative for triggerPriceType: TP, IP or MP
|
|
1326
1521
|
:param bool [params.closeOrder]: set to True to close position
|
|
1327
1522
|
:param bool [params.test]: set to True to use the test order endpoint(does not submit order, use to validate params)
|
|
1328
1523
|
:param bool [params.forceHold]: A mark to forcely hold the funds for an order, even though it's an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to False by default.
|
|
@@ -1332,12 +1527,16 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
1332
1527
|
market = self.market(symbol)
|
|
1333
1528
|
testOrder = self.safe_bool(params, 'test', False)
|
|
1334
1529
|
params = self.omit(params, 'test')
|
|
1530
|
+
isTpAndSlOrder = (self.safe_value(params, 'stopLoss') is not None) or (self.safe_value(params, 'takeProfit') is not None)
|
|
1335
1531
|
orderRequest = self.create_contract_order_request(symbol, type, side, amount, price, params)
|
|
1336
1532
|
response = None
|
|
1337
1533
|
if testOrder:
|
|
1338
1534
|
response = await self.futuresPrivatePostOrdersTest(orderRequest)
|
|
1339
1535
|
else:
|
|
1340
|
-
|
|
1536
|
+
if isTpAndSlOrder:
|
|
1537
|
+
response = await self.futuresPrivatePostStOrders(orderRequest)
|
|
1538
|
+
else:
|
|
1539
|
+
response = await self.futuresPrivatePostOrders(orderRequest)
|
|
1341
1540
|
#
|
|
1342
1541
|
# {
|
|
1343
1542
|
# "code": "200000",
|
|
@@ -1352,7 +1551,9 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
1352
1551
|
async def create_orders(self, orders: List[OrderRequest], params={}):
|
|
1353
1552
|
"""
|
|
1354
1553
|
create a list of trade orders
|
|
1355
|
-
|
|
1554
|
+
|
|
1555
|
+
https://www.kucoin.com/docs/rest/futures-trading/orders/place-multiple-orders
|
|
1556
|
+
|
|
1356
1557
|
: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
|
|
1357
1558
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1358
1559
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
|
@@ -1400,18 +1601,29 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
1400
1601
|
# required param, cannot be used twice
|
|
1401
1602
|
clientOrderId = self.safe_string_2(params, 'clientOid', 'clientOrderId', self.uuid())
|
|
1402
1603
|
params = self.omit(params, ['clientOid', 'clientOrderId'])
|
|
1403
|
-
if amount < 1:
|
|
1404
|
-
raise InvalidOrder(self.id + ' createOrder() minimum contract order amount is 1')
|
|
1405
|
-
preciseAmount = int(self.amount_to_precision(symbol, amount))
|
|
1406
1604
|
request: dict = {
|
|
1407
1605
|
'clientOid': clientOrderId,
|
|
1408
1606
|
'side': side,
|
|
1409
1607
|
'symbol': market['id'],
|
|
1410
1608
|
'type': type, # limit or market
|
|
1411
|
-
'size': preciseAmount,
|
|
1412
1609
|
'leverage': 1,
|
|
1413
1610
|
}
|
|
1611
|
+
marginModeUpper = self.safe_string_upper(params, 'marginMode')
|
|
1612
|
+
if marginModeUpper is not None:
|
|
1613
|
+
params = self.omit(params, 'marginMode')
|
|
1614
|
+
request['marginMode'] = marginModeUpper
|
|
1615
|
+
cost = self.safe_string(params, 'cost')
|
|
1616
|
+
params = self.omit(params, 'cost')
|
|
1617
|
+
if cost is not None:
|
|
1618
|
+
request['valueQty'] = self.cost_to_precision(symbol, cost)
|
|
1619
|
+
else:
|
|
1620
|
+
if amount < 1:
|
|
1621
|
+
raise InvalidOrder(self.id + ' createOrder() minimum contract order amount is 1')
|
|
1622
|
+
request['size'] = int(self.amount_to_precision(symbol, amount))
|
|
1414
1623
|
triggerPrice, stopLossPrice, takeProfitPrice = self.handle_trigger_prices(params)
|
|
1624
|
+
stopLoss = self.safe_dict(params, 'stopLoss')
|
|
1625
|
+
takeProfit = self.safe_dict(params, 'takeProfit')
|
|
1626
|
+
# isTpAndSl = stopLossPrice and takeProfitPrice
|
|
1415
1627
|
triggerPriceTypes: dict = {
|
|
1416
1628
|
'mark': 'MP',
|
|
1417
1629
|
'last': 'TP',
|
|
@@ -1419,11 +1631,24 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
1419
1631
|
}
|
|
1420
1632
|
triggerPriceType = self.safe_string(params, 'triggerPriceType', 'mark')
|
|
1421
1633
|
triggerPriceTypeValue = self.safe_string(triggerPriceTypes, triggerPriceType, triggerPriceType)
|
|
1422
|
-
params = self.omit(params, ['stopLossPrice', 'takeProfitPrice', 'triggerPrice', 'stopPrice'])
|
|
1634
|
+
params = self.omit(params, ['stopLossPrice', 'takeProfitPrice', 'triggerPrice', 'stopPrice', 'takeProfit', 'stopLoss'])
|
|
1423
1635
|
if triggerPrice:
|
|
1424
1636
|
request['stop'] = 'up' if (side == 'buy') else 'down'
|
|
1425
1637
|
request['stopPrice'] = self.price_to_precision(symbol, triggerPrice)
|
|
1426
1638
|
request['stopPriceType'] = triggerPriceTypeValue
|
|
1639
|
+
elif stopLoss is not None or takeProfit is not None:
|
|
1640
|
+
priceType = triggerPriceTypeValue
|
|
1641
|
+
if stopLoss is not None:
|
|
1642
|
+
slPrice = self.safe_string_2(stopLoss, 'triggerPrice', 'stopPrice')
|
|
1643
|
+
request['triggerStopDownPrice'] = self.price_to_precision(symbol, slPrice)
|
|
1644
|
+
priceType = self.safe_string(stopLoss, 'triggerPriceType', 'mark')
|
|
1645
|
+
priceType = self.safe_string(triggerPriceTypes, priceType, priceType)
|
|
1646
|
+
if takeProfit is not None:
|
|
1647
|
+
tpPrice = self.safe_string_2(takeProfit, 'triggerPrice', 'takeProfitPrice')
|
|
1648
|
+
request['triggerStopUpPrice'] = self.price_to_precision(symbol, tpPrice)
|
|
1649
|
+
priceType = self.safe_string(takeProfit, 'triggerPriceType', 'mark')
|
|
1650
|
+
priceType = self.safe_string(triggerPriceTypes, priceType, priceType)
|
|
1651
|
+
request['stopPriceType'] = priceType
|
|
1427
1652
|
elif stopLossPrice or takeProfitPrice:
|
|
1428
1653
|
if stopLossPrice:
|
|
1429
1654
|
request['stop'] = 'up' if (side == 'buy') else 'down'
|
|
@@ -1460,7 +1685,9 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
1460
1685
|
async def cancel_order(self, id: str, symbol: Str = None, params={}):
|
|
1461
1686
|
"""
|
|
1462
1687
|
cancels an open order
|
|
1463
|
-
|
|
1688
|
+
|
|
1689
|
+
https://www.kucoin.com/docs/rest/futures-trading/orders/cancel-futures-order-by-orderid
|
|
1690
|
+
|
|
1464
1691
|
:param str id: order id
|
|
1465
1692
|
:param str symbol: unified symbol of the market the order was made in
|
|
1466
1693
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -1492,13 +1719,72 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
1492
1719
|
# },
|
|
1493
1720
|
# }
|
|
1494
1721
|
#
|
|
1495
|
-
return self.
|
|
1722
|
+
return self.safe_order({'info': response})
|
|
1723
|
+
|
|
1724
|
+
async def cancel_orders(self, ids, symbol: Str = None, params={}):
|
|
1725
|
+
"""
|
|
1726
|
+
cancel multiple orders
|
|
1727
|
+
|
|
1728
|
+
https://www.kucoin.com/docs/rest/futures-trading/orders/batch-cancel-orders
|
|
1729
|
+
|
|
1730
|
+
:param str[] ids: order ids
|
|
1731
|
+
:param str symbol: unified symbol of the market the order was made in
|
|
1732
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1733
|
+
:param str[] [params.clientOrderIds]: client order ids
|
|
1734
|
+
:returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
|
1735
|
+
"""
|
|
1736
|
+
await self.load_markets()
|
|
1737
|
+
market = None
|
|
1738
|
+
if symbol is not None:
|
|
1739
|
+
market = self.market(symbol)
|
|
1740
|
+
ordersRequests = []
|
|
1741
|
+
clientOrderIds = self.safe_list_2(params, 'clientOrderIds', 'clientOids', [])
|
|
1742
|
+
params = self.omit(params, ['clientOrderIds', 'clientOids'])
|
|
1743
|
+
useClientorderId = False
|
|
1744
|
+
for i in range(0, len(clientOrderIds)):
|
|
1745
|
+
useClientorderId = True
|
|
1746
|
+
if symbol is None:
|
|
1747
|
+
raise ArgumentsRequired(self.id + ' cancelOrders() requires a symbol argument when cancelling by clientOrderIds')
|
|
1748
|
+
ordersRequests.append({
|
|
1749
|
+
'symbol': market['id'],
|
|
1750
|
+
'clientOid': self.safe_string(clientOrderIds, i),
|
|
1751
|
+
})
|
|
1752
|
+
for i in range(0, len(ids)):
|
|
1753
|
+
ordersRequests.append(ids[i])
|
|
1754
|
+
requestKey = 'clientOidsList' if useClientorderId else 'orderIdsList'
|
|
1755
|
+
request: dict = {}
|
|
1756
|
+
request[requestKey] = ordersRequests
|
|
1757
|
+
response = await self.futuresPrivateDeleteOrdersMultiCancel(self.extend(request, params))
|
|
1758
|
+
#
|
|
1759
|
+
# {
|
|
1760
|
+
# "code": "200000",
|
|
1761
|
+
# "data":
|
|
1762
|
+
# [
|
|
1763
|
+
# {
|
|
1764
|
+
# "orderId": "80465574458560512",
|
|
1765
|
+
# "clientOid": null,
|
|
1766
|
+
# "code": "200",
|
|
1767
|
+
# "msg": "success"
|
|
1768
|
+
# },
|
|
1769
|
+
# {
|
|
1770
|
+
# "orderId": "80465575289094144",
|
|
1771
|
+
# "clientOid": null,
|
|
1772
|
+
# "code": "200",
|
|
1773
|
+
# "msg": "success"
|
|
1774
|
+
# }
|
|
1775
|
+
# ]
|
|
1776
|
+
# }
|
|
1777
|
+
#
|
|
1778
|
+
orders = self.safe_list(response, 'data', [])
|
|
1779
|
+
return self.parse_orders(orders, market)
|
|
1496
1780
|
|
|
1497
1781
|
async def cancel_all_orders(self, symbol: Str = None, params={}):
|
|
1498
1782
|
"""
|
|
1499
1783
|
cancel all open orders
|
|
1500
|
-
|
|
1501
|
-
|
|
1784
|
+
|
|
1785
|
+
https://www.kucoin.com/docs/rest/futures-trading/orders/cancel-multiple-futures-limit-orders
|
|
1786
|
+
https://www.kucoin.com/docs/rest/futures-trading/orders/cancel-multiple-futures-stop-orders
|
|
1787
|
+
|
|
1502
1788
|
:param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
|
|
1503
1789
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1504
1790
|
:param dict [params.trigger]: When True, all the trigger orders will be cancelled
|
|
@@ -1508,10 +1794,10 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
1508
1794
|
request: dict = {}
|
|
1509
1795
|
if symbol is not None:
|
|
1510
1796
|
request['symbol'] = self.market_id(symbol)
|
|
1511
|
-
|
|
1797
|
+
trigger = self.safe_value_2(params, 'stop', 'trigger')
|
|
1512
1798
|
params = self.omit(params, ['stop', 'trigger'])
|
|
1513
1799
|
response = None
|
|
1514
|
-
if
|
|
1800
|
+
if trigger:
|
|
1515
1801
|
response = await self.futuresPrivateDeleteStopOrders(self.extend(request, params))
|
|
1516
1802
|
else:
|
|
1517
1803
|
response = await self.futuresPrivateDeleteOrders(self.extend(request, params))
|
|
@@ -1525,12 +1811,15 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
1525
1811
|
# },
|
|
1526
1812
|
# }
|
|
1527
1813
|
#
|
|
1528
|
-
|
|
1814
|
+
data = self.safe_dict(response, 'data')
|
|
1815
|
+
return [self.safe_order({'info': data})]
|
|
1529
1816
|
|
|
1530
1817
|
async def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
|
1531
1818
|
"""
|
|
1532
1819
|
add margin
|
|
1533
|
-
|
|
1820
|
+
|
|
1821
|
+
https://www.kucoin.com/docs/rest/futures-trading/positions/add-margin-manually
|
|
1822
|
+
|
|
1534
1823
|
:param str symbol: unified market symbol
|
|
1535
1824
|
:param float amount: amount of margin to add
|
|
1536
1825
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -1669,8 +1958,10 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
1669
1958
|
async def fetch_orders_by_status(self, status, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
|
1670
1959
|
"""
|
|
1671
1960
|
fetches a list of orders placed on the exchange
|
|
1672
|
-
|
|
1673
|
-
|
|
1961
|
+
|
|
1962
|
+
https://docs.kucoin.com/futures/#get-order-list
|
|
1963
|
+
https://docs.kucoin.com/futures/#get-untriggered-stop-order-list
|
|
1964
|
+
|
|
1674
1965
|
:param str status: 'active' or 'closed', only 'active' is valid for stop orders
|
|
1675
1966
|
:param str symbol: unified symbol for the market to retrieve orders from
|
|
1676
1967
|
:param int [since]: timestamp in ms of the earliest order to retrieve
|
|
@@ -1688,7 +1979,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
1688
1979
|
paginate, params = self.handle_option_and_params(params, 'fetchOrdersByStatus', 'paginate')
|
|
1689
1980
|
if paginate:
|
|
1690
1981
|
return await self.fetch_paginated_call_dynamic('fetchOrdersByStatus', symbol, since, limit, params)
|
|
1691
|
-
|
|
1982
|
+
trigger = self.safe_bool_2(params, 'stop', 'trigger')
|
|
1692
1983
|
until = self.safe_integer(params, 'until')
|
|
1693
1984
|
params = self.omit(params, ['stop', 'until', 'trigger'])
|
|
1694
1985
|
if status == 'closed':
|
|
@@ -1696,7 +1987,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
1696
1987
|
elif status == 'open':
|
|
1697
1988
|
status = 'active'
|
|
1698
1989
|
request: dict = {}
|
|
1699
|
-
if not
|
|
1990
|
+
if not trigger:
|
|
1700
1991
|
request['status'] = status
|
|
1701
1992
|
elif status != 'active':
|
|
1702
1993
|
raise BadRequest(self.id + ' fetchOrdersByStatus() can only fetch untriggered stop orders')
|
|
@@ -1709,7 +2000,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
1709
2000
|
if until is not None:
|
|
1710
2001
|
request['endAt'] = until
|
|
1711
2002
|
response = None
|
|
1712
|
-
if
|
|
2003
|
+
if trigger:
|
|
1713
2004
|
response = await self.futuresPrivateGetStopOrders(self.extend(request, params))
|
|
1714
2005
|
else:
|
|
1715
2006
|
response = await self.futuresPrivateGetOrders(self.extend(request, params))
|
|
@@ -1771,7 +2062,9 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
1771
2062
|
async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
|
1772
2063
|
"""
|
|
1773
2064
|
fetches information on multiple closed orders made by the user
|
|
1774
|
-
|
|
2065
|
+
|
|
2066
|
+
https://docs.kucoin.com/futures/#get-order-list
|
|
2067
|
+
|
|
1775
2068
|
:param str symbol: unified market symbol of the market orders were made in
|
|
1776
2069
|
:param int [since]: the earliest time in ms to fetch orders for
|
|
1777
2070
|
:param int [limit]: the maximum number of order structures to retrieve
|
|
@@ -1792,8 +2085,10 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
1792
2085
|
async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
|
1793
2086
|
"""
|
|
1794
2087
|
fetches information on multiple open orders made by the user
|
|
1795
|
-
|
|
1796
|
-
|
|
2088
|
+
|
|
2089
|
+
https://docs.kucoin.com/futures/#get-order-list
|
|
2090
|
+
https://docs.kucoin.com/futures/#get-untriggered-stop-order-list
|
|
2091
|
+
|
|
1797
2092
|
:param str symbol: unified market symbol of the market orders were made in
|
|
1798
2093
|
:param int [since]: the earliest time in ms to fetch orders for
|
|
1799
2094
|
:param int [limit]: the maximum number of order structures to retrieve
|
|
@@ -1812,10 +2107,13 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
1812
2107
|
return await self.fetch_paginated_call_dynamic('fetchOpenOrders', symbol, since, limit, params)
|
|
1813
2108
|
return await self.fetch_orders_by_status('open', symbol, since, limit, params)
|
|
1814
2109
|
|
|
1815
|
-
async def fetch_order(self, id: Str
|
|
2110
|
+
async def fetch_order(self, id: Str, symbol: Str = None, params={}):
|
|
1816
2111
|
"""
|
|
1817
2112
|
fetches information on an order made by the user
|
|
1818
|
-
|
|
2113
|
+
|
|
2114
|
+
https://docs.kucoin.com/futures/#get-details-of-a-single-order
|
|
2115
|
+
|
|
2116
|
+
:param str id: order id
|
|
1819
2117
|
:param str symbol: unified symbol of the market the order was made in
|
|
1820
2118
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1821
2119
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
|
@@ -1956,8 +2254,8 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
1956
2254
|
amount = self.safe_string(order, 'size')
|
|
1957
2255
|
filled = self.safe_string(order, 'filledSize')
|
|
1958
2256
|
cost = self.safe_string(order, 'filledValue')
|
|
1959
|
-
average =
|
|
1960
|
-
if Precise.string_gt(filled, '0'):
|
|
2257
|
+
average = self.safe_string(order, 'avgDealPrice')
|
|
2258
|
+
if (average is None) and Precise.string_gt(filled, '0'):
|
|
1961
2259
|
contractSize = self.safe_string(market, 'contractSize')
|
|
1962
2260
|
if market['linear']:
|
|
1963
2261
|
average = Precise.string_div(cost, Precise.string_mul(contractSize, filled))
|
|
@@ -1980,7 +2278,6 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
1980
2278
|
}
|
|
1981
2279
|
clientOrderId = self.safe_string(order, 'clientOid')
|
|
1982
2280
|
timeInForce = self.safe_string(order, 'timeInForce')
|
|
1983
|
-
stopPrice = self.safe_number(order, 'stopPrice')
|
|
1984
2281
|
postOnly = self.safe_value(order, 'postOnly')
|
|
1985
2282
|
reduceOnly = self.safe_value(order, 'reduceOnly')
|
|
1986
2283
|
lastUpdateTimestamp = self.safe_integer(order, 'updatedAt')
|
|
@@ -1995,8 +2292,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
1995
2292
|
'side': side,
|
|
1996
2293
|
'amount': amount,
|
|
1997
2294
|
'price': price,
|
|
1998
|
-
'
|
|
1999
|
-
'triggerPrice': stopPrice,
|
|
2295
|
+
'triggerPrice': self.safe_number(order, 'stopPrice'),
|
|
2000
2296
|
'cost': cost,
|
|
2001
2297
|
'filled': filled,
|
|
2002
2298
|
'remaining': None,
|
|
@@ -2011,10 +2307,12 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
2011
2307
|
'trades': None,
|
|
2012
2308
|
}, market)
|
|
2013
2309
|
|
|
2014
|
-
async def fetch_funding_rate(self, symbol: str, params={}):
|
|
2310
|
+
async def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
|
2015
2311
|
"""
|
|
2016
2312
|
fetch the current funding rate
|
|
2017
|
-
|
|
2313
|
+
|
|
2314
|
+
https://www.kucoin.com/docs/rest/futures-trading/funding-fees/get-current-funding-rate
|
|
2315
|
+
|
|
2018
2316
|
:param str symbol: unified market symbol
|
|
2019
2317
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
2020
2318
|
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
|
@@ -2037,12 +2335,37 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
2037
2335
|
# },
|
|
2038
2336
|
# }
|
|
2039
2337
|
#
|
|
2040
|
-
data = self.
|
|
2041
|
-
fundingTimestamp = self.safe_integer(data, 'timePoint')
|
|
2338
|
+
data = self.safe_dict(response, 'data', {})
|
|
2042
2339
|
# the website displayes the previous funding rate as "funding rate"
|
|
2340
|
+
return self.parse_funding_rate(data, market)
|
|
2341
|
+
|
|
2342
|
+
async def fetch_funding_interval(self, symbol: str, params={}) -> FundingRate:
|
|
2343
|
+
"""
|
|
2344
|
+
fetch the current funding rate interval
|
|
2345
|
+
|
|
2346
|
+
https://www.kucoin.com/docs/rest/futures-trading/funding-fees/get-current-funding-rate
|
|
2347
|
+
|
|
2348
|
+
:param str symbol: unified market symbol
|
|
2349
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
2350
|
+
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
|
2351
|
+
"""
|
|
2352
|
+
return await self.fetch_funding_rate(symbol, params)
|
|
2353
|
+
|
|
2354
|
+
def parse_funding_rate(self, data, market: Market = None) -> FundingRate:
|
|
2355
|
+
#
|
|
2356
|
+
# {
|
|
2357
|
+
# "symbol": ".ETHUSDTMFPI8H",
|
|
2358
|
+
# "granularity": 28800000,
|
|
2359
|
+
# "timePoint": 1637380800000,
|
|
2360
|
+
# "value": 0.0001,
|
|
2361
|
+
# "predictedValue": 0.0001,
|
|
2362
|
+
# }
|
|
2363
|
+
#
|
|
2364
|
+
fundingTimestamp = self.safe_integer(data, 'timePoint')
|
|
2365
|
+
marketId = self.safe_string(data, 'symbol')
|
|
2043
2366
|
return {
|
|
2044
2367
|
'info': data,
|
|
2045
|
-
'symbol': market
|
|
2368
|
+
'symbol': self.safe_symbol(marketId, market, None, 'contract'),
|
|
2046
2369
|
'markPrice': None,
|
|
2047
2370
|
'indexPrice': None,
|
|
2048
2371
|
'interestRate': None,
|
|
@@ -2058,7 +2381,18 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
2058
2381
|
'previousFundingRate': None,
|
|
2059
2382
|
'previousFundingTimestamp': None,
|
|
2060
2383
|
'previousFundingDatetime': None,
|
|
2384
|
+
'interval': self.parse_funding_interval(self.safe_string(data, 'granularity')),
|
|
2385
|
+
}
|
|
2386
|
+
|
|
2387
|
+
def parse_funding_interval(self, interval):
|
|
2388
|
+
intervals: dict = {
|
|
2389
|
+
'3600000': '1h',
|
|
2390
|
+
'14400000': '4h',
|
|
2391
|
+
'28800000': '8h',
|
|
2392
|
+
'57600000': '16h',
|
|
2393
|
+
'86400000': '24h',
|
|
2061
2394
|
}
|
|
2395
|
+
return self.safe_string(intervals, interval, interval)
|
|
2062
2396
|
|
|
2063
2397
|
def parse_balance(self, response) -> Balances:
|
|
2064
2398
|
result: dict = {
|
|
@@ -2078,8 +2412,11 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
2078
2412
|
async def fetch_balance(self, params={}) -> Balances:
|
|
2079
2413
|
"""
|
|
2080
2414
|
query for balance and get the amount of funds available for trading or funds locked in orders
|
|
2081
|
-
|
|
2415
|
+
|
|
2416
|
+
https://www.kucoin.com/docs/rest/funding/funding-overview/get-account-detail-futures
|
|
2417
|
+
|
|
2082
2418
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
2419
|
+
:param dict [params.code]: the unified currency code to fetch the balance for, if not provided, the default .options['fetchBalance']['code'] will be used
|
|
2083
2420
|
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
|
2084
2421
|
"""
|
|
2085
2422
|
await self.load_markets()
|
|
@@ -2113,6 +2450,10 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
2113
2450
|
async def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
|
|
2114
2451
|
"""
|
|
2115
2452
|
transfer currency internally between wallets on the same account
|
|
2453
|
+
|
|
2454
|
+
https://www.kucoin.com/docs/rest/funding/transfer/transfer-to-main-or-trade-account
|
|
2455
|
+
https://www.kucoin.com/docs/rest/funding/transfer/transfer-to-futures-account
|
|
2456
|
+
|
|
2116
2457
|
:param str code: unified currency code
|
|
2117
2458
|
:param float amount: amount to transfer
|
|
2118
2459
|
:param str fromAccount: account to transfer from
|
|
@@ -2120,47 +2461,99 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
2120
2461
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
2121
2462
|
:returns dict: a `transfer structure <https://docs.ccxt.com/#/?id=transfer-structure>`
|
|
2122
2463
|
"""
|
|
2123
|
-
if (toAccount != 'main' and toAccount != 'funding') or (fromAccount != 'futures' and fromAccount != 'future' and fromAccount != 'contract'):
|
|
2124
|
-
raise BadRequest(self.id + ' transfer() only supports transfers from contract(future) account to main(funding) account')
|
|
2125
2464
|
await self.load_markets()
|
|
2126
2465
|
currency = self.currency(code)
|
|
2127
2466
|
amountToPrecision = self.currency_to_precision(code, amount)
|
|
2128
2467
|
request: dict = {
|
|
2129
|
-
'currency': self.safe_string(currency, 'id'),
|
|
2468
|
+
'currency': self.safe_string(currency, 'id'),
|
|
2130
2469
|
'amount': amountToPrecision,
|
|
2131
2470
|
}
|
|
2132
|
-
|
|
2133
|
-
response =
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2471
|
+
toAccountString = self.parse_transfer_type(toAccount)
|
|
2472
|
+
response = None
|
|
2473
|
+
if toAccountString == 'TRADE' or toAccountString == 'MAIN':
|
|
2474
|
+
request['recAccountType'] = toAccountString
|
|
2475
|
+
response = await self.futuresPrivatePostTransferOut(self.extend(request, params))
|
|
2476
|
+
#
|
|
2477
|
+
# {
|
|
2478
|
+
# "code": "200000",
|
|
2479
|
+
# "data": {
|
|
2480
|
+
# "applyId": "6738754373ceee00011ec3f8",
|
|
2481
|
+
# "bizNo": "6738754373ceee00011ec3f7",
|
|
2482
|
+
# "payAccountType": "CONTRACT",
|
|
2483
|
+
# "payTag": "DEFAULT",
|
|
2484
|
+
# "remark": "",
|
|
2485
|
+
# "recAccountType": "MAIN",
|
|
2486
|
+
# "recTag": "DEFAULT",
|
|
2487
|
+
# "recRemark": "",
|
|
2488
|
+
# "recSystem": "KUCOIN",
|
|
2489
|
+
# "status": "PROCESSING",
|
|
2490
|
+
# "currency": "USDT",
|
|
2491
|
+
# "amount": "5",
|
|
2492
|
+
# "fee": "0",
|
|
2493
|
+
# "sn": 1519769124846692,
|
|
2494
|
+
# "reason": "",
|
|
2495
|
+
# "createdAt": 1731753283000,
|
|
2496
|
+
# "updatedAt": 1731753283000
|
|
2497
|
+
# }
|
|
2498
|
+
# }
|
|
2499
|
+
#
|
|
2500
|
+
elif toAccount == 'future' or toAccount == 'swap' or toAccount == 'contract':
|
|
2501
|
+
request['payAccountType'] = self.parse_transfer_type(fromAccount)
|
|
2502
|
+
response = await self.futuresPrivatePostTransferIn(self.extend(request, params))
|
|
2503
|
+
#
|
|
2504
|
+
# {
|
|
2505
|
+
# "code": "200000",
|
|
2506
|
+
# "data": {
|
|
2507
|
+
# "applyId": "5bffb63303aa675e8bbe18f9" # Transfer-out request ID
|
|
2508
|
+
# }
|
|
2509
|
+
# }
|
|
2510
|
+
#
|
|
2511
|
+
else:
|
|
2512
|
+
raise BadRequest(self.id + ' transfer() only supports transfers between future/swap, spot and funding accounts')
|
|
2513
|
+
data = self.safe_dict(response, 'data', {})
|
|
2143
2514
|
return self.extend(self.parse_transfer(data, currency), {
|
|
2144
2515
|
'amount': self.parse_number(amountToPrecision),
|
|
2145
|
-
'fromAccount':
|
|
2146
|
-
'toAccount':
|
|
2516
|
+
'fromAccount': fromAccount,
|
|
2517
|
+
'toAccount': toAccount,
|
|
2147
2518
|
})
|
|
2148
2519
|
|
|
2149
2520
|
def parse_transfer(self, transfer: dict, currency: Currency = None) -> TransferEntry:
|
|
2150
2521
|
#
|
|
2151
|
-
# transfer
|
|
2522
|
+
# transfer to spot or funding account
|
|
2152
2523
|
#
|
|
2153
2524
|
# {
|
|
2154
2525
|
# "applyId": "5bffb63303aa675e8bbe18f9" # Transfer-out request ID
|
|
2155
2526
|
# }
|
|
2156
2527
|
#
|
|
2528
|
+
# transfer to future account
|
|
2529
|
+
#
|
|
2530
|
+
# {
|
|
2531
|
+
# "applyId": "6738754373ceee00011ec3f8",
|
|
2532
|
+
# "bizNo": "6738754373ceee00011ec3f7",
|
|
2533
|
+
# "payAccountType": "CONTRACT",
|
|
2534
|
+
# "payTag": "DEFAULT",
|
|
2535
|
+
# "remark": "",
|
|
2536
|
+
# "recAccountType": "MAIN",
|
|
2537
|
+
# "recTag": "DEFAULT",
|
|
2538
|
+
# "recRemark": "",
|
|
2539
|
+
# "recSystem": "KUCOIN",
|
|
2540
|
+
# "status": "PROCESSING",
|
|
2541
|
+
# "currency": "USDT",
|
|
2542
|
+
# "amount": "5",
|
|
2543
|
+
# "fee": "0",
|
|
2544
|
+
# "sn": 1519769124846692,
|
|
2545
|
+
# "reason": "",
|
|
2546
|
+
# "createdAt": 1731753283000,
|
|
2547
|
+
# "updatedAt": 1731753283000
|
|
2548
|
+
# }
|
|
2549
|
+
#
|
|
2157
2550
|
timestamp = self.safe_integer(transfer, 'updatedAt')
|
|
2158
2551
|
return {
|
|
2159
2552
|
'id': self.safe_string(transfer, 'applyId'),
|
|
2160
2553
|
'timestamp': timestamp,
|
|
2161
2554
|
'datetime': self.iso8601(timestamp),
|
|
2162
2555
|
'currency': self.safe_currency_code(None, currency),
|
|
2163
|
-
'amount':
|
|
2556
|
+
'amount': self.safe_number(transfer, 'amount'),
|
|
2164
2557
|
'fromAccount': None,
|
|
2165
2558
|
'toAccount': None,
|
|
2166
2559
|
'status': self.safe_string(transfer, 'status'),
|
|
@@ -2173,9 +2566,18 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
2173
2566
|
}
|
|
2174
2567
|
return self.safe_string(statuses, status, status)
|
|
2175
2568
|
|
|
2569
|
+
def parse_transfer_type(self, transferType: Str) -> Str:
|
|
2570
|
+
transferTypes: dict = {
|
|
2571
|
+
'spot': 'TRADE',
|
|
2572
|
+
'funding': 'MAIN',
|
|
2573
|
+
}
|
|
2574
|
+
return self.safe_string_upper(transferTypes, transferType, transferType)
|
|
2575
|
+
|
|
2176
2576
|
async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
|
2177
2577
|
"""
|
|
2178
|
-
|
|
2578
|
+
|
|
2579
|
+
https://docs.kucoin.com/futures/#get-fills
|
|
2580
|
+
|
|
2179
2581
|
fetch all trades made by the user
|
|
2180
2582
|
:param str symbol: unified market symbol
|
|
2181
2583
|
:param int [since]: the earliest time in ms to fetch trades for
|
|
@@ -2204,6 +2606,8 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
2204
2606
|
request['symbol'] = market['id']
|
|
2205
2607
|
if since is not None:
|
|
2206
2608
|
request['startAt'] = since
|
|
2609
|
+
if limit is not None:
|
|
2610
|
+
request['pageSize'] = min(1000, limit)
|
|
2207
2611
|
request, params = self.handle_until_option('endAt', request, params)
|
|
2208
2612
|
response = await self.futuresPrivateGetFills(self.extend(request, params))
|
|
2209
2613
|
#
|
|
@@ -2246,7 +2650,9 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
2246
2650
|
async def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
|
2247
2651
|
"""
|
|
2248
2652
|
get the list of most recent trades for a particular symbol
|
|
2249
|
-
|
|
2653
|
+
|
|
2654
|
+
https://www.kucoin.com/docs/rest/futures-trading/market-data/get-transaction-history
|
|
2655
|
+
|
|
2250
2656
|
:param str symbol: unified symbol of the market to fetch trades for
|
|
2251
2657
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
|
2252
2658
|
:param int [limit]: the maximum amount of trades to fetch
|
|
@@ -2510,7 +2916,9 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
2510
2916
|
async def fetch_market_leverage_tiers(self, symbol: str, params={}) -> List[LeverageTier]:
|
|
2511
2917
|
"""
|
|
2512
2918
|
retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
|
|
2513
|
-
|
|
2919
|
+
|
|
2920
|
+
https://www.kucoin.com/docs/rest/futures-trading/risk-limit/get-futures-risk-limit-level
|
|
2921
|
+
|
|
2514
2922
|
:param str symbol: unified market symbol
|
|
2515
2923
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
2516
2924
|
:returns dict: a `leverage tiers structure <https://docs.ccxt.com/#/?id=leverage-tiers-structure>`
|
|
@@ -2545,7 +2953,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
2545
2953
|
|
|
2546
2954
|
def parse_market_leverage_tiers(self, info, market: Market = None) -> List[LeverageTier]:
|
|
2547
2955
|
"""
|
|
2548
|
-
|
|
2956
|
+
@ignore
|
|
2549
2957
|
:param dict info: Exchange market response for 1 market
|
|
2550
2958
|
:param dict market: CCXT market
|
|
2551
2959
|
"""
|
|
@@ -2563,8 +2971,10 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
2563
2971
|
tiers = []
|
|
2564
2972
|
for i in range(0, len(info)):
|
|
2565
2973
|
tier = info[i]
|
|
2974
|
+
marketId = self.safe_string(tier, 'symbol')
|
|
2566
2975
|
tiers.append({
|
|
2567
2976
|
'tier': self.safe_number(tier, 'level'),
|
|
2977
|
+
'symbol': self.safe_symbol(marketId, market, None, 'contract'),
|
|
2568
2978
|
'currency': market['base'],
|
|
2569
2979
|
'minNotional': self.safe_number(tier, 'minRiskLimit'),
|
|
2570
2980
|
'maxNotional': self.safe_number(tier, 'maxRiskLimit'),
|
|
@@ -2576,7 +2986,9 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
2576
2986
|
|
|
2577
2987
|
async def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
|
2578
2988
|
"""
|
|
2579
|
-
|
|
2989
|
+
|
|
2990
|
+
https://www.kucoin.com/docs/rest/futures-trading/funding-fees/get-public-funding-history#request-url
|
|
2991
|
+
|
|
2580
2992
|
fetches historical funding rate prices
|
|
2581
2993
|
:param str symbol: unified symbol of the market to fetch the funding rate history for
|
|
2582
2994
|
:param int [since]: not used by kucuoinfutures
|
|
@@ -2634,7 +3046,9 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
2634
3046
|
async def close_position(self, symbol: str, side: OrderSide = None, params={}) -> Order:
|
|
2635
3047
|
"""
|
|
2636
3048
|
closes open positions for a market
|
|
2637
|
-
|
|
3049
|
+
|
|
3050
|
+
https://www.kucoin.com/docs/rest/futures-trading/orders/place-order
|
|
3051
|
+
|
|
2638
3052
|
:param str symbol: Unified CCXT market symbol
|
|
2639
3053
|
:param str side: not used by kucoinfutures closePositions
|
|
2640
3054
|
:param dict [params]: extra parameters specific to the okx api endpoint
|
|
@@ -2664,7 +3078,9 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
2664
3078
|
async def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
|
|
2665
3079
|
"""
|
|
2666
3080
|
fetch the trading fees for a market
|
|
2667
|
-
|
|
3081
|
+
|
|
3082
|
+
https://www.kucoin.com/docs/rest/funding/trade-fee/trading-pair-actual-fee-futures
|
|
3083
|
+
|
|
2668
3084
|
:param str symbol: unified market symbol
|
|
2669
3085
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
2670
3086
|
:returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
|
|
@@ -2696,3 +3112,150 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
|
2696
3112
|
'percentage': True,
|
|
2697
3113
|
'tierBased': True,
|
|
2698
3114
|
}
|
|
3115
|
+
|
|
3116
|
+
async def fetch_margin_mode(self, symbol: str, params={}) -> MarginMode:
|
|
3117
|
+
"""
|
|
3118
|
+
fetches the margin mode of a trading pair
|
|
3119
|
+
|
|
3120
|
+
https://www.kucoin.com/docs/rest/futures-trading/positions/get-margin-mode
|
|
3121
|
+
|
|
3122
|
+
:param str symbol: unified symbol of the market to fetch the margin mode for
|
|
3123
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
3124
|
+
:returns dict: a `margin mode structure <https://docs.ccxt.com/#/?id=margin-mode-structure>`
|
|
3125
|
+
"""
|
|
3126
|
+
await self.load_markets()
|
|
3127
|
+
market = self.market(symbol)
|
|
3128
|
+
request: dict = {
|
|
3129
|
+
'symbol': market['id'],
|
|
3130
|
+
}
|
|
3131
|
+
response = await self.futuresPrivateGetPositionGetMarginMode(self.extend(request, params))
|
|
3132
|
+
#
|
|
3133
|
+
# {
|
|
3134
|
+
# "code": "200000",
|
|
3135
|
+
# "data": {
|
|
3136
|
+
# "symbol": "XBTUSDTM",
|
|
3137
|
+
# "marginMode": "ISOLATED"
|
|
3138
|
+
# }
|
|
3139
|
+
# }
|
|
3140
|
+
#
|
|
3141
|
+
data = self.safe_dict(response, 'data', {})
|
|
3142
|
+
return self.parse_margin_mode(data, market)
|
|
3143
|
+
|
|
3144
|
+
def parse_margin_mode(self, marginMode: dict, market=None) -> MarginMode:
|
|
3145
|
+
marginType = self.safe_string(marginMode, 'marginMode')
|
|
3146
|
+
marginType = 'isolated' if (marginType == 'ISOLATED') else 'cross'
|
|
3147
|
+
return {
|
|
3148
|
+
'info': marginMode,
|
|
3149
|
+
'symbol': market['symbol'],
|
|
3150
|
+
'marginMode': marginType,
|
|
3151
|
+
}
|
|
3152
|
+
|
|
3153
|
+
async def set_margin_mode(self, marginMode: str, symbol: Str = None, params={}):
|
|
3154
|
+
"""
|
|
3155
|
+
set margin mode to 'cross' or 'isolated'
|
|
3156
|
+
|
|
3157
|
+
https://www.kucoin.com/docs/rest/futures-trading/positions/modify-margin-mode
|
|
3158
|
+
|
|
3159
|
+
:param str marginMode: 'cross' or 'isolated'
|
|
3160
|
+
:param str symbol: unified market symbol
|
|
3161
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
3162
|
+
:returns dict: response from the exchange
|
|
3163
|
+
"""
|
|
3164
|
+
if symbol is None:
|
|
3165
|
+
raise ArgumentsRequired(self.id + ' setMarginMode() requires a symbol argument')
|
|
3166
|
+
self.check_required_argument('setMarginMode', marginMode, 'marginMode', ['cross', 'isolated'])
|
|
3167
|
+
await self.load_markets()
|
|
3168
|
+
market = self.market(symbol)
|
|
3169
|
+
request: dict = {
|
|
3170
|
+
'symbol': market['id'],
|
|
3171
|
+
'marginMode': marginMode.upper(),
|
|
3172
|
+
}
|
|
3173
|
+
response = await self.futuresPrivatePostPositionChangeMarginMode(self.extend(request, params))
|
|
3174
|
+
#
|
|
3175
|
+
# {
|
|
3176
|
+
# "code": "200000",
|
|
3177
|
+
# "data": {
|
|
3178
|
+
# "symbol": "XBTUSDTM",
|
|
3179
|
+
# "marginMode": "ISOLATED"
|
|
3180
|
+
# }
|
|
3181
|
+
# }
|
|
3182
|
+
#
|
|
3183
|
+
data = self.safe_dict(response, 'data', {})
|
|
3184
|
+
return self.parse_margin_mode(data, market)
|
|
3185
|
+
|
|
3186
|
+
async def fetch_leverage(self, symbol: str, params={}) -> Leverage:
|
|
3187
|
+
"""
|
|
3188
|
+
fetch the set leverage for a market
|
|
3189
|
+
|
|
3190
|
+
https://www.kucoin.com/docs/rest/futures-trading/positions/get-cross-margin-leverage
|
|
3191
|
+
|
|
3192
|
+
:param str symbol: unified market symbol
|
|
3193
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
3194
|
+
:returns dict: a `leverage structure <https://docs.ccxt.com/#/?id=leverage-structure>`
|
|
3195
|
+
"""
|
|
3196
|
+
marginMode = None
|
|
3197
|
+
marginMode, params = self.handle_margin_mode_and_params(symbol, params)
|
|
3198
|
+
if marginMode != 'cross':
|
|
3199
|
+
raise NotSupported(self.id + ' fetchLeverage() currently supports only params["marginMode"] = "cross"')
|
|
3200
|
+
await self.load_markets()
|
|
3201
|
+
market = self.market(symbol)
|
|
3202
|
+
request: dict = {
|
|
3203
|
+
'symbol': market['id'],
|
|
3204
|
+
}
|
|
3205
|
+
response = await self.futuresPrivateGetGetCrossUserLeverage(self.extend(request, params))
|
|
3206
|
+
#
|
|
3207
|
+
# {
|
|
3208
|
+
# "code": "200000",
|
|
3209
|
+
# "data": {
|
|
3210
|
+
# "symbol": "XBTUSDTM",
|
|
3211
|
+
# "leverage": "3"
|
|
3212
|
+
# }
|
|
3213
|
+
# }
|
|
3214
|
+
#
|
|
3215
|
+
data = self.safe_dict(response, 'data', {})
|
|
3216
|
+
parsed = self.parse_leverage(data, market)
|
|
3217
|
+
return self.extend(parsed, {
|
|
3218
|
+
'marginMode': marginMode,
|
|
3219
|
+
})
|
|
3220
|
+
|
|
3221
|
+
async def set_leverage(self, leverage: int, symbol: Str = None, params={}):
|
|
3222
|
+
"""
|
|
3223
|
+
set the level of leverage for a market
|
|
3224
|
+
|
|
3225
|
+
https://www.kucoin.com/docs/rest/futures-trading/positions/modify-cross-margin-leverage
|
|
3226
|
+
|
|
3227
|
+
:param float leverage: the rate of leverage
|
|
3228
|
+
:param str symbol: unified market symbol
|
|
3229
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
3230
|
+
:returns dict: response from the exchange
|
|
3231
|
+
"""
|
|
3232
|
+
marginMode = None
|
|
3233
|
+
marginMode, params = self.handle_margin_mode_and_params(symbol, params)
|
|
3234
|
+
if marginMode != 'cross':
|
|
3235
|
+
raise NotSupported(self.id + ' setLeverage() currently supports only params["marginMode"] = "cross"')
|
|
3236
|
+
await self.load_markets()
|
|
3237
|
+
market = self.market(symbol)
|
|
3238
|
+
request: dict = {
|
|
3239
|
+
'symbol': market['id'],
|
|
3240
|
+
'leverage': str(leverage),
|
|
3241
|
+
}
|
|
3242
|
+
response = await self.futuresPrivatePostChangeCrossUserLeverage(self.extend(request, params))
|
|
3243
|
+
#
|
|
3244
|
+
# {
|
|
3245
|
+
# "code": "200000",
|
|
3246
|
+
# "data": True
|
|
3247
|
+
# }
|
|
3248
|
+
#
|
|
3249
|
+
return self.parse_leverage(response, market)
|
|
3250
|
+
|
|
3251
|
+
def parse_leverage(self, leverage: dict, market: Market = None) -> Leverage:
|
|
3252
|
+
marketId = self.safe_string(leverage, 'symbol')
|
|
3253
|
+
market = self.safe_market(marketId, market)
|
|
3254
|
+
leverageNum = self.safe_integer(leverage, 'leverage')
|
|
3255
|
+
return {
|
|
3256
|
+
'info': leverage,
|
|
3257
|
+
'symbol': market['symbol'],
|
|
3258
|
+
'marginMode': None,
|
|
3259
|
+
'longLeverage': leverageNum,
|
|
3260
|
+
'shortLeverage': leverageNum,
|
|
3261
|
+
}
|