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/lykke.py
DELETED
|
@@ -1,1270 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
|
-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
|
|
4
|
-
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
|
|
5
|
-
|
|
6
|
-
from ccxt.base.exchange import Exchange
|
|
7
|
-
from ccxt.abstract.lykke import ImplicitAPI
|
|
8
|
-
from ccxt.base.types import Balances, Currencies, Currency, IndexType, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
|
|
9
|
-
from typing import List
|
|
10
|
-
from ccxt.base.errors import ExchangeError
|
|
11
|
-
from ccxt.base.errors import BadRequest
|
|
12
|
-
from ccxt.base.errors import InsufficientFunds
|
|
13
|
-
from ccxt.base.errors import InvalidOrder
|
|
14
|
-
from ccxt.base.errors import DuplicateOrderId
|
|
15
|
-
from ccxt.base.errors import NotSupported
|
|
16
|
-
from ccxt.base.decimal_to_precision import TICK_SIZE
|
|
17
|
-
from ccxt.base.precise import Precise
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class lykke(Exchange, ImplicitAPI):
|
|
21
|
-
|
|
22
|
-
def describe(self):
|
|
23
|
-
return self.deep_extend(super(lykke, self).describe(), {
|
|
24
|
-
'id': 'lykke',
|
|
25
|
-
'name': 'Lykke',
|
|
26
|
-
'countries': ['UK'],
|
|
27
|
-
'version': '2',
|
|
28
|
-
# 300 requests per minute per method => 60000ms / 300 = 200(/api/orders/*)
|
|
29
|
-
# 120 requests per minute per method =>( 60000ms / rateLimit ) / 120 = cost = 2.5(/api/*)
|
|
30
|
-
'rateLimit': 200, # TODO: optim\ize https://lykkecity.github.io/Trading-API/#request-rate-limits
|
|
31
|
-
'has': {
|
|
32
|
-
'CORS': None,
|
|
33
|
-
'spot': True,
|
|
34
|
-
'margin': False,
|
|
35
|
-
'swap': False,
|
|
36
|
-
'future': False,
|
|
37
|
-
'option': False,
|
|
38
|
-
'cancelAllOrders': True,
|
|
39
|
-
'cancelOrder': True,
|
|
40
|
-
'createOrder': True,
|
|
41
|
-
'createStopLimitOrder': False,
|
|
42
|
-
'createStopMarketOrder': False,
|
|
43
|
-
'createStopOrder': False,
|
|
44
|
-
'editOrder': False,
|
|
45
|
-
'fetchBalance': True,
|
|
46
|
-
'fetchBorrowRateHistories': False,
|
|
47
|
-
'fetchBorrowRateHistory': False,
|
|
48
|
-
'fetchClosedOrders': True,
|
|
49
|
-
'fetchCrossBorrowRate': False,
|
|
50
|
-
'fetchCrossBorrowRates': False,
|
|
51
|
-
'fetchCurrencies': True,
|
|
52
|
-
'fetchDepositAddress': True,
|
|
53
|
-
'fetchDeposits': False,
|
|
54
|
-
'fetchDepositsWithdrawals': True,
|
|
55
|
-
'fetchFundingHistory': False,
|
|
56
|
-
'fetchFundingRate': False,
|
|
57
|
-
'fetchFundingRateHistory': False,
|
|
58
|
-
'fetchFundingRates': False,
|
|
59
|
-
'fetchIndexOHLCV': False,
|
|
60
|
-
'fetchIsolatedBorrowRate': False,
|
|
61
|
-
'fetchIsolatedBorrowRates': False,
|
|
62
|
-
'fetchMarginMode': False,
|
|
63
|
-
'fetchMarkets': True,
|
|
64
|
-
'fetchMarkOHLCV': False,
|
|
65
|
-
'fetchMyTrades': True,
|
|
66
|
-
'fetchOHLCV': None,
|
|
67
|
-
'fetchOpenInterestHistory': False,
|
|
68
|
-
'fetchOpenOrders': True,
|
|
69
|
-
'fetchOrder': True,
|
|
70
|
-
'fetchOrderBook': True,
|
|
71
|
-
'fetchOrders': False,
|
|
72
|
-
'fetchOrderTrades': False,
|
|
73
|
-
'fetchPosition': False,
|
|
74
|
-
'fetchPositionHistory': False,
|
|
75
|
-
'fetchPositionMode': False,
|
|
76
|
-
'fetchPositions': False,
|
|
77
|
-
'fetchPositionsForSymbol': False,
|
|
78
|
-
'fetchPositionsHistory': False,
|
|
79
|
-
'fetchPositionsRisk': False,
|
|
80
|
-
'fetchPremiumIndexOHLCV': False,
|
|
81
|
-
'fetchTicker': True,
|
|
82
|
-
'fetchTickers': True,
|
|
83
|
-
'fetchTime': False,
|
|
84
|
-
'fetchTrades': True,
|
|
85
|
-
'fetchTradingFee': False,
|
|
86
|
-
'fetchTradingFees': False,
|
|
87
|
-
'fetchTransactionFees': False,
|
|
88
|
-
'fetchTransactions': 'emulated',
|
|
89
|
-
'fetchWithdrawals': False,
|
|
90
|
-
'setLeverage': False,
|
|
91
|
-
'setMarginMode': False,
|
|
92
|
-
'withdraw': True,
|
|
93
|
-
},
|
|
94
|
-
'requiredCredentials': {
|
|
95
|
-
'apiKey': True,
|
|
96
|
-
'secret': False,
|
|
97
|
-
},
|
|
98
|
-
'urls': {
|
|
99
|
-
'logo': 'https://user-images.githubusercontent.com/1294454/155840500-1ea4fdf0-47c0-4daa-9597-c6c1cd51b9ec.jpg',
|
|
100
|
-
'api': {
|
|
101
|
-
'public': 'https://hft-apiv2.lykke.com/api',
|
|
102
|
-
'private': 'https://hft-apiv2.lykke.com/api',
|
|
103
|
-
},
|
|
104
|
-
'www': 'https://www.lykke.com',
|
|
105
|
-
'doc': [
|
|
106
|
-
'https://hft-apiv2.lykke.com/swagger/ui/index.html',
|
|
107
|
-
'https://lykkecity.github.io/Trading-API',
|
|
108
|
-
],
|
|
109
|
-
'fees': 'https://support.lykke.com/hc/en-us/articles/115002141125-What-are-the-fees-and-charges-', # zero fee
|
|
110
|
-
},
|
|
111
|
-
'api': {
|
|
112
|
-
'public': {
|
|
113
|
-
'get': {
|
|
114
|
-
'assetpairs': 2.5,
|
|
115
|
-
'assetpairs/{id}': 2.5,
|
|
116
|
-
'assets': 2.5,
|
|
117
|
-
'assets/{id}': 2.5,
|
|
118
|
-
'isalive': 2.5,
|
|
119
|
-
'orderbooks': 2.5,
|
|
120
|
-
'tickers': 2.5,
|
|
121
|
-
'prices': 2.5,
|
|
122
|
-
'trades/public/{assetPairId}': 2.5,
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
'private': {
|
|
126
|
-
'get': {
|
|
127
|
-
'balance': 2.5,
|
|
128
|
-
'trades': 2.5,
|
|
129
|
-
'trades/order/{orderId}': 2.5,
|
|
130
|
-
'orders/active': 1,
|
|
131
|
-
'orders/closed': 1,
|
|
132
|
-
'orders/{orderId}': 1,
|
|
133
|
-
'operations': 2.5,
|
|
134
|
-
'operations/deposits/addresses': 2.5,
|
|
135
|
-
'operations/deposits/addresses/{assetId}': 2.5,
|
|
136
|
-
},
|
|
137
|
-
'post': {
|
|
138
|
-
'orders/limit': 1,
|
|
139
|
-
'orders/market': 1,
|
|
140
|
-
'orders/bulk': 1,
|
|
141
|
-
'operations/withdrawals': 2.5,
|
|
142
|
-
'operations/deposits/addresses': 2.5,
|
|
143
|
-
},
|
|
144
|
-
'delete': {
|
|
145
|
-
'orders': 1,
|
|
146
|
-
'orders/{orderId}': 1,
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
'fees': {
|
|
151
|
-
'trading': {
|
|
152
|
-
'tierBased': False,
|
|
153
|
-
'percentage': True,
|
|
154
|
-
'maker': 0, # https://support.lykke.com/hc/en-us/articles/115002141125-What-are-the-fees-and-min-amounts-
|
|
155
|
-
'taker': 0,
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
'precisionMode': TICK_SIZE,
|
|
159
|
-
'exceptions': {
|
|
160
|
-
'exact': {
|
|
161
|
-
'1001': ExchangeError,
|
|
162
|
-
'1100': ExchangeError,
|
|
163
|
-
'1101': ExchangeError,
|
|
164
|
-
'2000': BadRequest,
|
|
165
|
-
'2001': InsufficientFunds,
|
|
166
|
-
'2202': DuplicateOrderId,
|
|
167
|
-
'2003': ExchangeError,
|
|
168
|
-
'2004': NotSupported,
|
|
169
|
-
'2005': ExchangeError,
|
|
170
|
-
'2006': InsufficientFunds,
|
|
171
|
-
'2007': InsufficientFunds,
|
|
172
|
-
'2008': InsufficientFunds,
|
|
173
|
-
'2009': ExchangeError,
|
|
174
|
-
'2010': InsufficientFunds,
|
|
175
|
-
'2011': InvalidOrder,
|
|
176
|
-
'2012': InvalidOrder,
|
|
177
|
-
'2013': InvalidOrder,
|
|
178
|
-
'2014': InvalidOrder,
|
|
179
|
-
'2015': InvalidOrder,
|
|
180
|
-
'2016': InvalidOrder,
|
|
181
|
-
'2017': InvalidOrder,
|
|
182
|
-
'2018': InvalidOrder,
|
|
183
|
-
'2019': InvalidOrder,
|
|
184
|
-
'2020': InvalidOrder,
|
|
185
|
-
'2021': InvalidOrder,
|
|
186
|
-
'2022': InvalidOrder,
|
|
187
|
-
'2023': ExchangeError,
|
|
188
|
-
},
|
|
189
|
-
'broad': {},
|
|
190
|
-
},
|
|
191
|
-
'commonCurrencies': {
|
|
192
|
-
},
|
|
193
|
-
})
|
|
194
|
-
|
|
195
|
-
def fetch_currencies(self, params={}) -> Currencies:
|
|
196
|
-
"""
|
|
197
|
-
fetches all available currencies on an exchange
|
|
198
|
-
:see: https://lykkecity.github.io/Trading-API/#get-all-assets
|
|
199
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
200
|
-
:returns dict: an associative dictionary of currencies
|
|
201
|
-
"""
|
|
202
|
-
response = self.publicGetAssets(params)
|
|
203
|
-
currencies = self.safe_value(response, 'payload', [])
|
|
204
|
-
#
|
|
205
|
-
# {
|
|
206
|
-
# "payload":[
|
|
207
|
-
# {
|
|
208
|
-
# "assetId":"115a60c2-0da1-40f9-a7f2-41da723b9074",
|
|
209
|
-
# "name":"Monaco Token",
|
|
210
|
-
# "symbol":"MCO",
|
|
211
|
-
# "accuracy":6,
|
|
212
|
-
# "multiplierPower":8,
|
|
213
|
-
# "assetAddress":"",
|
|
214
|
-
# "blockchainIntegrationLayerId":"",
|
|
215
|
-
# "blockchain":"ethereum",
|
|
216
|
-
# "type":"erc20Token",
|
|
217
|
-
# "isTradable":true,
|
|
218
|
-
# "isTrusted":true,
|
|
219
|
-
# "kycNeeded":false,
|
|
220
|
-
# "blockchainWithdrawal":true,
|
|
221
|
-
# "cashoutMinimalAmount":0.1,
|
|
222
|
-
# "lowVolumeAmount":null,
|
|
223
|
-
# "lykkeEntityId":"LYKKE NL",
|
|
224
|
-
# "siriusAssetId":0,
|
|
225
|
-
# "siriusBlockchainId":null,
|
|
226
|
-
# "blockchainIntegrationType":"none",
|
|
227
|
-
# "blockchainDepositEnabled":false,
|
|
228
|
-
# "isDisabled":false
|
|
229
|
-
# }
|
|
230
|
-
# ],
|
|
231
|
-
# "error":null
|
|
232
|
-
# }
|
|
233
|
-
#
|
|
234
|
-
result: dict = {}
|
|
235
|
-
for i in range(0, len(currencies)):
|
|
236
|
-
currency = currencies[i]
|
|
237
|
-
id = self.safe_string(currency, 'assetId')
|
|
238
|
-
code = self.safe_string(currency, 'symbol')
|
|
239
|
-
name = self.safe_string(currency, 'name')
|
|
240
|
-
rawType = self.safe_string(currency, 'type')
|
|
241
|
-
type = 'crypto' if (rawType == 'erc20Token') else 'other'
|
|
242
|
-
deposit = self.safe_value(currency, 'blockchainDepositEnabled')
|
|
243
|
-
withdraw = self.safe_value(currency, 'blockchainWithdrawal')
|
|
244
|
-
isDisabled = self.safe_value(currency, 'isDisabled')
|
|
245
|
-
active = not isDisabled
|
|
246
|
-
result[code] = {
|
|
247
|
-
'id': id,
|
|
248
|
-
'code': code,
|
|
249
|
-
'info': currency,
|
|
250
|
-
'type': type,
|
|
251
|
-
'name': name,
|
|
252
|
-
'active': active,
|
|
253
|
-
'deposit': deposit,
|
|
254
|
-
'withdraw': withdraw,
|
|
255
|
-
'fee': None,
|
|
256
|
-
'precision': self.parse_number(self.parse_precision(self.safe_string(currency, 'accuracy'))),
|
|
257
|
-
'limits': {
|
|
258
|
-
'withdraw': {
|
|
259
|
-
'min': self.safe_value(currency, 'cashoutMinimalAmount'),
|
|
260
|
-
'max': None,
|
|
261
|
-
},
|
|
262
|
-
'amount': {
|
|
263
|
-
'min': self.safe_value(currency, 'lowVolumeAmount'),
|
|
264
|
-
'max': None,
|
|
265
|
-
},
|
|
266
|
-
},
|
|
267
|
-
'networks': {},
|
|
268
|
-
}
|
|
269
|
-
return result
|
|
270
|
-
|
|
271
|
-
def fetch_markets(self, params={}) -> List[Market]:
|
|
272
|
-
"""
|
|
273
|
-
retrieves data on all markets for lykke
|
|
274
|
-
:see: https://lykkecity.github.io/Trading-API/#get-asset-by-id
|
|
275
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
276
|
-
:returns dict[]: an array of objects representing market data
|
|
277
|
-
"""
|
|
278
|
-
response = self.publicGetAssetpairs(params)
|
|
279
|
-
markets = self.safe_value(response, 'payload', [])
|
|
280
|
-
#
|
|
281
|
-
# {
|
|
282
|
-
# "payload":[
|
|
283
|
-
# {
|
|
284
|
-
# "assetPairId":"AAVEBTC",
|
|
285
|
-
# "baseAssetId":"c9e55548-dae5-44fc-bebd-e72249cb19f3",
|
|
286
|
-
# "quoteAssetId":"BTC",
|
|
287
|
-
# "name":"AAVE/BTC",
|
|
288
|
-
# "priceAccuracy":6,
|
|
289
|
-
# "baseAssetAccuracy":6,
|
|
290
|
-
# "quoteAssetAccuracy":8,
|
|
291
|
-
# "minVolume":0.001,
|
|
292
|
-
# "minOppositeVolume":0.0001
|
|
293
|
-
# }
|
|
294
|
-
# ],
|
|
295
|
-
# "error":null
|
|
296
|
-
# }
|
|
297
|
-
#
|
|
298
|
-
result = []
|
|
299
|
-
for i in range(0, len(markets)):
|
|
300
|
-
market = markets[i]
|
|
301
|
-
id = self.safe_string(market, 'assetPairId')
|
|
302
|
-
name = self.safe_string(market, 'name')
|
|
303
|
-
baseAssetId = self.safe_string(market, 'baseAssetId')
|
|
304
|
-
quoteAssetId = self.safe_string(market, 'quoteAssetId')
|
|
305
|
-
baseId, quoteId = name.split('/')
|
|
306
|
-
base = self.safe_currency_code(baseId)
|
|
307
|
-
quote = self.safe_currency_code(quoteId)
|
|
308
|
-
symbol = base + '/' + quote
|
|
309
|
-
result.append({
|
|
310
|
-
'id': id,
|
|
311
|
-
'symbol': symbol,
|
|
312
|
-
'base': base,
|
|
313
|
-
'quote': quote,
|
|
314
|
-
'baseId': baseAssetId,
|
|
315
|
-
'quoteId': quoteAssetId,
|
|
316
|
-
'settle': None,
|
|
317
|
-
'settleId': None,
|
|
318
|
-
'type': 'spot',
|
|
319
|
-
'spot': True,
|
|
320
|
-
'margin': False,
|
|
321
|
-
'swap': False,
|
|
322
|
-
'future': False,
|
|
323
|
-
'option': False,
|
|
324
|
-
'contract': False,
|
|
325
|
-
'active': True,
|
|
326
|
-
'linear': None,
|
|
327
|
-
'inverse': None,
|
|
328
|
-
'contractSize': None,
|
|
329
|
-
'expiry': None,
|
|
330
|
-
'expiryDatetime': None,
|
|
331
|
-
'strike': None,
|
|
332
|
-
'optionType': None,
|
|
333
|
-
'precision': {
|
|
334
|
-
'amount': self.parse_number(self.parse_precision(self.safe_string(market, 'baseAssetAccuracy'))),
|
|
335
|
-
'price': self.parse_number(self.parse_precision(self.safe_string(market, 'priceAccuracy'))),
|
|
336
|
-
},
|
|
337
|
-
'limits': {
|
|
338
|
-
'amount': {
|
|
339
|
-
'min': self.safe_number(market, 'minVolume'),
|
|
340
|
-
'max': None,
|
|
341
|
-
},
|
|
342
|
-
'price': {
|
|
343
|
-
'min': None,
|
|
344
|
-
'max': None,
|
|
345
|
-
},
|
|
346
|
-
'cost': {
|
|
347
|
-
'min': self.safe_number(market, 'minOppositeVolume'),
|
|
348
|
-
'max': None,
|
|
349
|
-
},
|
|
350
|
-
'leverage': {
|
|
351
|
-
'min': None,
|
|
352
|
-
'max': None,
|
|
353
|
-
},
|
|
354
|
-
},
|
|
355
|
-
'created': None,
|
|
356
|
-
'info': market,
|
|
357
|
-
})
|
|
358
|
-
return result
|
|
359
|
-
|
|
360
|
-
def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
|
|
361
|
-
#
|
|
362
|
-
# fetchTickers
|
|
363
|
-
#
|
|
364
|
-
# publicGetTickers
|
|
365
|
-
#
|
|
366
|
-
# {
|
|
367
|
-
# "assetPairId":"BTCUSD",
|
|
368
|
-
# "volumeBase":2.56905016,
|
|
369
|
-
# "volumeQuote":95653.8730,
|
|
370
|
-
# "priceChange":-0.0367945778541765034194707584,
|
|
371
|
-
# "lastPrice":36840.0,
|
|
372
|
-
# "high":38371.645,
|
|
373
|
-
# "low":35903.356,
|
|
374
|
-
# "timestamp":1643295740729
|
|
375
|
-
# }
|
|
376
|
-
#
|
|
377
|
-
# fetchTicker
|
|
378
|
-
#
|
|
379
|
-
# publicGetTickers
|
|
380
|
-
#
|
|
381
|
-
# {
|
|
382
|
-
# "assetPairId":"BTCUSD",
|
|
383
|
-
# "volumeBase":2.56905016,
|
|
384
|
-
# "volumeQuote":95653.8730,
|
|
385
|
-
# "priceChange":-0.0367945778541765034194707584,
|
|
386
|
-
# "lastPrice":36840.0,
|
|
387
|
-
# "high":38371.645,
|
|
388
|
-
# "low":35903.356,
|
|
389
|
-
# "timestamp":1643295740729
|
|
390
|
-
# }
|
|
391
|
-
#
|
|
392
|
-
# publicGetPrices
|
|
393
|
-
#
|
|
394
|
-
# {
|
|
395
|
-
# "assetPairId":"BTCUSD",
|
|
396
|
-
# "bid":36181.521,
|
|
397
|
-
# "ask":36244.492,
|
|
398
|
-
# "timestamp":1643305510990
|
|
399
|
-
# }
|
|
400
|
-
#
|
|
401
|
-
timestamp = None # temporary bug in lykke api, returns unrealistic numbers
|
|
402
|
-
marketId = self.safe_string(ticker, 'assetPairId')
|
|
403
|
-
market = self.safe_market(marketId, market)
|
|
404
|
-
close = self.safe_string(ticker, 'lastPrice')
|
|
405
|
-
return self.safe_ticker({
|
|
406
|
-
'symbol': self.safe_string(market, 'symbol'),
|
|
407
|
-
'timestamp': timestamp,
|
|
408
|
-
'datetime': self.iso8601(timestamp),
|
|
409
|
-
'high': self.safe_string(ticker, 'high'),
|
|
410
|
-
'low': self.safe_string(ticker, 'low'),
|
|
411
|
-
'bid': self.safe_string(ticker, 'bid'),
|
|
412
|
-
'bidVolume': None,
|
|
413
|
-
'ask': self.safe_string(ticker, 'ask'),
|
|
414
|
-
'askVolume': None,
|
|
415
|
-
'vwap': None,
|
|
416
|
-
'open': None,
|
|
417
|
-
'close': close,
|
|
418
|
-
'last': close,
|
|
419
|
-
'previousClose': None,
|
|
420
|
-
'change': self.safe_string(ticker, 'priceChange'),
|
|
421
|
-
'percentage': None,
|
|
422
|
-
'average': None,
|
|
423
|
-
'baseVolume': self.safe_string(ticker, 'volumeBase'),
|
|
424
|
-
'quoteVolume': self.safe_string(ticker, 'volumeQuote'),
|
|
425
|
-
'info': ticker,
|
|
426
|
-
}, market)
|
|
427
|
-
|
|
428
|
-
def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
|
429
|
-
"""
|
|
430
|
-
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
431
|
-
:see: https://lykkecity.github.io/Trading-API/#get-current-prices
|
|
432
|
-
:see: https://lykkecity.github.io/Trading-API/#24hr-ticker-price-change-statistics
|
|
433
|
-
:param str symbol: unified symbol of the market to fetch the ticker for
|
|
434
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
435
|
-
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
|
436
|
-
"""
|
|
437
|
-
self.load_markets()
|
|
438
|
-
market = self.market(symbol)
|
|
439
|
-
request: dict = {
|
|
440
|
-
'assetPairIds': market['id'],
|
|
441
|
-
}
|
|
442
|
-
# publicGetTickers or publicGetPrices
|
|
443
|
-
method = self.safe_string(self.options, 'fetchTickerMethod', 'publicGetTickers')
|
|
444
|
-
response = None
|
|
445
|
-
if method == 'publicGetPrices':
|
|
446
|
-
response = self.publicGetPrices(self.extend(request, params))
|
|
447
|
-
else:
|
|
448
|
-
response = self.publicGetTickers(self.extend(request, params))
|
|
449
|
-
ticker = self.safe_value(response, 'payload', [])
|
|
450
|
-
#
|
|
451
|
-
# publicGetTickers
|
|
452
|
-
#
|
|
453
|
-
# {
|
|
454
|
-
# "payload":[
|
|
455
|
-
# {
|
|
456
|
-
# "assetPairId":"BTCUSD",
|
|
457
|
-
# "volumeBase":0.78056880,
|
|
458
|
-
# "volumeQuote":29782.5169,
|
|
459
|
-
# "priceChange":0.0436602362590968619931324699,
|
|
460
|
-
# "lastPrice":38626.885,
|
|
461
|
-
# "high":38742.896,
|
|
462
|
-
# "low":36872.498,
|
|
463
|
-
# "timestamp":1643687822840
|
|
464
|
-
# }
|
|
465
|
-
# ],
|
|
466
|
-
# "error":null
|
|
467
|
-
# }
|
|
468
|
-
#
|
|
469
|
-
# publicGetPrices
|
|
470
|
-
#
|
|
471
|
-
# {
|
|
472
|
-
# "payload":[
|
|
473
|
-
# {
|
|
474
|
-
# "assetPairId":"BTCUSD",
|
|
475
|
-
# "bid":38597.936,
|
|
476
|
-
# "ask":38640.311,
|
|
477
|
-
# "timestamp":1643688350847
|
|
478
|
-
# }
|
|
479
|
-
# ],
|
|
480
|
-
# "error":null
|
|
481
|
-
# }
|
|
482
|
-
#
|
|
483
|
-
return self.parse_ticker(self.safe_value(ticker, 0, {}), market)
|
|
484
|
-
|
|
485
|
-
def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
|
486
|
-
"""
|
|
487
|
-
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
488
|
-
:see: https://lykkecity.github.io/Trading-API/#24hr-ticker-price-change-statistics
|
|
489
|
-
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
490
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
491
|
-
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
|
492
|
-
"""
|
|
493
|
-
self.load_markets()
|
|
494
|
-
response = self.publicGetTickers(params)
|
|
495
|
-
tickers = self.safe_value(response, 'payload', [])
|
|
496
|
-
#
|
|
497
|
-
# {
|
|
498
|
-
# "payload":[
|
|
499
|
-
# {
|
|
500
|
-
# "assetPairId":"BTCUSD",
|
|
501
|
-
# "volumeBase":0.78056880,
|
|
502
|
-
# "volumeQuote":29782.5169,
|
|
503
|
-
# "priceChange":0.0436602362590968619931324699,
|
|
504
|
-
# "lastPrice":38626.885,
|
|
505
|
-
# "high":38742.896,
|
|
506
|
-
# "low":36872.498,
|
|
507
|
-
# "timestamp":1643687822840
|
|
508
|
-
# }
|
|
509
|
-
# ],
|
|
510
|
-
# "error":null
|
|
511
|
-
# }
|
|
512
|
-
#
|
|
513
|
-
return self.parse_tickers(tickers, symbols)
|
|
514
|
-
|
|
515
|
-
def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
|
516
|
-
"""
|
|
517
|
-
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
|
518
|
-
:see: https://lykkecity.github.io/Trading-API/#asset-pair-order-book-ticker
|
|
519
|
-
:param str symbol: unified symbol of the market to fetch the order book for
|
|
520
|
-
:param int [limit]: the maximum amount of order book entries to return
|
|
521
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
522
|
-
:returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
|
|
523
|
-
"""
|
|
524
|
-
self.load_markets()
|
|
525
|
-
market = self.market(symbol)
|
|
526
|
-
request: dict = {
|
|
527
|
-
'assetPairId': market['id'],
|
|
528
|
-
}
|
|
529
|
-
if limit is not None:
|
|
530
|
-
request['depth'] = limit # default 0
|
|
531
|
-
response = self.publicGetOrderbooks(self.extend(request, params))
|
|
532
|
-
payload = self.safe_value(response, 'payload', [])
|
|
533
|
-
#
|
|
534
|
-
# {
|
|
535
|
-
# "payload":[
|
|
536
|
-
# {
|
|
537
|
-
# "assetPairId": "BTCUSD",
|
|
538
|
-
# "timestamp": "1643298038203",
|
|
539
|
-
# "bids": [
|
|
540
|
-
# {
|
|
541
|
-
# "v":0.59034382,
|
|
542
|
-
# "p":36665.329
|
|
543
|
-
# }
|
|
544
|
-
# ],
|
|
545
|
-
# "asks": [
|
|
546
|
-
# {
|
|
547
|
-
# "v":-0.003,
|
|
548
|
-
# "p":36729.686
|
|
549
|
-
# }
|
|
550
|
-
# ]
|
|
551
|
-
# }
|
|
552
|
-
# ],
|
|
553
|
-
# "error":null
|
|
554
|
-
# }
|
|
555
|
-
#
|
|
556
|
-
orderbook = self.safe_value(payload, 0, {})
|
|
557
|
-
timestamp = self.safe_integer(orderbook, 'timestamp')
|
|
558
|
-
return self.parse_order_book(orderbook, market['symbol'], timestamp, 'bids', 'asks', 'p', 'v')
|
|
559
|
-
|
|
560
|
-
def parse_trade(self, trade: dict, market: Market = None) -> Trade:
|
|
561
|
-
#
|
|
562
|
-
# public fetchTrades
|
|
563
|
-
#
|
|
564
|
-
# {
|
|
565
|
-
# "id":"71df1f0c-be4e-4d45-b809-c108fad5f2a8",
|
|
566
|
-
# "assetPairId":"BTCUSD",
|
|
567
|
-
# "timestamp":1643345958414,
|
|
568
|
-
# "volume":0.00010996,
|
|
569
|
-
# "price":37205.723,
|
|
570
|
-
# "side":"buy"
|
|
571
|
-
# }
|
|
572
|
-
#
|
|
573
|
-
# private fetchMyTrades
|
|
574
|
-
# {
|
|
575
|
-
# "id":"813a3ffa-1c4b-45cb-b13f-1c077ea2748b",
|
|
576
|
-
# "timestamp":1644155923357,
|
|
577
|
-
# "assetPairId":"BCHEUR",
|
|
578
|
-
# "orderId":"1b367978-7e4f-454b-b870-64040d484443",
|
|
579
|
-
# "role":"Taker",
|
|
580
|
-
# "side":"sell",
|
|
581
|
-
# "price":280.569,
|
|
582
|
-
# "baseVolume":0.01,
|
|
583
|
-
# "quoteVolume":2.8056,
|
|
584
|
-
# "baseAssetId":"2a34d6a6-5839-40e5-836f-c1178fa09b89",
|
|
585
|
-
# "quoteAssetId":"EUR",
|
|
586
|
-
# "fee":null
|
|
587
|
-
# }
|
|
588
|
-
#
|
|
589
|
-
marketId = self.safe_string(trade, 'assetPairId')
|
|
590
|
-
market = self.safe_market(marketId, market)
|
|
591
|
-
symbol = market['symbol']
|
|
592
|
-
id = self.safe_string_2(trade, 'id', 'id')
|
|
593
|
-
orderId = self.safe_string(trade, 'orderId')
|
|
594
|
-
timestamp = self.safe_integer(trade, 'timestamp')
|
|
595
|
-
price = self.safe_string_2(trade, 'price', 'price')
|
|
596
|
-
amount = self.safe_string_2(trade, 'volume', 'amount')
|
|
597
|
-
if amount is None:
|
|
598
|
-
amount = self.safe_string_2(trade, 'baseVolume', 'amount')
|
|
599
|
-
side = self.safe_string_lower(trade, 'side')
|
|
600
|
-
return self.safe_trade({
|
|
601
|
-
'id': id,
|
|
602
|
-
'info': trade,
|
|
603
|
-
'timestamp': timestamp,
|
|
604
|
-
'datetime': self.iso8601(timestamp),
|
|
605
|
-
'symbol': symbol,
|
|
606
|
-
'type': None,
|
|
607
|
-
'order': orderId,
|
|
608
|
-
'side': side,
|
|
609
|
-
'takerOrMaker': None,
|
|
610
|
-
'price': price,
|
|
611
|
-
'amount': amount,
|
|
612
|
-
'cost': None,
|
|
613
|
-
'fee': None,
|
|
614
|
-
}, market)
|
|
615
|
-
|
|
616
|
-
def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
|
617
|
-
"""
|
|
618
|
-
get the list of most recent trades for a particular symbol
|
|
619
|
-
:see: https://lykkecity.github.io/Trading-API/#get-public-trades
|
|
620
|
-
:param str symbol: unified symbol of the market to fetch trades for
|
|
621
|
-
:param int [since]: timestamp in ms of the earliest trade to fetch
|
|
622
|
-
:param int [limit]: the maximum amount of trades to fetch
|
|
623
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
624
|
-
:returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
|
|
625
|
-
"""
|
|
626
|
-
self.load_markets()
|
|
627
|
-
market = self.market(symbol)
|
|
628
|
-
request: dict = {
|
|
629
|
-
'assetPairId': market['id'],
|
|
630
|
-
# 'offset': 0,
|
|
631
|
-
}
|
|
632
|
-
if limit is not None:
|
|
633
|
-
request['take'] = limit
|
|
634
|
-
response = self.publicGetTradesPublicAssetPairId(self.extend(request, params))
|
|
635
|
-
result = self.safe_value(response, 'payload', [])
|
|
636
|
-
#
|
|
637
|
-
# {
|
|
638
|
-
# "payload":[
|
|
639
|
-
# {
|
|
640
|
-
# "id":"71df1f0c-be4e-4d45-b809-c108fad5f2a8",
|
|
641
|
-
# "assetPairId":"BTCUSD",
|
|
642
|
-
# "timestamp":1643345958414,
|
|
643
|
-
# "volume":0.00010996,
|
|
644
|
-
# "price":37205.723,
|
|
645
|
-
# "side":"buy"
|
|
646
|
-
# }
|
|
647
|
-
# ],
|
|
648
|
-
# "error":null
|
|
649
|
-
# }
|
|
650
|
-
#
|
|
651
|
-
return self.parse_trades(result, market, since, limit)
|
|
652
|
-
|
|
653
|
-
def parse_balance(self, response) -> Balances:
|
|
654
|
-
#
|
|
655
|
-
# [
|
|
656
|
-
# {
|
|
657
|
-
# "assetId":"2a34d6a6-5839-40e5-836f-c1178fa09b89",
|
|
658
|
-
# "available":0.1,
|
|
659
|
-
# "reserved":0.0,
|
|
660
|
-
# "timestamp":1644146723620
|
|
661
|
-
# }
|
|
662
|
-
# ]
|
|
663
|
-
#
|
|
664
|
-
result: dict = {'info': response}
|
|
665
|
-
for i in range(0, len(response)):
|
|
666
|
-
balance = response[i]
|
|
667
|
-
currencyId = self.safe_string(balance, 'assetId')
|
|
668
|
-
code = self.safe_currency_code(currencyId)
|
|
669
|
-
account = self.account()
|
|
670
|
-
free = self.safe_string(balance, 'available')
|
|
671
|
-
used = self.safe_string(balance, 'reserved')
|
|
672
|
-
account['free'] = free
|
|
673
|
-
account['used'] = used
|
|
674
|
-
result[code] = account
|
|
675
|
-
return self.safe_balance(result)
|
|
676
|
-
|
|
677
|
-
def fetch_balance(self, params={}) -> Balances:
|
|
678
|
-
"""
|
|
679
|
-
query for balance and get the amount of funds available for trading or funds locked in orders
|
|
680
|
-
:see: https://lykkecity.github.io/Trading-API/#get-the-current-balance
|
|
681
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
682
|
-
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
|
683
|
-
"""
|
|
684
|
-
self.load_markets()
|
|
685
|
-
response = self.privateGetBalance(params)
|
|
686
|
-
payload = self.safe_value(response, 'payload', [])
|
|
687
|
-
#
|
|
688
|
-
# {
|
|
689
|
-
# "payload":[
|
|
690
|
-
# {
|
|
691
|
-
# "assetId":"2a34d6a6-5839-40e5-836f-c1178fa09b89",
|
|
692
|
-
# "available":0.1,
|
|
693
|
-
# "reserved":0.0,
|
|
694
|
-
# "timestamp":1644146723620
|
|
695
|
-
# }
|
|
696
|
-
# ],
|
|
697
|
-
# "error":null
|
|
698
|
-
# }
|
|
699
|
-
#
|
|
700
|
-
return self.parse_balance(payload)
|
|
701
|
-
|
|
702
|
-
def parse_order_status(self, status: Str):
|
|
703
|
-
statuses: dict = {
|
|
704
|
-
'Open': 'open',
|
|
705
|
-
'Pending': 'open',
|
|
706
|
-
'InOrderBook': 'open',
|
|
707
|
-
'Processing': 'open',
|
|
708
|
-
'Matched': 'closed',
|
|
709
|
-
'Cancelled': 'canceled',
|
|
710
|
-
'Rejected': 'rejected',
|
|
711
|
-
'Replaced': 'canceled',
|
|
712
|
-
'Placed': 'open',
|
|
713
|
-
}
|
|
714
|
-
return self.safe_string(statuses, status, status)
|
|
715
|
-
|
|
716
|
-
def parse_order(self, order: dict, market: Market = None) -> Order:
|
|
717
|
-
#
|
|
718
|
-
# {
|
|
719
|
-
# "id":"1b367978-7e4f-454b-b870-64040d484443",
|
|
720
|
-
# "timestamp":1644155923357,
|
|
721
|
-
# "lastTradeTimestamp":1644155923357,
|
|
722
|
-
# "status":"Matched",
|
|
723
|
-
# "assetPairId":"BCHEUR",
|
|
724
|
-
# "type":"Market",
|
|
725
|
-
# "side":"Sell",
|
|
726
|
-
# "price":280.569,
|
|
727
|
-
# "volume":0.01,
|
|
728
|
-
# "filledVolume":0.01,
|
|
729
|
-
# "remainingVolume":0.0,
|
|
730
|
-
# "cost":2.80569
|
|
731
|
-
# }
|
|
732
|
-
#
|
|
733
|
-
id = self.safe_string(order, 'id')
|
|
734
|
-
status = self.parse_order_status(self.safe_string(order, 'status'))
|
|
735
|
-
marketId = self.safe_string(order, 'assetPairId')
|
|
736
|
-
symbol = self.safe_symbol(marketId, market)
|
|
737
|
-
type = self.safe_string_lower(order, 'type')
|
|
738
|
-
lastTradeTimestamp = self.safe_integer(order, 'lastTradeTimestamp')
|
|
739
|
-
timestamp = self.safe_integer(order, 'timestamp')
|
|
740
|
-
price = self.safe_string(order, 'price')
|
|
741
|
-
side = self.safe_string_lower(order, 'side')
|
|
742
|
-
amount = self.safe_string(order, 'volume')
|
|
743
|
-
remaining = self.safe_string(order, 'remainingVolume')
|
|
744
|
-
filled = self.safe_string(order, 'filledVolume')
|
|
745
|
-
cost = self.safe_string(order, 'cost')
|
|
746
|
-
return self.safe_order({
|
|
747
|
-
'info': order,
|
|
748
|
-
'id': id,
|
|
749
|
-
'clientOrderId': None,
|
|
750
|
-
'timestamp': timestamp,
|
|
751
|
-
'datetime': self.iso8601(timestamp),
|
|
752
|
-
'lastTradeTimestamp': lastTradeTimestamp,
|
|
753
|
-
'symbol': symbol,
|
|
754
|
-
'type': type,
|
|
755
|
-
'timeInForce': None,
|
|
756
|
-
'postOnly': None,
|
|
757
|
-
'side': side,
|
|
758
|
-
'price': price,
|
|
759
|
-
'stopPrice': None,
|
|
760
|
-
'triggerPrice': None,
|
|
761
|
-
'amount': amount,
|
|
762
|
-
'cost': cost,
|
|
763
|
-
'average': None,
|
|
764
|
-
'filled': filled,
|
|
765
|
-
'remaining': remaining,
|
|
766
|
-
'status': status,
|
|
767
|
-
'fee': None,
|
|
768
|
-
'trades': None,
|
|
769
|
-
}, market)
|
|
770
|
-
|
|
771
|
-
def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
|
772
|
-
"""
|
|
773
|
-
create a trade order
|
|
774
|
-
:see: https://lykkecity.github.io/Trading-API/#place-a-limit-order
|
|
775
|
-
:see: https://lykkecity.github.io/Trading-API/#place-a-market-order
|
|
776
|
-
:param str symbol: unified symbol of the market to create an order in
|
|
777
|
-
:param str type: 'market' or 'limit'
|
|
778
|
-
:param str side: 'buy' or 'sell'
|
|
779
|
-
:param float amount: how much of currency you want to trade in units of base currency
|
|
780
|
-
:param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
781
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
782
|
-
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
|
783
|
-
"""
|
|
784
|
-
self.load_markets()
|
|
785
|
-
market = self.market(symbol)
|
|
786
|
-
query: dict = {
|
|
787
|
-
'assetPairId': market['id'],
|
|
788
|
-
'side': self.capitalize(side),
|
|
789
|
-
'volume': float(self.amount_to_precision(market['symbol'], amount)),
|
|
790
|
-
}
|
|
791
|
-
if type == 'limit':
|
|
792
|
-
query['price'] = float(self.price_to_precision(market['symbol'], price))
|
|
793
|
-
result = None
|
|
794
|
-
if self.capitalize(type) == 'Market':
|
|
795
|
-
result = self.privatePostOrdersMarket(self.extend(query, params))
|
|
796
|
-
else:
|
|
797
|
-
result = self.privatePostOrdersLimit(self.extend(query, params))
|
|
798
|
-
#
|
|
799
|
-
# market
|
|
800
|
-
#
|
|
801
|
-
# {
|
|
802
|
-
# "payload":{
|
|
803
|
-
# "orderId":"2b98ec26-8410-49b6-9f37-1fb2150e2299",
|
|
804
|
-
# "price":280.699
|
|
805
|
-
# },
|
|
806
|
-
# "error":null
|
|
807
|
-
# }
|
|
808
|
-
#
|
|
809
|
-
# limit
|
|
810
|
-
#
|
|
811
|
-
# {
|
|
812
|
-
# "payload":{
|
|
813
|
-
# "orderId":"27be8802-30be-40ca-bf40-ec886b309c5b"
|
|
814
|
-
# },
|
|
815
|
-
# "error":null
|
|
816
|
-
# }
|
|
817
|
-
#
|
|
818
|
-
payload = self.safe_value(result, 'payload')
|
|
819
|
-
id = self.safe_string(payload, 'orderId')
|
|
820
|
-
if type == 'market':
|
|
821
|
-
price = self.safe_number(payload, 'price')
|
|
822
|
-
return self.safe_order({
|
|
823
|
-
'id': id,
|
|
824
|
-
'info': result,
|
|
825
|
-
'clientOrderId': None,
|
|
826
|
-
'timestamp': None,
|
|
827
|
-
'datetime': None,
|
|
828
|
-
'lastTradeTimestamp': None,
|
|
829
|
-
'symbol': market['symbol'],
|
|
830
|
-
'type': type,
|
|
831
|
-
'side': side,
|
|
832
|
-
'price': price,
|
|
833
|
-
'amount': amount,
|
|
834
|
-
'cost': None,
|
|
835
|
-
'average': None,
|
|
836
|
-
'filled': None,
|
|
837
|
-
'remaining': None,
|
|
838
|
-
'status': None,
|
|
839
|
-
'fee': None,
|
|
840
|
-
'trades': None,
|
|
841
|
-
}, market)
|
|
842
|
-
|
|
843
|
-
def cancel_order(self, id: str, symbol: Str = None, params={}):
|
|
844
|
-
"""
|
|
845
|
-
cancels an open order
|
|
846
|
-
:see: https://lykkecity.github.io/Trading-API/#cancel-orders-by-id
|
|
847
|
-
:param str id: order id
|
|
848
|
-
:param str symbol: unified symbol of the market the order was made in
|
|
849
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
850
|
-
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
|
851
|
-
"""
|
|
852
|
-
request: dict = {
|
|
853
|
-
'orderId': id,
|
|
854
|
-
}
|
|
855
|
-
#
|
|
856
|
-
# {
|
|
857
|
-
# "payload":null,
|
|
858
|
-
# "error":null
|
|
859
|
-
# }
|
|
860
|
-
#
|
|
861
|
-
response = self.privateDeleteOrdersOrderId(self.extend(request, params))
|
|
862
|
-
return self.safe_order({
|
|
863
|
-
'info': response,
|
|
864
|
-
})
|
|
865
|
-
|
|
866
|
-
def cancel_all_orders(self, symbol: Str = None, params={}):
|
|
867
|
-
"""
|
|
868
|
-
cancel all open orders
|
|
869
|
-
:see: https://lykkecity.github.io/Trading-API/#mass-cancel-orders
|
|
870
|
-
:param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
|
|
871
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
872
|
-
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
|
873
|
-
"""
|
|
874
|
-
self.load_markets()
|
|
875
|
-
request: dict = {
|
|
876
|
-
# 'side': 'Buy',
|
|
877
|
-
}
|
|
878
|
-
market = None
|
|
879
|
-
if symbol is not None:
|
|
880
|
-
market = self.market(symbol)
|
|
881
|
-
request['assetPairId'] = market['id']
|
|
882
|
-
#
|
|
883
|
-
# {
|
|
884
|
-
# "payload":null,
|
|
885
|
-
# "error":null
|
|
886
|
-
# }
|
|
887
|
-
#
|
|
888
|
-
response = self.privateDeleteOrders(self.extend(request, params))
|
|
889
|
-
return [
|
|
890
|
-
self.safe_order({
|
|
891
|
-
'info': response,
|
|
892
|
-
}),
|
|
893
|
-
]
|
|
894
|
-
|
|
895
|
-
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
|
896
|
-
"""
|
|
897
|
-
fetches information on an order made by the user
|
|
898
|
-
:see: https://lykkecity.github.io/Trading-API/#get-order-by-id
|
|
899
|
-
:param str symbol: not used by lykke fetchOrder
|
|
900
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
901
|
-
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
|
902
|
-
"""
|
|
903
|
-
self.load_markets()
|
|
904
|
-
request: dict = {
|
|
905
|
-
'orderId': id,
|
|
906
|
-
}
|
|
907
|
-
response = self.privateGetOrdersOrderId(self.extend(request, params))
|
|
908
|
-
payload = self.safe_value(response, 'payload')
|
|
909
|
-
#
|
|
910
|
-
# {
|
|
911
|
-
# "payload":{
|
|
912
|
-
# "id":"1b367978-7e4f-454b-b870-64040d484443",
|
|
913
|
-
# "timestamp":1644155923357,
|
|
914
|
-
# "lastTradeTimestamp":1644155923357,
|
|
915
|
-
# "status":"Matched",
|
|
916
|
-
# "assetPairId":"BCHEUR",
|
|
917
|
-
# "type":"Market",
|
|
918
|
-
# "side":"Sell",
|
|
919
|
-
# "price":280.569,
|
|
920
|
-
# "volume":0.01,
|
|
921
|
-
# "filledVolume":0.01,
|
|
922
|
-
# "remainingVolume":0.0,
|
|
923
|
-
# "cost":2.80569
|
|
924
|
-
# },
|
|
925
|
-
# "error":null
|
|
926
|
-
# }
|
|
927
|
-
#
|
|
928
|
-
return self.parse_order(payload)
|
|
929
|
-
|
|
930
|
-
def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
|
931
|
-
"""
|
|
932
|
-
fetch all unfilled currently open orders
|
|
933
|
-
:see: https://lykkecity.github.io/Trading-API/#get-active-or-closed-orders
|
|
934
|
-
:param str symbol: unified market symbol
|
|
935
|
-
:param int [since]: the earliest time in ms to fetch open orders for
|
|
936
|
-
:param int [limit]: the maximum number of open orders structures to retrieve
|
|
937
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
938
|
-
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
|
939
|
-
"""
|
|
940
|
-
self.load_markets()
|
|
941
|
-
market = None
|
|
942
|
-
if symbol is not None:
|
|
943
|
-
market = self.market(symbol)
|
|
944
|
-
request: dict = {
|
|
945
|
-
# 'offset': 0,
|
|
946
|
-
# 'take': 1,
|
|
947
|
-
}
|
|
948
|
-
if limit is not None:
|
|
949
|
-
request['take'] = limit
|
|
950
|
-
response = self.privateGetOrdersActive(self.extend(request, params))
|
|
951
|
-
payload = self.safe_value(response, 'payload')
|
|
952
|
-
#
|
|
953
|
-
# {
|
|
954
|
-
# "payload":[
|
|
955
|
-
# {
|
|
956
|
-
# "id":"b26f58f5-8542-4b4c-9815-91562b523cc3",
|
|
957
|
-
# "timestamp":1644157177155,
|
|
958
|
-
# "lastTradeTimestamp":null,
|
|
959
|
-
# "status":"Placed",
|
|
960
|
-
# "assetPairId":"BCHEUR",
|
|
961
|
-
# "type":"Limit",
|
|
962
|
-
# "side":"Sell",
|
|
963
|
-
# "price":666.666,
|
|
964
|
-
# "volume":0.01,
|
|
965
|
-
# "filledVolume":0.00,
|
|
966
|
-
# "remainingVolume":0.01,
|
|
967
|
-
# "cost":0.00000
|
|
968
|
-
# }
|
|
969
|
-
# ],
|
|
970
|
-
# "error":null
|
|
971
|
-
# }
|
|
972
|
-
#
|
|
973
|
-
return self.parse_orders(payload, market, since, limit)
|
|
974
|
-
|
|
975
|
-
def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
|
976
|
-
"""
|
|
977
|
-
fetches information on multiple closed orders made by the user
|
|
978
|
-
:see: https://lykkecity.github.io/Trading-API/#get-active-or-closed-orders
|
|
979
|
-
:param str symbol: unified market symbol of the market orders were made in
|
|
980
|
-
:param int [since]: the earliest time in ms to fetch orders for
|
|
981
|
-
:param int [limit]: the maximum number of order structures to retrieve
|
|
982
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
983
|
-
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
|
984
|
-
"""
|
|
985
|
-
self.load_markets()
|
|
986
|
-
market = None
|
|
987
|
-
if symbol is not None:
|
|
988
|
-
market = self.market(symbol)
|
|
989
|
-
request: dict = {
|
|
990
|
-
# 'offset': 0,
|
|
991
|
-
# 'take': 1,
|
|
992
|
-
}
|
|
993
|
-
if limit is not None:
|
|
994
|
-
request['take'] = limit
|
|
995
|
-
response = self.privateGetOrdersClosed(self.extend(request, params))
|
|
996
|
-
payload = self.safe_value(response, 'payload')
|
|
997
|
-
#
|
|
998
|
-
# {
|
|
999
|
-
# "payload":[
|
|
1000
|
-
# {
|
|
1001
|
-
# "id":"1b367978-7e4f-454b-b870-64040d484443",
|
|
1002
|
-
# "timestamp":1644155923357,
|
|
1003
|
-
# "lastTradeTimestamp":1644155923357,
|
|
1004
|
-
# "status":"Matched",
|
|
1005
|
-
# "assetPairId":"BCHEUR",
|
|
1006
|
-
# "type":"Market",
|
|
1007
|
-
# "side":"Sell",
|
|
1008
|
-
# "price":280.569,
|
|
1009
|
-
# "volume":0.01,
|
|
1010
|
-
# "filledVolume":0.01,
|
|
1011
|
-
# "remainingVolume":0.0,
|
|
1012
|
-
# "cost":2.80569
|
|
1013
|
-
# }
|
|
1014
|
-
# ],
|
|
1015
|
-
# "error":null
|
|
1016
|
-
# }
|
|
1017
|
-
#
|
|
1018
|
-
return self.parse_orders(payload, market, since, limit)
|
|
1019
|
-
|
|
1020
|
-
def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
|
1021
|
-
"""
|
|
1022
|
-
fetch all trades made by the user
|
|
1023
|
-
:see: https://lykkecity.github.io/Trading-API/#get-trade-history
|
|
1024
|
-
:param str symbol: unified market symbol
|
|
1025
|
-
:param int [since]: the earliest time in ms to fetch trades for
|
|
1026
|
-
:param int [limit]: the maximum number of trades structures to retrieve
|
|
1027
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1028
|
-
:returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
|
|
1029
|
-
"""
|
|
1030
|
-
self.load_markets()
|
|
1031
|
-
request: dict = {
|
|
1032
|
-
# 'side': 'buy',
|
|
1033
|
-
# 'offset': 0,
|
|
1034
|
-
# 'take': 1,
|
|
1035
|
-
# 'to': 0,
|
|
1036
|
-
}
|
|
1037
|
-
market = None
|
|
1038
|
-
if limit is not None:
|
|
1039
|
-
request['take'] = limit # How many maximum items have to be returned, max 1000 default 100.
|
|
1040
|
-
if symbol is not None:
|
|
1041
|
-
market = self.market(symbol)
|
|
1042
|
-
request['assetPairId'] = market['id']
|
|
1043
|
-
if since is not None:
|
|
1044
|
-
request['from'] = since
|
|
1045
|
-
response = self.privateGetTrades(self.extend(request, params))
|
|
1046
|
-
payload = self.safe_value(response, 'payload')
|
|
1047
|
-
#
|
|
1048
|
-
# {
|
|
1049
|
-
# "payload":[
|
|
1050
|
-
# {
|
|
1051
|
-
# "id":"813a3ffa-1c4b-45cb-b13f-1c077ea2748b",
|
|
1052
|
-
# "timestamp":1644155923357,
|
|
1053
|
-
# "assetPairId":"BCHEUR",
|
|
1054
|
-
# "orderId":"1b367978-7e4f-454b-b870-64040d484443",
|
|
1055
|
-
# "role":"Taker",
|
|
1056
|
-
# "side":"sell",
|
|
1057
|
-
# "price":280.569,
|
|
1058
|
-
# "baseVolume":0.01,
|
|
1059
|
-
# "quoteVolume":2.8056,
|
|
1060
|
-
# "baseAssetId":"2a34d6a6-5839-40e5-836f-c1178fa09b89",
|
|
1061
|
-
# "quoteAssetId":"EUR",
|
|
1062
|
-
# "fee":null
|
|
1063
|
-
# }
|
|
1064
|
-
# ],
|
|
1065
|
-
# "error":null
|
|
1066
|
-
# }
|
|
1067
|
-
#
|
|
1068
|
-
return self.parse_trades(payload, market, since, limit)
|
|
1069
|
-
|
|
1070
|
-
def parse_bid_ask(self, bidask, priceKey: IndexType = 0, amountKey: IndexType = 1, countOrIdKey: IndexType = 2):
|
|
1071
|
-
price = self.safe_string(bidask, priceKey)
|
|
1072
|
-
amount = Precise.string_abs(self.safe_string(bidask, amountKey))
|
|
1073
|
-
return [self.parse_number(price), self.parse_number(amount)]
|
|
1074
|
-
|
|
1075
|
-
def fetch_deposit_address(self, code: str, params={}):
|
|
1076
|
-
"""
|
|
1077
|
-
fetch the deposit address for a currency associated with self account
|
|
1078
|
-
:see: https://lykkecity.github.io/Trading-API/#get-deposit-address-for-a-given-asset
|
|
1079
|
-
:param str code: unified currency code
|
|
1080
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1081
|
-
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
|
|
1082
|
-
"""
|
|
1083
|
-
self.load_markets()
|
|
1084
|
-
currency = self.currency(code)
|
|
1085
|
-
request: dict = {
|
|
1086
|
-
'assetId': self.safe_string(currency, 'id'),
|
|
1087
|
-
}
|
|
1088
|
-
response = self.privateGetOperationsDepositsAddressesAssetId(self.extend(request, params))
|
|
1089
|
-
#
|
|
1090
|
-
# {
|
|
1091
|
-
# "assetId":"2a34d6a6-5839-40e5-836f-c1178fa09b89",
|
|
1092
|
-
# "symbol":"BCH",
|
|
1093
|
-
# "address":null,
|
|
1094
|
-
# "baseAddress":null,
|
|
1095
|
-
# "addressExtension":null,
|
|
1096
|
-
# "state":"Active"
|
|
1097
|
-
# }
|
|
1098
|
-
#
|
|
1099
|
-
address = self.safe_string(response, 'baseAddress')
|
|
1100
|
-
tag = self.safe_string(response, 'addressExtension')
|
|
1101
|
-
self.check_address(address)
|
|
1102
|
-
return {
|
|
1103
|
-
'currency': code,
|
|
1104
|
-
'address': address,
|
|
1105
|
-
'tag': tag,
|
|
1106
|
-
'network': None,
|
|
1107
|
-
'info': response,
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
|
|
1111
|
-
#
|
|
1112
|
-
# withdraw
|
|
1113
|
-
# "3035b1ad-2005-4587-a986-1f7966be78e0"
|
|
1114
|
-
#
|
|
1115
|
-
# fetchDepositsWithdrawals
|
|
1116
|
-
# {
|
|
1117
|
-
# "operationId":"787201c8-f1cc-45c0-aec1-fa06eeea426b",
|
|
1118
|
-
# "assetId":"2a34d6a6-5839-40e5-836f-c1178fa09b89",
|
|
1119
|
-
# "totalVolume":0.1,
|
|
1120
|
-
# "fee":0.0,
|
|
1121
|
-
# "type":"deposit",
|
|
1122
|
-
# "timestamp":1644146723620
|
|
1123
|
-
# }
|
|
1124
|
-
#
|
|
1125
|
-
id = None
|
|
1126
|
-
assetId = None
|
|
1127
|
-
code = None
|
|
1128
|
-
amount = None
|
|
1129
|
-
fee = None
|
|
1130
|
-
type = None
|
|
1131
|
-
timestamp = None
|
|
1132
|
-
if isinstance(transaction, str):
|
|
1133
|
-
id = transaction
|
|
1134
|
-
else:
|
|
1135
|
-
id = self.safe_string(transaction, 'operationId')
|
|
1136
|
-
assetId = self.safe_string(transaction, 'assetId')
|
|
1137
|
-
code = self.safe_currency_code(assetId, currency)
|
|
1138
|
-
amount = self.safe_number(transaction, 'totalVolume')
|
|
1139
|
-
type = self.safe_string(transaction, 'type')
|
|
1140
|
-
timestamp = self.safe_integer(transaction, 'timestamp')
|
|
1141
|
-
feeCost = self.safe_number(transaction, 'fee')
|
|
1142
|
-
fee = {
|
|
1143
|
-
'currency': code,
|
|
1144
|
-
'cost': feeCost,
|
|
1145
|
-
}
|
|
1146
|
-
return {
|
|
1147
|
-
'info': transaction,
|
|
1148
|
-
'id': id,
|
|
1149
|
-
'txid': None,
|
|
1150
|
-
'timestamp': timestamp,
|
|
1151
|
-
'datetime': self.iso8601(timestamp),
|
|
1152
|
-
'network': None,
|
|
1153
|
-
'addressFrom': None,
|
|
1154
|
-
'address': None,
|
|
1155
|
-
'addressTo': None,
|
|
1156
|
-
'tagFrom': None,
|
|
1157
|
-
'tag': None,
|
|
1158
|
-
'tagTo': None,
|
|
1159
|
-
'type': type,
|
|
1160
|
-
'amount': amount,
|
|
1161
|
-
'currency': code,
|
|
1162
|
-
'status': None,
|
|
1163
|
-
'updated': None,
|
|
1164
|
-
'internal': None,
|
|
1165
|
-
'comment': None,
|
|
1166
|
-
'fee': fee,
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
|
-
def fetch_deposits_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
|
1170
|
-
"""
|
|
1171
|
-
fetch history of deposits and withdrawals
|
|
1172
|
-
:see: https://lykkecity.github.io/Trading-API/#get-the-history-of-withdrawals-and-deposits
|
|
1173
|
-
:param str [code]: unified currency code for the currency of the deposit/withdrawals, default is None
|
|
1174
|
-
:param int [since]: timestamp in ms of the earliest deposit/withdrawal, default is None
|
|
1175
|
-
:param int [limit]: max number of deposit/withdrawals to return, default is None
|
|
1176
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1177
|
-
:returns dict: a list of `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
|
|
1178
|
-
"""
|
|
1179
|
-
self.load_markets()
|
|
1180
|
-
request: dict = {
|
|
1181
|
-
# 'offset': 0,
|
|
1182
|
-
# 'take': 1,
|
|
1183
|
-
}
|
|
1184
|
-
if limit is not None:
|
|
1185
|
-
request['take'] = limit
|
|
1186
|
-
response = self.privateGetOperations(self.extend(request, params))
|
|
1187
|
-
payload = self.safe_value(response, 'payload', [])
|
|
1188
|
-
#
|
|
1189
|
-
# {
|
|
1190
|
-
# "payload":[
|
|
1191
|
-
# {
|
|
1192
|
-
# "operationId":"787201c8-f1cc-45c0-aec1-fa06eeea426b",
|
|
1193
|
-
# "assetId":"2a34d6a6-5839-40e5-836f-c1178fa09b89",
|
|
1194
|
-
# "totalVolume":0.1,
|
|
1195
|
-
# "fee":0.0,
|
|
1196
|
-
# "type":"deposit",
|
|
1197
|
-
# "timestamp":1644146723620
|
|
1198
|
-
# }
|
|
1199
|
-
# ],
|
|
1200
|
-
# "error":null
|
|
1201
|
-
# }
|
|
1202
|
-
#
|
|
1203
|
-
currency = None
|
|
1204
|
-
if code is not None:
|
|
1205
|
-
currency = self.currency(code)
|
|
1206
|
-
return self.parse_transactions(payload, currency, since, limit)
|
|
1207
|
-
|
|
1208
|
-
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
|
1209
|
-
"""
|
|
1210
|
-
make a withdrawal
|
|
1211
|
-
:see: https://lykkecity.github.io/Trading-API/#withdrawal
|
|
1212
|
-
:param str code: unified currency code
|
|
1213
|
-
:param float amount: the amount to withdraw
|
|
1214
|
-
:param str address: the address to withdraw to
|
|
1215
|
-
:param str tag:
|
|
1216
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1217
|
-
:returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
|
|
1218
|
-
"""
|
|
1219
|
-
self.load_markets()
|
|
1220
|
-
self.check_address(address)
|
|
1221
|
-
currency = self.currency(code)
|
|
1222
|
-
request: dict = {
|
|
1223
|
-
'assetId': currency['id'],
|
|
1224
|
-
'volume': float(self.currency_to_precision(code, amount)),
|
|
1225
|
-
'destinationAddress': address,
|
|
1226
|
-
# 'destinationAddressExtension': tag,
|
|
1227
|
-
}
|
|
1228
|
-
if tag is not None:
|
|
1229
|
-
request['destinationAddressExtension'] = tag
|
|
1230
|
-
response = self.privatePostOperationsWithdrawals(self.extend(request, params))
|
|
1231
|
-
#
|
|
1232
|
-
# "3035b1ad-2005-4587-a986-1f7966be78e0"
|
|
1233
|
-
#
|
|
1234
|
-
return self.parse_transaction(response, currency)
|
|
1235
|
-
|
|
1236
|
-
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
|
1237
|
-
url = self.urls['api'][api] + '/' + self.implode_params(path, params)
|
|
1238
|
-
query = self.omit(params, self.extract_params(path))
|
|
1239
|
-
headers = {
|
|
1240
|
-
'Accept': 'application/json',
|
|
1241
|
-
'Content-Type': 'application/json',
|
|
1242
|
-
}
|
|
1243
|
-
if api == 'public':
|
|
1244
|
-
if query:
|
|
1245
|
-
url += '?' + self.urlencode(query)
|
|
1246
|
-
elif api == 'private':
|
|
1247
|
-
if (method == 'GET') or (method == 'DELETE'):
|
|
1248
|
-
if query:
|
|
1249
|
-
url += '?' + self.urlencode(query)
|
|
1250
|
-
self.check_required_credentials()
|
|
1251
|
-
headers['Authorization'] = 'Bearer ' + self.apiKey
|
|
1252
|
-
if method == 'POST':
|
|
1253
|
-
if params:
|
|
1254
|
-
body = self.json(params)
|
|
1255
|
-
if path == 'operations/withdrawals':
|
|
1256
|
-
headers['X-Request-ID'] = self.uuid()
|
|
1257
|
-
return {'url': url, 'method': method, 'body': body, 'headers': headers}
|
|
1258
|
-
|
|
1259
|
-
def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
|
|
1260
|
-
if response is None:
|
|
1261
|
-
return None
|
|
1262
|
-
error = self.safe_value(response, 'error', {})
|
|
1263
|
-
errorCode = self.safe_string(error, 'code')
|
|
1264
|
-
if (errorCode is not None) and (errorCode != '0'):
|
|
1265
|
-
feedback = self.id + ' ' + body
|
|
1266
|
-
message = self.safe_string(error, 'message')
|
|
1267
|
-
self.throw_exactly_matched_exception(self.exceptions['exact'], errorCode, feedback)
|
|
1268
|
-
self.throw_broadly_matched_exception(self.exceptions['broad'], message, feedback)
|
|
1269
|
-
raise ExchangeError(feedback)
|
|
1270
|
-
return None
|