ccxt-ir 4.3.46.0.3__py2.py3-none-any.whl → 4.5.0__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ccxt/__init__.py +39 -35
- ccxt/abantether.py +8 -8
- ccxt/abstract/alpaca.py +4 -0
- ccxt/abstract/apex.py +31 -0
- ccxt/abstract/bigone.py +1 -1
- ccxt/abstract/binance.py +106 -48
- ccxt/abstract/binancecoinm.py +106 -48
- ccxt/abstract/binanceus.py +141 -83
- ccxt/abstract/binanceusdm.py +106 -48
- ccxt/abstract/bingx.py +50 -1
- ccxt/abstract/bitbank.py +5 -0
- ccxt/abstract/bitfinex.py +136 -65
- ccxt/abstract/bitflyer.py +1 -0
- ccxt/abstract/bitget.py +67 -0
- ccxt/abstract/bitmart.py +19 -1
- ccxt/abstract/bitopro.py +1 -0
- ccxt/abstract/bitrue.py +68 -68
- ccxt/abstract/bitstamp.py +1 -0
- ccxt/abstract/blofin.py +30 -0
- ccxt/abstract/btcbox.py +2 -0
- ccxt/abstract/bybit.py +28 -13
- ccxt/abstract/cex.py +28 -29
- ccxt/abstract/coinbaseexchange.py +1 -0
- ccxt/abstract/coinbaseinternational.py +1 -1
- ccxt/abstract/cryptocom.py +16 -0
- ccxt/abstract/cryptomus.py +20 -0
- ccxt/abstract/defx.py +69 -0
- ccxt/abstract/deribit.py +1 -0
- ccxt/abstract/derive.py +117 -0
- ccxt/abstract/digifinex.py +1 -0
- ccxt/abstract/ellipx.py +25 -0
- ccxt/abstract/foxbit.py +26 -0
- ccxt/abstract/gate.py +19 -0
- ccxt/abstract/gateio.py +19 -0
- ccxt/abstract/gemini.py +1 -0
- ccxt/abstract/hibachi.py +26 -0
- ccxt/abstract/hyperliquid.py +1 -1
- ccxt/abstract/independentreserve.py +6 -0
- ccxt/abstract/kraken.py +1 -0
- ccxt/abstract/krakenfutures.py +4 -0
- ccxt/abstract/kucoin.py +10 -0
- ccxt/abstract/kucoinfutures.py +18 -0
- ccxt/abstract/lbank.py +2 -1
- ccxt/abstract/luno.py +1 -0
- ccxt/abstract/mexc.py +2 -0
- ccxt/abstract/modetrade.py +119 -0
- ccxt/abstract/myokx.py +349 -0
- ccxt/abstract/oceanex.py +5 -0
- ccxt/abstract/okx.py +25 -0
- ccxt/abstract/okxus.py +349 -0
- ccxt/abstract/onetrading.py +0 -12
- ccxt/abstract/paradex.py +23 -0
- ccxt/abstract/phemex.py +2 -0
- ccxt/abstract/poloniex.py +36 -0
- ccxt/abstract/tradeogre.py +3 -1
- ccxt/abstract/upbit.py +51 -34
- ccxt/abstract/whitebit.py +16 -0
- ccxt/abstract/woo.py +64 -6
- ccxt/abstract/xt.py +10 -5
- ccxt/afratether.py +7 -7
- ccxt/alpaca.py +828 -51
- ccxt/apex.py +1875 -0
- ccxt/arzinja.py +7 -7
- ccxt/arzplus.py +9 -9
- ccxt/ascendex.py +501 -306
- ccxt/async_support/__init__.py +39 -35
- ccxt/async_support/abantether.py +8 -8
- ccxt/async_support/afratether.py +9 -9
- ccxt/async_support/alpaca.py +828 -51
- ccxt/async_support/apex.py +1875 -0
- ccxt/async_support/arzinja.py +10 -10
- ccxt/async_support/arzplus.py +12 -12
- ccxt/async_support/ascendex.py +502 -306
- ccxt/async_support/base/exchange.py +303 -89
- ccxt/async_support/base/ws/cache.py +9 -3
- ccxt/async_support/base/ws/client.py +173 -38
- ccxt/async_support/base/ws/future.py +25 -37
- ccxt/async_support/bequant.py +5 -3
- ccxt/async_support/bigone.py +279 -144
- ccxt/async_support/binance.py +2347 -1158
- ccxt/async_support/binancecoinm.py +9 -3
- ccxt/async_support/binanceus.py +17 -3
- ccxt/async_support/binanceusdm.py +9 -4
- ccxt/async_support/bingx.py +2962 -920
- ccxt/async_support/bit2c.py +147 -27
- ccxt/async_support/bitbank.py +151 -23
- ccxt/async_support/bitbns.py +104 -30
- ccxt/async_support/bitfinex.py +3291 -1113
- ccxt/async_support/bitflyer.py +202 -27
- ccxt/async_support/bitget.py +3683 -1538
- ccxt/async_support/bithumb.py +195 -38
- ccxt/async_support/bitimen.py +12 -12
- ccxt/async_support/bitir.py +38 -38
- ccxt/async_support/bitmart.py +1288 -350
- ccxt/async_support/bitmex.py +260 -75
- ccxt/async_support/bitopro.py +262 -62
- ccxt/async_support/bitpin.py +17 -16
- ccxt/async_support/bitrue.py +459 -290
- ccxt/async_support/bitso.py +199 -54
- ccxt/async_support/bitstamp.py +230 -96
- ccxt/async_support/bitteam.py +167 -25
- ccxt/async_support/{huobijp.py → bittrade.py} +158 -30
- ccxt/async_support/bitvavo.py +213 -49
- ccxt/async_support/blockchaincom.py +160 -46
- ccxt/async_support/blofin.py +502 -120
- ccxt/async_support/btcalpha.py +169 -31
- ccxt/async_support/btcbox.py +292 -23
- ccxt/async_support/btcmarkets.py +211 -58
- ccxt/async_support/btcturk.py +161 -38
- ccxt/async_support/bybit.py +1775 -1030
- ccxt/async_support/cex.py +1440 -1303
- ccxt/async_support/coinbase.py +724 -212
- ccxt/async_support/coinbaseadvanced.py +2 -1
- ccxt/async_support/coinbaseexchange.py +388 -89
- ccxt/async_support/coinbaseinternational.py +412 -57
- ccxt/async_support/coincatch.py +177 -78
- ccxt/async_support/coincheck.py +135 -19
- ccxt/async_support/coinex.py +606 -232
- ccxt/async_support/coinmate.py +189 -63
- ccxt/async_support/coinmetro.py +195 -54
- ccxt/async_support/coinone.py +158 -51
- ccxt/async_support/coinsph.py +336 -61
- ccxt/async_support/coinspot.py +151 -52
- ccxt/async_support/cryptocom.py +661 -111
- ccxt/async_support/cryptomus.py +1137 -0
- ccxt/async_support/defx.py +2071 -0
- ccxt/async_support/delta.py +299 -99
- ccxt/async_support/deribit.py +348 -126
- ccxt/async_support/derive.py +2572 -0
- ccxt/async_support/digifinex.py +430 -214
- ccxt/async_support/ellipx.py +2029 -0
- ccxt/async_support/eterex.py +10 -10
- ccxt/async_support/excoino.py +31 -31
- ccxt/async_support/exir.py +14 -14
- ccxt/async_support/exmo.py +344 -131
- ccxt/async_support/exnovin.py +10 -10
- ccxt/async_support/farhadexchange.py +12 -12
- ccxt/async_support/fmfwio.py +2 -1
- ccxt/async_support/foxbit.py +1935 -0
- ccxt/async_support/gate.py +1351 -529
- ccxt/async_support/gateio.py +2 -1
- ccxt/async_support/gemini.py +144 -39
- ccxt/async_support/hashkey.py +152 -109
- ccxt/async_support/hibachi.py +2080 -0
- ccxt/async_support/hitbtc.py +395 -167
- ccxt/async_support/hitobit.py +12 -12
- ccxt/async_support/hollaex.py +307 -119
- ccxt/async_support/htx.py +851 -383
- ccxt/async_support/huobi.py +2 -1
- ccxt/async_support/hyperliquid.py +1848 -536
- ccxt/async_support/independentreserve.py +288 -15
- ccxt/async_support/indodax.py +190 -33
- ccxt/async_support/jibitex.py +12 -12
- ccxt/async_support/kraken.py +795 -351
- ccxt/async_support/krakenfutures.py +214 -62
- ccxt/async_support/kucoin.py +715 -396
- ccxt/async_support/kucoinfutures.py +652 -89
- ccxt/async_support/latoken.py +217 -113
- ccxt/async_support/lbank.py +425 -97
- ccxt/async_support/luno.py +382 -35
- ccxt/async_support/mercado.py +113 -6
- ccxt/async_support/mexc.py +874 -437
- ccxt/async_support/modetrade.py +2818 -0
- ccxt/async_support/myokx.py +54 -0
- ccxt/async_support/ndax.py +221 -64
- ccxt/async_support/nobitex.py +31 -37
- ccxt/async_support/novadax.py +190 -34
- ccxt/async_support/oceanex.py +217 -28
- ccxt/async_support/okcoin.py +253 -145
- ccxt/async_support/okexchange.py +11 -11
- ccxt/async_support/okx.py +1088 -351
- ccxt/async_support/okxus.py +54 -0
- ccxt/async_support/ompfinex.py +25 -24
- ccxt/async_support/onetrading.py +213 -392
- ccxt/async_support/oxfun.py +245 -166
- ccxt/async_support/p2b.py +151 -29
- ccxt/async_support/paradex.py +562 -49
- ccxt/async_support/paymium.py +82 -19
- ccxt/async_support/phemex.py +713 -172
- ccxt/async_support/poloniex.py +1602 -283
- ccxt/async_support/probit.py +224 -95
- ccxt/async_support/ramzinex.py +30 -27
- ccxt/async_support/sarmayex.py +9 -9
- ccxt/async_support/sarrafex.py +13 -13
- ccxt/async_support/tabdeal.py +14 -13
- ccxt/async_support/tetherland.py +9 -9
- ccxt/async_support/timex.py +210 -51
- ccxt/async_support/tokocrypto.py +167 -47
- ccxt/async_support/tradeogre.py +266 -31
- ccxt/async_support/twox.py +9 -9
- ccxt/async_support/ubitex.py +12 -12
- ccxt/async_support/upbit.py +568 -165
- ccxt/async_support/vertex.py +160 -32
- ccxt/async_support/wallex.py +12 -12
- ccxt/async_support/wavesexchange.py +165 -30
- ccxt/async_support/whitebit.py +975 -127
- ccxt/async_support/woo.py +1918 -1016
- ccxt/async_support/woofipro.py +433 -141
- ccxt/async_support/xt.py +649 -193
- ccxt/async_support/yobit.py +195 -70
- ccxt/async_support/zaif.py +91 -15
- ccxt/async_support/zonda.py +151 -36
- ccxt/base/decimal_to_precision.py +14 -10
- ccxt/base/errors.py +49 -18
- ccxt/base/exchange.py +1556 -450
- ccxt/base/precise.py +10 -0
- ccxt/base/types.py +114 -6
- ccxt/bequant.py +5 -3
- ccxt/bigone.py +279 -144
- ccxt/binance.py +2347 -1158
- ccxt/binancecoinm.py +9 -3
- ccxt/binanceus.py +17 -3
- ccxt/binanceusdm.py +9 -4
- ccxt/bingx.py +2962 -920
- ccxt/bit2c.py +147 -27
- ccxt/bitbank.py +151 -23
- ccxt/bitbns.py +104 -30
- ccxt/bitfinex.py +3290 -1113
- ccxt/bitflyer.py +202 -27
- ccxt/bitget.py +3683 -1538
- ccxt/bithumb.py +194 -38
- ccxt/bitimen.py +9 -9
- ccxt/bitir.py +35 -35
- ccxt/bitmart.py +1288 -350
- ccxt/bitmex.py +260 -75
- ccxt/bitopro.py +262 -62
- ccxt/bitpin.py +15 -14
- ccxt/bitrue.py +459 -290
- ccxt/bitso.py +199 -54
- ccxt/bitstamp.py +230 -96
- ccxt/bitteam.py +167 -25
- ccxt/{huobijp.py → bittrade.py} +158 -30
- ccxt/bitvavo.py +213 -49
- ccxt/blockchaincom.py +160 -46
- ccxt/blofin.py +502 -120
- ccxt/btcalpha.py +169 -31
- ccxt/btcbox.py +291 -23
- ccxt/btcmarkets.py +211 -58
- ccxt/btcturk.py +161 -38
- ccxt/bybit.py +1775 -1030
- ccxt/cex.py +1439 -1303
- ccxt/coinbase.py +724 -212
- ccxt/coinbaseadvanced.py +2 -1
- ccxt/coinbaseexchange.py +388 -89
- ccxt/coinbaseinternational.py +412 -57
- ccxt/coincatch.py +177 -78
- ccxt/coincheck.py +135 -19
- ccxt/coinex.py +606 -232
- ccxt/coinmate.py +189 -63
- ccxt/coinmetro.py +194 -54
- ccxt/coinone.py +158 -51
- ccxt/coinsph.py +336 -61
- ccxt/coinspot.py +151 -52
- ccxt/cryptocom.py +661 -111
- ccxt/cryptomus.py +1137 -0
- ccxt/defx.py +2070 -0
- ccxt/delta.py +299 -99
- ccxt/deribit.py +348 -126
- ccxt/derive.py +2571 -0
- ccxt/digifinex.py +430 -214
- ccxt/ellipx.py +2029 -0
- ccxt/eterex.py +7 -7
- ccxt/excoino.py +29 -29
- ccxt/exir.py +11 -11
- ccxt/exmo.py +343 -131
- ccxt/exnovin.py +8 -8
- ccxt/farhadexchange.py +10 -10
- ccxt/fmfwio.py +2 -1
- ccxt/foxbit.py +1935 -0
- ccxt/gate.py +1351 -529
- ccxt/gateio.py +2 -1
- ccxt/gemini.py +144 -39
- ccxt/hashkey.py +152 -109
- ccxt/hibachi.py +2079 -0
- ccxt/hitbtc.py +395 -167
- ccxt/hitobit.py +9 -9
- ccxt/hollaex.py +307 -119
- ccxt/htx.py +851 -383
- ccxt/huobi.py +2 -1
- ccxt/hyperliquid.py +1848 -536
- ccxt/independentreserve.py +287 -15
- ccxt/indodax.py +190 -33
- ccxt/jibitex.py +9 -9
- ccxt/kraken.py +794 -351
- ccxt/krakenfutures.py +214 -62
- ccxt/kucoin.py +715 -396
- ccxt/kucoinfutures.py +652 -89
- ccxt/latoken.py +217 -113
- ccxt/lbank.py +425 -97
- ccxt/luno.py +382 -35
- ccxt/mercado.py +113 -6
- ccxt/mexc.py +873 -437
- ccxt/modetrade.py +2818 -0
- ccxt/myokx.py +54 -0
- ccxt/ndax.py +221 -64
- ccxt/nobitex.py +29 -35
- ccxt/novadax.py +190 -34
- ccxt/oceanex.py +217 -28
- ccxt/okcoin.py +253 -145
- ccxt/okexchange.py +9 -9
- ccxt/okx.py +1088 -351
- ccxt/okxus.py +54 -0
- ccxt/ompfinex.py +22 -21
- ccxt/onetrading.py +213 -392
- ccxt/oxfun.py +245 -166
- ccxt/p2b.py +151 -29
- ccxt/paradex.py +562 -49
- ccxt/paymium.py +82 -19
- ccxt/phemex.py +712 -172
- ccxt/poloniex.py +1601 -283
- ccxt/pro/__init__.py +76 -17
- ccxt/pro/alpaca.py +21 -6
- ccxt/pro/apex.py +984 -0
- ccxt/pro/ascendex.py +58 -10
- ccxt/pro/bequant.py +6 -1
- ccxt/pro/binance.py +728 -156
- ccxt/pro/binancecoinm.py +6 -2
- ccxt/pro/binanceus.py +8 -4
- ccxt/pro/binanceusdm.py +7 -2
- ccxt/pro/bingx.py +333 -142
- ccxt/pro/bitfinex.py +727 -262
- ccxt/pro/bitget.py +570 -79
- ccxt/pro/bithumb.py +20 -6
- ccxt/pro/bitmart.py +216 -87
- ccxt/pro/bitmex.py +47 -9
- ccxt/pro/bitopro.py +26 -14
- ccxt/pro/bitrue.py +22 -22
- ccxt/pro/bitstamp.py +54 -21
- ccxt/pro/{huobijp.py → bittrade.py} +7 -6
- ccxt/pro/bitvavo.py +191 -67
- ccxt/pro/blockchaincom.py +21 -8
- ccxt/pro/blofin.py +9 -1
- ccxt/pro/bybit.py +632 -245
- ccxt/pro/cex.py +59 -24
- ccxt/pro/coinbase.py +102 -73
- ccxt/pro/coinbaseadvanced.py +2 -1
- ccxt/pro/coinbaseexchange.py +8 -8
- ccxt/pro/coinbaseinternational.py +181 -25
- ccxt/pro/coincatch.py +6 -7
- ccxt/pro/coincheck.py +11 -6
- ccxt/pro/coinex.py +967 -665
- ccxt/pro/coinone.py +16 -9
- ccxt/pro/cryptocom.py +448 -45
- ccxt/pro/defx.py +831 -0
- ccxt/pro/deribit.py +150 -14
- ccxt/pro/derive.py +704 -0
- ccxt/pro/exmo.py +239 -6
- ccxt/pro/gate.py +623 -65
- ccxt/pro/gateio.py +2 -1
- ccxt/pro/gemini.py +27 -11
- ccxt/pro/hashkey.py +2 -2
- ccxt/pro/hitbtc.py +196 -91
- ccxt/pro/hollaex.py +23 -7
- ccxt/pro/htx.py +51 -14
- ccxt/pro/huobi.py +2 -1
- ccxt/pro/hyperliquid.py +591 -27
- ccxt/pro/independentreserve.py +9 -6
- ccxt/pro/kraken.py +640 -320
- ccxt/pro/krakenfutures.py +62 -35
- ccxt/pro/kucoin.py +267 -46
- ccxt/pro/kucoinfutures.py +165 -21
- ccxt/pro/lbank.py +102 -21
- ccxt/pro/luno.py +12 -8
- ccxt/pro/mexc.py +877 -111
- ccxt/pro/modetrade.py +1271 -0
- ccxt/pro/myokx.py +38 -0
- ccxt/pro/ndax.py +15 -2
- ccxt/pro/okcoin.py +23 -4
- ccxt/pro/okx.py +573 -98
- ccxt/pro/okxus.py +38 -0
- ccxt/pro/onetrading.py +30 -13
- ccxt/pro/oxfun.py +131 -27
- ccxt/pro/p2b.py +88 -22
- ccxt/pro/paradex.py +3 -3
- ccxt/pro/phemex.py +75 -21
- ccxt/pro/poloniex.py +124 -41
- ccxt/pro/probit.py +87 -80
- ccxt/pro/tradeogre.py +272 -0
- ccxt/pro/upbit.py +152 -12
- ccxt/pro/vertex.py +8 -3
- ccxt/pro/whitebit.py +58 -5
- ccxt/pro/woo.py +228 -37
- ccxt/pro/woofipro.py +106 -18
- ccxt/pro/xt.py +111 -5
- ccxt/probit.py +224 -95
- ccxt/protobuf/__init__.py +0 -0
- ccxt/protobuf/mexc/PrivateAccountV3Api_pb2.py +37 -0
- ccxt/protobuf/mexc/PrivateDealsV3Api_pb2.py +37 -0
- ccxt/protobuf/mexc/PrivateOrdersV3Api_pb2.py +37 -0
- ccxt/protobuf/mexc/PublicAggreBookTickerV3Api_pb2.py +37 -0
- ccxt/protobuf/mexc/PublicAggreDealsV3Api_pb2.py +39 -0
- ccxt/protobuf/mexc/PublicAggreDepthsV3Api_pb2.py +39 -0
- ccxt/protobuf/mexc/PublicBookTickerBatchV3Api_pb2.py +38 -0
- ccxt/protobuf/mexc/PublicBookTickerV3Api_pb2.py +37 -0
- ccxt/protobuf/mexc/PublicDealsV3Api_pb2.py +39 -0
- ccxt/protobuf/mexc/PublicIncreaseDepthsBatchV3Api_pb2.py +38 -0
- ccxt/protobuf/mexc/PublicIncreaseDepthsV3Api_pb2.py +39 -0
- ccxt/protobuf/mexc/PublicLimitDepthsV3Api_pb2.py +39 -0
- ccxt/protobuf/mexc/PublicMiniTickerV3Api_pb2.py +37 -0
- ccxt/protobuf/mexc/PublicMiniTickersV3Api_pb2.py +38 -0
- ccxt/protobuf/mexc/PublicSpotKlineV3Api_pb2.py +37 -0
- ccxt/protobuf/mexc/PushDataV3ApiWrapper_pb2.py +52 -0
- ccxt/protobuf/mexc/__init__.py +0 -0
- ccxt/ramzinex.py +28 -25
- ccxt/sarmayex.py +7 -7
- ccxt/sarrafex.py +10 -10
- ccxt/static_dependencies/__init__.py +1 -1
- ccxt/static_dependencies/lark/py.typed +0 -0
- ccxt/static_dependencies/marshmallow/py.typed +0 -0
- ccxt/static_dependencies/marshmallow_dataclass/py.typed +0 -0
- ccxt/static_dependencies/marshmallow_oneofschema/py.typed +0 -0
- ccxt/tabdeal.py +12 -11
- ccxt/test/tests_async.py +261 -57
- ccxt/test/tests_helpers.py +1 -3
- ccxt/test/tests_init.py +4 -3
- ccxt/test/tests_sync.py +261 -57
- ccxt/tetherland.py +7 -7
- ccxt/timex.py +210 -51
- ccxt/tokocrypto.py +167 -47
- ccxt/tradeogre.py +266 -31
- ccxt/twox.py +7 -7
- ccxt/ubitex.py +9 -9
- ccxt/upbit.py +568 -165
- ccxt/vertex.py +160 -32
- ccxt/wallex.py +9 -9
- ccxt/wavesexchange.py +165 -30
- ccxt/whitebit.py +975 -127
- ccxt/woo.py +1917 -1016
- ccxt/woofipro.py +432 -141
- ccxt/xt.py +649 -193
- ccxt/yobit.py +194 -70
- ccxt/zaif.py +91 -15
- ccxt/zonda.py +151 -36
- {ccxt_ir-4.3.46.0.3.dist-info → ccxt_ir-4.5.0.dist-info}/METADATA +225 -73
- ccxt_ir-4.5.0.dist-info/RECORD +743 -0
- {ccxt_ir-4.3.46.0.3.dist-info → ccxt_ir-4.5.0.dist-info}/WHEEL +1 -1
- ccxt/__test__.py +0 -7
- ccxt/abstract/ace.py +0 -15
- ccxt/abstract/bitbay.py +0 -53
- ccxt/abstract/bitcoincom.py +0 -115
- ccxt/abstract/bitfinex2.py +0 -139
- ccxt/abstract/bitpanda.py +0 -35
- ccxt/abstract/bl3p.py +0 -19
- ccxt/abstract/coinlist.py +0 -54
- ccxt/abstract/currencycom.py +0 -68
- ccxt/abstract/hitbtc3.py +0 -115
- ccxt/abstract/idex.py +0 -26
- ccxt/abstract/kuna.py +0 -182
- ccxt/abstract/lykke.py +0 -29
- ccxt/abstract/poloniexfutures.py +0 -48
- ccxt/abstract/wazirx.py +0 -30
- ccxt/ace.py +0 -1012
- ccxt/async_support/ace.py +0 -1012
- ccxt/async_support/base/ws/aiohttp_client.py +0 -125
- ccxt/async_support/base/ws/fast_client.py +0 -96
- ccxt/async_support/bitbay.py +0 -17
- ccxt/async_support/bitcoincom.py +0 -17
- ccxt/async_support/bitfinex2.py +0 -3552
- ccxt/async_support/bitpanda.py +0 -16
- ccxt/async_support/bl3p.py +0 -485
- ccxt/async_support/coinlist.py +0 -2243
- ccxt/async_support/currencycom.py +0 -1950
- ccxt/async_support/hitbtc3.py +0 -16
- ccxt/async_support/idex.py +0 -1766
- ccxt/async_support/kuna.py +0 -1841
- ccxt/async_support/lykke.py +0 -1270
- ccxt/async_support/poloniexfutures.py +0 -1717
- ccxt/async_support/wazirx.py +0 -1224
- ccxt/bitbay.py +0 -17
- ccxt/bitcoincom.py +0 -17
- ccxt/bitfinex2.py +0 -3552
- ccxt/bitpanda.py +0 -16
- ccxt/bl3p.py +0 -485
- ccxt/coinlist.py +0 -2243
- ccxt/currencycom.py +0 -1950
- ccxt/hitbtc3.py +0 -16
- ccxt/idex.py +0 -1766
- ccxt/kuna.py +0 -1841
- ccxt/lykke.py +0 -1270
- ccxt/poloniexfutures.py +0 -1717
- ccxt/pro/bitcoincom.py +0 -34
- ccxt/pro/bitfinex2.py +0 -1083
- ccxt/pro/bitpanda.py +0 -15
- ccxt/pro/currencycom.py +0 -536
- ccxt/pro/idex.py +0 -672
- ccxt/pro/poloniexfutures.py +0 -990
- ccxt/pro/wazirx.py +0 -749
- ccxt/test/base/__init__.py +0 -29
- ccxt/test/base/test_account.py +0 -26
- ccxt/test/base/test_balance.py +0 -56
- ccxt/test/base/test_borrow_interest.py +0 -35
- ccxt/test/base/test_borrow_rate.py +0 -32
- ccxt/test/base/test_calculate_fee.py +0 -51
- ccxt/test/base/test_crypto.py +0 -127
- ccxt/test/base/test_currency.py +0 -76
- ccxt/test/base/test_datetime.py +0 -109
- ccxt/test/base/test_decimal_to_precision.py +0 -392
- ccxt/test/base/test_deep_extend.py +0 -68
- ccxt/test/base/test_deposit_withdrawal.py +0 -50
- ccxt/test/base/test_exchange_datetime_functions.py +0 -76
- ccxt/test/base/test_funding_rate_history.py +0 -29
- ccxt/test/base/test_last_price.py +0 -31
- ccxt/test/base/test_ledger_entry.py +0 -45
- ccxt/test/base/test_ledger_item.py +0 -48
- ccxt/test/base/test_leverage_tier.py +0 -33
- ccxt/test/base/test_liquidation.py +0 -50
- ccxt/test/base/test_margin_mode.py +0 -24
- ccxt/test/base/test_margin_modification.py +0 -35
- ccxt/test/base/test_market.py +0 -193
- ccxt/test/base/test_number.py +0 -411
- ccxt/test/base/test_ohlcv.py +0 -33
- ccxt/test/base/test_open_interest.py +0 -32
- ccxt/test/base/test_order.py +0 -64
- ccxt/test/base/test_order_book.py +0 -69
- ccxt/test/base/test_position.py +0 -60
- ccxt/test/base/test_shared_methods.py +0 -353
- ccxt/test/base/test_status.py +0 -24
- ccxt/test/base/test_throttle.py +0 -126
- ccxt/test/base/test_ticker.py +0 -92
- ccxt/test/base/test_trade.py +0 -47
- ccxt/test/base/test_trading_fee.py +0 -26
- ccxt/test/base/test_transaction.py +0 -39
- ccxt/test/test_async.py +0 -1649
- ccxt/test/test_sync.py +0 -1648
- ccxt/wazirx.py +0 -1224
- ccxt_ir-4.3.46.0.3.dist-info/RECORD +0 -773
- /ccxt/abstract/{huobijp.py → bittrade.py} +0 -0
- {ccxt_ir-4.3.46.0.3.dist-info → ccxt_ir-4.5.0.dist-info/licenses}/LICENSE.txt +0 -0
- {ccxt_ir-4.3.46.0.3.dist-info → ccxt_ir-4.5.0.dist-info}/top_level.txt +0 -0
ccxt/async_support/cryptocom.py
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.cryptocom import ImplicitAPI
|
|
8
8
|
import hashlib
|
|
9
|
-
|
|
9
|
+
import math
|
|
10
|
+
from ccxt.base.types import Account, Any, Balances, Currencies, Currency, DepositAddress, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFeeInterface, TradingFees, Transaction
|
|
10
11
|
from typing import List
|
|
11
12
|
from ccxt.base.errors import ExchangeError
|
|
12
13
|
from ccxt.base.errors import AuthenticationError
|
|
@@ -17,17 +18,20 @@ from ccxt.base.errors import BadRequest
|
|
|
17
18
|
from ccxt.base.errors import BadSymbol
|
|
18
19
|
from ccxt.base.errors import InsufficientFunds
|
|
19
20
|
from ccxt.base.errors import InvalidOrder
|
|
21
|
+
from ccxt.base.errors import OrderNotFound
|
|
20
22
|
from ccxt.base.errors import NotSupported
|
|
21
23
|
from ccxt.base.errors import DDoSProtection
|
|
24
|
+
from ccxt.base.errors import RateLimitExceeded
|
|
22
25
|
from ccxt.base.errors import OnMaintenance
|
|
23
26
|
from ccxt.base.errors import InvalidNonce
|
|
27
|
+
from ccxt.base.errors import RequestTimeout
|
|
24
28
|
from ccxt.base.decimal_to_precision import TICK_SIZE
|
|
25
29
|
from ccxt.base.precise import Precise
|
|
26
30
|
|
|
27
31
|
|
|
28
32
|
class cryptocom(Exchange, ImplicitAPI):
|
|
29
33
|
|
|
30
|
-
def describe(self):
|
|
34
|
+
def describe(self) -> Any:
|
|
31
35
|
return self.deep_extend(super(cryptocom, self).describe(), {
|
|
32
36
|
'id': 'cryptocom',
|
|
33
37
|
'name': 'Crypto.com',
|
|
@@ -55,6 +59,9 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
55
59
|
'createMarketSellOrderWithCost': False,
|
|
56
60
|
'createOrder': True,
|
|
57
61
|
'createOrders': True,
|
|
62
|
+
'createStopOrder': True,
|
|
63
|
+
'createTriggerOrder': True,
|
|
64
|
+
'editOrder': True,
|
|
58
65
|
'fetchAccounts': True,
|
|
59
66
|
'fetchBalance': True,
|
|
60
67
|
'fetchBidsAsks': False,
|
|
@@ -64,15 +71,16 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
64
71
|
'fetchClosedOrders': 'emulated',
|
|
65
72
|
'fetchCrossBorrowRate': False,
|
|
66
73
|
'fetchCrossBorrowRates': False,
|
|
67
|
-
'fetchCurrencies':
|
|
74
|
+
'fetchCurrencies': True,
|
|
68
75
|
'fetchDepositAddress': True,
|
|
76
|
+
'fetchDepositAddresses': False,
|
|
69
77
|
'fetchDepositAddressesByNetwork': True,
|
|
70
78
|
'fetchDeposits': True,
|
|
71
79
|
'fetchDepositsWithdrawals': False,
|
|
72
80
|
'fetchDepositWithdrawFee': 'emulated',
|
|
73
81
|
'fetchDepositWithdrawFees': True,
|
|
74
82
|
'fetchFundingHistory': False,
|
|
75
|
-
'fetchFundingRate':
|
|
83
|
+
'fetchFundingRate': True,
|
|
76
84
|
'fetchFundingRateHistory': True,
|
|
77
85
|
'fetchFundingRates': False,
|
|
78
86
|
'fetchGreeks': False,
|
|
@@ -106,8 +114,8 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
106
114
|
'fetchTickers': True,
|
|
107
115
|
'fetchTime': False,
|
|
108
116
|
'fetchTrades': True,
|
|
109
|
-
'fetchTradingFee':
|
|
110
|
-
'fetchTradingFees':
|
|
117
|
+
'fetchTradingFee': True,
|
|
118
|
+
'fetchTradingFees': True,
|
|
111
119
|
'fetchTransactionFees': False,
|
|
112
120
|
'fetchTransactions': False,
|
|
113
121
|
'fetchTransfers': False,
|
|
@@ -146,6 +154,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
146
154
|
'derivatives': 'https://uat-api.3ona.co/v2',
|
|
147
155
|
},
|
|
148
156
|
'api': {
|
|
157
|
+
'base': 'https://api.crypto.com',
|
|
149
158
|
'v1': 'https://api.crypto.com/exchange/v1',
|
|
150
159
|
'v2': 'https://api.crypto.com/v2',
|
|
151
160
|
'derivatives': 'https://deriv-api.crypto.com/v1',
|
|
@@ -153,7 +162,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
153
162
|
'www': 'https://crypto.com/',
|
|
154
163
|
'referral': {
|
|
155
164
|
'url': 'https://crypto.com/exch/kdacthrnxt',
|
|
156
|
-
'discount': 0.
|
|
165
|
+
'discount': 0.75,
|
|
157
166
|
},
|
|
158
167
|
'doc': [
|
|
159
168
|
'https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html',
|
|
@@ -163,6 +172,13 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
163
172
|
'fees': 'https://crypto.com/exchange/document/fees-limits',
|
|
164
173
|
},
|
|
165
174
|
'api': {
|
|
175
|
+
'base': {
|
|
176
|
+
'public': {
|
|
177
|
+
'get': {
|
|
178
|
+
'v1/public/get-announcements': 1, # no description of rate limit
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
},
|
|
166
182
|
'v1': {
|
|
167
183
|
'public': {
|
|
168
184
|
'get': {
|
|
@@ -175,6 +191,10 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
175
191
|
'public/get-valuations': 1,
|
|
176
192
|
'public/get-expired-settlement-price': 10 / 3,
|
|
177
193
|
'public/get-insurance': 1,
|
|
194
|
+
'public/get-risk-parameters': 1,
|
|
195
|
+
},
|
|
196
|
+
'post': {
|
|
197
|
+
'public/staking/get-conversion-rate': 2,
|
|
178
198
|
},
|
|
179
199
|
},
|
|
180
200
|
'private': {
|
|
@@ -185,6 +205,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
185
205
|
'private/user-balance-history': 10 / 3,
|
|
186
206
|
'private/get-positions': 10 / 3,
|
|
187
207
|
'private/create-order': 2 / 3,
|
|
208
|
+
'private/amend-order': 4 / 3, # no description of rate limit
|
|
188
209
|
'private/create-order-list': 10 / 3,
|
|
189
210
|
'private/cancel-order': 2 / 3,
|
|
190
211
|
'private/cancel-order-list': 10 / 3,
|
|
@@ -205,6 +226,18 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
205
226
|
'private/get-accounts': 10 / 3,
|
|
206
227
|
'private/get-withdrawal-history': 10 / 3,
|
|
207
228
|
'private/get-deposit-history': 10 / 3,
|
|
229
|
+
'private/get-fee-rate': 2,
|
|
230
|
+
'private/get-instrument-fee-rate': 2,
|
|
231
|
+
'private/staking/stake': 2,
|
|
232
|
+
'private/staking/unstake': 2,
|
|
233
|
+
'private/staking/get-staking-position': 2,
|
|
234
|
+
'private/staking/get-staking-instruments': 2,
|
|
235
|
+
'private/staking/get-open-stake': 2,
|
|
236
|
+
'private/staking/get-stake-history': 2,
|
|
237
|
+
'private/staking/get-reward-history': 2,
|
|
238
|
+
'private/staking/convert': 2,
|
|
239
|
+
'private/staking/get-open-convert': 2,
|
|
240
|
+
'private/staking/get-convert-history': 2,
|
|
208
241
|
},
|
|
209
242
|
},
|
|
210
243
|
},
|
|
@@ -344,6 +377,102 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
344
377
|
},
|
|
345
378
|
'broker': 'CCXT',
|
|
346
379
|
},
|
|
380
|
+
'features': {
|
|
381
|
+
'default': {
|
|
382
|
+
'sandbox': True,
|
|
383
|
+
'createOrder': {
|
|
384
|
+
'marginMode': True,
|
|
385
|
+
'triggerPrice': True,
|
|
386
|
+
# todo: implementation fix
|
|
387
|
+
'triggerPriceType': {
|
|
388
|
+
'last': True,
|
|
389
|
+
'mark': True,
|
|
390
|
+
'index': True,
|
|
391
|
+
},
|
|
392
|
+
'triggerDirection': False,
|
|
393
|
+
'stopLossPrice': True,
|
|
394
|
+
'takeProfitPrice': True,
|
|
395
|
+
'attachedStopLossTakeProfit': None,
|
|
396
|
+
'timeInForce': {
|
|
397
|
+
'IOC': True,
|
|
398
|
+
'FOK': True,
|
|
399
|
+
'PO': True,
|
|
400
|
+
'GTD': False,
|
|
401
|
+
},
|
|
402
|
+
'hedged': False,
|
|
403
|
+
'selfTradePrevention': True, # todo: implement
|
|
404
|
+
'trailing': False,
|
|
405
|
+
'iceberg': False,
|
|
406
|
+
'leverage': False,
|
|
407
|
+
'marketBuyByCost': True,
|
|
408
|
+
'marketBuyRequiresPrice': True,
|
|
409
|
+
},
|
|
410
|
+
'createOrders': {
|
|
411
|
+
'max': 10,
|
|
412
|
+
},
|
|
413
|
+
'fetchMyTrades': {
|
|
414
|
+
'marginMode': False,
|
|
415
|
+
'limit': 100,
|
|
416
|
+
'daysBack': None,
|
|
417
|
+
'untilDays': 1,
|
|
418
|
+
'symbolRequired': False,
|
|
419
|
+
},
|
|
420
|
+
'fetchOrder': {
|
|
421
|
+
'marginMode': False,
|
|
422
|
+
'trigger': False,
|
|
423
|
+
'trailing': False,
|
|
424
|
+
'symbolRequired': False,
|
|
425
|
+
},
|
|
426
|
+
'fetchOpenOrders': {
|
|
427
|
+
'marginMode': True,
|
|
428
|
+
'limit': 100,
|
|
429
|
+
'trigger': False,
|
|
430
|
+
'trailing': False,
|
|
431
|
+
'symbolRequired': False,
|
|
432
|
+
},
|
|
433
|
+
'fetchOrders': {
|
|
434
|
+
'marginMode': False,
|
|
435
|
+
'limit': 100,
|
|
436
|
+
'daysBack': None,
|
|
437
|
+
'untilDays': 1,
|
|
438
|
+
'trigger': False,
|
|
439
|
+
'trailing': False,
|
|
440
|
+
'symbolRequired': False,
|
|
441
|
+
},
|
|
442
|
+
'fetchClosedOrders': {
|
|
443
|
+
'marginMode': False,
|
|
444
|
+
'limit': 100,
|
|
445
|
+
'daysBack': None,
|
|
446
|
+
'daysBackCanceled': None,
|
|
447
|
+
'untilDays': 1,
|
|
448
|
+
'trigger': False,
|
|
449
|
+
'trailing': False,
|
|
450
|
+
'symbolRequired': False,
|
|
451
|
+
},
|
|
452
|
+
'fetchOHLCV': {
|
|
453
|
+
'limit': 300,
|
|
454
|
+
},
|
|
455
|
+
},
|
|
456
|
+
'spot': {
|
|
457
|
+
'extends': 'default',
|
|
458
|
+
},
|
|
459
|
+
'swap': {
|
|
460
|
+
'linear': {
|
|
461
|
+
'extends': 'default',
|
|
462
|
+
},
|
|
463
|
+
'inverse': {
|
|
464
|
+
'extends': 'default',
|
|
465
|
+
},
|
|
466
|
+
},
|
|
467
|
+
'future': {
|
|
468
|
+
'linear': {
|
|
469
|
+
'extends': 'default',
|
|
470
|
+
},
|
|
471
|
+
'inverse': {
|
|
472
|
+
'extends': 'default',
|
|
473
|
+
},
|
|
474
|
+
},
|
|
475
|
+
},
|
|
347
476
|
# https://exchange-docs.crypto.com/spot/index.html#response-and-reason-codes
|
|
348
477
|
'commonCurrencies': {
|
|
349
478
|
'USD_STABLE_COIN': 'USDC',
|
|
@@ -352,7 +481,10 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
352
481
|
'exceptions': {
|
|
353
482
|
'exact': {
|
|
354
483
|
'219': InvalidOrder,
|
|
484
|
+
'306': InsufficientFunds, # {"id" : 1753xxx, "method" : "private/amend-order", "code" : 306, "message" : "INSUFFICIENT_AVAILABLE_BALANCE", "result" : {"client_oid" : "1753xxx", "order_id" : "6530xxx"}}
|
|
355
485
|
'314': InvalidOrder, # {"id" : 1700xxx, "method" : "private/create-order", "code" : 314, "message" : "EXCEEDS_MAX_ORDER_SIZE", "result" : {"client_oid" : "1700xxx", "order_id" : "6530xxx"}}
|
|
486
|
+
'325': InvalidOrder, # {"id" : 1741xxx, "method" : "private/create-order", "code" : 325, "message" : "EXCEED_DAILY_VOL_LIMIT", "result" : {"client_oid" : "1741xxx", "order_id" : "6530xxx"}}
|
|
487
|
+
'415': InvalidOrder, # {"id" : 1741xxx, "method" : "private/create-order", "code" : 415, "message" : "BELOW_MIN_ORDER_SIZE", "result" : {"client_oid" : "1741xxx", "order_id" : "6530xxx"}}
|
|
356
488
|
'10001': ExchangeError,
|
|
357
489
|
'10002': PermissionDenied,
|
|
358
490
|
'10003': PermissionDenied,
|
|
@@ -388,16 +520,151 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
388
520
|
'40006': BadRequest,
|
|
389
521
|
'40007': BadRequest,
|
|
390
522
|
'40101': AuthenticationError,
|
|
391
|
-
'
|
|
523
|
+
'40102': InvalidNonce, # Nonce value differs by more than 60 seconds from server
|
|
524
|
+
'40103': AuthenticationError, # IP address not whitelisted
|
|
525
|
+
'40104': AuthenticationError, # Disallowed based on user tier
|
|
526
|
+
'40107': BadRequest, # Session subscription limit has been exceeded
|
|
527
|
+
'40401': OrderNotFound,
|
|
528
|
+
'40801': RequestTimeout,
|
|
529
|
+
'42901': RateLimitExceeded,
|
|
530
|
+
'43005': InvalidOrder, # Rejected POST_ONLY create-order request(normally happened when exec_inst contains POST_ONLY but time_in_force is NOT GOOD_TILL_CANCEL)
|
|
531
|
+
'43003': InvalidOrder, # FOK order has not been filled and cancelled
|
|
532
|
+
'43004': InvalidOrder, # IOC order has not been filled and cancelled
|
|
533
|
+
'43012': BadRequest, # Canceled due to Self Trade Prevention
|
|
534
|
+
'50001': ExchangeError,
|
|
392
535
|
'9010001': OnMaintenance, # {"code":9010001,"message":"SYSTEM_MAINTENANCE","details":"Crypto.com Exchange is currently under maintenance. Please refer to https://status.crypto.com for more details."}
|
|
393
536
|
},
|
|
394
537
|
'broad': {},
|
|
395
538
|
},
|
|
396
539
|
})
|
|
397
540
|
|
|
541
|
+
async def fetch_currencies(self, params={}) -> Currencies:
|
|
542
|
+
"""
|
|
543
|
+
fetches all available currencies on an exchange
|
|
544
|
+
|
|
545
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-currency-networks
|
|
546
|
+
|
|
547
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
548
|
+
:returns dict: an associative dictionary of currencies
|
|
549
|
+
"""
|
|
550
|
+
# self endpoint requires authentication
|
|
551
|
+
if not self.check_required_credentials(False):
|
|
552
|
+
return None
|
|
553
|
+
skipFetchCurrencies = False
|
|
554
|
+
skipFetchCurrencies, params = self.handle_option_and_params(params, 'fetchCurrencies', 'skipFetchCurrencies', False)
|
|
555
|
+
if skipFetchCurrencies:
|
|
556
|
+
# sub-accounts can't access self endpoint
|
|
557
|
+
return None
|
|
558
|
+
response = {}
|
|
559
|
+
try:
|
|
560
|
+
response = await self.v1PrivatePostPrivateGetCurrencyNetworks(params)
|
|
561
|
+
except Exception as e:
|
|
562
|
+
if isinstance(e, ExchangeError):
|
|
563
|
+
# sub-accounts can't access self endpoint
|
|
564
|
+
# {"code":"10001","msg":"SYS_ERROR"}
|
|
565
|
+
return None
|
|
566
|
+
raise e
|
|
567
|
+
# do nothing
|
|
568
|
+
# sub-accounts can't access self endpoint
|
|
569
|
+
#
|
|
570
|
+
# {
|
|
571
|
+
# "id": "1747502328559",
|
|
572
|
+
# "method": "private/get-currency-networks",
|
|
573
|
+
# "code": "0",
|
|
574
|
+
# "result": {
|
|
575
|
+
# "update_time": "1747502281000",
|
|
576
|
+
# "currency_map": {
|
|
577
|
+
# "USDT": {
|
|
578
|
+
# "full_name": "Tether USD",
|
|
579
|
+
# "default_network": "ETH",
|
|
580
|
+
# "network_list": [
|
|
581
|
+
# {
|
|
582
|
+
# "network_id": "ETH",
|
|
583
|
+
# "withdrawal_fee": "10.00000000",
|
|
584
|
+
# "withdraw_enabled": True,
|
|
585
|
+
# "min_withdrawal_amount": "20.0",
|
|
586
|
+
# "deposit_enabled": True,
|
|
587
|
+
# "confirmation_required": "32"
|
|
588
|
+
# },
|
|
589
|
+
# {
|
|
590
|
+
# "network_id": "CRONOS",
|
|
591
|
+
# "withdrawal_fee": "0.18000000",
|
|
592
|
+
# "withdraw_enabled": True,
|
|
593
|
+
# "min_withdrawal_amount": "0.35",
|
|
594
|
+
# "deposit_enabled": True,
|
|
595
|
+
# "confirmation_required": "15"
|
|
596
|
+
# },
|
|
597
|
+
# {
|
|
598
|
+
# "network_id": "SOL",
|
|
599
|
+
# "withdrawal_fee": "5.31000000",
|
|
600
|
+
# "withdraw_enabled": True,
|
|
601
|
+
# "min_withdrawal_amount": "10.62",
|
|
602
|
+
# "deposit_enabled": True,
|
|
603
|
+
# "confirmation_required": "1"
|
|
604
|
+
# }
|
|
605
|
+
# ]
|
|
606
|
+
# }
|
|
607
|
+
# }
|
|
608
|
+
# }
|
|
609
|
+
# }
|
|
610
|
+
#
|
|
611
|
+
resultData = self.safe_dict(response, 'result', {})
|
|
612
|
+
currencyMap = self.safe_dict(resultData, 'currency_map', {})
|
|
613
|
+
keys = list(currencyMap.keys())
|
|
614
|
+
result: dict = {}
|
|
615
|
+
for i in range(0, len(keys)):
|
|
616
|
+
key = keys[i]
|
|
617
|
+
currency = currencyMap[key]
|
|
618
|
+
id = key
|
|
619
|
+
code = self.safe_currency_code(id)
|
|
620
|
+
networks: dict = {}
|
|
621
|
+
chains = self.safe_list(currency, 'network_list', [])
|
|
622
|
+
for j in range(0, len(chains)):
|
|
623
|
+
chain = chains[j]
|
|
624
|
+
networkId = self.safe_string(chain, 'network_id')
|
|
625
|
+
network = self.network_id_to_code(networkId)
|
|
626
|
+
networks[network] = {
|
|
627
|
+
'info': chain,
|
|
628
|
+
'id': networkId,
|
|
629
|
+
'network': network,
|
|
630
|
+
'active': None,
|
|
631
|
+
'deposit': self.safe_bool(chain, 'deposit_enabled', False),
|
|
632
|
+
'withdraw': self.safe_bool(chain, 'withdraw_enabled', False),
|
|
633
|
+
'fee': self.safe_number(chain, 'withdrawal_fee'),
|
|
634
|
+
'precision': None,
|
|
635
|
+
'limits': {
|
|
636
|
+
'withdraw': {
|
|
637
|
+
'min': self.safe_number(chain, 'min_withdrawal_amount'),
|
|
638
|
+
'max': None,
|
|
639
|
+
},
|
|
640
|
+
},
|
|
641
|
+
}
|
|
642
|
+
result[code] = self.safe_currency_structure({
|
|
643
|
+
'info': currency,
|
|
644
|
+
'id': id,
|
|
645
|
+
'code': code,
|
|
646
|
+
'name': self.safe_string(currency, 'full_name'),
|
|
647
|
+
'active': None,
|
|
648
|
+
'deposit': None,
|
|
649
|
+
'withdraw': None,
|
|
650
|
+
'fee': None,
|
|
651
|
+
'precision': None,
|
|
652
|
+
'limits': {
|
|
653
|
+
'amount': {
|
|
654
|
+
'min': None,
|
|
655
|
+
'max': None,
|
|
656
|
+
},
|
|
657
|
+
},
|
|
658
|
+
'type': 'crypto', # only crypto now
|
|
659
|
+
'networks': networks,
|
|
660
|
+
})
|
|
661
|
+
return result
|
|
662
|
+
|
|
398
663
|
async def fetch_markets(self, params={}) -> List[Market]:
|
|
399
664
|
"""
|
|
400
|
-
|
|
665
|
+
|
|
666
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-instruments
|
|
667
|
+
|
|
401
668
|
retrieves data on all markets for cryptocom
|
|
402
669
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
403
670
|
:returns dict[]: an array of objects representing market data
|
|
@@ -490,8 +757,8 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
490
757
|
# }
|
|
491
758
|
# }
|
|
492
759
|
#
|
|
493
|
-
resultResponse = self.
|
|
494
|
-
data = self.
|
|
760
|
+
resultResponse = self.safe_dict(response, 'result', {})
|
|
761
|
+
data = self.safe_list(resultResponse, 'data', [])
|
|
495
762
|
result = []
|
|
496
763
|
for i in range(0, len(data)):
|
|
497
764
|
market = data[i]
|
|
@@ -508,8 +775,8 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
508
775
|
settle = None if spot else self.safe_currency_code(settleId)
|
|
509
776
|
optionType = self.safe_string_lower(market, 'put_call')
|
|
510
777
|
strike = self.safe_string(market, 'strike')
|
|
511
|
-
marginBuyEnabled = self.
|
|
512
|
-
marginSellEnabled = self.
|
|
778
|
+
marginBuyEnabled = self.safe_bool(market, 'margin_buy_enabled')
|
|
779
|
+
marginSellEnabled = self.safe_bool(market, 'margin_sell_enabled')
|
|
513
780
|
expiryString = self.omit_zero(self.safe_string(market, 'expiry_timestamp_ms'))
|
|
514
781
|
expiry = int(expiryString) if (expiryString is not None) else None
|
|
515
782
|
symbol = base + '/' + quote
|
|
@@ -546,7 +813,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
546
813
|
'swap': swap,
|
|
547
814
|
'future': future,
|
|
548
815
|
'option': option,
|
|
549
|
-
'active': self.
|
|
816
|
+
'active': self.safe_bool(market, 'tradable'),
|
|
550
817
|
'contract': contract,
|
|
551
818
|
'linear': True if (contract) else None,
|
|
552
819
|
'inverse': False if (contract) else None,
|
|
@@ -585,8 +852,10 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
585
852
|
async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
|
586
853
|
"""
|
|
587
854
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
588
|
-
|
|
589
|
-
|
|
855
|
+
|
|
856
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-tickers
|
|
857
|
+
https://exchange-docs.crypto.com/derivatives/index.html#public-get-tickers
|
|
858
|
+
|
|
590
859
|
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
591
860
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
592
861
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
|
@@ -630,13 +899,15 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
630
899
|
# }
|
|
631
900
|
# }
|
|
632
901
|
#
|
|
633
|
-
result = self.
|
|
902
|
+
result = self.safe_dict(response, 'result', {})
|
|
634
903
|
data = self.safe_list(result, 'data', [])
|
|
635
904
|
return self.parse_tickers(data, symbols)
|
|
636
905
|
|
|
637
906
|
async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
|
638
907
|
"""
|
|
639
|
-
|
|
908
|
+
|
|
909
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-tickers
|
|
910
|
+
|
|
640
911
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
641
912
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
|
642
913
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -650,7 +921,9 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
650
921
|
async def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
|
651
922
|
"""
|
|
652
923
|
fetches information on multiple orders made by the user
|
|
653
|
-
|
|
924
|
+
|
|
925
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-order-history
|
|
926
|
+
|
|
654
927
|
:param str symbol: unified market symbol of the market the orders were made in
|
|
655
928
|
:param int [since]: the earliest time in ms to fetch orders for, max date range is one day
|
|
656
929
|
:param int [limit]: the maximum number of order structures to retrieve, default 100 max 100
|
|
@@ -717,14 +990,16 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
717
990
|
# }
|
|
718
991
|
# }
|
|
719
992
|
#
|
|
720
|
-
data = self.
|
|
993
|
+
data = self.safe_dict(response, 'result', {})
|
|
721
994
|
orders = self.safe_list(data, 'data', [])
|
|
722
995
|
return self.parse_orders(orders, market, since, limit)
|
|
723
996
|
|
|
724
997
|
async def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
|
725
998
|
"""
|
|
726
999
|
get a list of the most recent trades for a particular symbol
|
|
727
|
-
|
|
1000
|
+
|
|
1001
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-trades
|
|
1002
|
+
|
|
728
1003
|
:param str symbol: unified symbol of the market to fetch trades for
|
|
729
1004
|
:param int [since]: timestamp in ms of the earliest trade to fetch, maximum date range is one day
|
|
730
1005
|
:param int [limit]: the maximum number of trades to fetch
|
|
@@ -771,14 +1046,16 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
771
1046
|
# }
|
|
772
1047
|
# }
|
|
773
1048
|
#
|
|
774
|
-
result = self.
|
|
1049
|
+
result = self.safe_dict(response, 'result', {})
|
|
775
1050
|
trades = self.safe_list(result, 'data', [])
|
|
776
1051
|
return self.parse_trades(trades, market, since, limit)
|
|
777
1052
|
|
|
778
1053
|
async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
|
779
1054
|
"""
|
|
780
1055
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
781
|
-
|
|
1056
|
+
|
|
1057
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-candlestick
|
|
1058
|
+
|
|
782
1059
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
|
783
1060
|
:param str timeframe: the length of time each candle represents
|
|
784
1061
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
|
@@ -798,13 +1075,21 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
798
1075
|
'instrument_name': market['id'],
|
|
799
1076
|
'timeframe': self.safe_string(self.timeframes, timeframe, timeframe),
|
|
800
1077
|
}
|
|
801
|
-
if since is not None:
|
|
802
|
-
request['start_ts'] = since
|
|
803
1078
|
if limit is not None:
|
|
1079
|
+
if limit > 300:
|
|
1080
|
+
limit = 300
|
|
804
1081
|
request['count'] = limit
|
|
805
|
-
|
|
1082
|
+
now = self.microseconds()
|
|
1083
|
+
duration = self.parse_timeframe(timeframe)
|
|
1084
|
+
until = self.safe_integer(params, 'until', now)
|
|
806
1085
|
params = self.omit(params, ['until'])
|
|
807
|
-
if
|
|
1086
|
+
if since is not None:
|
|
1087
|
+
request['start_ts'] = since - duration * 1000
|
|
1088
|
+
if limit is not None:
|
|
1089
|
+
request['end_ts'] = self.sum(since, duration * limit * 1000)
|
|
1090
|
+
else:
|
|
1091
|
+
request['end_ts'] = until
|
|
1092
|
+
else:
|
|
808
1093
|
request['end_ts'] = until
|
|
809
1094
|
response = await self.v1PublicGetPublicGetCandlestick(self.extend(request, params))
|
|
810
1095
|
#
|
|
@@ -828,14 +1113,16 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
828
1113
|
# }
|
|
829
1114
|
# }
|
|
830
1115
|
#
|
|
831
|
-
result = self.
|
|
1116
|
+
result = self.safe_dict(response, 'result', {})
|
|
832
1117
|
data = self.safe_list(result, 'data', [])
|
|
833
1118
|
return self.parse_ohlcvs(data, market, timeframe, since, limit)
|
|
834
1119
|
|
|
835
1120
|
async def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
|
836
1121
|
"""
|
|
837
1122
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
|
838
|
-
|
|
1123
|
+
|
|
1124
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-book
|
|
1125
|
+
|
|
839
1126
|
:param str symbol: unified symbol of the market to fetch the order book for
|
|
840
1127
|
:param int [limit]: the number of order book entries to return, max 50
|
|
841
1128
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -847,7 +1134,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
847
1134
|
'instrument_name': market['id'],
|
|
848
1135
|
}
|
|
849
1136
|
if limit:
|
|
850
|
-
request['depth'] = limit
|
|
1137
|
+
request['depth'] = min(limit, 50) # max 50
|
|
851
1138
|
response = await self.v1PublicGetPublicGetBook(self.extend(request, params))
|
|
852
1139
|
#
|
|
853
1140
|
# {
|
|
@@ -867,15 +1154,15 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
867
1154
|
# }
|
|
868
1155
|
# }
|
|
869
1156
|
#
|
|
870
|
-
result = self.
|
|
871
|
-
data = self.
|
|
1157
|
+
result = self.safe_dict(response, 'result', {})
|
|
1158
|
+
data = self.safe_list(result, 'data', [])
|
|
872
1159
|
orderBook = self.safe_value(data, 0)
|
|
873
1160
|
timestamp = self.safe_integer(orderBook, 't')
|
|
874
1161
|
return self.parse_order_book(orderBook, symbol, timestamp)
|
|
875
1162
|
|
|
876
1163
|
def parse_balance(self, response) -> Balances:
|
|
877
|
-
responseResult = self.
|
|
878
|
-
data = self.
|
|
1164
|
+
responseResult = self.safe_dict(response, 'result', {})
|
|
1165
|
+
data = self.safe_list(responseResult, 'data', [])
|
|
879
1166
|
positionBalances = self.safe_value(data[0], 'position_balances', [])
|
|
880
1167
|
result: dict = {'info': response}
|
|
881
1168
|
for i in range(0, len(positionBalances)):
|
|
@@ -891,7 +1178,9 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
891
1178
|
async def fetch_balance(self, params={}) -> Balances:
|
|
892
1179
|
"""
|
|
893
1180
|
query for balance and get the amount of funds available for trading or funds locked in orders
|
|
894
|
-
|
|
1181
|
+
|
|
1182
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-user-balance
|
|
1183
|
+
|
|
895
1184
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
896
1185
|
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
|
897
1186
|
"""
|
|
@@ -945,7 +1234,10 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
945
1234
|
async def fetch_order(self, id: str, symbol: Str = None, params={}):
|
|
946
1235
|
"""
|
|
947
1236
|
fetches information on an order made by the user
|
|
948
|
-
|
|
1237
|
+
|
|
1238
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-order-detail
|
|
1239
|
+
|
|
1240
|
+
:param str id: order id
|
|
949
1241
|
:param str symbol: unified symbol of the market the order was made in
|
|
950
1242
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
951
1243
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
|
@@ -1079,16 +1371,18 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
1079
1371
|
async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
|
1080
1372
|
"""
|
|
1081
1373
|
create a trade order
|
|
1082
|
-
|
|
1374
|
+
|
|
1375
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-create-order
|
|
1376
|
+
|
|
1083
1377
|
:param str symbol: unified symbol of the market to create an order in
|
|
1084
1378
|
:param str type: 'market', 'limit', 'stop_loss', 'stop_limit', 'take_profit', 'take_profit_limit'
|
|
1085
1379
|
:param str side: 'buy' or 'sell'
|
|
1086
1380
|
:param float amount: how much you want to trade in units of base currency
|
|
1087
|
-
:param float [price]: the price at which the order is to be
|
|
1381
|
+
:param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
1088
1382
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1089
1383
|
:param str [params.timeInForce]: 'GTC', 'IOC', 'FOK' or 'PO'
|
|
1090
1384
|
:param str [params.ref_price_type]: 'MARK_PRICE', 'INDEX_PRICE', 'LAST_PRICE' which trigger price type to use, default is MARK_PRICE
|
|
1091
|
-
:param float [params.
|
|
1385
|
+
:param float [params.triggerPrice]: price to trigger a trigger order
|
|
1092
1386
|
:param float [params.stopLossPrice]: price to trigger a stop-loss trigger order
|
|
1093
1387
|
:param float [params.takeProfitPrice]: price to trigger a take-profit trigger order
|
|
1094
1388
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
|
@@ -1114,9 +1408,12 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
1114
1408
|
async def create_orders(self, orders: List[OrderRequest], params={}):
|
|
1115
1409
|
"""
|
|
1116
1410
|
create a list of trade orders
|
|
1117
|
-
|
|
1118
|
-
|
|
1411
|
+
|
|
1412
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-create-order-list-list
|
|
1413
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-create-order-list-oco
|
|
1414
|
+
|
|
1119
1415
|
: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
|
|
1416
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1120
1417
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
|
1121
1418
|
"""
|
|
1122
1419
|
await self.load_markets()
|
|
@@ -1128,7 +1425,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
1128
1425
|
side = self.safe_string(rawOrder, 'side')
|
|
1129
1426
|
amount = self.safe_value(rawOrder, 'amount')
|
|
1130
1427
|
price = self.safe_value(rawOrder, 'price')
|
|
1131
|
-
orderParams = self.
|
|
1428
|
+
orderParams = self.safe_dict(rawOrder, 'params', {})
|
|
1132
1429
|
orderRequest = self.create_advanced_order_request(marketId, type, side, amount, price, orderParams)
|
|
1133
1430
|
ordersRequests.append(orderRequest)
|
|
1134
1431
|
contigency = self.safe_string(params, 'contingency_type', 'LIST')
|
|
@@ -1281,10 +1578,51 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
1281
1578
|
params = self.omit(params, ['postOnly', 'clientOrderId', 'timeInForce', 'stopPrice', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice'])
|
|
1282
1579
|
return self.extend(request, params)
|
|
1283
1580
|
|
|
1581
|
+
async def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
|
|
1582
|
+
"""
|
|
1583
|
+
edit a trade order
|
|
1584
|
+
|
|
1585
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-amend-order
|
|
1586
|
+
|
|
1587
|
+
:param str id: order id
|
|
1588
|
+
:param str symbol: unified market symbol of the order to edit
|
|
1589
|
+
:param str [type]: not used by cryptocom editOrder
|
|
1590
|
+
:param str [side]: not used by cryptocom editOrder
|
|
1591
|
+
:param float amount:(mandatory) how much of the currency you want to trade in units of the base currency
|
|
1592
|
+
:param float price:(mandatory) the price for the order, in units of the quote currency, ignored in market orders
|
|
1593
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1594
|
+
:param str [params.clientOrderId]: the original client order id of the order to edit, required if id is not provided
|
|
1595
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
|
1596
|
+
"""
|
|
1597
|
+
await self.load_markets()
|
|
1598
|
+
request = self.edit_order_request(id, symbol, amount, price, params)
|
|
1599
|
+
response = await self.v1PrivatePostPrivateAmendOrder(request)
|
|
1600
|
+
result = self.safe_dict(response, 'result', {})
|
|
1601
|
+
return self.parse_order(result)
|
|
1602
|
+
|
|
1603
|
+
def edit_order_request(self, id: str, symbol: str, amount: float, price: Num = None, params={}):
|
|
1604
|
+
request: dict = {}
|
|
1605
|
+
if id is not None:
|
|
1606
|
+
request['order_id'] = id
|
|
1607
|
+
else:
|
|
1608
|
+
originalClientOrderId = self.safe_string_2(params, 'orig_client_oid', 'clientOrderId')
|
|
1609
|
+
if originalClientOrderId is None:
|
|
1610
|
+
raise ArgumentsRequired(self.id + ' editOrder() requires an id argument or orig_client_oid parameter')
|
|
1611
|
+
else:
|
|
1612
|
+
request['orig_client_oid'] = originalClientOrderId
|
|
1613
|
+
params = self.omit(params, ['orig_client_oid', 'clientOrderId'])
|
|
1614
|
+
if (amount is None) or (price is None):
|
|
1615
|
+
raise ArgumentsRequired(self.id + ' editOrder() requires both amount and price arguments. If you do not want to change the amount or price, you should pass the original values')
|
|
1616
|
+
request['new_quantity'] = self.amount_to_precision(symbol, amount)
|
|
1617
|
+
request['new_price'] = self.price_to_precision(symbol, price)
|
|
1618
|
+
return self.extend(request, params)
|
|
1619
|
+
|
|
1284
1620
|
async def cancel_all_orders(self, symbol: Str = None, params={}):
|
|
1285
1621
|
"""
|
|
1286
1622
|
cancel all open orders
|
|
1287
|
-
|
|
1623
|
+
|
|
1624
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-all-orders
|
|
1625
|
+
|
|
1288
1626
|
:param str symbol: unified market symbol of the orders to cancel
|
|
1289
1627
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1290
1628
|
:returns dict} Returns exchange raw message{@link https://docs.ccxt.com/#/?id=order-structure:
|
|
@@ -1295,12 +1633,15 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
1295
1633
|
if symbol is not None:
|
|
1296
1634
|
market = self.market(symbol)
|
|
1297
1635
|
request['instrument_name'] = market['id']
|
|
1298
|
-
|
|
1636
|
+
response = await self.v1PrivatePostPrivateCancelAllOrders(self.extend(request, params))
|
|
1637
|
+
return [self.safe_order({'info': response})]
|
|
1299
1638
|
|
|
1300
1639
|
async def cancel_order(self, id: str, symbol: Str = None, params={}):
|
|
1301
1640
|
"""
|
|
1302
1641
|
cancels an open order
|
|
1303
|
-
|
|
1642
|
+
|
|
1643
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-order
|
|
1644
|
+
|
|
1304
1645
|
:param str id: the order id of the order to cancel
|
|
1305
1646
|
:param str [symbol]: unified symbol of the market the order was made in
|
|
1306
1647
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -1332,7 +1673,9 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
1332
1673
|
async def cancel_orders(self, ids, symbol: Str = None, params={}):
|
|
1333
1674
|
"""
|
|
1334
1675
|
cancel multiple orders
|
|
1335
|
-
|
|
1676
|
+
|
|
1677
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-order-list-list
|
|
1678
|
+
|
|
1336
1679
|
:param str[] ids: order ids
|
|
1337
1680
|
:param str symbol: unified market symbol
|
|
1338
1681
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -1361,8 +1704,10 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
1361
1704
|
async def cancel_orders_for_symbols(self, orders: List[CancellationRequest], params={}):
|
|
1362
1705
|
"""
|
|
1363
1706
|
cancel multiple orders for multiple symbols
|
|
1364
|
-
|
|
1365
|
-
|
|
1707
|
+
|
|
1708
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-order-list-list
|
|
1709
|
+
|
|
1710
|
+
:param CancellationRequest[] orders: each order should contain the parameters required by cancelOrder namely id and symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}]
|
|
1366
1711
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1367
1712
|
:returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
|
1368
1713
|
"""
|
|
@@ -1389,7 +1734,9 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
1389
1734
|
async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
|
1390
1735
|
"""
|
|
1391
1736
|
fetch all unfilled currently open orders
|
|
1392
|
-
|
|
1737
|
+
|
|
1738
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-open-orders
|
|
1739
|
+
|
|
1393
1740
|
:param str symbol: unified market symbol
|
|
1394
1741
|
:param int [since]: the earliest time in ms to fetch open orders for
|
|
1395
1742
|
:param int [limit]: the maximum number of open order structures to retrieve
|
|
@@ -1440,14 +1787,16 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
1440
1787
|
# }
|
|
1441
1788
|
# }
|
|
1442
1789
|
#
|
|
1443
|
-
data = self.
|
|
1790
|
+
data = self.safe_dict(response, 'result', {})
|
|
1444
1791
|
orders = self.safe_list(data, 'data', [])
|
|
1445
1792
|
return self.parse_orders(orders, market, since, limit)
|
|
1446
1793
|
|
|
1447
1794
|
async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
|
1448
1795
|
"""
|
|
1449
1796
|
fetch all trades made by the user
|
|
1450
|
-
|
|
1797
|
+
|
|
1798
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-trades
|
|
1799
|
+
|
|
1451
1800
|
:param str symbol: unified market symbol
|
|
1452
1801
|
:param int [since]: the earliest time in ms to fetch trades for, maximum date range is one day
|
|
1453
1802
|
:param int [limit]: the maximum number of trade structures to retrieve
|
|
@@ -1460,7 +1809,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
1460
1809
|
paginate = False
|
|
1461
1810
|
paginate, params = self.handle_option_and_params(params, 'fetchMyTrades', 'paginate')
|
|
1462
1811
|
if paginate:
|
|
1463
|
-
return await self.fetch_paginated_call_dynamic('fetchMyTrades', symbol, since, limit, params)
|
|
1812
|
+
return await self.fetch_paginated_call_dynamic('fetchMyTrades', symbol, since, limit, params, 100)
|
|
1464
1813
|
request: dict = {}
|
|
1465
1814
|
market = None
|
|
1466
1815
|
if symbol is not None:
|
|
@@ -1504,7 +1853,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
1504
1853
|
# }
|
|
1505
1854
|
# }
|
|
1506
1855
|
#
|
|
1507
|
-
result = self.
|
|
1856
|
+
result = self.safe_dict(response, 'result', {})
|
|
1508
1857
|
trades = self.safe_list(result, 'data', [])
|
|
1509
1858
|
return self.parse_trades(trades, market, since, limit)
|
|
1510
1859
|
|
|
@@ -1520,10 +1869,12 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
1520
1869
|
address = addressString
|
|
1521
1870
|
return [address, tag]
|
|
1522
1871
|
|
|
1523
|
-
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
|
1872
|
+
async def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
|
|
1524
1873
|
"""
|
|
1525
1874
|
make a withdrawal
|
|
1526
|
-
|
|
1875
|
+
|
|
1876
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-create-withdrawal
|
|
1877
|
+
|
|
1527
1878
|
:param str code: unified currency code
|
|
1528
1879
|
:param float amount: the amount to withdraw
|
|
1529
1880
|
:param str address: the address to withdraw to
|
|
@@ -1566,10 +1917,12 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
1566
1917
|
result = self.safe_dict(response, 'result')
|
|
1567
1918
|
return self.parse_transaction(result, currency)
|
|
1568
1919
|
|
|
1569
|
-
async def fetch_deposit_addresses_by_network(self, code: str, params={}):
|
|
1920
|
+
async def fetch_deposit_addresses_by_network(self, code: str, params={}) -> List[DepositAddress]:
|
|
1570
1921
|
"""
|
|
1571
1922
|
fetch a dictionary of addresses for a currency, indexed by network
|
|
1572
|
-
|
|
1923
|
+
|
|
1924
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-deposit-address
|
|
1925
|
+
|
|
1573
1926
|
:param str code: unified currency code of the currency for the deposit address
|
|
1574
1927
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1575
1928
|
:returns dict: a dictionary of `address structures <https://docs.ccxt.com/#/?id=address-structure>` indexed by the network
|
|
@@ -1599,14 +1952,14 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
1599
1952
|
# }
|
|
1600
1953
|
# }
|
|
1601
1954
|
#
|
|
1602
|
-
data = self.
|
|
1603
|
-
addresses = self.
|
|
1955
|
+
data = self.safe_dict(response, 'result', {})
|
|
1956
|
+
addresses = self.safe_list(data, 'deposit_address_list', [])
|
|
1604
1957
|
addressesLength = len(addresses)
|
|
1605
1958
|
if addressesLength == 0:
|
|
1606
1959
|
raise ExchangeError(self.id + ' fetchDepositAddressesByNetwork() generating address...')
|
|
1607
1960
|
result: dict = {}
|
|
1608
1961
|
for i in range(0, addressesLength):
|
|
1609
|
-
value = self.
|
|
1962
|
+
value = self.safe_dict(addresses, i)
|
|
1610
1963
|
addressString = self.safe_string(value, 'address')
|
|
1611
1964
|
currencyId = self.safe_string(value, 'currency')
|
|
1612
1965
|
responseCode = self.safe_currency_code(currencyId)
|
|
@@ -1617,15 +1970,18 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
1617
1970
|
result[network] = {
|
|
1618
1971
|
'info': value,
|
|
1619
1972
|
'currency': responseCode,
|
|
1973
|
+
'network': network,
|
|
1620
1974
|
'address': address,
|
|
1621
1975
|
'tag': tag,
|
|
1622
|
-
'network': network,
|
|
1623
1976
|
}
|
|
1624
1977
|
return result
|
|
1625
1978
|
|
|
1626
|
-
async def fetch_deposit_address(self, code: str, params={}):
|
|
1979
|
+
async def fetch_deposit_address(self, code: str, params={}) -> DepositAddress:
|
|
1627
1980
|
"""
|
|
1628
1981
|
fetch the deposit address for a currency associated with self account
|
|
1982
|
+
|
|
1983
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-deposit-address
|
|
1984
|
+
|
|
1629
1985
|
:param str code: unified currency code
|
|
1630
1986
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1631
1987
|
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
|
|
@@ -1639,22 +1995,12 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
1639
1995
|
keys = list(depositAddresses.keys())
|
|
1640
1996
|
return depositAddresses[keys[0]]
|
|
1641
1997
|
|
|
1642
|
-
def safe_network(self, networkId):
|
|
1643
|
-
networksById: dict = {
|
|
1644
|
-
'BTC': 'BTC',
|
|
1645
|
-
'ETH': 'ETH',
|
|
1646
|
-
'SOL': 'SOL',
|
|
1647
|
-
'BNB': 'BNB',
|
|
1648
|
-
'CRONOS': 'CRONOS',
|
|
1649
|
-
'MATIC': 'MATIC',
|
|
1650
|
-
'OP': 'OP',
|
|
1651
|
-
}
|
|
1652
|
-
return self.safe_string(networksById, networkId, networkId)
|
|
1653
|
-
|
|
1654
1998
|
async def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
|
1655
1999
|
"""
|
|
1656
2000
|
fetch all deposits made to an account
|
|
1657
|
-
|
|
2001
|
+
|
|
2002
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-deposit-history
|
|
2003
|
+
|
|
1658
2004
|
:param str code: unified currency code
|
|
1659
2005
|
:param int [since]: the earliest time in ms to fetch deposits for
|
|
1660
2006
|
:param int [limit]: the maximum number of deposits structures to retrieve
|
|
@@ -1700,14 +2046,16 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
1700
2046
|
# }
|
|
1701
2047
|
# }
|
|
1702
2048
|
#
|
|
1703
|
-
data = self.
|
|
2049
|
+
data = self.safe_dict(response, 'result', {})
|
|
1704
2050
|
depositList = self.safe_list(data, 'deposit_list', [])
|
|
1705
2051
|
return self.parse_transactions(depositList, currency, since, limit)
|
|
1706
2052
|
|
|
1707
2053
|
async def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
|
1708
2054
|
"""
|
|
1709
2055
|
fetch all withdrawals made from an account
|
|
1710
|
-
|
|
2056
|
+
|
|
2057
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-withdrawal-history
|
|
2058
|
+
|
|
1711
2059
|
:param str code: unified currency code
|
|
1712
2060
|
:param int [since]: the earliest time in ms to fetch withdrawals for
|
|
1713
2061
|
:param int [limit]: the maximum number of withdrawals structures to retrieve
|
|
@@ -1755,7 +2103,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
1755
2103
|
# }
|
|
1756
2104
|
# }
|
|
1757
2105
|
#
|
|
1758
|
-
data = self.
|
|
2106
|
+
data = self.safe_dict(response, 'result', {})
|
|
1759
2107
|
withdrawalList = self.safe_list(data, 'withdrawal_list', [])
|
|
1760
2108
|
return self.parse_transactions(withdrawalList, currency, since, limit)
|
|
1761
2109
|
|
|
@@ -2119,7 +2467,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
2119
2467
|
|
|
2120
2468
|
def custom_handle_margin_mode_and_params(self, methodName, params={}):
|
|
2121
2469
|
"""
|
|
2122
|
-
|
|
2470
|
+
@ignore
|
|
2123
2471
|
marginMode specified by params["marginMode"], self.options["marginMode"], self.options["defaultMarginMode"], params["margin"] = True or self.options["defaultType"] = 'margin'
|
|
2124
2472
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
2125
2473
|
:returns Array: the marginMode in lowercase
|
|
@@ -2154,7 +2502,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
2154
2502
|
# ]
|
|
2155
2503
|
# }
|
|
2156
2504
|
#
|
|
2157
|
-
networkList = self.
|
|
2505
|
+
networkList = self.safe_list(fee, 'network_list', [])
|
|
2158
2506
|
networkListLength = len(networkList)
|
|
2159
2507
|
result: dict = {
|
|
2160
2508
|
'info': fee,
|
|
@@ -2186,7 +2534,9 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
2186
2534
|
async def fetch_deposit_withdraw_fees(self, codes: Strings = None, params={}):
|
|
2187
2535
|
"""
|
|
2188
2536
|
fetch deposit and withdraw fees
|
|
2189
|
-
|
|
2537
|
+
|
|
2538
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-currency-networks
|
|
2539
|
+
|
|
2190
2540
|
:param str[]|None codes: list of unified currency codes
|
|
2191
2541
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
2192
2542
|
:returns dict: a list of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>`
|
|
@@ -2197,16 +2547,18 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
2197
2547
|
currencyMap = self.safe_list(data, 'currency_map')
|
|
2198
2548
|
return self.parse_deposit_withdraw_fees(currencyMap, codes, 'full_name')
|
|
2199
2549
|
|
|
2200
|
-
async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
|
2550
|
+
async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
|
|
2201
2551
|
"""
|
|
2202
2552
|
fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
|
2203
|
-
|
|
2204
|
-
|
|
2553
|
+
|
|
2554
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-transactions
|
|
2555
|
+
|
|
2556
|
+
:param str [code]: unified currency code
|
|
2205
2557
|
:param int [since]: timestamp in ms of the earliest ledger entry
|
|
2206
2558
|
:param int [limit]: max number of ledger entries to return
|
|
2207
2559
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
2208
2560
|
:param int [params.until]: timestamp in ms for the ending date filter, default is the current time
|
|
2209
|
-
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger
|
|
2561
|
+
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
|
|
2210
2562
|
"""
|
|
2211
2563
|
await self.load_markets()
|
|
2212
2564
|
request: dict = {}
|
|
@@ -2251,11 +2603,11 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
2251
2603
|
# }
|
|
2252
2604
|
# }
|
|
2253
2605
|
#
|
|
2254
|
-
result = self.
|
|
2255
|
-
ledger = self.
|
|
2606
|
+
result = self.safe_dict(response, 'result', {})
|
|
2607
|
+
ledger = self.safe_list(result, 'data', [])
|
|
2256
2608
|
return self.parse_ledger(ledger, currency, since, limit)
|
|
2257
2609
|
|
|
2258
|
-
def parse_ledger_entry(self, item: dict, currency: Currency = None):
|
|
2610
|
+
def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
|
|
2259
2611
|
#
|
|
2260
2612
|
# {
|
|
2261
2613
|
# "account_id": "ce075cef-1234-4321-bd6e-gf9007351e64",
|
|
@@ -2278,6 +2630,8 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
2278
2630
|
#
|
|
2279
2631
|
timestamp = self.safe_integer(item, 'event_timestamp_ms')
|
|
2280
2632
|
currencyId = self.safe_string(item, 'instrument_name')
|
|
2633
|
+
code = self.safe_currency_code(currencyId, currency)
|
|
2634
|
+
currency = self.safe_currency(currencyId, currency)
|
|
2281
2635
|
amount = self.safe_string(item, 'transaction_qty')
|
|
2282
2636
|
direction = None
|
|
2283
2637
|
if Precise.string_lt(amount, '0'):
|
|
@@ -2285,14 +2639,15 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
2285
2639
|
amount = Precise.string_abs(amount)
|
|
2286
2640
|
else:
|
|
2287
2641
|
direction = 'in'
|
|
2288
|
-
return {
|
|
2642
|
+
return self.safe_ledger_entry({
|
|
2643
|
+
'info': item,
|
|
2289
2644
|
'id': self.safe_string(item, 'order_id'),
|
|
2290
2645
|
'direction': direction,
|
|
2291
2646
|
'account': self.safe_string(item, 'account_id'),
|
|
2292
2647
|
'referenceId': self.safe_string(item, 'trade_id'),
|
|
2293
2648
|
'referenceAccount': self.safe_string(item, 'trade_match_id'),
|
|
2294
2649
|
'type': self.parse_ledger_entry_type(self.safe_string(item, 'journal_type')),
|
|
2295
|
-
'currency':
|
|
2650
|
+
'currency': code,
|
|
2296
2651
|
'amount': self.parse_number(amount),
|
|
2297
2652
|
'timestamp': timestamp,
|
|
2298
2653
|
'datetime': self.iso8601(timestamp),
|
|
@@ -2303,8 +2658,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
2303
2658
|
'currency': None,
|
|
2304
2659
|
'cost': None,
|
|
2305
2660
|
},
|
|
2306
|
-
|
|
2307
|
-
}
|
|
2661
|
+
}, currency)
|
|
2308
2662
|
|
|
2309
2663
|
def parse_ledger_entry_type(self, type):
|
|
2310
2664
|
ledgerType: dict = {
|
|
@@ -2335,7 +2689,9 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
2335
2689
|
async def fetch_accounts(self, params={}) -> List[Account]:
|
|
2336
2690
|
"""
|
|
2337
2691
|
fetch all the accounts associated with a profile
|
|
2338
|
-
|
|
2692
|
+
|
|
2693
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-accounts
|
|
2694
|
+
|
|
2339
2695
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
2340
2696
|
:returns dict: a dictionary of `account structures <https://docs.ccxt.com/#/?id=account-structure>` indexed by the account type
|
|
2341
2697
|
"""
|
|
@@ -2372,9 +2728,9 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
2372
2728
|
# }
|
|
2373
2729
|
# }
|
|
2374
2730
|
#
|
|
2375
|
-
result = self.
|
|
2376
|
-
masterAccount = self.
|
|
2377
|
-
accounts = self.
|
|
2731
|
+
result = self.safe_dict(response, 'result', {})
|
|
2732
|
+
masterAccount = self.safe_dict(result, 'master_account', {})
|
|
2733
|
+
accounts = self.safe_list(result, 'sub_account_list', [])
|
|
2378
2734
|
accounts.append(masterAccount)
|
|
2379
2735
|
return self.parse_accounts(accounts, params)
|
|
2380
2736
|
|
|
@@ -2414,7 +2770,9 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
2414
2770
|
async def fetch_settlement_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
|
2415
2771
|
"""
|
|
2416
2772
|
fetches historical settlement records
|
|
2417
|
-
|
|
2773
|
+
|
|
2774
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-expired-settlement-price
|
|
2775
|
+
|
|
2418
2776
|
:param str symbol: unified market symbol of the settlement history
|
|
2419
2777
|
:param int [since]: timestamp in ms
|
|
2420
2778
|
:param int [limit]: number of records
|
|
@@ -2452,8 +2810,8 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
2452
2810
|
# }
|
|
2453
2811
|
# }
|
|
2454
2812
|
#
|
|
2455
|
-
result = self.
|
|
2456
|
-
data = self.
|
|
2813
|
+
result = self.safe_dict(response, 'result', {})
|
|
2814
|
+
data = self.safe_list(result, 'data', [])
|
|
2457
2815
|
settlements = self.parse_settlements(data, market)
|
|
2458
2816
|
sorted = self.sort_by(settlements, 'timestamp')
|
|
2459
2817
|
return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
|
|
@@ -2493,10 +2851,85 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
2493
2851
|
result.append(self.parse_settlement(settlements[i], market))
|
|
2494
2852
|
return result
|
|
2495
2853
|
|
|
2854
|
+
async def fetch_funding_rate(self, symbol: str, params={}):
|
|
2855
|
+
"""
|
|
2856
|
+
fetches historical funding rates
|
|
2857
|
+
|
|
2858
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-valuations
|
|
2859
|
+
|
|
2860
|
+
:param str symbol: unified symbol of the market to fetch the funding rate history for
|
|
2861
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
2862
|
+
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>`
|
|
2863
|
+
"""
|
|
2864
|
+
await self.load_markets()
|
|
2865
|
+
market = self.market(symbol)
|
|
2866
|
+
if not market['swap']:
|
|
2867
|
+
raise BadSymbol(self.id + ' fetchFundingRate() supports swap contracts only')
|
|
2868
|
+
request: dict = {
|
|
2869
|
+
'instrument_name': market['id'],
|
|
2870
|
+
'valuation_type': 'estimated_funding_rate',
|
|
2871
|
+
'count': 1,
|
|
2872
|
+
}
|
|
2873
|
+
response = await self.v1PublicGetPublicGetValuations(self.extend(request, params))
|
|
2874
|
+
#
|
|
2875
|
+
# {
|
|
2876
|
+
# "id": -1,
|
|
2877
|
+
# "method": "public/get-valuations",
|
|
2878
|
+
# "code": 0,
|
|
2879
|
+
# "result": {
|
|
2880
|
+
# "data": [
|
|
2881
|
+
# {
|
|
2882
|
+
# "v": "-0.000001884",
|
|
2883
|
+
# "t": 1687892400000
|
|
2884
|
+
# },
|
|
2885
|
+
# ],
|
|
2886
|
+
# "instrument_name": "BTCUSD-PERP"
|
|
2887
|
+
# }
|
|
2888
|
+
# }
|
|
2889
|
+
#
|
|
2890
|
+
result = self.safe_dict(response, 'result', {})
|
|
2891
|
+
data = self.safe_list(result, 'data', [])
|
|
2892
|
+
entry = self.safe_dict(data, 0, {})
|
|
2893
|
+
return self.parse_funding_rate(entry, market)
|
|
2894
|
+
|
|
2895
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
|
2896
|
+
#
|
|
2897
|
+
# {
|
|
2898
|
+
# "v": "-0.000001884",
|
|
2899
|
+
# "t": 1687892400000
|
|
2900
|
+
# },
|
|
2901
|
+
#
|
|
2902
|
+
timestamp = self.safe_integer(contract, 't')
|
|
2903
|
+
fundingTimestamp = None
|
|
2904
|
+
if timestamp is not None:
|
|
2905
|
+
fundingTimestamp = int(math.ceil(timestamp / 3600000)) * 3600000 # end of the next hour
|
|
2906
|
+
return {
|
|
2907
|
+
'info': contract,
|
|
2908
|
+
'symbol': self.safe_symbol(None, market),
|
|
2909
|
+
'markPrice': None,
|
|
2910
|
+
'indexPrice': None,
|
|
2911
|
+
'interestRate': None,
|
|
2912
|
+
'estimatedSettlePrice': None,
|
|
2913
|
+
'timestamp': timestamp,
|
|
2914
|
+
'datetime': self.iso8601(timestamp),
|
|
2915
|
+
'fundingRate': self.safe_number(contract, 'v'),
|
|
2916
|
+
'fundingTimestamp': fundingTimestamp,
|
|
2917
|
+
'fundingDatetime': self.iso8601(fundingTimestamp),
|
|
2918
|
+
'nextFundingRate': None,
|
|
2919
|
+
'nextFundingTimestamp': None,
|
|
2920
|
+
'nextFundingDatetime': None,
|
|
2921
|
+
'previousFundingRate': None,
|
|
2922
|
+
'previousFundingTimestamp': None,
|
|
2923
|
+
'previousFundingDatetime': None,
|
|
2924
|
+
'interval': '1h',
|
|
2925
|
+
}
|
|
2926
|
+
|
|
2496
2927
|
async def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
|
2497
2928
|
"""
|
|
2498
2929
|
fetches historical funding rates
|
|
2499
|
-
|
|
2930
|
+
|
|
2931
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-valuations
|
|
2932
|
+
|
|
2500
2933
|
:param str symbol: unified symbol of the market to fetch the funding rate history for
|
|
2501
2934
|
:param int [since]: timestamp in ms of the earliest funding rate to fetch
|
|
2502
2935
|
:param int [limit]: the maximum amount of [funding rate structures] to fetch
|
|
@@ -2544,8 +2977,8 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
2544
2977
|
# }
|
|
2545
2978
|
# }
|
|
2546
2979
|
#
|
|
2547
|
-
result = self.
|
|
2548
|
-
data = self.
|
|
2980
|
+
result = self.safe_dict(response, 'result', {})
|
|
2981
|
+
data = self.safe_list(result, 'data', [])
|
|
2549
2982
|
marketId = self.safe_string(result, 'instrument_name')
|
|
2550
2983
|
rates = []
|
|
2551
2984
|
for i in range(0, len(data)):
|
|
@@ -2564,7 +2997,9 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
2564
2997
|
async def fetch_position(self, symbol: str, params={}):
|
|
2565
2998
|
"""
|
|
2566
2999
|
fetch data on a single open contract trade position
|
|
2567
|
-
|
|
3000
|
+
|
|
3001
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-positions
|
|
3002
|
+
|
|
2568
3003
|
:param str symbol: unified market symbol of the market the position is held in
|
|
2569
3004
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
2570
3005
|
:returns dict: a `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
|
@@ -2601,10 +3036,12 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
2601
3036
|
data = self.safe_list(result, 'data', [])
|
|
2602
3037
|
return self.parse_position(self.safe_dict(data, 0), market)
|
|
2603
3038
|
|
|
2604
|
-
async def fetch_positions(self, symbols: Strings = None, params={}):
|
|
3039
|
+
async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
|
2605
3040
|
"""
|
|
2606
3041
|
fetch all open positions
|
|
2607
|
-
|
|
3042
|
+
|
|
3043
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-positions
|
|
3044
|
+
|
|
2608
3045
|
:param str[]|None symbols: list of unified market symbols
|
|
2609
3046
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
2610
3047
|
:returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
|
@@ -2647,8 +3084,8 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
2647
3084
|
# }
|
|
2648
3085
|
# }
|
|
2649
3086
|
#
|
|
2650
|
-
responseResult = self.
|
|
2651
|
-
positions = self.
|
|
3087
|
+
responseResult = self.safe_dict(response, 'result', {})
|
|
3088
|
+
positions = self.safe_list(responseResult, 'data', [])
|
|
2652
3089
|
result = []
|
|
2653
3090
|
for i in range(0, len(positions)):
|
|
2654
3091
|
entry = positions[i]
|
|
@@ -2736,13 +3173,14 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
2736
3173
|
async def close_position(self, symbol: str, side: OrderSide = None, params={}) -> Order:
|
|
2737
3174
|
"""
|
|
2738
3175
|
closes open positions for a market
|
|
2739
|
-
|
|
3176
|
+
|
|
3177
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-close-position
|
|
3178
|
+
|
|
2740
3179
|
:param str symbol: Unified CCXT market symbol
|
|
2741
|
-
:param str [marginMode]: not used by cryptocom.closePositions
|
|
2742
3180
|
:param str [side]: not used by cryptocom.closePositions
|
|
2743
3181
|
:param dict [params]: extra parameters specific to the okx api endpoint
|
|
2744
|
-
|
|
2745
|
-
|
|
3182
|
+
|
|
3183
|
+
EXCHANGE SPECIFIC PARAMETERS
|
|
2746
3184
|
:param str [params.type]: LIMIT or MARKET
|
|
2747
3185
|
:param number [params.price]: for limit orders only
|
|
2748
3186
|
:returns dict[]: `A list of position structures <https://docs.ccxt.com/#/?id=position-structure>`
|
|
@@ -2774,6 +3212,118 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
|
2774
3212
|
result = self.safe_dict(response, 'result')
|
|
2775
3213
|
return self.parse_order(result, market)
|
|
2776
3214
|
|
|
3215
|
+
async def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
|
|
3216
|
+
"""
|
|
3217
|
+
fetch the trading fees for a market
|
|
3218
|
+
|
|
3219
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-instrument-fee-rate
|
|
3220
|
+
|
|
3221
|
+
:param str symbol: unified market symbol
|
|
3222
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
3223
|
+
:returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
|
|
3224
|
+
"""
|
|
3225
|
+
await self.load_markets()
|
|
3226
|
+
market = self.market(symbol)
|
|
3227
|
+
request: dict = {
|
|
3228
|
+
'instrument_name': market['id'],
|
|
3229
|
+
}
|
|
3230
|
+
response = await self.v1PrivatePostPrivateGetInstrumentFeeRate(self.extend(request, params))
|
|
3231
|
+
#
|
|
3232
|
+
# {
|
|
3233
|
+
# "id": 1,
|
|
3234
|
+
# "code": 0,
|
|
3235
|
+
# "method": "private/staking/unstake",
|
|
3236
|
+
# "result": {
|
|
3237
|
+
# "staking_id": "1",
|
|
3238
|
+
# "instrument_name": "SOL.staked",
|
|
3239
|
+
# "status": "NEW",
|
|
3240
|
+
# "quantity": "1",
|
|
3241
|
+
# "underlying_inst_name": "SOL",
|
|
3242
|
+
# "reason": "NO_ERROR"
|
|
3243
|
+
# }
|
|
3244
|
+
# }
|
|
3245
|
+
#
|
|
3246
|
+
data = self.safe_dict(response, 'result', {})
|
|
3247
|
+
return self.parse_trading_fee(data, market)
|
|
3248
|
+
|
|
3249
|
+
async def fetch_trading_fees(self, params={}) -> TradingFees:
|
|
3250
|
+
"""
|
|
3251
|
+
|
|
3252
|
+
https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-fee-rate
|
|
3253
|
+
|
|
3254
|
+
fetch the trading fees for multiple markets
|
|
3255
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
3256
|
+
:returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
|
|
3257
|
+
"""
|
|
3258
|
+
await self.load_markets()
|
|
3259
|
+
response = await self.v1PrivatePostPrivateGetFeeRate(params)
|
|
3260
|
+
#
|
|
3261
|
+
# {
|
|
3262
|
+
# "id": 1,
|
|
3263
|
+
# "method": "/private/get-fee-rate",
|
|
3264
|
+
# "code": 0,
|
|
3265
|
+
# "result": {
|
|
3266
|
+
# "spot_tier": "3",
|
|
3267
|
+
# "deriv_tier": "3",
|
|
3268
|
+
# "effective_spot_maker_rate_bps": "6.5",
|
|
3269
|
+
# "effective_spot_taker_rate_bps": "6.9",
|
|
3270
|
+
# "effective_deriv_maker_rate_bps": "1.1",
|
|
3271
|
+
# "effective_deriv_taker_rate_bps": "3"
|
|
3272
|
+
# }
|
|
3273
|
+
# }
|
|
3274
|
+
#
|
|
3275
|
+
result = self.safe_dict(response, 'result', {})
|
|
3276
|
+
return self.parse_trading_fees(result)
|
|
3277
|
+
|
|
3278
|
+
def parse_trading_fees(self, response):
|
|
3279
|
+
#
|
|
3280
|
+
# {
|
|
3281
|
+
# "spot_tier": "3",
|
|
3282
|
+
# "deriv_tier": "3",
|
|
3283
|
+
# "effective_spot_maker_rate_bps": "6.5",
|
|
3284
|
+
# "effective_spot_taker_rate_bps": "6.9",
|
|
3285
|
+
# "effective_deriv_maker_rate_bps": "1.1",
|
|
3286
|
+
# "effective_deriv_taker_rate_bps": "3"
|
|
3287
|
+
# }
|
|
3288
|
+
#
|
|
3289
|
+
result: dict = {}
|
|
3290
|
+
result['info'] = response
|
|
3291
|
+
for i in range(0, len(self.symbols)):
|
|
3292
|
+
symbol = self.symbols[i]
|
|
3293
|
+
market = self.market(symbol)
|
|
3294
|
+
isSwap = market['swap']
|
|
3295
|
+
takerFeeKey = 'effective_deriv_taker_rate_bps' if isSwap else 'effective_spot_taker_rate_bps'
|
|
3296
|
+
makerFeeKey = 'effective_deriv_maker_rate_bps' if isSwap else 'effective_spot_maker_rate_bps'
|
|
3297
|
+
tradingFee = {
|
|
3298
|
+
'info': response,
|
|
3299
|
+
'symbol': symbol,
|
|
3300
|
+
'maker': self.parse_number(Precise.string_div(self.safe_string(response, makerFeeKey), '10000')),
|
|
3301
|
+
'taker': self.parse_number(Precise.string_div(self.safe_string(response, takerFeeKey), '10000')),
|
|
3302
|
+
'percentage': None,
|
|
3303
|
+
'tierBased': None,
|
|
3304
|
+
}
|
|
3305
|
+
result[symbol] = tradingFee
|
|
3306
|
+
return result
|
|
3307
|
+
|
|
3308
|
+
def parse_trading_fee(self, fee: dict, market: Market = None) -> TradingFeeInterface:
|
|
3309
|
+
#
|
|
3310
|
+
# {
|
|
3311
|
+
# "instrument_name": "BTC_USD",
|
|
3312
|
+
# "effective_maker_rate_bps": "6.5",
|
|
3313
|
+
# "effective_taker_rate_bps": "6.9"
|
|
3314
|
+
# }
|
|
3315
|
+
#
|
|
3316
|
+
marketId = self.safe_string(fee, 'instrument_name')
|
|
3317
|
+
symbol = self.safe_symbol(marketId, market)
|
|
3318
|
+
return {
|
|
3319
|
+
'info': fee,
|
|
3320
|
+
'symbol': symbol,
|
|
3321
|
+
'maker': self.parse_number(Precise.string_div(self.safe_string(fee, 'effective_maker_rate_bps'), '10000')),
|
|
3322
|
+
'taker': self.parse_number(Precise.string_div(self.safe_string(fee, 'effective_taker_rate_bps'), '10000')),
|
|
3323
|
+
'percentage': None,
|
|
3324
|
+
'tierBased': None,
|
|
3325
|
+
}
|
|
3326
|
+
|
|
2777
3327
|
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
|
2778
3328
|
type = self.safe_string(api, 0)
|
|
2779
3329
|
access = self.safe_string(api, 1)
|