ccxt-ir 4.3.46.0.2__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 +9 -9
- 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 +10 -10
- 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.2.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.2.dist-info → ccxt_ir-4.5.0.dist-info}/WHEEL +1 -1
- 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.2.dist-info/RECORD +0 -772
- /ccxt/abstract/{huobijp.py → bittrade.py} +0 -0
- {ccxt_ir-4.3.46.0.2.dist-info → ccxt_ir-4.5.0.dist-info/licenses}/LICENSE.txt +0 -0
- {ccxt_ir-4.3.46.0.2.dist-info → ccxt_ir-4.5.0.dist-info}/top_level.txt +0 -0
ccxt/coinex.py
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.coinex import ImplicitAPI
|
|
8
|
-
from ccxt.base.types import Balances, Currencies, Currency, Int, IsolatedBorrowRate, Leverage, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
|
8
|
+
from ccxt.base.types import Any, Balances, BorrowInterest, Currencies, Currency, DepositAddress, Int, IsolatedBorrowRate, Leverage, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
|
9
9
|
from typing import List
|
|
10
10
|
from ccxt.base.errors import ExchangeError
|
|
11
11
|
from ccxt.base.errors import AuthenticationError
|
|
@@ -18,6 +18,7 @@ from ccxt.base.errors import InsufficientFunds
|
|
|
18
18
|
from ccxt.base.errors import InvalidOrder
|
|
19
19
|
from ccxt.base.errors import OrderNotFound
|
|
20
20
|
from ccxt.base.errors import NotSupported
|
|
21
|
+
from ccxt.base.errors import OperationFailed
|
|
21
22
|
from ccxt.base.errors import RateLimitExceeded
|
|
22
23
|
from ccxt.base.errors import ExchangeNotAvailable
|
|
23
24
|
from ccxt.base.errors import RequestTimeout
|
|
@@ -27,7 +28,7 @@ from ccxt.base.precise import Precise
|
|
|
27
28
|
|
|
28
29
|
class coinex(Exchange, ImplicitAPI):
|
|
29
30
|
|
|
30
|
-
def describe(self):
|
|
31
|
+
def describe(self) -> Any:
|
|
31
32
|
return self.deep_extend(super(coinex, self).describe(), {
|
|
32
33
|
'id': 'coinex',
|
|
33
34
|
'name': 'CoinEx',
|
|
@@ -58,6 +59,8 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
58
59
|
'cancelAllOrders': True,
|
|
59
60
|
'cancelOrder': True,
|
|
60
61
|
'cancelOrders': True,
|
|
62
|
+
'closeAllPositions': False,
|
|
63
|
+
'closePosition': True,
|
|
61
64
|
'createDepositAddress': True,
|
|
62
65
|
'createMarketBuyOrderWithCost': True,
|
|
63
66
|
'createMarketOrderWithCost': False,
|
|
@@ -66,6 +69,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
66
69
|
'createOrders': True,
|
|
67
70
|
'createReduceOnlyOrder': True,
|
|
68
71
|
'createStopLossOrder': True,
|
|
72
|
+
'createStopOrder': True,
|
|
69
73
|
'createTakeProfitOrder': True,
|
|
70
74
|
'createTriggerOrder': True,
|
|
71
75
|
'editOrder': True,
|
|
@@ -78,12 +82,14 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
78
82
|
'fetchCrossBorrowRates': False,
|
|
79
83
|
'fetchCurrencies': True,
|
|
80
84
|
'fetchDepositAddress': True,
|
|
81
|
-
'fetchDepositAddressByNetwork': False,
|
|
82
85
|
'fetchDepositAddresses': False,
|
|
86
|
+
'fetchDepositAddressesByNetwork': False,
|
|
83
87
|
'fetchDeposits': True,
|
|
84
88
|
'fetchDepositWithdrawFee': True,
|
|
85
|
-
'fetchDepositWithdrawFees':
|
|
89
|
+
'fetchDepositWithdrawFees': True,
|
|
86
90
|
'fetchFundingHistory': True,
|
|
91
|
+
'fetchFundingInterval': True,
|
|
92
|
+
'fetchFundingIntervals': False,
|
|
87
93
|
'fetchFundingRate': True,
|
|
88
94
|
'fetchFundingRateHistory': True,
|
|
89
95
|
'fetchFundingRates': True,
|
|
@@ -469,9 +475,133 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
469
475
|
'FUTURES': 'swap',
|
|
470
476
|
},
|
|
471
477
|
'networks': {
|
|
478
|
+
'BTC': 'BTC',
|
|
472
479
|
'BEP20': 'BSC',
|
|
473
|
-
'
|
|
474
|
-
'
|
|
480
|
+
'TRC20': 'TRC20',
|
|
481
|
+
'ERC20': 'ERC20',
|
|
482
|
+
'BRC20': 'BRC20',
|
|
483
|
+
'SOL': 'SOL',
|
|
484
|
+
'TON': 'TON',
|
|
485
|
+
'BSV': 'BSV',
|
|
486
|
+
'AVAXC': 'AVA_C',
|
|
487
|
+
'AVAXX': 'AVA',
|
|
488
|
+
'SUI': 'SUI',
|
|
489
|
+
'ACA': 'ACA',
|
|
490
|
+
'CHZ': 'CHILIZ',
|
|
491
|
+
'ADA': 'ADA',
|
|
492
|
+
'ARB': 'ARBITRUM',
|
|
493
|
+
'ARBNOVA': 'ARBITRUM_NOVA',
|
|
494
|
+
'OP': 'OPTIMISM',
|
|
495
|
+
'APT': 'APTOS',
|
|
496
|
+
'ATOM': 'ATOM',
|
|
497
|
+
'FTM': 'FTM',
|
|
498
|
+
'BCH': 'BCH',
|
|
499
|
+
'ASTR': 'ASTR',
|
|
500
|
+
'LTC': 'LTC',
|
|
501
|
+
'MATIC': 'MATIC',
|
|
502
|
+
'CRONOS': 'CRONOS',
|
|
503
|
+
'DASH': 'DASH',
|
|
504
|
+
'DOT': 'DOT',
|
|
505
|
+
'ETC': 'ETC',
|
|
506
|
+
'ETHW': 'ETHPOW',
|
|
507
|
+
'FIL': 'FIL',
|
|
508
|
+
'ZIL': 'ZIL',
|
|
509
|
+
'DOGE': 'DOGE',
|
|
510
|
+
'TIA': 'CELESTIA',
|
|
511
|
+
'SEI': 'SEI',
|
|
512
|
+
'XRP': 'XRP',
|
|
513
|
+
'XMR': 'XMR',
|
|
514
|
+
# CSC, AE, BASE, AIPG, AKASH, POLKADOTASSETHUB ?, ALEO, STX, ALGO, ALPH, BLAST, AR, ARCH, ARDR, ARK, ARRR, MANTA, NTRN, LUNA, AURORA, AVAIL, ASC20, AVA, AYA, AZERO, BAN, BAND, BB, RUNES, BEAM, BELLSCOIN, BITCI, NEAR, AGORIC, BLOCX, BNC, BOBA, BRISE, KRC20, CANTO, CAPS, CCD, CELO, CFX, CHI, CKB, CLORE, CLV, CORE, CSPR, CTXC, DAG, DCR, DERO, DESO, DEFI, DGB, DNX, DOCK, DOGECHAIN, DYDX, DYMENSION, EGLD, ELA, ELF, ENJIN, EOSIO, ERG, ETN_SC, EVMOS, EWC, SGB, FACT, FB, FET, FIO, FIRO, NEO3, FLOW, FLARE, FLUX, LINEA, FREN, FSN, FB_BRC20, GLMR, GRIN, GRS, HACASH, HBAR, HERB, HIVE, MAPO, HMND, HNS, ZKSYNC, HTR, HUAHUA, MERLIN, ICP, ICX, INJ, IOST, IOTA, IOTX, IRIS, IRON, ONE, JOYSTREAM, KAI, KAR, KAS, KAVA, KCN, KDA, KLAY, KLY, KMD, KSM, KUB, KUJIRA, LAT, LBC, LUNC, LUKSO, MARS, METIS, MINA, MANTLE, MOB, MODE, MONA, MOVR, MTL, NEOX, NEXA, NIBI, NIMIQ, NMC, ONOMY, NRG, WAVES, NULS, OAS, OCTA, OLT, ONT, OORT, ORAI, OSMO, P3D, COMPOSABLE, PIVX, RON, POKT, POLYMESH, PRE_MARKET, PYI, QKC, QTUM, QUBIC, RSK, ROSE, ROUTE, RTM, THORCHAIN, RVN, RADIANT, SAGA, SALVIUM, SATOX, SC, SCP, _NULL, SCRT, SDN, RGBPP, SELF, SMH, SPACE, STARGAZE, STC, STEEM, STRATISEVM, STRD, STARKNET, SXP, SYS, TAIKO, TAO, TARA, TENET, THETA, TT, VENOM, VECHAIN, TOMO, VITE, VLX, VSYS, VTC, WAN, WAXP, WEMIX, XCH, XDC, XEC, XELIS, NEM, XHV, XLM, XNA, NANO, XPLA, XPR, XPRT, XRD, XTZ, XVG, XYM, ZANO, ZEC, ZEN, ZEPH, ZETA
|
|
515
|
+
},
|
|
516
|
+
},
|
|
517
|
+
'features': {
|
|
518
|
+
'spot': {
|
|
519
|
+
'sandbox': False,
|
|
520
|
+
'createOrder': {
|
|
521
|
+
'marginMode': True,
|
|
522
|
+
'triggerPrice': True,
|
|
523
|
+
'triggerPriceType': None,
|
|
524
|
+
'triggerDirection': False,
|
|
525
|
+
'stopLossPrice': False, # todo
|
|
526
|
+
'takeProfitPrice': False, # todo
|
|
527
|
+
'attachedStopLossTakeProfit': None,
|
|
528
|
+
'timeInForce': {
|
|
529
|
+
'IOC': True,
|
|
530
|
+
'FOK': True,
|
|
531
|
+
'PO': True,
|
|
532
|
+
'GTD': False,
|
|
533
|
+
},
|
|
534
|
+
'hedged': False,
|
|
535
|
+
'trailing': False,
|
|
536
|
+
'leverage': False,
|
|
537
|
+
'marketBuyByCost': True,
|
|
538
|
+
'marketBuyRequiresPrice': True,
|
|
539
|
+
'selfTradePrevention': True, # todo: implement
|
|
540
|
+
'iceberg': True, # todo implement
|
|
541
|
+
},
|
|
542
|
+
'createOrders': {
|
|
543
|
+
'max': 5,
|
|
544
|
+
},
|
|
545
|
+
'fetchMyTrades': {
|
|
546
|
+
'marginMode': True,
|
|
547
|
+
'limit': 1000,
|
|
548
|
+
'daysBack': None,
|
|
549
|
+
'untilDays': 100000,
|
|
550
|
+
'symbolRequired': True,
|
|
551
|
+
},
|
|
552
|
+
'fetchOrder': {
|
|
553
|
+
'marginMode': False,
|
|
554
|
+
'trigger': False,
|
|
555
|
+
'trailing': False,
|
|
556
|
+
'symbolRequired': True,
|
|
557
|
+
},
|
|
558
|
+
'fetchOpenOrders': {
|
|
559
|
+
'marginMode': True,
|
|
560
|
+
'limit': 1000,
|
|
561
|
+
'trigger': True,
|
|
562
|
+
'trailing': False,
|
|
563
|
+
'symbolRequired': False,
|
|
564
|
+
},
|
|
565
|
+
'fetchOrders': None,
|
|
566
|
+
'fetchClosedOrders': {
|
|
567
|
+
'marginMode': True,
|
|
568
|
+
'limit': 1000,
|
|
569
|
+
'daysBack': None,
|
|
570
|
+
'daysBackCanceled': None,
|
|
571
|
+
'untilDays': None,
|
|
572
|
+
'trigger': True,
|
|
573
|
+
'trailing': False,
|
|
574
|
+
'symbolRequired': False,
|
|
575
|
+
},
|
|
576
|
+
'fetchOHLCV': {
|
|
577
|
+
'limit': 1000,
|
|
578
|
+
},
|
|
579
|
+
},
|
|
580
|
+
'forDerivatives': {
|
|
581
|
+
'extends': 'spot',
|
|
582
|
+
'createOrder': {
|
|
583
|
+
'marginMode': True,
|
|
584
|
+
'stopLossPrice': True,
|
|
585
|
+
'takeProfitPrice': True,
|
|
586
|
+
},
|
|
587
|
+
'fetchOpenOrders': {
|
|
588
|
+
'marginMode': False,
|
|
589
|
+
},
|
|
590
|
+
'fetchClosedOrders': {
|
|
591
|
+
'marginMode': False,
|
|
592
|
+
},
|
|
593
|
+
},
|
|
594
|
+
'swap': {
|
|
595
|
+
'linear': {
|
|
596
|
+
'extends': 'forDerivatives',
|
|
597
|
+
},
|
|
598
|
+
'inverse': {
|
|
599
|
+
'extends': 'forDerivatives',
|
|
600
|
+
},
|
|
601
|
+
},
|
|
602
|
+
'future': {
|
|
603
|
+
'linear': None,
|
|
604
|
+
'inverse': None,
|
|
475
605
|
},
|
|
476
606
|
},
|
|
477
607
|
'commonCurrencies': {
|
|
@@ -497,6 +627,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
497
627
|
'3008': RequestTimeout, # Service busy, please try again later.
|
|
498
628
|
'3109': InsufficientFunds, # {"code":3109,"data":{},"message":"balance not enough"}
|
|
499
629
|
'3127': InvalidOrder, # The order quantity is below the minimum requirement. Please adjust the order quantity.
|
|
630
|
+
'3600': OrderNotFound, # {"code":3600,"data":{},"message":"Order not found"}
|
|
500
631
|
'3606': InvalidOrder, # The price difference between the order price and the latest price is too large. Please adjust the order amount accordingly.
|
|
501
632
|
'3610': ExchangeError, # Order cancellation prohibited during the Call Auction period.
|
|
502
633
|
'3612': InvalidOrder, # The est. ask price is lower than the current bottom ask price. Please reduce the amount.
|
|
@@ -540,6 +671,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
540
671
|
'broad': {
|
|
541
672
|
'ip not allow visit': PermissionDenied,
|
|
542
673
|
'service too busy': ExchangeNotAvailable,
|
|
674
|
+
'Service is not available during funding fee settlement': OperationFailed,
|
|
543
675
|
},
|
|
544
676
|
},
|
|
545
677
|
})
|
|
@@ -547,7 +679,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
547
679
|
def fetch_currencies(self, params={}) -> Currencies:
|
|
548
680
|
"""
|
|
549
681
|
fetches all available currencies on an exchange
|
|
550
|
-
|
|
682
|
+
|
|
683
|
+
https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/list-all-deposit-withdrawal-config
|
|
684
|
+
|
|
551
685
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
552
686
|
:returns dict: an associative dictionary of currencies
|
|
553
687
|
"""
|
|
@@ -601,35 +735,13 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
601
735
|
canWithdraw = self.safe_bool(asset, 'withdraw_enabled')
|
|
602
736
|
firstChain = self.safe_dict(chains, 0, {})
|
|
603
737
|
firstPrecisionString = self.parse_precision(self.safe_string(firstChain, 'withdrawal_precision'))
|
|
604
|
-
|
|
605
|
-
'id': currencyId,
|
|
606
|
-
'code': code,
|
|
607
|
-
'name': None,
|
|
608
|
-
'active': canDeposit and canWithdraw,
|
|
609
|
-
'deposit': canDeposit,
|
|
610
|
-
'withdraw': canWithdraw,
|
|
611
|
-
'fee': None,
|
|
612
|
-
'precision': self.parse_number(firstPrecisionString),
|
|
613
|
-
'limits': {
|
|
614
|
-
'amount': {
|
|
615
|
-
'min': None,
|
|
616
|
-
'max': None,
|
|
617
|
-
},
|
|
618
|
-
'deposit': {
|
|
619
|
-
'min': None,
|
|
620
|
-
'max': None,
|
|
621
|
-
},
|
|
622
|
-
'withdraw': {
|
|
623
|
-
'min': None,
|
|
624
|
-
'max': None,
|
|
625
|
-
},
|
|
626
|
-
},
|
|
627
|
-
'networks': {},
|
|
628
|
-
'info': coin,
|
|
629
|
-
}
|
|
738
|
+
networks: dict = {}
|
|
630
739
|
for j in range(0, len(chains)):
|
|
631
740
|
chain = chains[j]
|
|
632
741
|
networkId = self.safe_string(chain, 'chain')
|
|
742
|
+
networkCode = self.network_id_to_code(networkId, code)
|
|
743
|
+
if networkId is None:
|
|
744
|
+
continue
|
|
633
745
|
precisionString = self.parse_precision(self.safe_string(chain, 'withdrawal_precision'))
|
|
634
746
|
feeString = self.safe_string(chain, 'withdrawal_fee')
|
|
635
747
|
minNetworkDepositString = self.safe_string(chain, 'min_deposit_amount')
|
|
@@ -638,7 +750,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
638
750
|
canWithdrawChain = self.safe_bool(chain, 'withdraw_enabled')
|
|
639
751
|
network: dict = {
|
|
640
752
|
'id': networkId,
|
|
641
|
-
'network':
|
|
753
|
+
'network': networkCode,
|
|
642
754
|
'name': None,
|
|
643
755
|
'active': canDepositChain and canWithdrawChain,
|
|
644
756
|
'deposit': canDepositChain,
|
|
@@ -661,16 +773,43 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
661
773
|
},
|
|
662
774
|
'info': chain,
|
|
663
775
|
}
|
|
664
|
-
networks
|
|
665
|
-
|
|
666
|
-
|
|
776
|
+
networks[networkCode] = network
|
|
777
|
+
result[code] = self.safe_currency_structure({
|
|
778
|
+
'id': currencyId,
|
|
779
|
+
'code': code,
|
|
780
|
+
'name': None,
|
|
781
|
+
'active': canDeposit and canWithdraw,
|
|
782
|
+
'deposit': canDeposit,
|
|
783
|
+
'withdraw': canWithdraw,
|
|
784
|
+
'fee': None,
|
|
785
|
+
'precision': self.parse_number(firstPrecisionString),
|
|
786
|
+
'limits': {
|
|
787
|
+
'amount': {
|
|
788
|
+
'min': None,
|
|
789
|
+
'max': None,
|
|
790
|
+
},
|
|
791
|
+
'deposit': {
|
|
792
|
+
'min': None,
|
|
793
|
+
'max': None,
|
|
794
|
+
},
|
|
795
|
+
'withdraw': {
|
|
796
|
+
'min': None,
|
|
797
|
+
'max': None,
|
|
798
|
+
},
|
|
799
|
+
},
|
|
800
|
+
'networks': networks,
|
|
801
|
+
'type': 'crypto',
|
|
802
|
+
'info': coin,
|
|
803
|
+
})
|
|
667
804
|
return result
|
|
668
805
|
|
|
669
806
|
def fetch_markets(self, params={}) -> List[Market]:
|
|
670
807
|
"""
|
|
671
808
|
retrieves data on all markets for coinex
|
|
672
|
-
|
|
673
|
-
|
|
809
|
+
|
|
810
|
+
https://docs.coinex.com/api/v2/spot/market/http/list-market
|
|
811
|
+
https://docs.coinex.com/api/v2/futures/market/http/list-market
|
|
812
|
+
|
|
674
813
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
675
814
|
:returns dict[]: an array of objects representing market data
|
|
676
815
|
"""
|
|
@@ -683,24 +822,26 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
683
822
|
swapMarkets = promises[1]
|
|
684
823
|
return self.array_concat(spotMarkets, swapMarkets)
|
|
685
824
|
|
|
686
|
-
def fetch_spot_markets(self, params):
|
|
825
|
+
def fetch_spot_markets(self, params) -> List[Market]:
|
|
687
826
|
response = self.v2PublicGetSpotMarket(params)
|
|
688
827
|
#
|
|
689
828
|
# {
|
|
690
829
|
# "code": 0,
|
|
691
830
|
# "data": [
|
|
692
831
|
# {
|
|
693
|
-
# "
|
|
832
|
+
# "market": "BTCUSDT",
|
|
833
|
+
# "taker_fee_rate": "0.002",
|
|
834
|
+
# "maker_fee_rate": "0.002",
|
|
835
|
+
# "min_amount": "0.0005",
|
|
836
|
+
# "base_ccy": "BTC",
|
|
837
|
+
# "quote_ccy": "USDT",
|
|
694
838
|
# "base_ccy_precision": 8,
|
|
839
|
+
# "quote_ccy_precision": 2,
|
|
695
840
|
# "is_amm_available": True,
|
|
696
|
-
# "is_margin_available":
|
|
697
|
-
# "
|
|
698
|
-
# "
|
|
699
|
-
#
|
|
700
|
-
# "quote_ccy": "USDT",
|
|
701
|
-
# "quote_ccy_precision": 6,
|
|
702
|
-
# "taker_fee_rate": "0.003"
|
|
703
|
-
# },
|
|
841
|
+
# "is_margin_available": True,
|
|
842
|
+
# "is_pre_trading_available": True,
|
|
843
|
+
# "is_api_trading_available": True
|
|
844
|
+
# }
|
|
704
845
|
# ],
|
|
705
846
|
# "message": "OK"
|
|
706
847
|
# }
|
|
@@ -726,11 +867,11 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
726
867
|
'settleId': None,
|
|
727
868
|
'type': 'spot',
|
|
728
869
|
'spot': True,
|
|
729
|
-
'margin':
|
|
870
|
+
'margin': self.safe_bool(market, 'is_margin_available'),
|
|
730
871
|
'swap': False,
|
|
731
872
|
'future': False,
|
|
732
873
|
'option': False,
|
|
733
|
-
'active':
|
|
874
|
+
'active': self.safe_bool(market, 'is_api_trading_available'),
|
|
734
875
|
'contract': False,
|
|
735
876
|
'linear': None,
|
|
736
877
|
'inverse': None,
|
|
@@ -921,14 +1062,18 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
921
1062
|
'average': None,
|
|
922
1063
|
'baseVolume': self.safe_string(ticker, 'volume'),
|
|
923
1064
|
'quoteVolume': None,
|
|
1065
|
+
'markPrice': self.safe_string(ticker, 'mark_price'),
|
|
1066
|
+
'indexPrice': self.safe_string(ticker, 'index_price'),
|
|
924
1067
|
'info': ticker,
|
|
925
1068
|
}, market)
|
|
926
1069
|
|
|
927
1070
|
def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
|
928
1071
|
"""
|
|
929
1072
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
930
|
-
|
|
931
|
-
|
|
1073
|
+
|
|
1074
|
+
https://docs.coinex.com/api/v2/spot/market/http/list-market-ticker
|
|
1075
|
+
https://docs.coinex.com/api/v2/futures/market/http/list-market-ticker
|
|
1076
|
+
|
|
932
1077
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
|
933
1078
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
934
1079
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
|
@@ -997,8 +1142,10 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
997
1142
|
def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
|
998
1143
|
"""
|
|
999
1144
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
1000
|
-
|
|
1001
|
-
|
|
1145
|
+
|
|
1146
|
+
https://docs.coinex.com/api/v2/spot/market/http/list-market-ticker
|
|
1147
|
+
https://docs.coinex.com/api/v2/futures/market/http/list-market-ticker
|
|
1148
|
+
|
|
1002
1149
|
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
1003
1150
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1004
1151
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
|
@@ -1065,10 +1212,12 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
1065
1212
|
data = self.safe_list(response, 'data', [])
|
|
1066
1213
|
return self.parse_tickers(data, symbols)
|
|
1067
1214
|
|
|
1068
|
-
def fetch_time(self, params={}):
|
|
1215
|
+
def fetch_time(self, params={}) -> Int:
|
|
1069
1216
|
"""
|
|
1070
1217
|
fetches the current integer timestamp in milliseconds from the exchange server
|
|
1071
|
-
|
|
1218
|
+
|
|
1219
|
+
https://docs.coinex.com/api/v2/common/http/time
|
|
1220
|
+
|
|
1072
1221
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1073
1222
|
:returns int: the current integer timestamp in milliseconds from the exchange server
|
|
1074
1223
|
"""
|
|
@@ -1088,8 +1237,10 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
1088
1237
|
def fetch_order_book(self, symbol: str, limit: Int = 20, params={}):
|
|
1089
1238
|
"""
|
|
1090
1239
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
|
1091
|
-
|
|
1092
|
-
|
|
1240
|
+
|
|
1241
|
+
https://docs.coinex.com/api/v2/spot/market/http/list-market-depth
|
|
1242
|
+
https://docs.coinex.com/api/v2/futures/market/http/list-market-depth
|
|
1243
|
+
|
|
1093
1244
|
:param str symbol: unified symbol of the market to fetch the order book for
|
|
1094
1245
|
:param int [limit]: the maximum amount of order book entries to return
|
|
1095
1246
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -1198,7 +1349,10 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
1198
1349
|
# "side": "buy",
|
|
1199
1350
|
# "order_id": 136915589622,
|
|
1200
1351
|
# "price": "64376",
|
|
1201
|
-
# "amount": "0.0001"
|
|
1352
|
+
# "amount": "0.0001",
|
|
1353
|
+
# "role": "taker",
|
|
1354
|
+
# "fee": "0.0299",
|
|
1355
|
+
# "fee_ccy": "USDT"
|
|
1202
1356
|
# }
|
|
1203
1357
|
#
|
|
1204
1358
|
timestamp = self.safe_integer(trade, 'created_at')
|
|
@@ -1207,6 +1361,15 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
1207
1361
|
defaultType = market['type']
|
|
1208
1362
|
marketId = self.safe_string(trade, 'market')
|
|
1209
1363
|
market = self.safe_market(marketId, market, None, defaultType)
|
|
1364
|
+
feeCostString = self.safe_string(trade, 'fee')
|
|
1365
|
+
fee = None
|
|
1366
|
+
if feeCostString is not None:
|
|
1367
|
+
feeCurrencyId = self.safe_string(trade, 'fee_ccy')
|
|
1368
|
+
feeCurrencyCode = self.safe_currency_code(feeCurrencyId)
|
|
1369
|
+
fee = {
|
|
1370
|
+
'cost': feeCostString,
|
|
1371
|
+
'currency': feeCurrencyCode,
|
|
1372
|
+
}
|
|
1210
1373
|
return self.safe_trade({
|
|
1211
1374
|
'info': trade,
|
|
1212
1375
|
'timestamp': timestamp,
|
|
@@ -1216,18 +1379,20 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
1216
1379
|
'order': self.safe_string(trade, 'order_id'),
|
|
1217
1380
|
'type': None,
|
|
1218
1381
|
'side': self.safe_string(trade, 'side'),
|
|
1219
|
-
'takerOrMaker':
|
|
1382
|
+
'takerOrMaker': self.safe_string(trade, 'role'),
|
|
1220
1383
|
'price': self.safe_string(trade, 'price'),
|
|
1221
1384
|
'amount': self.safe_string(trade, 'amount'),
|
|
1222
1385
|
'cost': self.safe_string(trade, 'deal_money'),
|
|
1223
|
-
'fee':
|
|
1386
|
+
'fee': fee,
|
|
1224
1387
|
}, market)
|
|
1225
1388
|
|
|
1226
1389
|
def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
|
1227
1390
|
"""
|
|
1228
1391
|
get the list of the most recent trades for a particular symbol
|
|
1229
|
-
|
|
1230
|
-
|
|
1392
|
+
|
|
1393
|
+
https://docs.coinex.com/api/v2/spot/market/http/list-market-deals
|
|
1394
|
+
https://docs.coinex.com/api/v2/futures/market/http/list-market-deals
|
|
1395
|
+
|
|
1231
1396
|
:param str symbol: unified symbol of the market to fetch trades for
|
|
1232
1397
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
|
1233
1398
|
:param int [limit]: the maximum amount of trades to fetch
|
|
@@ -1269,8 +1434,10 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
1269
1434
|
def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
|
|
1270
1435
|
"""
|
|
1271
1436
|
fetch the trading fees for a market
|
|
1272
|
-
|
|
1273
|
-
|
|
1437
|
+
|
|
1438
|
+
https://docs.coinex.com/api/v2/spot/market/http/list-market
|
|
1439
|
+
https://docs.coinex.com/api/v2/futures/market/http/list-market
|
|
1440
|
+
|
|
1274
1441
|
:param str symbol: unified market symbol
|
|
1275
1442
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1276
1443
|
:returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
|
|
@@ -1333,8 +1500,10 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
1333
1500
|
def fetch_trading_fees(self, params={}) -> TradingFees:
|
|
1334
1501
|
"""
|
|
1335
1502
|
fetch the trading fees for multiple markets
|
|
1336
|
-
|
|
1337
|
-
|
|
1503
|
+
|
|
1504
|
+
https://docs.coinex.com/api/v2/spot/market/http/list-market
|
|
1505
|
+
https://docs.coinex.com/api/v2/futures/market/http/list-market
|
|
1506
|
+
|
|
1338
1507
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1339
1508
|
:returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
|
|
1340
1509
|
"""
|
|
@@ -1434,8 +1603,10 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
1434
1603
|
def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
|
1435
1604
|
"""
|
|
1436
1605
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
1437
|
-
|
|
1438
|
-
|
|
1606
|
+
|
|
1607
|
+
https://docs.coinex.com/api/v2/spot/market/http/list-market-kline
|
|
1608
|
+
https://docs.coinex.com/api/v2/futures/market/http/list-market-kline
|
|
1609
|
+
|
|
1439
1610
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
|
1440
1611
|
:param str timeframe: the length of time each candle represents
|
|
1441
1612
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
|
@@ -1622,10 +1793,12 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
1622
1793
|
def fetch_balance(self, params={}) -> Balances:
|
|
1623
1794
|
"""
|
|
1624
1795
|
query for balance and get the amount of funds available for trading or funds locked in orders
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1796
|
+
|
|
1797
|
+
https://docs.coinex.com/api/v2/assets/balance/http/get-spot-balance # spot
|
|
1798
|
+
https://docs.coinex.com/api/v2/assets/balance/http/get-futures-balance # swap
|
|
1799
|
+
https://docs.coinex.com/api/v2/assets/balance/http/get-marigin-balance # margin
|
|
1800
|
+
https://docs.coinex.com/api/v2/assets/balance/http/get-financial-balance # financial
|
|
1801
|
+
|
|
1629
1802
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1630
1803
|
:param str [params.type]: 'margin', 'swap', 'financial', or 'spot'
|
|
1631
1804
|
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
|
@@ -1713,7 +1886,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
1713
1886
|
# "stop_id": 117180138153
|
|
1714
1887
|
# }
|
|
1715
1888
|
#
|
|
1716
|
-
# Swap createOrder, createOrders, editOrder, cancelOrders, cancelOrder, fetchOpenOrders, fetchClosedOrders
|
|
1889
|
+
# Swap createOrder, createOrders, editOrder, cancelOrders, cancelOrder, fetchOpenOrders, fetchClosedOrders, closePosition
|
|
1717
1890
|
#
|
|
1718
1891
|
# {
|
|
1719
1892
|
# "amount": "0.0001",
|
|
@@ -1901,7 +2074,6 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
1901
2074
|
'reduceOnly': None,
|
|
1902
2075
|
'side': side,
|
|
1903
2076
|
'price': self.safe_string(order, 'price'),
|
|
1904
|
-
'stopPrice': self.safe_string(order, 'trigger_price'),
|
|
1905
2077
|
'triggerPrice': self.safe_string(order, 'trigger_price'),
|
|
1906
2078
|
'takeProfitPrice': self.safe_number(order, 'take_profit_price'),
|
|
1907
2079
|
'stopLossPrice': self.safe_number(order, 'stop_loss_price'),
|
|
@@ -1921,8 +2093,10 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
1921
2093
|
def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}):
|
|
1922
2094
|
"""
|
|
1923
2095
|
create a market buy order by providing the symbol and cost
|
|
1924
|
-
|
|
1925
|
-
|
|
2096
|
+
|
|
2097
|
+
https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade003_market_order
|
|
2098
|
+
https://docs.coinex.com/api/v2/spot/order/http/put-order
|
|
2099
|
+
|
|
1926
2100
|
:param str symbol: unified symbol of the market to create an order in
|
|
1927
2101
|
:param float cost: how much you want to trade in units of the quote currency
|
|
1928
2102
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -1939,7 +2113,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
1939
2113
|
market = self.market(symbol)
|
|
1940
2114
|
swap = market['swap']
|
|
1941
2115
|
clientOrderId = self.safe_string_2(params, 'client_id', 'clientOrderId')
|
|
1942
|
-
|
|
2116
|
+
triggerPrice = self.safe_string_2(params, 'stopPrice', 'triggerPrice')
|
|
1943
2117
|
stopLossPrice = self.safe_string(params, 'stopLossPrice')
|
|
1944
2118
|
takeProfitPrice = self.safe_string(params, 'takeProfitPrice')
|
|
1945
2119
|
option = self.safe_string(params, 'option')
|
|
@@ -1984,8 +2158,8 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
1984
2158
|
request['take_profit_type'] = self.safe_string(params, 'stop_type', 'latest_price')
|
|
1985
2159
|
else:
|
|
1986
2160
|
request['amount'] = self.amount_to_precision(symbol, amount)
|
|
1987
|
-
if
|
|
1988
|
-
request['trigger_price'] = self.price_to_precision(symbol,
|
|
2161
|
+
if triggerPrice is not None:
|
|
2162
|
+
request['trigger_price'] = self.price_to_precision(symbol, triggerPrice)
|
|
1989
2163
|
request['trigger_price_type'] = self.safe_string(params, 'stop_type', 'latest_price')
|
|
1990
2164
|
else:
|
|
1991
2165
|
marginMode = None
|
|
@@ -2012,26 +2186,28 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
2012
2186
|
request['amount'] = self.cost_to_precision(symbol, amount)
|
|
2013
2187
|
else:
|
|
2014
2188
|
request['amount'] = self.amount_to_precision(symbol, amount)
|
|
2015
|
-
if
|
|
2016
|
-
request['trigger_price'] = self.price_to_precision(symbol,
|
|
2189
|
+
if triggerPrice is not None:
|
|
2190
|
+
request['trigger_price'] = self.price_to_precision(symbol, triggerPrice)
|
|
2017
2191
|
params = self.omit(params, ['reduceOnly', 'timeInForce', 'postOnly', 'stopPrice', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice'])
|
|
2018
2192
|
return self.extend(request, params)
|
|
2019
2193
|
|
|
2020
2194
|
def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
|
2021
2195
|
"""
|
|
2022
2196
|
create a trade order
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2197
|
+
|
|
2198
|
+
https://docs.coinex.com/api/v2/spot/order/http/put-order
|
|
2199
|
+
https://docs.coinex.com/api/v2/spot/order/http/put-stop-order
|
|
2200
|
+
https://docs.coinex.com/api/v2/futures/order/http/put-order
|
|
2201
|
+
https://docs.coinex.com/api/v2/futures/order/http/put-stop-order
|
|
2202
|
+
https://docs.coinex.com/api/v2/futures/position/http/close-position
|
|
2203
|
+
https://docs.coinex.com/api/v2/futures/position/http/set-position-stop-loss
|
|
2204
|
+
https://docs.coinex.com/api/v2/futures/position/http/set-position-take-profit
|
|
2205
|
+
|
|
2030
2206
|
:param str symbol: unified symbol of the market to create an order in
|
|
2031
2207
|
:param str type: 'market' or 'limit'
|
|
2032
2208
|
:param str side: 'buy' or 'sell'
|
|
2033
2209
|
:param float amount: how much you want to trade in units of the base currency
|
|
2034
|
-
:param float [price]: the price at which the order is to be
|
|
2210
|
+
:param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
2035
2211
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
2036
2212
|
:param float [params.triggerPrice]: price to trigger stop orders
|
|
2037
2213
|
:param float [params.stopLossPrice]: price to trigger stop loss orders
|
|
@@ -2256,10 +2432,12 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
2256
2432
|
def create_orders(self, orders: List[OrderRequest], params={}) -> List[Order]:
|
|
2257
2433
|
"""
|
|
2258
2434
|
create a list of trade orders(all orders should be of the same symbol)
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2435
|
+
|
|
2436
|
+
https://docs.coinex.com/api/v2/spot/order/http/put-multi-order
|
|
2437
|
+
https://docs.coinex.com/api/v2/spot/order/http/put-multi-stop-order
|
|
2438
|
+
https://docs.coinex.com/api/v2/futures/order/http/put-multi-order
|
|
2439
|
+
https://docs.coinex.com/api/v2/futures/order/http/put-multi-stop-order
|
|
2440
|
+
|
|
2263
2441
|
: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
|
|
2264
2442
|
:param dict [params]: extra parameters specific to the api endpoint
|
|
2265
2443
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
|
@@ -2441,10 +2619,12 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
2441
2619
|
def cancel_orders(self, ids, symbol: Str = None, params={}):
|
|
2442
2620
|
"""
|
|
2443
2621
|
cancel multiple orders
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2622
|
+
|
|
2623
|
+
https://docs.coinex.com/api/v2/spot/order/http/cancel-batch-order
|
|
2624
|
+
https://docs.coinex.com/api/v2/spot/order/http/cancel-batch-stop-order
|
|
2625
|
+
https://docs.coinex.com/api/v2/futures/order/http/cancel-batch-order
|
|
2626
|
+
https://docs.coinex.com/api/v2/futures/order/http/cancel-batch-stop-order
|
|
2627
|
+
|
|
2448
2628
|
:param str[] ids: order ids
|
|
2449
2629
|
:param str symbol: unified market symbol
|
|
2450
2630
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -2458,15 +2638,18 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
2458
2638
|
request: dict = {
|
|
2459
2639
|
'market': market['id'],
|
|
2460
2640
|
}
|
|
2461
|
-
|
|
2641
|
+
trigger = self.safe_bool_2(params, 'stop', 'trigger')
|
|
2462
2642
|
params = self.omit(params, ['stop', 'trigger'])
|
|
2463
2643
|
response = None
|
|
2464
|
-
|
|
2465
|
-
|
|
2644
|
+
requestIds = []
|
|
2645
|
+
for i in range(0, len(ids)):
|
|
2646
|
+
requestIds.append(int(ids[i]))
|
|
2647
|
+
if trigger:
|
|
2648
|
+
request['stop_ids'] = requestIds
|
|
2466
2649
|
else:
|
|
2467
|
-
request['order_ids'] =
|
|
2650
|
+
request['order_ids'] = requestIds
|
|
2468
2651
|
if market['spot']:
|
|
2469
|
-
if
|
|
2652
|
+
if trigger:
|
|
2470
2653
|
response = self.v2PrivatePostSpotCancelBatchStopOrder(self.extend(request, params))
|
|
2471
2654
|
#
|
|
2472
2655
|
# {
|
|
@@ -2535,7 +2718,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
2535
2718
|
#
|
|
2536
2719
|
else:
|
|
2537
2720
|
request['market_type'] = 'FUTURES'
|
|
2538
|
-
if
|
|
2721
|
+
if trigger:
|
|
2539
2722
|
response = self.v2PrivatePostFuturesCancelBatchStopOrder(self.extend(request, params))
|
|
2540
2723
|
#
|
|
2541
2724
|
# {
|
|
@@ -2612,16 +2795,18 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
2612
2795
|
def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
|
|
2613
2796
|
"""
|
|
2614
2797
|
edit a trade order
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2798
|
+
|
|
2799
|
+
https://docs.coinex.com/api/v2/spot/order/http/edit-order
|
|
2800
|
+
https://docs.coinex.com/api/v2/spot/order/http/edit-stop-order
|
|
2801
|
+
https://docs.coinex.com/api/v2/futures/order/http/edit-order
|
|
2802
|
+
https://docs.coinex.com/api/v2/futures/order/http/edit-stop-order
|
|
2803
|
+
|
|
2619
2804
|
:param str id: order id
|
|
2620
2805
|
:param str symbol: unified symbol of the market to create an order in
|
|
2621
2806
|
:param str type: 'market' or 'limit'
|
|
2622
2807
|
:param str side: 'buy' or 'sell'
|
|
2623
2808
|
:param float amount: how much of the currency you want to trade in units of the base currency
|
|
2624
|
-
:param float [price]: the price at which the order is to be
|
|
2809
|
+
:param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
2625
2810
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
2626
2811
|
:param float [params.triggerPrice]: the price to trigger stop orders
|
|
2627
2812
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
|
@@ -2745,14 +2930,16 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
2745
2930
|
def cancel_order(self, id: str, symbol: Str = None, params={}):
|
|
2746
2931
|
"""
|
|
2747
2932
|
cancels an open order
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2933
|
+
|
|
2934
|
+
https://docs.coinex.com/api/v2/spot/order/http/cancel-order
|
|
2935
|
+
https://docs.coinex.com/api/v2/spot/order/http/cancel-stop-order
|
|
2936
|
+
https://docs.coinex.com/api/v2/spot/order/http/cancel-order-by-client-id
|
|
2937
|
+
https://docs.coinex.com/api/v2/spot/order/http/cancel-stop-order-by-client-id
|
|
2938
|
+
https://docs.coinex.com/api/v2/futures/order/http/cancel-order
|
|
2939
|
+
https://docs.coinex.com/api/v2/futures/order/http/cancel-stop-order
|
|
2940
|
+
https://docs.coinex.com/api/v2/futures/order/http/cancel-order-by-client-id
|
|
2941
|
+
https://docs.coinex.com/api/v2/futures/order/http/cancel-stop-order-by-client-id
|
|
2942
|
+
|
|
2756
2943
|
:param str id: order id
|
|
2757
2944
|
:param str symbol: unified symbol of the market the order was made in
|
|
2758
2945
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -3026,8 +3213,10 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
3026
3213
|
def cancel_all_orders(self, symbol: Str = None, params={}):
|
|
3027
3214
|
"""
|
|
3028
3215
|
cancel all open orders in a market
|
|
3029
|
-
|
|
3030
|
-
|
|
3216
|
+
|
|
3217
|
+
https://docs.coinex.com/api/v2/spot/order/http/cancel-all-order
|
|
3218
|
+
https://docs.coinex.com/api/v2/futures/order/http/cancel-all-order
|
|
3219
|
+
|
|
3031
3220
|
:param str symbol: unified market symbol of the market to cancel orders in
|
|
3032
3221
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
3033
3222
|
:param str [params.marginMode]: 'cross' or 'isolated' for canceling spot margin orders
|
|
@@ -3067,8 +3256,11 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
3067
3256
|
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
|
3068
3257
|
"""
|
|
3069
3258
|
fetches information on an order made by the user
|
|
3070
|
-
|
|
3071
|
-
|
|
3259
|
+
|
|
3260
|
+
https://docs.coinex.com/api/v2/spot/order/http/get-order-status
|
|
3261
|
+
https://docs.coinex.com/api/v2/futures/order/http/get-order-status
|
|
3262
|
+
|
|
3263
|
+
:param str id: order id
|
|
3072
3264
|
:param str symbol: unified symbol of the market the order was made in
|
|
3073
3265
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
3074
3266
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
|
@@ -3151,13 +3343,17 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
3151
3343
|
def fetch_orders_by_status(self, status, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
|
3152
3344
|
"""
|
|
3153
3345
|
fetch a list of orders
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3346
|
+
|
|
3347
|
+
https://docs.coinex.com/api/v2/spot/order/http/list-finished-order
|
|
3348
|
+
https://docs.coinex.com/api/v2/spot/order/http/list-finished-stop-order
|
|
3349
|
+
https://docs.coinex.com/api/v2/futures/order/http/list-finished-order
|
|
3350
|
+
https://docs.coinex.com/api/v2/futures/order/http/list-finished-stop-order
|
|
3351
|
+
|
|
3352
|
+
:param str status: order status to fetch for
|
|
3158
3353
|
:param str symbol: unified market symbol of the market orders were made in
|
|
3159
3354
|
:param int [since]: the earliest time in ms to fetch orders for
|
|
3160
3355
|
:param int [limit]: the maximum number of order structures to retrieve
|
|
3356
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
3161
3357
|
:param boolean [params.trigger]: set to True for fetching trigger orders
|
|
3162
3358
|
:param str [params.marginMode]: 'cross' or 'isolated' for fetching spot margin orders
|
|
3163
3359
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
|
@@ -3170,7 +3366,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
3170
3366
|
request['market'] = market['id']
|
|
3171
3367
|
if limit is not None:
|
|
3172
3368
|
request['limit'] = limit
|
|
3173
|
-
|
|
3369
|
+
trigger = self.safe_bool_2(params, 'stop', 'trigger')
|
|
3174
3370
|
params = self.omit(params, ['stop', 'trigger'])
|
|
3175
3371
|
marketType = None
|
|
3176
3372
|
marketType, params = self.handle_market_type_and_params('fetchOrdersByStatus', market, params)
|
|
@@ -3180,7 +3376,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
3180
3376
|
if marketType == 'swap':
|
|
3181
3377
|
request['market_type'] = 'FUTURES'
|
|
3182
3378
|
if isClosed:
|
|
3183
|
-
if
|
|
3379
|
+
if trigger:
|
|
3184
3380
|
response = self.v2PrivateGetFuturesFinishedStopOrder(self.extend(request, params))
|
|
3185
3381
|
#
|
|
3186
3382
|
# {
|
|
@@ -3241,7 +3437,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
3241
3437
|
# }
|
|
3242
3438
|
#
|
|
3243
3439
|
elif isOpen:
|
|
3244
|
-
if
|
|
3440
|
+
if trigger:
|
|
3245
3441
|
response = self.v2PrivateGetFuturesPendingStopOrder(self.extend(request, params))
|
|
3246
3442
|
#
|
|
3247
3443
|
# {
|
|
@@ -3314,7 +3510,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
3314
3510
|
else:
|
|
3315
3511
|
request['market_type'] = 'SPOT'
|
|
3316
3512
|
if isClosed:
|
|
3317
|
-
if
|
|
3513
|
+
if trigger:
|
|
3318
3514
|
response = self.v2PrivateGetSpotFinishedStopOrder(self.extend(request, params))
|
|
3319
3515
|
#
|
|
3320
3516
|
# {
|
|
@@ -3378,7 +3574,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
3378
3574
|
# }
|
|
3379
3575
|
#
|
|
3380
3576
|
elif status == 'pending':
|
|
3381
|
-
if
|
|
3577
|
+
if trigger:
|
|
3382
3578
|
response = self.v2PrivateGetSpotPendingStopOrder(self.extend(request, params))
|
|
3383
3579
|
#
|
|
3384
3580
|
# {
|
|
@@ -3451,10 +3647,12 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
3451
3647
|
def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
|
3452
3648
|
"""
|
|
3453
3649
|
fetch all unfilled currently open orders
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3650
|
+
|
|
3651
|
+
https://docs.coinex.com/api/v2/spot/order/http/list-pending-order
|
|
3652
|
+
https://docs.coinex.com/api/v2/spot/order/http/list-pending-stop-order
|
|
3653
|
+
https://docs.coinex.com/api/v2/futures/order/http/list-pending-order
|
|
3654
|
+
https://docs.coinex.com/api/v2/futures/order/http/list-pending-stop-order
|
|
3655
|
+
|
|
3458
3656
|
:param str symbol: unified market symbol
|
|
3459
3657
|
:param int [since]: the earliest time in ms to fetch open orders for
|
|
3460
3658
|
:param int [limit]: the maximum number of open order structures to retrieve
|
|
@@ -3471,23 +3669,28 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
3471
3669
|
def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
|
3472
3670
|
"""
|
|
3473
3671
|
fetches information on multiple closed orders made by the user
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3672
|
+
|
|
3673
|
+
https://docs.coinex.com/api/v2/spot/order/http/list-finished-order
|
|
3674
|
+
https://docs.coinex.com/api/v2/spot/order/http/list-finished-stop-order
|
|
3675
|
+
https://docs.coinex.com/api/v2/futures/order/http/list-finished-order
|
|
3676
|
+
https://docs.coinex.com/api/v2/futures/order/http/list-finished-stop-order
|
|
3677
|
+
|
|
3478
3678
|
:param str symbol: unified market symbol of the market orders were made in
|
|
3479
3679
|
:param int [since]: the earliest time in ms to fetch orders for
|
|
3480
3680
|
:param int [limit]: the maximum number of order structures to retrieve
|
|
3681
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
3481
3682
|
:param boolean [params.trigger]: set to True for fetching trigger orders
|
|
3482
3683
|
:param str [params.marginMode]: 'cross' or 'isolated' for fetching spot margin orders
|
|
3483
3684
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
|
3484
3685
|
"""
|
|
3485
3686
|
return self.fetch_orders_by_status('finished', symbol, since, limit, params)
|
|
3486
3687
|
|
|
3487
|
-
def create_deposit_address(self, code: str, params={}):
|
|
3688
|
+
def create_deposit_address(self, code: str, params={}) -> DepositAddress:
|
|
3488
3689
|
"""
|
|
3489
3690
|
create a currency deposit address
|
|
3490
|
-
|
|
3691
|
+
|
|
3692
|
+
https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/update-deposit-address
|
|
3693
|
+
|
|
3491
3694
|
:param str code: unified currency code of the currency for the deposit address
|
|
3492
3695
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
3493
3696
|
:param str [params.network]: the blockchain network to create a deposit address on
|
|
@@ -3517,10 +3720,12 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
3517
3720
|
data = self.safe_dict(response, 'data', {})
|
|
3518
3721
|
return self.parse_deposit_address(data, currency)
|
|
3519
3722
|
|
|
3520
|
-
def fetch_deposit_address(self, code: str, params={}):
|
|
3723
|
+
def fetch_deposit_address(self, code: str, params={}) -> DepositAddress:
|
|
3521
3724
|
"""
|
|
3522
3725
|
fetch the deposit address for a currency associated with self account
|
|
3523
|
-
|
|
3726
|
+
|
|
3727
|
+
https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/get-deposit-address
|
|
3728
|
+
|
|
3524
3729
|
:param str code: unified currency code
|
|
3525
3730
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
3526
3731
|
:param str [params.network]: the blockchain network to create a deposit address on
|
|
@@ -3528,20 +3733,14 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
3528
3733
|
"""
|
|
3529
3734
|
self.load_markets()
|
|
3530
3735
|
currency = self.currency(code)
|
|
3531
|
-
networks = self.safe_dict(currency, 'networks', {})
|
|
3532
|
-
network = self.safe_string_2(params, 'network', 'chain')
|
|
3533
|
-
params = self.omit(params, 'network')
|
|
3534
|
-
networksKeys = list(networks.keys())
|
|
3535
|
-
numOfNetworks = len(networksKeys)
|
|
3536
|
-
if networks is not None and numOfNetworks > 1:
|
|
3537
|
-
if network is None:
|
|
3538
|
-
raise ArgumentsRequired(self.id + ' fetchDepositAddress() ' + code + ' requires a network parameter')
|
|
3539
|
-
if not (network in networks):
|
|
3540
|
-
raise ExchangeError(self.id + ' fetchDepositAddress() ' + network + ' network not supported for ' + code)
|
|
3541
3736
|
request: dict = {
|
|
3542
3737
|
'ccy': currency['id'],
|
|
3543
|
-
'chain': network,
|
|
3544
3738
|
}
|
|
3739
|
+
networkCode = None
|
|
3740
|
+
networkCode, params = self.handle_network_code_and_params(params)
|
|
3741
|
+
if networkCode is None:
|
|
3742
|
+
raise ArgumentsRequired(self.id + ' fetchDepositAddress() requires a "network" parameter')
|
|
3743
|
+
request['chain'] = self.network_code_to_id(networkCode) # required for on-chain, not required for inter-user transfer
|
|
3545
3744
|
response = self.v2PrivateGetAssetsDepositAddress(self.extend(request, params))
|
|
3546
3745
|
#
|
|
3547
3746
|
# {
|
|
@@ -3554,29 +3753,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
3554
3753
|
# }
|
|
3555
3754
|
#
|
|
3556
3755
|
data = self.safe_dict(response, 'data', {})
|
|
3557
|
-
|
|
3558
|
-
options = self.safe_dict(self.options, 'fetchDepositAddress', {})
|
|
3559
|
-
fillResponseFromRequest = self.safe_bool(options, 'fillResponseFromRequest', True)
|
|
3560
|
-
if fillResponseFromRequest:
|
|
3561
|
-
depositAddress['network'] = self.safe_network_code(network, currency)
|
|
3562
|
-
return depositAddress
|
|
3563
|
-
|
|
3564
|
-
def safe_network(self, networkId, currency: Currency = None):
|
|
3565
|
-
networks = self.safe_value(currency, 'networks', {})
|
|
3566
|
-
networksCodes = list(networks.keys())
|
|
3567
|
-
networksCodesLength = len(networksCodes)
|
|
3568
|
-
if networkId is None and networksCodesLength == 1:
|
|
3569
|
-
return networks[networksCodes[0]]
|
|
3570
|
-
return {
|
|
3571
|
-
'id': networkId,
|
|
3572
|
-
'network': None if (networkId is None) else networkId.upper(),
|
|
3573
|
-
}
|
|
3574
|
-
|
|
3575
|
-
def safe_network_code(self, networkId, currency: Currency = None):
|
|
3576
|
-
network = self.safe_network(networkId, currency)
|
|
3577
|
-
return network['network']
|
|
3756
|
+
return self.parse_deposit_address(data, currency)
|
|
3578
3757
|
|
|
3579
|
-
def parse_deposit_address(self, depositAddress, currency: Currency = None):
|
|
3758
|
+
def parse_deposit_address(self, depositAddress, currency: Currency = None) -> DepositAddress:
|
|
3580
3759
|
#
|
|
3581
3760
|
# {
|
|
3582
3761
|
# "address": "1P1JqozxioQwaqPwgMAQdNDYNyaVSqgARq",
|
|
@@ -3596,16 +3775,18 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
3596
3775
|
return {
|
|
3597
3776
|
'info': depositAddress,
|
|
3598
3777
|
'currency': self.safe_currency_code(None, currency),
|
|
3599
|
-
'address': address,
|
|
3600
|
-
'tag': tag,
|
|
3601
3778
|
'network': None,
|
|
3779
|
+
'address': address,
|
|
3780
|
+
'tag': self.safe_string(depositAddress, 'memo', tag),
|
|
3602
3781
|
}
|
|
3603
3782
|
|
|
3604
3783
|
def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
|
3605
3784
|
"""
|
|
3606
3785
|
fetch all trades made by the user
|
|
3607
|
-
|
|
3608
|
-
|
|
3786
|
+
|
|
3787
|
+
https://docs.coinex.com/api/v2/spot/deal/http/list-user-deals
|
|
3788
|
+
https://docs.coinex.com/api/v2/futures/deal/http/list-user-deals
|
|
3789
|
+
|
|
3609
3790
|
:param str symbol: unified market symbol
|
|
3610
3791
|
:param int [since]: the earliest time in ms to fetch trades for
|
|
3611
3792
|
:param int [limit]: the maximum number of trade structures to retrieve
|
|
@@ -3682,11 +3863,13 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
3682
3863
|
data = self.safe_list(response, 'data', [])
|
|
3683
3864
|
return self.parse_trades(data, market, since, limit)
|
|
3684
3865
|
|
|
3685
|
-
def fetch_positions(self, symbols: Strings = None, params={}):
|
|
3866
|
+
def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
|
3686
3867
|
"""
|
|
3687
3868
|
fetch all open positions
|
|
3688
|
-
|
|
3689
|
-
|
|
3869
|
+
|
|
3870
|
+
https://docs.coinex.com/api/v2/futures/position/http/list-pending-position
|
|
3871
|
+
https://docs.coinex.com/api/v2/futures/position/http/list-finished-position
|
|
3872
|
+
|
|
3690
3873
|
:param str[] [symbols]: list of unified market symbols
|
|
3691
3874
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
3692
3875
|
:param str [params.method]: the method to use 'v2PrivateGetFuturesPendingPosition' or 'v2PrivateGetFuturesFinishedPosition' default is 'v2PrivateGetFuturesPendingPosition'
|
|
@@ -3768,7 +3951,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
3768
3951
|
def fetch_position(self, symbol: str, params={}):
|
|
3769
3952
|
"""
|
|
3770
3953
|
fetch data on a single open contract trade position
|
|
3771
|
-
|
|
3954
|
+
|
|
3955
|
+
https://docs.coinex.com/api/v2/futures/position/http/list-pending-position
|
|
3956
|
+
|
|
3772
3957
|
:param str symbol: unified market symbol of the market the position is held in
|
|
3773
3958
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
3774
3959
|
:returns dict: a `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
|
@@ -3898,7 +4083,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
3898
4083
|
def set_margin_mode(self, marginMode: str, symbol: Str = None, params={}):
|
|
3899
4084
|
"""
|
|
3900
4085
|
set margin mode to 'cross' or 'isolated'
|
|
3901
|
-
|
|
4086
|
+
|
|
4087
|
+
https://docs.coinex.com/api/v2/futures/position/http/adjust-position-leverage
|
|
4088
|
+
|
|
3902
4089
|
:param str marginMode: 'cross' or 'isolated'
|
|
3903
4090
|
:param str symbol: unified market symbol
|
|
3904
4091
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -3938,9 +4125,11 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
3938
4125
|
# }
|
|
3939
4126
|
#
|
|
3940
4127
|
|
|
3941
|
-
def set_leverage(self, leverage:
|
|
4128
|
+
def set_leverage(self, leverage: int, symbol: Str = None, params={}):
|
|
3942
4129
|
"""
|
|
3943
|
-
|
|
4130
|
+
|
|
4131
|
+
https://docs.coinex.com/api/v2/futures/position/http/adjust-position-leverage
|
|
4132
|
+
|
|
3944
4133
|
set the level of leverage for a market
|
|
3945
4134
|
:param float leverage: the rate of leverage
|
|
3946
4135
|
:param str symbol: unified market symbol
|
|
@@ -3981,7 +4170,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
3981
4170
|
def fetch_leverage_tiers(self, symbols: Strings = None, params={}) -> LeverageTiers:
|
|
3982
4171
|
"""
|
|
3983
4172
|
retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
|
|
3984
|
-
|
|
4173
|
+
|
|
4174
|
+
https://docs.coinex.com/api/v2/futures/market/http/list-market-position-level
|
|
4175
|
+
|
|
3985
4176
|
:param str[]|None symbols: list of unified market symbols
|
|
3986
4177
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
3987
4178
|
:returns dict: a dictionary of `leverage tiers structures <https://docs.ccxt.com/#/?id=leverage-tiers-structure>`, indexed by market symbols
|
|
@@ -4031,6 +4222,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
4031
4222
|
maxNotional = self.safe_number(tier, 'amount')
|
|
4032
4223
|
tiers.append({
|
|
4033
4224
|
'tier': self.sum(i, 1),
|
|
4225
|
+
'symbol': self.safe_symbol(marketId, market, None, 'swap'),
|
|
4034
4226
|
'currency': market['base'] if market['linear'] else market['quote'],
|
|
4035
4227
|
'minNotional': minNotional,
|
|
4036
4228
|
'maxNotional': maxNotional,
|
|
@@ -4174,7 +4366,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
4174
4366
|
def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
|
4175
4367
|
"""
|
|
4176
4368
|
add margin
|
|
4177
|
-
|
|
4369
|
+
|
|
4370
|
+
https://docs.coinex.com/api/v2/futures/position/http/adjust-position-margin
|
|
4371
|
+
|
|
4178
4372
|
:param str symbol: unified market symbol
|
|
4179
4373
|
:param float amount: amount of margin to add
|
|
4180
4374
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -4185,7 +4379,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
4185
4379
|
def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
|
4186
4380
|
"""
|
|
4187
4381
|
remove margin from a position
|
|
4188
|
-
|
|
4382
|
+
|
|
4383
|
+
https://docs.coinex.com/api/v2/futures/position/http/adjust-position-margin
|
|
4384
|
+
|
|
4189
4385
|
:param str symbol: unified market symbol
|
|
4190
4386
|
:param float amount: the amount of margin to remove
|
|
4191
4387
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -4196,7 +4392,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
4196
4392
|
def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
|
4197
4393
|
"""
|
|
4198
4394
|
fetch the history of funding fee payments paid and received on self account
|
|
4199
|
-
|
|
4395
|
+
|
|
4396
|
+
https://docs.coinex.com/api/v2/futures/position/http/list-position-funding-history
|
|
4397
|
+
|
|
4200
4398
|
:param str symbol: unified market symbol
|
|
4201
4399
|
:param int [since]: the earliest time in ms to fetch funding history for
|
|
4202
4400
|
:param int [limit]: the maximum number of funding history structures to retrieve
|
|
@@ -4256,10 +4454,12 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
4256
4454
|
})
|
|
4257
4455
|
return result
|
|
4258
4456
|
|
|
4259
|
-
def fetch_funding_rate(self, symbol: str, params={}):
|
|
4457
|
+
def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
|
4260
4458
|
"""
|
|
4261
4459
|
fetch the current funding rate
|
|
4262
|
-
|
|
4460
|
+
|
|
4461
|
+
https://docs.coinex.com/api/v2/futures/market/http/list-market-funding-rate
|
|
4462
|
+
|
|
4263
4463
|
:param str symbol: unified market symbol
|
|
4264
4464
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
4265
4465
|
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
|
@@ -4294,9 +4494,21 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
4294
4494
|
first = self.safe_dict(data, 0, {})
|
|
4295
4495
|
return self.parse_funding_rate(first, market)
|
|
4296
4496
|
|
|
4297
|
-
def
|
|
4497
|
+
def fetch_funding_interval(self, symbol: str, params={}) -> FundingRate:
|
|
4498
|
+
"""
|
|
4499
|
+
fetch the current funding rate interval
|
|
4500
|
+
|
|
4501
|
+
https://docs.coinex.com/api/v2/futures/market/http/list-market-funding-rate
|
|
4502
|
+
|
|
4503
|
+
:param str symbol: unified market symbol
|
|
4504
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
4505
|
+
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
|
4506
|
+
"""
|
|
4507
|
+
return self.fetch_funding_rate(symbol, params)
|
|
4508
|
+
|
|
4509
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
|
4298
4510
|
#
|
|
4299
|
-
# fetchFundingRate, fetchFundingRates
|
|
4511
|
+
# fetchFundingRate, fetchFundingRates, fetchFundingInterval
|
|
4300
4512
|
#
|
|
4301
4513
|
# {
|
|
4302
4514
|
# "latest_funding_rate": "0",
|
|
@@ -4311,6 +4523,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
4311
4523
|
#
|
|
4312
4524
|
currentFundingTimestamp = self.safe_integer(contract, 'latest_funding_time')
|
|
4313
4525
|
futureFundingTimestamp = self.safe_integer(contract, 'next_funding_time')
|
|
4526
|
+
fundingTimeString = self.safe_string(contract, 'latest_funding_time')
|
|
4527
|
+
nextFundingTimeString = self.safe_string(contract, 'next_funding_time')
|
|
4528
|
+
millisecondsInterval = Precise.string_sub(nextFundingTimeString, fundingTimeString)
|
|
4314
4529
|
marketId = self.safe_string(contract, 'market')
|
|
4315
4530
|
return {
|
|
4316
4531
|
'info': contract,
|
|
@@ -4330,12 +4545,25 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
4330
4545
|
'previousFundingRate': None,
|
|
4331
4546
|
'previousFundingTimestamp': None,
|
|
4332
4547
|
'previousFundingDatetime': None,
|
|
4548
|
+
'interval': self.parse_funding_interval(millisecondsInterval),
|
|
4333
4549
|
}
|
|
4334
4550
|
|
|
4335
|
-
def
|
|
4551
|
+
def parse_funding_interval(self, interval):
|
|
4552
|
+
intervals: dict = {
|
|
4553
|
+
'3600000': '1h',
|
|
4554
|
+
'14400000': '4h',
|
|
4555
|
+
'28800000': '8h',
|
|
4556
|
+
'57600000': '16h',
|
|
4557
|
+
'86400000': '24h',
|
|
4558
|
+
}
|
|
4559
|
+
return self.safe_string(intervals, interval, interval)
|
|
4560
|
+
|
|
4561
|
+
def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
|
4336
4562
|
"""
|
|
4337
|
-
fetch the current funding rates
|
|
4338
|
-
|
|
4563
|
+
fetch the current funding rates for multiple markets
|
|
4564
|
+
|
|
4565
|
+
https://docs.coinex.com/api/v2/futures/market/http/list-market-funding-rate
|
|
4566
|
+
|
|
4339
4567
|
:param str[] symbols: unified market symbols
|
|
4340
4568
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
4341
4569
|
:returns dict[]: an array of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
|
@@ -4371,17 +4599,18 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
4371
4599
|
# }
|
|
4372
4600
|
#
|
|
4373
4601
|
data = self.safe_list(response, 'data', [])
|
|
4374
|
-
|
|
4375
|
-
return self.filter_by_array(result, 'symbol', symbols)
|
|
4602
|
+
return self.parse_funding_rates(data, symbols)
|
|
4376
4603
|
|
|
4377
|
-
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
|
4604
|
+
def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
|
|
4378
4605
|
"""
|
|
4379
4606
|
make a withdrawal
|
|
4380
|
-
|
|
4607
|
+
|
|
4608
|
+
https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/withdrawal
|
|
4609
|
+
|
|
4381
4610
|
:param str code: unified currency code
|
|
4382
4611
|
:param float amount: the amount to withdraw
|
|
4383
4612
|
:param str address: the address to withdraw to
|
|
4384
|
-
:param str tag:
|
|
4613
|
+
:param str [tag]: memo
|
|
4385
4614
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
4386
4615
|
:param str [params.network]: unified network code
|
|
4387
4616
|
:returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
|
|
@@ -4390,15 +4619,15 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
4390
4619
|
self.check_address(address)
|
|
4391
4620
|
self.load_markets()
|
|
4392
4621
|
currency = self.currency(code)
|
|
4393
|
-
networkCode = self.safe_string_upper_2(params, 'network', 'chain')
|
|
4394
|
-
params = self.omit(params, 'network')
|
|
4395
|
-
if tag:
|
|
4396
|
-
address = address + ':' + tag
|
|
4397
4622
|
request: dict = {
|
|
4398
4623
|
'ccy': currency['id'],
|
|
4399
4624
|
'to_address': address, # must be authorized, inter-user transfer by a registered mobile phone number or an email address is supported
|
|
4400
|
-
'amount': self.
|
|
4625
|
+
'amount': self.currency_to_precision(code, amount), # the actual amount without fees, https://www.coinex.com/fees
|
|
4401
4626
|
}
|
|
4627
|
+
if tag is not None:
|
|
4628
|
+
request['memo'] = tag
|
|
4629
|
+
networkCode = None
|
|
4630
|
+
networkCode, params = self.handle_network_code_and_params(params)
|
|
4402
4631
|
if networkCode is not None:
|
|
4403
4632
|
request['chain'] = self.network_code_to_id(networkCode) # required for on-chain, not required for inter-user transfer
|
|
4404
4633
|
response = self.v2PrivatePostAssetsWithdraw(self.extend(request, params))
|
|
@@ -4435,11 +4664,13 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
4435
4664
|
statuses: dict = {
|
|
4436
4665
|
'audit': 'pending',
|
|
4437
4666
|
'pass': 'pending',
|
|
4667
|
+
'audit_required': 'pending',
|
|
4438
4668
|
'processing': 'pending',
|
|
4439
4669
|
'confirming': 'pending',
|
|
4440
4670
|
'not_pass': 'failed',
|
|
4441
4671
|
'cancel': 'canceled',
|
|
4442
4672
|
'finish': 'ok',
|
|
4673
|
+
'finished': 'ok',
|
|
4443
4674
|
'fail': 'failed',
|
|
4444
4675
|
}
|
|
4445
4676
|
return self.safe_string(statuses, status, status)
|
|
@@ -4447,7 +4678,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
4447
4678
|
def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
|
4448
4679
|
"""
|
|
4449
4680
|
fetches historical funding rate prices
|
|
4450
|
-
|
|
4681
|
+
|
|
4682
|
+
https://docs.coinex.com/api/v2/futures/market/http/list-market-funding-rate-history
|
|
4683
|
+
|
|
4451
4684
|
:param str symbol: unified symbol of the market to fetch the funding rate history for
|
|
4452
4685
|
:param int [since]: timestamp in ms of the earliest funding rate to fetch
|
|
4453
4686
|
:param int [limit]: the maximum amount of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>` to fetch
|
|
@@ -4609,7 +4842,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
4609
4842
|
def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
|
|
4610
4843
|
"""
|
|
4611
4844
|
transfer currency internally between wallets on the same account
|
|
4612
|
-
|
|
4845
|
+
|
|
4846
|
+
https://docs.coinex.com/api/v2/assets/transfer/http/transfer
|
|
4847
|
+
|
|
4613
4848
|
:param str code: unified currency code
|
|
4614
4849
|
:param float amount: amount to transfer
|
|
4615
4850
|
:param str fromAccount: account to transfer from
|
|
@@ -4621,7 +4856,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
4621
4856
|
self.load_markets()
|
|
4622
4857
|
currency = self.currency(code)
|
|
4623
4858
|
amountToPrecision = self.currency_to_precision(code, amount)
|
|
4624
|
-
accountsByType = self.safe_dict(self.options, '
|
|
4859
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType', {})
|
|
4625
4860
|
fromId = self.safe_string(accountsByType, fromAccount, fromAccount)
|
|
4626
4861
|
toId = self.safe_string(accountsByType, toAccount, toAccount)
|
|
4627
4862
|
request: dict = {
|
|
@@ -4679,10 +4914,12 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
4679
4914
|
'status': self.parse_transfer_status(self.safe_string_2(transfer, 'code', 'status')),
|
|
4680
4915
|
}
|
|
4681
4916
|
|
|
4682
|
-
def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) ->
|
|
4917
|
+
def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[TransferEntry]:
|
|
4683
4918
|
"""
|
|
4684
4919
|
fetch a history of internal transfers made on an account
|
|
4685
|
-
|
|
4920
|
+
|
|
4921
|
+
https://docs.coinex.com/api/v2/assets/transfer/http/list-transfer-history
|
|
4922
|
+
|
|
4686
4923
|
:param str code: unified currency code of the currency transferred
|
|
4687
4924
|
:param int [since]: the earliest time in ms to fetch transfers for
|
|
4688
4925
|
:param int [limit]: the maximum number of transfer structures to retrieve
|
|
@@ -4735,7 +4972,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
4735
4972
|
def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
|
4736
4973
|
"""
|
|
4737
4974
|
fetch all withdrawals made from an account
|
|
4738
|
-
|
|
4975
|
+
|
|
4976
|
+
https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/list-withdrawal-history
|
|
4977
|
+
|
|
4739
4978
|
:param str [code]: unified currency code
|
|
4740
4979
|
:param int [since]: the earliest time in ms to fetch withdrawals for
|
|
4741
4980
|
:param int [limit]: the maximum number of withdrawal structures to retrieve
|
|
@@ -4789,7 +5028,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
4789
5028
|
def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
|
4790
5029
|
"""
|
|
4791
5030
|
fetch all deposits made to an account
|
|
4792
|
-
|
|
5031
|
+
|
|
5032
|
+
https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/list-deposit-history
|
|
5033
|
+
|
|
4793
5034
|
:param str [code]: unified currency code
|
|
4794
5035
|
:param int [since]: the earliest time in ms to fetch deposits for
|
|
4795
5036
|
:param int [limit]: the maximum number of deposit structures to retrieve
|
|
@@ -4837,7 +5078,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
4837
5078
|
data = self.safe_list(response, 'data', [])
|
|
4838
5079
|
return self.parse_transactions(data, currency, since, limit)
|
|
4839
5080
|
|
|
4840
|
-
def parse_isolated_borrow_rate(self, info, market: Market = None) -> IsolatedBorrowRate:
|
|
5081
|
+
def parse_isolated_borrow_rate(self, info: dict, market: Market = None) -> IsolatedBorrowRate:
|
|
4841
5082
|
#
|
|
4842
5083
|
# {
|
|
4843
5084
|
# "market": "BTCUSDT",
|
|
@@ -4873,7 +5114,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
4873
5114
|
def fetch_isolated_borrow_rate(self, symbol: str, params={}) -> IsolatedBorrowRate:
|
|
4874
5115
|
"""
|
|
4875
5116
|
fetch the rate of interest to borrow a currency for margin trading
|
|
4876
|
-
|
|
5117
|
+
|
|
5118
|
+
https://docs.coinex.com/api/v2/assets/loan-flat/http/list-margin-interest-limit
|
|
5119
|
+
|
|
4877
5120
|
:param str symbol: unified symbol of the market to fetch the borrow rate for
|
|
4878
5121
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
4879
5122
|
:param str params['code']: unified currency code
|
|
@@ -4908,10 +5151,12 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
4908
5151
|
data = self.safe_dict(response, 'data', {})
|
|
4909
5152
|
return self.parse_isolated_borrow_rate(data, market)
|
|
4910
5153
|
|
|
4911
|
-
def fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
|
5154
|
+
def fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[BorrowInterest]:
|
|
4912
5155
|
"""
|
|
4913
5156
|
fetch the interest owed by the user for borrowing currency for margin trading
|
|
4914
|
-
|
|
5157
|
+
|
|
5158
|
+
https://docs.coinex.com/api/v2/assets/loan-flat/http/list-margin-borrow-history
|
|
5159
|
+
|
|
4915
5160
|
:param str [code]: unified currency code
|
|
4916
5161
|
:param str [symbol]: unified market symbol when fetch interest in isolated markets
|
|
4917
5162
|
:param int [since]: the earliest time in ms to fetch borrrow interest for
|
|
@@ -4956,7 +5201,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
4956
5201
|
interest = self.parse_borrow_interests(rows, market)
|
|
4957
5202
|
return self.filter_by_currency_since_limit(interest, code, since, limit)
|
|
4958
5203
|
|
|
4959
|
-
def parse_borrow_interest(self, info: dict, market: Market = None):
|
|
5204
|
+
def parse_borrow_interest(self, info: dict, market: Market = None) -> BorrowInterest:
|
|
4960
5205
|
#
|
|
4961
5206
|
# {
|
|
4962
5207
|
# "borrow_id": 2642934,
|
|
@@ -4975,23 +5220,23 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
4975
5220
|
market = self.safe_market(marketId, market, None, 'spot')
|
|
4976
5221
|
timestamp = self.safe_integer(info, 'expired_at')
|
|
4977
5222
|
return {
|
|
4978
|
-
'
|
|
5223
|
+
'info': info,
|
|
4979
5224
|
'symbol': market['symbol'],
|
|
4980
|
-
'marginMode': 'isolated',
|
|
4981
|
-
'marginType': None, # deprecated
|
|
4982
5225
|
'currency': self.safe_currency_code(self.safe_string(info, 'ccy')),
|
|
4983
5226
|
'interest': self.safe_number(info, 'to_repaied_amount'),
|
|
4984
5227
|
'interestRate': self.safe_number(info, 'daily_interest_rate'),
|
|
4985
5228
|
'amountBorrowed': self.safe_number(info, 'borrow_amount'),
|
|
5229
|
+
'marginMode': 'isolated',
|
|
4986
5230
|
'timestamp': timestamp, # expiry time
|
|
4987
5231
|
'datetime': self.iso8601(timestamp),
|
|
4988
|
-
'info': info,
|
|
4989
5232
|
}
|
|
4990
5233
|
|
|
4991
5234
|
def borrow_isolated_margin(self, symbol: str, code: str, amount: float, params={}):
|
|
4992
5235
|
"""
|
|
4993
5236
|
create a loan to borrow margin
|
|
4994
|
-
|
|
5237
|
+
|
|
5238
|
+
https://docs.coinex.com/api/v2/assets/loan-flat/http/margin-borrow
|
|
5239
|
+
|
|
4995
5240
|
:param str symbol: unified market symbol, required for coinex
|
|
4996
5241
|
:param str code: unified currency code of the currency to borrow
|
|
4997
5242
|
:param float amount: the amount to borrow
|
|
@@ -5037,7 +5282,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
5037
5282
|
def repay_isolated_margin(self, symbol: str, code: str, amount, params={}):
|
|
5038
5283
|
"""
|
|
5039
5284
|
repay borrowed margin and interest
|
|
5040
|
-
|
|
5285
|
+
|
|
5286
|
+
https://docs.coinex.com/api/v2/assets/loan-flat/http/margin-repay
|
|
5287
|
+
|
|
5041
5288
|
:param str symbol: unified market symbol, required for coinex
|
|
5042
5289
|
:param str code: unified currency code of the currency to repay
|
|
5043
5290
|
:param float amount: the amount to repay
|
|
@@ -5097,7 +5344,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
5097
5344
|
def fetch_deposit_withdraw_fee(self, code: str, params={}):
|
|
5098
5345
|
"""
|
|
5099
5346
|
fetch the fee for deposits and withdrawals
|
|
5100
|
-
|
|
5347
|
+
|
|
5348
|
+
https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/get-deposit-withdrawal-config
|
|
5349
|
+
|
|
5101
5350
|
:param str code: unified currency code
|
|
5102
5351
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
5103
5352
|
:returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
|
|
@@ -5144,6 +5393,66 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
5144
5393
|
data = self.safe_dict(response, 'data', {})
|
|
5145
5394
|
return self.parse_deposit_withdraw_fee(data, currency)
|
|
5146
5395
|
|
|
5396
|
+
def fetch_deposit_withdraw_fees(self, codes: Strings = None, params={}):
|
|
5397
|
+
"""
|
|
5398
|
+
fetch the fees for deposits and withdrawals
|
|
5399
|
+
|
|
5400
|
+
https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/list-all-deposit-withdrawal-config
|
|
5401
|
+
|
|
5402
|
+
@param codes
|
|
5403
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
5404
|
+
:returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>`
|
|
5405
|
+
"""
|
|
5406
|
+
self.load_markets()
|
|
5407
|
+
response = self.v2PublicGetAssetsAllDepositWithdrawConfig(params)
|
|
5408
|
+
#
|
|
5409
|
+
# {
|
|
5410
|
+
# "code": 0,
|
|
5411
|
+
# "data": [
|
|
5412
|
+
# {
|
|
5413
|
+
# "asset": {
|
|
5414
|
+
# "ccy": "CET",
|
|
5415
|
+
# "deposit_enabled": True,
|
|
5416
|
+
# "withdraw_enabled": True,
|
|
5417
|
+
# "inter_transfer_enabled": True,
|
|
5418
|
+
# "is_st": False
|
|
5419
|
+
# },
|
|
5420
|
+
# "chains": [
|
|
5421
|
+
# {
|
|
5422
|
+
# "chain": "CSC",
|
|
5423
|
+
# "min_deposit_amount": "0.8",
|
|
5424
|
+
# "min_withdraw_amount": "8",
|
|
5425
|
+
# "deposit_enabled": True,
|
|
5426
|
+
# "withdraw_enabled": True,
|
|
5427
|
+
# "deposit_delay_minutes": 0,
|
|
5428
|
+
# "safe_confirmations": 10,
|
|
5429
|
+
# "irreversible_confirmations": 20,
|
|
5430
|
+
# "deflation_rate": "0",
|
|
5431
|
+
# "withdrawal_fee": "0.026",
|
|
5432
|
+
# "withdrawal_precision": 8,
|
|
5433
|
+
# "memo": "",
|
|
5434
|
+
# "is_memo_required_for_deposit": False,
|
|
5435
|
+
# "explorer_asset_url": ""
|
|
5436
|
+
# },
|
|
5437
|
+
# ]
|
|
5438
|
+
# }
|
|
5439
|
+
# ],
|
|
5440
|
+
# "message": "OK"
|
|
5441
|
+
# }
|
|
5442
|
+
#
|
|
5443
|
+
data = self.safe_list(response, 'data', [])
|
|
5444
|
+
result: dict = {}
|
|
5445
|
+
for i in range(0, len(data)):
|
|
5446
|
+
item = data[i]
|
|
5447
|
+
asset = self.safe_dict(item, 'asset', {})
|
|
5448
|
+
currencyId = self.safe_string(asset, 'ccy')
|
|
5449
|
+
if currencyId is None:
|
|
5450
|
+
continue
|
|
5451
|
+
code = self.safe_currency_code(currencyId)
|
|
5452
|
+
if codes is None or self.in_array(code, codes):
|
|
5453
|
+
result[code] = self.parse_deposit_withdraw_fee(item)
|
|
5454
|
+
return result
|
|
5455
|
+
|
|
5147
5456
|
def parse_deposit_withdraw_fee(self, fee, currency: Currency = None):
|
|
5148
5457
|
#
|
|
5149
5458
|
# {
|
|
@@ -5212,7 +5521,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
5212
5521
|
def fetch_leverage(self, symbol: str, params={}) -> Leverage:
|
|
5213
5522
|
"""
|
|
5214
5523
|
fetch the set leverage for a market
|
|
5215
|
-
|
|
5524
|
+
|
|
5525
|
+
https://docs.coinex.com/api/v2/assets/loan-flat/http/list-margin-interest-limit
|
|
5526
|
+
|
|
5216
5527
|
:param str symbol: unified market symbol
|
|
5217
5528
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
5218
5529
|
:param str params['code']: unified currency code
|
|
@@ -5268,10 +5579,12 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
5268
5579
|
'shortLeverage': leverageValue,
|
|
5269
5580
|
}
|
|
5270
5581
|
|
|
5271
|
-
def fetch_position_history(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> Position:
|
|
5582
|
+
def fetch_position_history(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Position]:
|
|
5272
5583
|
"""
|
|
5273
5584
|
fetches historical positions
|
|
5274
|
-
|
|
5585
|
+
|
|
5586
|
+
https://docs.coinex.com/api/v2/futures/position/http/list-finished-position
|
|
5587
|
+
|
|
5275
5588
|
:param str symbol: unified contract symbol
|
|
5276
5589
|
:param int [since]: the earliest time in ms to fetch positions for
|
|
5277
5590
|
:param int [limit]: the maximum amount of records to fetch, default is 10
|
|
@@ -5338,9 +5651,68 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
5338
5651
|
positions = self.parse_positions(records)
|
|
5339
5652
|
return self.filter_by_symbol_since_limit(positions, symbol, since, limit)
|
|
5340
5653
|
|
|
5654
|
+
def close_position(self, symbol: str, side: OrderSide = None, params={}) -> Order:
|
|
5655
|
+
"""
|
|
5656
|
+
closes an open position for a market
|
|
5657
|
+
|
|
5658
|
+
https://docs.coinex.com/api/v2/futures/position/http/close-position
|
|
5659
|
+
|
|
5660
|
+
:param str symbol: unified CCXT market symbol
|
|
5661
|
+
:param str [side]: buy or sell, not used by coinex
|
|
5662
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
5663
|
+
:param str params['type']: required by coinex, one of: limit, market, maker_only, ioc or fok, default is *market*
|
|
5664
|
+
:param str [params.price]: the price to fulfill the order, ignored in market orders
|
|
5665
|
+
:param str [params.amount]: the amount to trade in units of the base currency
|
|
5666
|
+
:param str [params.clientOrderId]: the client id of the order
|
|
5667
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
|
5668
|
+
"""
|
|
5669
|
+
self.load_markets()
|
|
5670
|
+
market = self.market(symbol)
|
|
5671
|
+
type = self.safe_string(params, 'type', 'market')
|
|
5672
|
+
request: dict = {
|
|
5673
|
+
'market': market['id'],
|
|
5674
|
+
'market_type': 'FUTURES',
|
|
5675
|
+
'type': type,
|
|
5676
|
+
}
|
|
5677
|
+
clientOrderId = self.safe_string_2(params, 'client_id', 'clientOrderId')
|
|
5678
|
+
if clientOrderId is not None:
|
|
5679
|
+
request['client_id'] = clientOrderId
|
|
5680
|
+
params = self.omit(params, 'clientOrderId')
|
|
5681
|
+
response = self.v2PrivatePostFuturesClosePosition(self.extend(request, params))
|
|
5682
|
+
#
|
|
5683
|
+
# {
|
|
5684
|
+
# "code": 0,
|
|
5685
|
+
# "data": {
|
|
5686
|
+
# "amount": "0.0001",
|
|
5687
|
+
# "client_id": "",
|
|
5688
|
+
# "created_at": 1729666043969,
|
|
5689
|
+
# "fee": "0.00335858",
|
|
5690
|
+
# "fee_ccy": "USDT",
|
|
5691
|
+
# "filled_amount": "0.0001",
|
|
5692
|
+
# "filled_value": "6.717179",
|
|
5693
|
+
# "last_filled_amount": "0.0001",
|
|
5694
|
+
# "last_filled_price": "67171.79",
|
|
5695
|
+
# "maker_fee_rate": "0",
|
|
5696
|
+
# "market": "BTCUSDT",
|
|
5697
|
+
# "market_type": "FUTURES",
|
|
5698
|
+
# "order_id": 155477479761,
|
|
5699
|
+
# "price": "0",
|
|
5700
|
+
# "realized_pnl": "-0.001823",
|
|
5701
|
+
# "side": "sell",
|
|
5702
|
+
# "taker_fee_rate": "0.0005",
|
|
5703
|
+
# "type": "market",
|
|
5704
|
+
# "unfilled_amount": "0",
|
|
5705
|
+
# "updated_at": 1729666043969
|
|
5706
|
+
# },
|
|
5707
|
+
# "message": "OK"
|
|
5708
|
+
# }
|
|
5709
|
+
#
|
|
5710
|
+
data = self.safe_dict(response, 'data', {})
|
|
5711
|
+
return self.parse_order(data, market)
|
|
5712
|
+
|
|
5341
5713
|
def handle_margin_mode_and_params(self, methodName, params={}, defaultValue=None):
|
|
5342
5714
|
"""
|
|
5343
|
-
|
|
5715
|
+
@ignore
|
|
5344
5716
|
marginMode specified by params["marginMode"], self.options["marginMode"], self.options["defaultMarginMode"], params["margin"] = True or self.options["defaultType"] = 'margin'
|
|
5345
5717
|
:param dict params: extra parameters specific to the exchange api endpoint
|
|
5346
5718
|
:returns Array: the marginMode in lowercase
|
|
@@ -5466,7 +5838,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
|
5466
5838
|
def fetch_margin_adjustment_history(self, symbol: Str = None, type: Str = None, since: Num = None, limit: Num = None, params={}) -> List[MarginModification]:
|
|
5467
5839
|
"""
|
|
5468
5840
|
fetches the history of margin added or reduced from contract isolated positions
|
|
5469
|
-
|
|
5841
|
+
|
|
5842
|
+
https://docs.coinex.com/api/v2/futures/position/http/list-position-margin-history
|
|
5843
|
+
|
|
5470
5844
|
:param str symbol: unified market symbol
|
|
5471
5845
|
:param str [type]: not used by coinex fetchMarginAdjustmentHistory
|
|
5472
5846
|
:param int [since]: timestamp in ms of the earliest change to fetch
|