ccxt-ir 4.3.46.0.1__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 +358 -0
- ccxt/abantether.py +316 -0
- ccxt/abstract/__init__.py +0 -0
- ccxt/abstract/abantether.py +5 -0
- ccxt/abstract/ace.py +15 -0
- ccxt/abstract/afratether.py +6 -0
- ccxt/abstract/alpaca.py +70 -0
- ccxt/abstract/arzinja.py +5 -0
- ccxt/abstract/arzplus.py +7 -0
- ccxt/abstract/ascendex.py +77 -0
- ccxt/abstract/bequant.py +115 -0
- ccxt/abstract/bigone.py +45 -0
- ccxt/abstract/binance.py +712 -0
- ccxt/abstract/binancecoinm.py +712 -0
- ccxt/abstract/binanceus.py +764 -0
- ccxt/abstract/binanceusdm.py +712 -0
- ccxt/abstract/bingx.py +113 -0
- ccxt/abstract/bit2c.py +27 -0
- ccxt/abstract/bitbank.py +27 -0
- ccxt/abstract/bitbay.py +53 -0
- ccxt/abstract/bitbns.py +40 -0
- ccxt/abstract/bitcoincom.py +115 -0
- ccxt/abstract/bitfinex.py +69 -0
- ccxt/abstract/bitfinex2.py +139 -0
- ccxt/abstract/bitflyer.py +38 -0
- ccxt/abstract/bitget.py +508 -0
- ccxt/abstract/bithumb.py +32 -0
- ccxt/abstract/bitimen.py +7 -0
- ccxt/abstract/bitir.py +7 -0
- ccxt/abstract/bitmart.py +99 -0
- ccxt/abstract/bitmex.py +97 -0
- ccxt/abstract/bitopro.py +29 -0
- ccxt/abstract/bitpanda.py +35 -0
- ccxt/abstract/bitpin.py +7 -0
- ccxt/abstract/bitrue.py +72 -0
- ccxt/abstract/bitso.py +43 -0
- ccxt/abstract/bitstamp.py +258 -0
- ccxt/abstract/bitteam.py +29 -0
- ccxt/abstract/bitvavo.py +27 -0
- ccxt/abstract/bl3p.py +19 -0
- ccxt/abstract/blockchaincom.py +28 -0
- ccxt/abstract/blofin.py +37 -0
- ccxt/abstract/btcalpha.py +18 -0
- ccxt/abstract/btcbox.py +13 -0
- ccxt/abstract/btcmarkets.py +39 -0
- ccxt/abstract/btcturk.py +20 -0
- ccxt/abstract/bybit.py +298 -0
- ccxt/abstract/cex.py +33 -0
- ccxt/abstract/coinbase.py +94 -0
- ccxt/abstract/coinbaseadvanced.py +94 -0
- ccxt/abstract/coinbaseexchange.py +67 -0
- ccxt/abstract/coinbaseinternational.py +39 -0
- ccxt/abstract/coincatch.py +94 -0
- ccxt/abstract/coincheck.py +33 -0
- ccxt/abstract/coinex.py +237 -0
- ccxt/abstract/coinlist.py +54 -0
- ccxt/abstract/coinmate.py +62 -0
- ccxt/abstract/coinmetro.py +34 -0
- ccxt/abstract/coinone.py +67 -0
- ccxt/abstract/coinsph.py +54 -0
- ccxt/abstract/coinspot.py +28 -0
- ccxt/abstract/cryptocom.py +107 -0
- ccxt/abstract/currencycom.py +68 -0
- ccxt/abstract/delta.py +50 -0
- ccxt/abstract/deribit.py +125 -0
- ccxt/abstract/digifinex.py +91 -0
- ccxt/abstract/eterex.py +5 -0
- ccxt/abstract/excoino.py +7 -0
- ccxt/abstract/exir.py +8 -0
- ccxt/abstract/exmo.py +55 -0
- ccxt/abstract/exnovin.py +6 -0
- ccxt/abstract/farhadexchange.py +5 -0
- ccxt/abstract/fmfwio.py +115 -0
- ccxt/abstract/gate.py +265 -0
- ccxt/abstract/gateio.py +265 -0
- ccxt/abstract/gemini.py +58 -0
- ccxt/abstract/hashkey.py +67 -0
- ccxt/abstract/hitbtc.py +115 -0
- ccxt/abstract/hitbtc3.py +115 -0
- ccxt/abstract/hitobit.py +8 -0
- ccxt/abstract/hollaex.py +33 -0
- ccxt/abstract/htx.py +548 -0
- ccxt/abstract/huobi.py +548 -0
- ccxt/abstract/huobijp.py +114 -0
- ccxt/abstract/hyperliquid.py +6 -0
- ccxt/abstract/idex.py +26 -0
- ccxt/abstract/independentreserve.py +37 -0
- ccxt/abstract/indodax.py +26 -0
- ccxt/abstract/jibitex.py +7 -0
- ccxt/abstract/kraken.py +57 -0
- ccxt/abstract/krakenfutures.py +38 -0
- ccxt/abstract/kucoin.py +214 -0
- ccxt/abstract/kucoinfutures.py +233 -0
- ccxt/abstract/kuna.py +182 -0
- ccxt/abstract/latoken.py +56 -0
- ccxt/abstract/lbank.py +61 -0
- ccxt/abstract/luno.py +37 -0
- ccxt/abstract/lykke.py +29 -0
- ccxt/abstract/mercado.py +25 -0
- ccxt/abstract/mexc.py +178 -0
- ccxt/abstract/ndax.py +97 -0
- ccxt/abstract/nobitex.py +7 -0
- ccxt/abstract/novadax.py +29 -0
- ccxt/abstract/oceanex.py +22 -0
- ccxt/abstract/okcoin.py +74 -0
- ccxt/abstract/okexchange.py +8 -0
- ccxt/abstract/okx.py +324 -0
- ccxt/abstract/ompfinex.py +7 -0
- ccxt/abstract/onetrading.py +35 -0
- ccxt/abstract/oxfun.py +34 -0
- ccxt/abstract/p2b.py +22 -0
- ccxt/abstract/paradex.py +40 -0
- ccxt/abstract/paymium.py +28 -0
- ccxt/abstract/phemex.py +115 -0
- ccxt/abstract/poloniex.py +69 -0
- ccxt/abstract/poloniexfutures.py +48 -0
- ccxt/abstract/probit.py +23 -0
- ccxt/abstract/ramzinex.py +7 -0
- ccxt/abstract/sarmayex.py +5 -0
- ccxt/abstract/sarrafex.py +7 -0
- ccxt/abstract/tabdeal.py +7 -0
- ccxt/abstract/tetherland.py +5 -0
- ccxt/abstract/timex.py +62 -0
- ccxt/abstract/tokocrypto.py +37 -0
- ccxt/abstract/tradeogre.py +16 -0
- ccxt/abstract/twox.py +5 -0
- ccxt/abstract/ubitex.py +7 -0
- ccxt/abstract/upbit.py +38 -0
- ccxt/abstract/vertex.py +19 -0
- ccxt/abstract/wallex.py +8 -0
- ccxt/abstract/wavesexchange.py +154 -0
- ccxt/abstract/wazirx.py +30 -0
- ccxt/abstract/whitebit.py +98 -0
- ccxt/abstract/woo.py +83 -0
- ccxt/abstract/woofipro.py +119 -0
- ccxt/abstract/xt.py +152 -0
- ccxt/abstract/yobit.py +16 -0
- ccxt/abstract/zaif.py +38 -0
- ccxt/abstract/zonda.py +53 -0
- ccxt/ace.py +1012 -0
- ccxt/afratether.py +293 -0
- ccxt/alpaca.py +1083 -0
- ccxt/arzinja.py +285 -0
- ccxt/arzplus.py +412 -0
- ccxt/ascendex.py +3330 -0
- ccxt/async_support/__init__.py +337 -0
- ccxt/async_support/abantether.py +316 -0
- ccxt/async_support/ace.py +1012 -0
- ccxt/async_support/afratether.py +293 -0
- ccxt/async_support/alpaca.py +1083 -0
- ccxt/async_support/arzinja.py +285 -0
- ccxt/async_support/arzplus.py +412 -0
- ccxt/async_support/ascendex.py +3330 -0
- ccxt/async_support/base/__init__.py +1 -0
- ccxt/async_support/base/exchange.py +1966 -0
- ccxt/async_support/base/throttler.py +50 -0
- ccxt/async_support/base/ws/__init__.py +38 -0
- ccxt/async_support/base/ws/aiohttp_client.py +125 -0
- ccxt/async_support/base/ws/cache.py +212 -0
- ccxt/async_support/base/ws/client.py +193 -0
- ccxt/async_support/base/ws/fast_client.py +96 -0
- ccxt/async_support/base/ws/functions.py +59 -0
- ccxt/async_support/base/ws/future.py +58 -0
- ccxt/async_support/base/ws/order_book.py +78 -0
- ccxt/async_support/base/ws/order_book_side.py +174 -0
- ccxt/async_support/bequant.py +33 -0
- ccxt/async_support/bigone.py +2113 -0
- ccxt/async_support/binance.py +12234 -0
- ccxt/async_support/binancecoinm.py +45 -0
- ccxt/async_support/binanceus.py +211 -0
- ccxt/async_support/binanceusdm.py +58 -0
- ccxt/async_support/bingx.py +4325 -0
- ccxt/async_support/bit2c.py +866 -0
- ccxt/async_support/bitbank.py +1001 -0
- ccxt/async_support/bitbay.py +17 -0
- ccxt/async_support/bitbns.py +1154 -0
- ccxt/async_support/bitcoincom.py +17 -0
- ccxt/async_support/bitfinex.py +1617 -0
- ccxt/async_support/bitfinex2.py +3552 -0
- ccxt/async_support/bitflyer.py +995 -0
- ccxt/async_support/bitget.py +8273 -0
- ccxt/async_support/bithumb.py +1061 -0
- ccxt/async_support/bitimen.py +401 -0
- ccxt/async_support/bitir.py +490 -0
- ccxt/async_support/bitmart.py +4415 -0
- ccxt/async_support/bitmex.py +2756 -0
- ccxt/async_support/bitopro.py +1630 -0
- ccxt/async_support/bitpanda.py +16 -0
- ccxt/async_support/bitpin.py +454 -0
- ccxt/async_support/bitrue.py +3027 -0
- ccxt/async_support/bitso.py +1670 -0
- ccxt/async_support/bitstamp.py +2203 -0
- ccxt/async_support/bitteam.py +2239 -0
- ccxt/async_support/bitvavo.py +1968 -0
- ccxt/async_support/bl3p.py +485 -0
- ccxt/async_support/blockchaincom.py +1104 -0
- ccxt/async_support/blofin.py +2066 -0
- ccxt/async_support/btcalpha.py +891 -0
- ccxt/async_support/btcbox.py +544 -0
- ccxt/async_support/btcmarkets.py +1221 -0
- ccxt/async_support/btcturk.py +911 -0
- ccxt/async_support/bybit.py +8159 -0
- ccxt/async_support/cex.py +1605 -0
- ccxt/async_support/coinbase.py +4475 -0
- ccxt/async_support/coinbaseadvanced.py +17 -0
- ccxt/async_support/coinbaseexchange.py +1734 -0
- ccxt/async_support/coinbaseinternational.py +1899 -0
- ccxt/async_support/coincatch.py +5069 -0
- ccxt/async_support/coincheck.py +815 -0
- ccxt/async_support/coinex.py +5526 -0
- ccxt/async_support/coinlist.py +2243 -0
- ccxt/async_support/coinmate.py +1067 -0
- ccxt/async_support/coinmetro.py +1797 -0
- ccxt/async_support/coinone.py +1127 -0
- ccxt/async_support/coinsph.py +1850 -0
- ccxt/async_support/coinspot.py +534 -0
- ccxt/async_support/cryptocom.py +2822 -0
- ccxt/async_support/currencycom.py +1950 -0
- ccxt/async_support/delta.py +3376 -0
- ccxt/async_support/deribit.py +3437 -0
- ccxt/async_support/digifinex.py +3960 -0
- ccxt/async_support/eterex.py +286 -0
- ccxt/async_support/excoino.py +399 -0
- ccxt/async_support/exir.py +375 -0
- ccxt/async_support/exmo.py +2462 -0
- ccxt/async_support/exnovin.py +360 -0
- ccxt/async_support/farhadexchange.py +266 -0
- ccxt/async_support/fmfwio.py +34 -0
- ccxt/async_support/gate.py +6976 -0
- ccxt/async_support/gateio.py +16 -0
- ccxt/async_support/gemini.py +1825 -0
- ccxt/async_support/hashkey.py +4150 -0
- ccxt/async_support/hitbtc.py +3423 -0
- ccxt/async_support/hitbtc3.py +16 -0
- ccxt/async_support/hitobit.py +391 -0
- ccxt/async_support/hollaex.py +1813 -0
- ccxt/async_support/htx.py +8506 -0
- ccxt/async_support/huobi.py +16 -0
- ccxt/async_support/huobijp.py +1801 -0
- ccxt/async_support/hyperliquid.py +2431 -0
- ccxt/async_support/idex.py +1766 -0
- ccxt/async_support/independentreserve.py +784 -0
- ccxt/async_support/indodax.py +1247 -0
- ccxt/async_support/jibitex.py +395 -0
- ccxt/async_support/kraken.py +2894 -0
- ccxt/async_support/krakenfutures.py +2601 -0
- ccxt/async_support/kucoin.py +4602 -0
- ccxt/async_support/kucoinfutures.py +2698 -0
- ccxt/async_support/kuna.py +1841 -0
- ccxt/async_support/latoken.py +1664 -0
- ccxt/async_support/lbank.py +2683 -0
- ccxt/async_support/luno.py +1067 -0
- ccxt/async_support/lykke.py +1270 -0
- ccxt/async_support/mercado.py +842 -0
- ccxt/async_support/mexc.py +5369 -0
- ccxt/async_support/ndax.py +2354 -0
- ccxt/async_support/nobitex.py +419 -0
- ccxt/async_support/novadax.py +1484 -0
- ccxt/async_support/oceanex.py +903 -0
- ccxt/async_support/okcoin.py +2936 -0
- ccxt/async_support/okexchange.py +349 -0
- ccxt/async_support/okx.py +7827 -0
- ccxt/async_support/ompfinex.py +472 -0
- ccxt/async_support/onetrading.py +1911 -0
- ccxt/async_support/oxfun.py +2773 -0
- ccxt/async_support/p2b.py +1194 -0
- ccxt/async_support/paradex.py +2015 -0
- ccxt/async_support/paymium.py +564 -0
- ccxt/async_support/phemex.py +4473 -0
- ccxt/async_support/poloniex.py +2232 -0
- ccxt/async_support/poloniexfutures.py +1717 -0
- ccxt/async_support/probit.py +1734 -0
- ccxt/async_support/ramzinex.py +476 -0
- ccxt/async_support/sarmayex.py +357 -0
- ccxt/async_support/sarrafex.py +478 -0
- ccxt/async_support/tabdeal.py +364 -0
- ccxt/async_support/tetherland.py +349 -0
- ccxt/async_support/timex.py +1593 -0
- ccxt/async_support/tokocrypto.py +2405 -0
- ccxt/async_support/tradeogre.py +608 -0
- ccxt/async_support/twox.py +326 -0
- ccxt/async_support/ubitex.py +409 -0
- ccxt/async_support/upbit.py +1833 -0
- ccxt/async_support/vertex.py +2922 -0
- ccxt/async_support/wallex.py +445 -0
- ccxt/async_support/wavesexchange.py +2473 -0
- ccxt/async_support/wazirx.py +1224 -0
- ccxt/async_support/whitebit.py +2469 -0
- ccxt/async_support/woo.py +3114 -0
- ccxt/async_support/woofipro.py +2533 -0
- ccxt/async_support/xt.py +4454 -0
- ccxt/async_support/yobit.py +1283 -0
- ccxt/async_support/zaif.py +725 -0
- ccxt/async_support/zonda.py +1828 -0
- ccxt/base/__init__.py +27 -0
- ccxt/base/decimal_to_precision.py +174 -0
- ccxt/base/errors.py +242 -0
- ccxt/base/exchange.py +5941 -0
- ccxt/base/precise.py +287 -0
- ccxt/base/types.py +502 -0
- ccxt/bequant.py +33 -0
- ccxt/bigone.py +2112 -0
- ccxt/binance.py +12233 -0
- ccxt/binancecoinm.py +45 -0
- ccxt/binanceus.py +211 -0
- ccxt/binanceusdm.py +58 -0
- ccxt/bingx.py +4324 -0
- ccxt/bit2c.py +866 -0
- ccxt/bitbank.py +1001 -0
- ccxt/bitbay.py +17 -0
- ccxt/bitbns.py +1154 -0
- ccxt/bitcoincom.py +17 -0
- ccxt/bitfinex.py +1617 -0
- ccxt/bitfinex2.py +3552 -0
- ccxt/bitflyer.py +995 -0
- ccxt/bitget.py +8272 -0
- ccxt/bithumb.py +1061 -0
- ccxt/bitimen.py +401 -0
- ccxt/bitir.py +490 -0
- ccxt/bitmart.py +4415 -0
- ccxt/bitmex.py +2756 -0
- ccxt/bitopro.py +1630 -0
- ccxt/bitpanda.py +16 -0
- ccxt/bitpin.py +454 -0
- ccxt/bitrue.py +3026 -0
- ccxt/bitso.py +1670 -0
- ccxt/bitstamp.py +2203 -0
- ccxt/bitteam.py +2239 -0
- ccxt/bitvavo.py +1968 -0
- ccxt/bl3p.py +485 -0
- ccxt/blockchaincom.py +1104 -0
- ccxt/blofin.py +2066 -0
- ccxt/btcalpha.py +891 -0
- ccxt/btcbox.py +544 -0
- ccxt/btcmarkets.py +1221 -0
- ccxt/btcturk.py +911 -0
- ccxt/bybit.py +8158 -0
- ccxt/cex.py +1605 -0
- ccxt/coinbase.py +4474 -0
- ccxt/coinbaseadvanced.py +17 -0
- ccxt/coinbaseexchange.py +1734 -0
- ccxt/coinbaseinternational.py +1899 -0
- ccxt/coincatch.py +5069 -0
- ccxt/coincheck.py +815 -0
- ccxt/coinex.py +5525 -0
- ccxt/coinlist.py +2243 -0
- ccxt/coinmate.py +1067 -0
- ccxt/coinmetro.py +1797 -0
- ccxt/coinone.py +1127 -0
- ccxt/coinsph.py +1850 -0
- ccxt/coinspot.py +534 -0
- ccxt/cryptocom.py +2822 -0
- ccxt/currencycom.py +1950 -0
- ccxt/delta.py +3376 -0
- ccxt/deribit.py +3437 -0
- ccxt/digifinex.py +3959 -0
- ccxt/eterex.py +286 -0
- ccxt/excoino.py +399 -0
- ccxt/exir.py +375 -0
- ccxt/exmo.py +2462 -0
- ccxt/exnovin.py +360 -0
- ccxt/farhadexchange.py +266 -0
- ccxt/fmfwio.py +34 -0
- ccxt/gate.py +6975 -0
- ccxt/gateio.py +16 -0
- ccxt/gemini.py +1824 -0
- ccxt/hashkey.py +4150 -0
- ccxt/hitbtc.py +3423 -0
- ccxt/hitbtc3.py +16 -0
- ccxt/hitobit.py +391 -0
- ccxt/hollaex.py +1813 -0
- ccxt/htx.py +8505 -0
- ccxt/huobi.py +16 -0
- ccxt/huobijp.py +1801 -0
- ccxt/hyperliquid.py +2430 -0
- ccxt/idex.py +1766 -0
- ccxt/independentreserve.py +784 -0
- ccxt/indodax.py +1247 -0
- ccxt/jibitex.py +395 -0
- ccxt/kraken.py +2894 -0
- ccxt/krakenfutures.py +2601 -0
- ccxt/kucoin.py +4601 -0
- ccxt/kucoinfutures.py +2698 -0
- ccxt/kuna.py +1841 -0
- ccxt/latoken.py +1664 -0
- ccxt/lbank.py +2682 -0
- ccxt/luno.py +1067 -0
- ccxt/lykke.py +1270 -0
- ccxt/mercado.py +842 -0
- ccxt/mexc.py +5369 -0
- ccxt/ndax.py +2354 -0
- ccxt/nobitex.py +419 -0
- ccxt/novadax.py +1484 -0
- ccxt/oceanex.py +903 -0
- ccxt/okcoin.py +2936 -0
- ccxt/okexchange.py +349 -0
- ccxt/okx.py +7826 -0
- ccxt/ompfinex.py +472 -0
- ccxt/onetrading.py +1911 -0
- ccxt/oxfun.py +2772 -0
- ccxt/p2b.py +1194 -0
- ccxt/paradex.py +2015 -0
- ccxt/paymium.py +564 -0
- ccxt/phemex.py +4473 -0
- ccxt/poloniex.py +2232 -0
- ccxt/poloniexfutures.py +1717 -0
- ccxt/pro/__init__.py +149 -0
- ccxt/pro/alpaca.py +685 -0
- ccxt/pro/ascendex.py +916 -0
- ccxt/pro/bequant.py +38 -0
- ccxt/pro/binance.py +3488 -0
- ccxt/pro/binancecoinm.py +28 -0
- ccxt/pro/binanceus.py +48 -0
- ccxt/pro/binanceusdm.py +31 -0
- ccxt/pro/bingx.py +1264 -0
- ccxt/pro/bitcoincom.py +34 -0
- ccxt/pro/bitfinex.py +621 -0
- ccxt/pro/bitfinex2.py +1083 -0
- ccxt/pro/bitget.py +1692 -0
- ccxt/pro/bithumb.py +368 -0
- ccxt/pro/bitmart.py +1449 -0
- ccxt/pro/bitmex.py +1656 -0
- ccxt/pro/bitopro.py +445 -0
- ccxt/pro/bitpanda.py +15 -0
- ccxt/pro/bitrue.py +447 -0
- ccxt/pro/bitstamp.py +522 -0
- ccxt/pro/bitvavo.py +1270 -0
- ccxt/pro/blockchaincom.py +738 -0
- ccxt/pro/blofin.py +692 -0
- ccxt/pro/bybit.py +2000 -0
- ccxt/pro/cex.py +1440 -0
- ccxt/pro/coinbase.py +678 -0
- ccxt/pro/coinbaseadvanced.py +16 -0
- ccxt/pro/coinbaseexchange.py +895 -0
- ccxt/pro/coinbaseinternational.py +620 -0
- ccxt/pro/coincatch.py +1464 -0
- ccxt/pro/coincheck.py +199 -0
- ccxt/pro/coinex.py +1061 -0
- ccxt/pro/coinone.py +395 -0
- ccxt/pro/cryptocom.py +947 -0
- ccxt/pro/currencycom.py +536 -0
- ccxt/pro/deribit.py +892 -0
- ccxt/pro/exmo.py +629 -0
- ccxt/pro/gate.py +1416 -0
- ccxt/pro/gateio.py +15 -0
- ccxt/pro/gemini.py +865 -0
- ccxt/pro/hashkey.py +802 -0
- ccxt/pro/hitbtc.py +1216 -0
- ccxt/pro/hollaex.py +563 -0
- ccxt/pro/htx.py +2215 -0
- ccxt/pro/huobi.py +15 -0
- ccxt/pro/huobijp.py +570 -0
- ccxt/pro/hyperliquid.py +525 -0
- ccxt/pro/idex.py +672 -0
- ccxt/pro/independentreserve.py +270 -0
- ccxt/pro/kraken.py +1356 -0
- ccxt/pro/krakenfutures.py +1492 -0
- ccxt/pro/kucoin.py +1133 -0
- ccxt/pro/kucoinfutures.py +1081 -0
- ccxt/pro/lbank.py +843 -0
- ccxt/pro/luno.py +303 -0
- ccxt/pro/mexc.py +1122 -0
- ccxt/pro/ndax.py +506 -0
- ccxt/pro/okcoin.py +698 -0
- ccxt/pro/okx.py +1851 -0
- ccxt/pro/onetrading.py +1275 -0
- ccxt/pro/oxfun.py +950 -0
- ccxt/pro/p2b.py +419 -0
- ccxt/pro/paradex.py +352 -0
- ccxt/pro/phemex.py +1441 -0
- ccxt/pro/poloniex.py +1166 -0
- ccxt/pro/poloniexfutures.py +990 -0
- ccxt/pro/probit.py +551 -0
- ccxt/pro/upbit.py +520 -0
- ccxt/pro/vertex.py +943 -0
- ccxt/pro/wazirx.py +749 -0
- ccxt/pro/whitebit.py +864 -0
- ccxt/pro/woo.py +1078 -0
- ccxt/pro/woofipro.py +1183 -0
- ccxt/pro/xt.py +1067 -0
- ccxt/probit.py +1734 -0
- ccxt/ramzinex.py +476 -0
- ccxt/sarmayex.py +357 -0
- ccxt/sarrafex.py +478 -0
- ccxt/static_dependencies/__init__.py +1 -0
- ccxt/static_dependencies/ecdsa/__init__.py +14 -0
- ccxt/static_dependencies/ecdsa/_version.py +520 -0
- ccxt/static_dependencies/ecdsa/curves.py +56 -0
- ccxt/static_dependencies/ecdsa/der.py +221 -0
- ccxt/static_dependencies/ecdsa/ecdsa.py +310 -0
- ccxt/static_dependencies/ecdsa/ellipticcurve.py +197 -0
- ccxt/static_dependencies/ecdsa/keys.py +332 -0
- ccxt/static_dependencies/ecdsa/numbertheory.py +531 -0
- ccxt/static_dependencies/ecdsa/rfc6979.py +100 -0
- ccxt/static_dependencies/ecdsa/util.py +266 -0
- ccxt/static_dependencies/ethereum/__init__.py +7 -0
- ccxt/static_dependencies/ethereum/abi/__init__.py +16 -0
- ccxt/static_dependencies/ethereum/abi/abi.py +19 -0
- ccxt/static_dependencies/ethereum/abi/base.py +152 -0
- ccxt/static_dependencies/ethereum/abi/codec.py +217 -0
- ccxt/static_dependencies/ethereum/abi/constants.py +3 -0
- ccxt/static_dependencies/ethereum/abi/decoding.py +565 -0
- ccxt/static_dependencies/ethereum/abi/encoding.py +720 -0
- ccxt/static_dependencies/ethereum/abi/exceptions.py +139 -0
- ccxt/static_dependencies/ethereum/abi/grammar.py +443 -0
- ccxt/static_dependencies/ethereum/abi/packed.py +13 -0
- ccxt/static_dependencies/ethereum/abi/py.typed +0 -0
- ccxt/static_dependencies/ethereum/abi/registry.py +643 -0
- ccxt/static_dependencies/ethereum/abi/tools/__init__.py +3 -0
- ccxt/static_dependencies/ethereum/abi/tools/_strategies.py +230 -0
- ccxt/static_dependencies/ethereum/abi/utils/__init__.py +0 -0
- ccxt/static_dependencies/ethereum/abi/utils/numeric.py +83 -0
- ccxt/static_dependencies/ethereum/abi/utils/padding.py +27 -0
- ccxt/static_dependencies/ethereum/abi/utils/string.py +19 -0
- ccxt/static_dependencies/ethereum/account/__init__.py +3 -0
- ccxt/static_dependencies/ethereum/account/encode_typed_data/__init__.py +4 -0
- ccxt/static_dependencies/ethereum/account/encode_typed_data/encoding_and_hashing.py +239 -0
- ccxt/static_dependencies/ethereum/account/encode_typed_data/helpers.py +40 -0
- ccxt/static_dependencies/ethereum/account/messages.py +263 -0
- ccxt/static_dependencies/ethereum/account/py.typed +0 -0
- ccxt/static_dependencies/ethereum/hexbytes/__init__.py +5 -0
- ccxt/static_dependencies/ethereum/hexbytes/_utils.py +54 -0
- ccxt/static_dependencies/ethereum/hexbytes/main.py +65 -0
- ccxt/static_dependencies/ethereum/hexbytes/py.typed +0 -0
- ccxt/static_dependencies/ethereum/typing/__init__.py +63 -0
- ccxt/static_dependencies/ethereum/typing/abi.py +6 -0
- ccxt/static_dependencies/ethereum/typing/bls.py +7 -0
- ccxt/static_dependencies/ethereum/typing/discovery.py +5 -0
- ccxt/static_dependencies/ethereum/typing/encoding.py +7 -0
- ccxt/static_dependencies/ethereum/typing/enums.py +17 -0
- ccxt/static_dependencies/ethereum/typing/ethpm.py +9 -0
- ccxt/static_dependencies/ethereum/typing/evm.py +20 -0
- ccxt/static_dependencies/ethereum/typing/networks.py +1122 -0
- ccxt/static_dependencies/ethereum/typing/py.typed +0 -0
- ccxt/static_dependencies/ethereum/utils/__init__.py +115 -0
- ccxt/static_dependencies/ethereum/utils/abi.py +72 -0
- ccxt/static_dependencies/ethereum/utils/address.py +171 -0
- ccxt/static_dependencies/ethereum/utils/applicators.py +151 -0
- ccxt/static_dependencies/ethereum/utils/conversions.py +190 -0
- ccxt/static_dependencies/ethereum/utils/currency.py +107 -0
- ccxt/static_dependencies/ethereum/utils/curried/__init__.py +269 -0
- ccxt/static_dependencies/ethereum/utils/debug.py +20 -0
- ccxt/static_dependencies/ethereum/utils/decorators.py +132 -0
- ccxt/static_dependencies/ethereum/utils/encoding.py +6 -0
- ccxt/static_dependencies/ethereum/utils/exceptions.py +4 -0
- ccxt/static_dependencies/ethereum/utils/functional.py +75 -0
- ccxt/static_dependencies/ethereum/utils/hexadecimal.py +74 -0
- ccxt/static_dependencies/ethereum/utils/humanize.py +188 -0
- ccxt/static_dependencies/ethereum/utils/logging.py +159 -0
- ccxt/static_dependencies/ethereum/utils/module_loading.py +31 -0
- ccxt/static_dependencies/ethereum/utils/numeric.py +43 -0
- ccxt/static_dependencies/ethereum/utils/py.typed +0 -0
- ccxt/static_dependencies/ethereum/utils/toolz.py +76 -0
- ccxt/static_dependencies/ethereum/utils/types.py +54 -0
- ccxt/static_dependencies/ethereum/utils/typing/__init__.py +18 -0
- ccxt/static_dependencies/ethereum/utils/typing/misc.py +14 -0
- ccxt/static_dependencies/ethereum/utils/units.py +31 -0
- ccxt/static_dependencies/keccak/__init__.py +3 -0
- ccxt/static_dependencies/keccak/keccak.py +197 -0
- ccxt/static_dependencies/lark/__init__.py +38 -0
- ccxt/static_dependencies/lark/__pyinstaller/__init__.py +6 -0
- ccxt/static_dependencies/lark/__pyinstaller/hook-lark.py +14 -0
- ccxt/static_dependencies/lark/ast_utils.py +59 -0
- ccxt/static_dependencies/lark/common.py +86 -0
- ccxt/static_dependencies/lark/exceptions.py +292 -0
- ccxt/static_dependencies/lark/grammar.py +130 -0
- ccxt/static_dependencies/lark/grammars/__init__.py +0 -0
- ccxt/static_dependencies/lark/indenter.py +143 -0
- ccxt/static_dependencies/lark/lark.py +658 -0
- ccxt/static_dependencies/lark/lexer.py +678 -0
- ccxt/static_dependencies/lark/load_grammar.py +1428 -0
- ccxt/static_dependencies/lark/parse_tree_builder.py +391 -0
- ccxt/static_dependencies/lark/parser_frontends.py +257 -0
- ccxt/static_dependencies/lark/parsers/__init__.py +0 -0
- ccxt/static_dependencies/lark/parsers/cyk.py +340 -0
- ccxt/static_dependencies/lark/parsers/earley.py +314 -0
- ccxt/static_dependencies/lark/parsers/earley_common.py +42 -0
- ccxt/static_dependencies/lark/parsers/earley_forest.py +801 -0
- ccxt/static_dependencies/lark/parsers/grammar_analysis.py +203 -0
- ccxt/static_dependencies/lark/parsers/lalr_analysis.py +332 -0
- ccxt/static_dependencies/lark/parsers/lalr_interactive_parser.py +158 -0
- ccxt/static_dependencies/lark/parsers/lalr_parser.py +122 -0
- ccxt/static_dependencies/lark/parsers/lalr_parser_state.py +110 -0
- ccxt/static_dependencies/lark/parsers/xearley.py +165 -0
- ccxt/static_dependencies/lark/reconstruct.py +107 -0
- ccxt/static_dependencies/lark/tools/__init__.py +70 -0
- ccxt/static_dependencies/lark/tools/nearley.py +202 -0
- ccxt/static_dependencies/lark/tools/serialize.py +32 -0
- ccxt/static_dependencies/lark/tools/standalone.py +196 -0
- ccxt/static_dependencies/lark/tree.py +267 -0
- ccxt/static_dependencies/lark/tree_matcher.py +186 -0
- ccxt/static_dependencies/lark/tree_templates.py +180 -0
- ccxt/static_dependencies/lark/utils.py +343 -0
- ccxt/static_dependencies/lark/visitors.py +596 -0
- ccxt/static_dependencies/marshmallow/__init__.py +81 -0
- ccxt/static_dependencies/marshmallow/base.py +65 -0
- ccxt/static_dependencies/marshmallow/class_registry.py +94 -0
- ccxt/static_dependencies/marshmallow/decorators.py +231 -0
- ccxt/static_dependencies/marshmallow/error_store.py +60 -0
- ccxt/static_dependencies/marshmallow/exceptions.py +71 -0
- ccxt/static_dependencies/marshmallow/fields.py +2114 -0
- ccxt/static_dependencies/marshmallow/orderedset.py +89 -0
- ccxt/static_dependencies/marshmallow/schema.py +1228 -0
- ccxt/static_dependencies/marshmallow/types.py +12 -0
- ccxt/static_dependencies/marshmallow/utils.py +378 -0
- ccxt/static_dependencies/marshmallow/validate.py +678 -0
- ccxt/static_dependencies/marshmallow/warnings.py +2 -0
- ccxt/static_dependencies/marshmallow_dataclass/__init__.py +1047 -0
- ccxt/static_dependencies/marshmallow_dataclass/collection_field.py +51 -0
- ccxt/static_dependencies/marshmallow_dataclass/lazy_class_attribute.py +45 -0
- ccxt/static_dependencies/marshmallow_dataclass/mypy.py +71 -0
- ccxt/static_dependencies/marshmallow_dataclass/typing.py +14 -0
- ccxt/static_dependencies/marshmallow_dataclass/union_field.py +82 -0
- ccxt/static_dependencies/marshmallow_oneofschema/__init__.py +1 -0
- ccxt/static_dependencies/marshmallow_oneofschema/one_of_schema.py +193 -0
- ccxt/static_dependencies/msgpack/__init__.py +55 -0
- ccxt/static_dependencies/msgpack/exceptions.py +48 -0
- ccxt/static_dependencies/msgpack/ext.py +168 -0
- ccxt/static_dependencies/msgpack/fallback.py +951 -0
- ccxt/static_dependencies/parsimonious/__init__.py +10 -0
- ccxt/static_dependencies/parsimonious/exceptions.py +105 -0
- ccxt/static_dependencies/parsimonious/expressions.py +479 -0
- ccxt/static_dependencies/parsimonious/grammar.py +487 -0
- ccxt/static_dependencies/parsimonious/nodes.py +325 -0
- ccxt/static_dependencies/parsimonious/utils.py +40 -0
- ccxt/static_dependencies/starknet/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/data_types.py +123 -0
- ccxt/static_dependencies/starknet/cairo/deprecated_parse/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/deprecated_parse/cairo_types.py +77 -0
- ccxt/static_dependencies/starknet/cairo/deprecated_parse/parser.py +46 -0
- ccxt/static_dependencies/starknet/cairo/deprecated_parse/parser_transformer.py +138 -0
- ccxt/static_dependencies/starknet/cairo/felt.py +64 -0
- ccxt/static_dependencies/starknet/cairo/type_parser.py +121 -0
- ccxt/static_dependencies/starknet/cairo/v1/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/v1/type_parser.py +59 -0
- ccxt/static_dependencies/starknet/cairo/v2/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/v2/type_parser.py +77 -0
- ccxt/static_dependencies/starknet/ccxt_utils.py +7 -0
- ccxt/static_dependencies/starknet/common.py +15 -0
- ccxt/static_dependencies/starknet/constants.py +39 -0
- ccxt/static_dependencies/starknet/hash/__init__.py +0 -0
- ccxt/static_dependencies/starknet/hash/address.py +79 -0
- ccxt/static_dependencies/starknet/hash/compiled_class_hash_objects.py +111 -0
- ccxt/static_dependencies/starknet/hash/selector.py +16 -0
- ccxt/static_dependencies/starknet/hash/storage.py +12 -0
- ccxt/static_dependencies/starknet/hash/utils.py +78 -0
- ccxt/static_dependencies/starknet/models/__init__.py +0 -0
- ccxt/static_dependencies/starknet/models/typed_data.py +45 -0
- ccxt/static_dependencies/starknet/serialization/__init__.py +24 -0
- ccxt/static_dependencies/starknet/serialization/_calldata_reader.py +40 -0
- ccxt/static_dependencies/starknet/serialization/_context.py +142 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/__init__.py +10 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/_common.py +82 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/array_serializer.py +43 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/bool_serializer.py +37 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/byte_array_serializer.py +66 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/cairo_data_serializer.py +71 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/enum_serializer.py +71 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/felt_serializer.py +50 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/named_tuple_serializer.py +58 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/option_serializer.py +43 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/output_serializer.py +40 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/payload_serializer.py +72 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/struct_serializer.py +36 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/tuple_serializer.py +36 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/uint256_serializer.py +76 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/uint_serializer.py +100 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/unit_serializer.py +32 -0
- ccxt/static_dependencies/starknet/serialization/errors.py +10 -0
- ccxt/static_dependencies/starknet/serialization/factory.py +229 -0
- ccxt/static_dependencies/starknet/serialization/function_serialization_adapter.py +110 -0
- ccxt/static_dependencies/starknet/serialization/tuple_dataclass.py +59 -0
- ccxt/static_dependencies/starknet/utils/__init__.py +0 -0
- ccxt/static_dependencies/starknet/utils/constructor_args_translator.py +86 -0
- ccxt/static_dependencies/starknet/utils/iterable.py +13 -0
- ccxt/static_dependencies/starknet/utils/schema.py +13 -0
- ccxt/static_dependencies/starknet/utils/typed_data.py +182 -0
- ccxt/static_dependencies/starkware/__init__.py +0 -0
- ccxt/static_dependencies/starkware/crypto/__init__.py +0 -0
- ccxt/static_dependencies/starkware/crypto/fast_pedersen_hash.py +50 -0
- ccxt/static_dependencies/starkware/crypto/math_utils.py +78 -0
- ccxt/static_dependencies/starkware/crypto/signature.py +2344 -0
- ccxt/static_dependencies/starkware/crypto/utils.py +63 -0
- ccxt/static_dependencies/sympy/__init__.py +0 -0
- ccxt/static_dependencies/sympy/core/__init__.py +0 -0
- ccxt/static_dependencies/sympy/core/intfunc.py +35 -0
- ccxt/static_dependencies/sympy/external/__init__.py +0 -0
- ccxt/static_dependencies/sympy/external/gmpy.py +345 -0
- ccxt/static_dependencies/sympy/external/importtools.py +187 -0
- ccxt/static_dependencies/sympy/external/ntheory.py +637 -0
- ccxt/static_dependencies/sympy/external/pythonmpq.py +341 -0
- ccxt/static_dependencies/toolz/__init__.py +26 -0
- ccxt/static_dependencies/toolz/_signatures.py +784 -0
- ccxt/static_dependencies/toolz/_version.py +520 -0
- ccxt/static_dependencies/toolz/compatibility.py +30 -0
- ccxt/static_dependencies/toolz/curried/__init__.py +101 -0
- ccxt/static_dependencies/toolz/curried/exceptions.py +22 -0
- ccxt/static_dependencies/toolz/curried/operator.py +22 -0
- ccxt/static_dependencies/toolz/dicttoolz.py +339 -0
- ccxt/static_dependencies/toolz/functoolz.py +1049 -0
- ccxt/static_dependencies/toolz/itertoolz.py +1057 -0
- ccxt/static_dependencies/toolz/recipes.py +46 -0
- ccxt/static_dependencies/toolz/utils.py +9 -0
- ccxt/static_dependencies/typing_inspect/__init__.py +0 -0
- ccxt/static_dependencies/typing_inspect/typing_inspect.py +851 -0
- ccxt/tabdeal.py +364 -0
- ccxt/test/__init__.py +3 -0
- ccxt/test/base/__init__.py +29 -0
- ccxt/test/base/test_account.py +26 -0
- ccxt/test/base/test_balance.py +56 -0
- ccxt/test/base/test_borrow_interest.py +35 -0
- ccxt/test/base/test_borrow_rate.py +32 -0
- ccxt/test/base/test_calculate_fee.py +51 -0
- ccxt/test/base/test_crypto.py +127 -0
- ccxt/test/base/test_currency.py +76 -0
- ccxt/test/base/test_datetime.py +109 -0
- ccxt/test/base/test_decimal_to_precision.py +392 -0
- ccxt/test/base/test_deep_extend.py +68 -0
- ccxt/test/base/test_deposit_withdrawal.py +50 -0
- ccxt/test/base/test_exchange_datetime_functions.py +76 -0
- ccxt/test/base/test_funding_rate_history.py +29 -0
- ccxt/test/base/test_last_price.py +31 -0
- ccxt/test/base/test_ledger_entry.py +45 -0
- ccxt/test/base/test_ledger_item.py +48 -0
- ccxt/test/base/test_leverage_tier.py +33 -0
- ccxt/test/base/test_liquidation.py +50 -0
- ccxt/test/base/test_margin_mode.py +24 -0
- ccxt/test/base/test_margin_modification.py +35 -0
- ccxt/test/base/test_market.py +193 -0
- ccxt/test/base/test_number.py +411 -0
- ccxt/test/base/test_ohlcv.py +33 -0
- ccxt/test/base/test_open_interest.py +32 -0
- ccxt/test/base/test_order.py +64 -0
- ccxt/test/base/test_order_book.py +69 -0
- ccxt/test/base/test_position.py +60 -0
- ccxt/test/base/test_shared_methods.py +353 -0
- ccxt/test/base/test_status.py +24 -0
- ccxt/test/base/test_throttle.py +126 -0
- ccxt/test/base/test_ticker.py +92 -0
- ccxt/test/base/test_trade.py +47 -0
- ccxt/test/base/test_trading_fee.py +26 -0
- ccxt/test/base/test_transaction.py +39 -0
- ccxt/test/test_async.py +1649 -0
- ccxt/test/test_sync.py +1648 -0
- ccxt/test/tests_async.py +1558 -0
- ccxt/test/tests_helpers.py +287 -0
- ccxt/test/tests_init.py +39 -0
- ccxt/test/tests_sync.py +1555 -0
- ccxt/tetherland.py +349 -0
- ccxt/timex.py +1593 -0
- ccxt/tokocrypto.py +2405 -0
- ccxt/tradeogre.py +608 -0
- ccxt/twox.py +326 -0
- ccxt/ubitex.py +409 -0
- ccxt/upbit.py +1833 -0
- ccxt/vertex.py +2922 -0
- ccxt/wallex.py +445 -0
- ccxt/wavesexchange.py +2472 -0
- ccxt/wazirx.py +1224 -0
- ccxt/whitebit.py +2469 -0
- ccxt/woo.py +3114 -0
- ccxt/woofipro.py +2533 -0
- ccxt/xt.py +4453 -0
- ccxt/yobit.py +1283 -0
- ccxt/zaif.py +725 -0
- ccxt/zonda.py +1828 -0
- ccxt_ir-4.3.46.0.1.dist-info/LICENSE.txt +21 -0
- ccxt_ir-4.3.46.0.1.dist-info/METADATA +655 -0
- ccxt_ir-4.3.46.0.1.dist-info/RECORD +772 -0
- ccxt_ir-4.3.46.0.1.dist-info/WHEEL +6 -0
- ccxt_ir-4.3.46.0.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1605 @@
|
|
|
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.async_support.base.exchange import Exchange
|
|
7
|
+
from ccxt.abstract.cex import ImplicitAPI
|
|
8
|
+
import hashlib
|
|
9
|
+
import json
|
|
10
|
+
from ccxt.base.types import Balances, Currencies, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees
|
|
11
|
+
from typing import List
|
|
12
|
+
from ccxt.base.errors import ExchangeError
|
|
13
|
+
from ccxt.base.errors import AuthenticationError
|
|
14
|
+
from ccxt.base.errors import ArgumentsRequired
|
|
15
|
+
from ccxt.base.errors import BadSymbol
|
|
16
|
+
from ccxt.base.errors import NullResponse
|
|
17
|
+
from ccxt.base.errors import InsufficientFunds
|
|
18
|
+
from ccxt.base.errors import InvalidOrder
|
|
19
|
+
from ccxt.base.errors import OrderNotFound
|
|
20
|
+
from ccxt.base.errors import DDoSProtection
|
|
21
|
+
from ccxt.base.errors import RateLimitExceeded
|
|
22
|
+
from ccxt.base.errors import InvalidNonce
|
|
23
|
+
from ccxt.base.decimal_to_precision import TICK_SIZE
|
|
24
|
+
from ccxt.base.precise import Precise
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class cex(Exchange, ImplicitAPI):
|
|
28
|
+
|
|
29
|
+
def describe(self):
|
|
30
|
+
return self.deep_extend(super(cex, self).describe(), {
|
|
31
|
+
'id': 'cex',
|
|
32
|
+
'name': 'CEX.IO',
|
|
33
|
+
'countries': ['GB', 'EU', 'CY', 'RU'],
|
|
34
|
+
'rateLimit': 1500,
|
|
35
|
+
'pro': True,
|
|
36
|
+
'has': {
|
|
37
|
+
'CORS': None,
|
|
38
|
+
'spot': True,
|
|
39
|
+
'margin': False, # has but not through api
|
|
40
|
+
'swap': False,
|
|
41
|
+
'future': False,
|
|
42
|
+
'option': False,
|
|
43
|
+
'addMargin': False,
|
|
44
|
+
'cancelAllOrders': True,
|
|
45
|
+
'cancelOrder': True,
|
|
46
|
+
'cancelOrders': False,
|
|
47
|
+
'createDepositAddress': False,
|
|
48
|
+
'createMarketBuyOrderWithCost': True,
|
|
49
|
+
'createMarketOrderWithCost': False,
|
|
50
|
+
'createMarketSellOrderWithCost': False,
|
|
51
|
+
'createOrder': True,
|
|
52
|
+
'createStopLimitOrder': False,
|
|
53
|
+
'createStopMarketOrder': False,
|
|
54
|
+
'createStopOrder': False,
|
|
55
|
+
'editOrder': True,
|
|
56
|
+
'fetchBalance': True,
|
|
57
|
+
'fetchClosedOrders': True,
|
|
58
|
+
'fetchCurrencies': True,
|
|
59
|
+
'fetchDeposit': False,
|
|
60
|
+
'fetchDepositAddress': True,
|
|
61
|
+
'fetchDepositAddresses': False,
|
|
62
|
+
'fetchDeposits': False,
|
|
63
|
+
'fetchDepositsWithdrawals': False,
|
|
64
|
+
'fetchFundingHistory': False,
|
|
65
|
+
'fetchFundingRate': False,
|
|
66
|
+
'fetchFundingRateHistory': False,
|
|
67
|
+
'fetchFundingRates': False,
|
|
68
|
+
'fetchIndexOHLCV': False,
|
|
69
|
+
'fetchMarginMode': False,
|
|
70
|
+
'fetchMarkets': True,
|
|
71
|
+
'fetchMarkOHLCV': False,
|
|
72
|
+
'fetchOHLCV': True,
|
|
73
|
+
'fetchOpenInterestHistory': False,
|
|
74
|
+
'fetchOpenOrders': True,
|
|
75
|
+
'fetchOrder': True,
|
|
76
|
+
'fetchOrderBook': True,
|
|
77
|
+
'fetchOrders': True,
|
|
78
|
+
'fetchPosition': False,
|
|
79
|
+
'fetchPositionHistory': False,
|
|
80
|
+
'fetchPositionMode': False,
|
|
81
|
+
'fetchPositions': False,
|
|
82
|
+
'fetchPositionsForSymbol': False,
|
|
83
|
+
'fetchPositionsHistory': False,
|
|
84
|
+
'fetchPositionsRisk': False,
|
|
85
|
+
'fetchPremiumIndexOHLCV': False,
|
|
86
|
+
'fetchTicker': True,
|
|
87
|
+
'fetchTickers': True,
|
|
88
|
+
'fetchTrades': True,
|
|
89
|
+
'fetchTradingFee': False,
|
|
90
|
+
'fetchTradingFees': True,
|
|
91
|
+
'fetchTransactions': False,
|
|
92
|
+
'fetchTransfer': False,
|
|
93
|
+
'fetchTransfers': False,
|
|
94
|
+
'fetchWithdrawal': False,
|
|
95
|
+
'fetchWithdrawals': False,
|
|
96
|
+
'fetchWithdrawalWhitelist': False,
|
|
97
|
+
'reduceMargin': False,
|
|
98
|
+
'setLeverage': False,
|
|
99
|
+
'setMargin': False,
|
|
100
|
+
'setMarginMode': False,
|
|
101
|
+
'transfer': False,
|
|
102
|
+
'withdraw': False,
|
|
103
|
+
},
|
|
104
|
+
'timeframes': {
|
|
105
|
+
'1m': '1m',
|
|
106
|
+
'1h': '1h',
|
|
107
|
+
'1d': '1d',
|
|
108
|
+
},
|
|
109
|
+
'urls': {
|
|
110
|
+
'logo': 'https://user-images.githubusercontent.com/1294454/27766442-8ddc33b0-5ed8-11e7-8b98-f786aef0f3c9.jpg',
|
|
111
|
+
'api': {
|
|
112
|
+
'rest': 'https://cex.io/api',
|
|
113
|
+
},
|
|
114
|
+
'www': 'https://cex.io',
|
|
115
|
+
'doc': 'https://cex.io/cex-api',
|
|
116
|
+
'fees': [
|
|
117
|
+
'https://cex.io/fee-schedule',
|
|
118
|
+
'https://cex.io/limits-commissions',
|
|
119
|
+
],
|
|
120
|
+
'referral': 'https://cex.io/r/0/up105393824/0/',
|
|
121
|
+
},
|
|
122
|
+
'requiredCredentials': {
|
|
123
|
+
'apiKey': True,
|
|
124
|
+
'secret': True,
|
|
125
|
+
'uid': True,
|
|
126
|
+
},
|
|
127
|
+
'api': {
|
|
128
|
+
'public': {
|
|
129
|
+
'get': [
|
|
130
|
+
'currency_profile',
|
|
131
|
+
'currency_limits/',
|
|
132
|
+
'last_price/{pair}/',
|
|
133
|
+
'last_prices/{currencies}/',
|
|
134
|
+
'ohlcv/hd/{yyyymmdd}/{pair}',
|
|
135
|
+
'order_book/{pair}/',
|
|
136
|
+
'ticker/{pair}/',
|
|
137
|
+
'tickers/{currencies}/',
|
|
138
|
+
'trade_history/{pair}/',
|
|
139
|
+
],
|
|
140
|
+
'post': [
|
|
141
|
+
'convert/{pair}',
|
|
142
|
+
'price_stats/{pair}',
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
'private': {
|
|
146
|
+
'post': [
|
|
147
|
+
'active_orders_status/',
|
|
148
|
+
'archived_orders/{pair}/',
|
|
149
|
+
'balance/',
|
|
150
|
+
'cancel_order/',
|
|
151
|
+
'cancel_orders/{pair}/',
|
|
152
|
+
'cancel_replace_order/{pair}/',
|
|
153
|
+
'close_position/{pair}/',
|
|
154
|
+
'get_address/',
|
|
155
|
+
'get_crypto_address',
|
|
156
|
+
'get_myfee/',
|
|
157
|
+
'get_order/',
|
|
158
|
+
'get_order_tx/',
|
|
159
|
+
'open_orders/{pair}/',
|
|
160
|
+
'open_orders/',
|
|
161
|
+
'open_position/{pair}/',
|
|
162
|
+
'open_positions/{pair}/',
|
|
163
|
+
'place_order/{pair}/',
|
|
164
|
+
'raw_tx_history',
|
|
165
|
+
],
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
'fees': {
|
|
169
|
+
'trading': {
|
|
170
|
+
'maker': self.parse_number('0.0016'),
|
|
171
|
+
'taker': self.parse_number('0.0025'),
|
|
172
|
+
},
|
|
173
|
+
'funding': {
|
|
174
|
+
'withdraw': {},
|
|
175
|
+
'deposit': {
|
|
176
|
+
# 'USD': amount => amount * 0.035 + 0.25,
|
|
177
|
+
# 'EUR': amount => amount * 0.035 + 0.24,
|
|
178
|
+
# 'RUB': amount => amount * 0.05 + 15.57,
|
|
179
|
+
# 'GBP': amount => amount * 0.035 + 0.2,
|
|
180
|
+
'BTC': 0.0,
|
|
181
|
+
'ETH': 0.0,
|
|
182
|
+
'BCH': 0.0,
|
|
183
|
+
'DASH': 0.0,
|
|
184
|
+
'BTG': 0.0,
|
|
185
|
+
'ZEC': 0.0,
|
|
186
|
+
'XRP': 0.0,
|
|
187
|
+
'XLM': 0.0,
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
'precisionMode': TICK_SIZE,
|
|
192
|
+
'exceptions': {
|
|
193
|
+
'exact': {},
|
|
194
|
+
'broad': {
|
|
195
|
+
'Insufficient funds': InsufficientFunds,
|
|
196
|
+
'Nonce must be incremented': InvalidNonce,
|
|
197
|
+
'Invalid Order': InvalidOrder,
|
|
198
|
+
'Order not found': OrderNotFound,
|
|
199
|
+
'limit exceeded': RateLimitExceeded, # {"error":"rate limit exceeded"}
|
|
200
|
+
'Invalid API key': AuthenticationError,
|
|
201
|
+
'There was an error while placing your order': InvalidOrder,
|
|
202
|
+
'Sorry, too many clients already': DDoSProtection,
|
|
203
|
+
'Invalid Symbols Pair': BadSymbol,
|
|
204
|
+
'Wrong currency pair': BadSymbol, # {"error":"There was an error while placing your order: Wrong currency pair.","safe":true}
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
'options': {
|
|
208
|
+
'fetchOHLCVWarning': True,
|
|
209
|
+
'createMarketBuyOrderRequiresPrice': True,
|
|
210
|
+
'order': {
|
|
211
|
+
'status': {
|
|
212
|
+
'c': 'canceled',
|
|
213
|
+
'd': 'closed',
|
|
214
|
+
'cd': 'canceled',
|
|
215
|
+
'a': 'open',
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
'defaultNetwork': 'ERC20',
|
|
219
|
+
'defaultNetworks': {
|
|
220
|
+
'USDT': 'TRC20',
|
|
221
|
+
},
|
|
222
|
+
'networks': {
|
|
223
|
+
'ERC20': 'Ethereum',
|
|
224
|
+
'BTC': 'BTC',
|
|
225
|
+
'BEP20': 'Binance Smart Chain',
|
|
226
|
+
'TRC20': 'Tron',
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
async def fetch_currencies_from_cache(self, params={}):
|
|
232
|
+
# self method is now redundant
|
|
233
|
+
# currencies are now fetched before markets
|
|
234
|
+
options = self.safe_value(self.options, 'fetchCurrencies', {})
|
|
235
|
+
timestamp = self.safe_integer(options, 'timestamp')
|
|
236
|
+
expires = self.safe_integer(options, 'expires', 1000)
|
|
237
|
+
now = self.milliseconds()
|
|
238
|
+
if (timestamp is None) or ((now - timestamp) > expires):
|
|
239
|
+
response = await self.publicGetCurrencyProfile(params)
|
|
240
|
+
self.options['fetchCurrencies'] = self.extend(options, {
|
|
241
|
+
'response': response,
|
|
242
|
+
'timestamp': now,
|
|
243
|
+
})
|
|
244
|
+
return self.safe_value(self.options['fetchCurrencies'], 'response')
|
|
245
|
+
|
|
246
|
+
async def fetch_currencies(self, params={}) -> Currencies:
|
|
247
|
+
"""
|
|
248
|
+
fetches all available currencies on an exchange
|
|
249
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
250
|
+
:returns dict: an associative dictionary of currencies
|
|
251
|
+
"""
|
|
252
|
+
response = await self.fetch_currencies_from_cache(params)
|
|
253
|
+
self.options['currencies'] = {
|
|
254
|
+
'timestamp': self.milliseconds(),
|
|
255
|
+
'response': response,
|
|
256
|
+
}
|
|
257
|
+
#
|
|
258
|
+
# {
|
|
259
|
+
# "e":"currency_profile",
|
|
260
|
+
# "ok":"ok",
|
|
261
|
+
# "data":{
|
|
262
|
+
# "symbols":[
|
|
263
|
+
# {
|
|
264
|
+
# "code":"GHS",
|
|
265
|
+
# "contract":true,
|
|
266
|
+
# "commodity":true,
|
|
267
|
+
# "fiat":false,
|
|
268
|
+
# "description":"CEX.IO doesn't provide cloud mining services anymore.",
|
|
269
|
+
# "precision":8,
|
|
270
|
+
# "scale":0,
|
|
271
|
+
# "minimumCurrencyAmount":"0.00000001",
|
|
272
|
+
# "minimalWithdrawalAmount":-1
|
|
273
|
+
# },
|
|
274
|
+
# {
|
|
275
|
+
# "code":"BTC",
|
|
276
|
+
# "contract":false,
|
|
277
|
+
# "commodity":false,
|
|
278
|
+
# "fiat":false,
|
|
279
|
+
# "description":"",
|
|
280
|
+
# "precision":8,
|
|
281
|
+
# "scale":0,
|
|
282
|
+
# "minimumCurrencyAmount":"0.00000001",
|
|
283
|
+
# "minimalWithdrawalAmount":0.002
|
|
284
|
+
# },
|
|
285
|
+
# {
|
|
286
|
+
# "code":"ETH",
|
|
287
|
+
# "contract":false,
|
|
288
|
+
# "commodity":false,
|
|
289
|
+
# "fiat":false,
|
|
290
|
+
# "description":"",
|
|
291
|
+
# "precision":8,
|
|
292
|
+
# "scale":2,
|
|
293
|
+
# "minimumCurrencyAmount":"0.00000100",
|
|
294
|
+
# "minimalWithdrawalAmount":0.01
|
|
295
|
+
# }
|
|
296
|
+
# ],
|
|
297
|
+
# "pairs":[
|
|
298
|
+
# {
|
|
299
|
+
# "symbol1":"BTC",
|
|
300
|
+
# "symbol2":"USD",
|
|
301
|
+
# "pricePrecision":1,
|
|
302
|
+
# "priceScale":"/1000000",
|
|
303
|
+
# "minLotSize":0.002,
|
|
304
|
+
# "minLotSizeS2":20
|
|
305
|
+
# },
|
|
306
|
+
# {
|
|
307
|
+
# "symbol1":"ETH",
|
|
308
|
+
# "symbol2":"USD",
|
|
309
|
+
# "pricePrecision":2,
|
|
310
|
+
# "priceScale":"/10000",
|
|
311
|
+
# "minLotSize":0.1,
|
|
312
|
+
# "minLotSizeS2":20
|
|
313
|
+
# }
|
|
314
|
+
# ]
|
|
315
|
+
# }
|
|
316
|
+
# }
|
|
317
|
+
#
|
|
318
|
+
data = self.safe_value(response, 'data', [])
|
|
319
|
+
currencies = self.safe_value(data, 'symbols', [])
|
|
320
|
+
result: dict = {}
|
|
321
|
+
for i in range(0, len(currencies)):
|
|
322
|
+
currency = currencies[i]
|
|
323
|
+
id = self.safe_string(currency, 'code')
|
|
324
|
+
code = self.safe_currency_code(id)
|
|
325
|
+
active = True
|
|
326
|
+
result[code] = {
|
|
327
|
+
'id': id,
|
|
328
|
+
'code': code,
|
|
329
|
+
'name': id,
|
|
330
|
+
'active': active,
|
|
331
|
+
'deposit': None,
|
|
332
|
+
'withdraw': None,
|
|
333
|
+
'precision': self.parse_number(self.parse_precision(self.safe_string(currency, 'precision'))),
|
|
334
|
+
'fee': None,
|
|
335
|
+
'limits': {
|
|
336
|
+
'amount': {
|
|
337
|
+
'min': self.safe_number(currency, 'minimumCurrencyAmount'),
|
|
338
|
+
'max': None,
|
|
339
|
+
},
|
|
340
|
+
'withdraw': {
|
|
341
|
+
'min': self.safe_number(currency, 'minimalWithdrawalAmount'),
|
|
342
|
+
'max': None,
|
|
343
|
+
},
|
|
344
|
+
},
|
|
345
|
+
'info': currency,
|
|
346
|
+
}
|
|
347
|
+
return result
|
|
348
|
+
|
|
349
|
+
async def fetch_markets(self, params={}) -> List[Market]:
|
|
350
|
+
"""
|
|
351
|
+
retrieves data on all markets for cex
|
|
352
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
353
|
+
:returns dict[]: an array of objects representing market data
|
|
354
|
+
"""
|
|
355
|
+
currenciesResponse = await self.fetch_currencies_from_cache(params)
|
|
356
|
+
currenciesData = self.safe_value(currenciesResponse, 'data', {})
|
|
357
|
+
currencies = self.safe_value(currenciesData, 'symbols', [])
|
|
358
|
+
currenciesById = self.index_by(currencies, 'code')
|
|
359
|
+
pairs = self.safe_value(currenciesData, 'pairs', [])
|
|
360
|
+
response = await self.publicGetCurrencyLimits(params)
|
|
361
|
+
#
|
|
362
|
+
# {
|
|
363
|
+
# "e":"currency_limits",
|
|
364
|
+
# "ok":"ok",
|
|
365
|
+
# "data": {
|
|
366
|
+
# "pairs":[
|
|
367
|
+
# {
|
|
368
|
+
# "symbol1":"BTC",
|
|
369
|
+
# "symbol2":"USD",
|
|
370
|
+
# "minLotSize":0.002,
|
|
371
|
+
# "minLotSizeS2":20,
|
|
372
|
+
# "maxLotSize":30,
|
|
373
|
+
# "minPrice":"1500",
|
|
374
|
+
# "maxPrice":"35000"
|
|
375
|
+
# },
|
|
376
|
+
# {
|
|
377
|
+
# "symbol1":"BCH",
|
|
378
|
+
# "symbol2":"EUR",
|
|
379
|
+
# "minLotSize":0.1,
|
|
380
|
+
# "minLotSizeS2":20,
|
|
381
|
+
# "maxLotSize":null,
|
|
382
|
+
# "minPrice":"25",
|
|
383
|
+
# "maxPrice":"8192"
|
|
384
|
+
# }
|
|
385
|
+
# ]
|
|
386
|
+
# }
|
|
387
|
+
# }
|
|
388
|
+
#
|
|
389
|
+
result = []
|
|
390
|
+
markets = self.safe_value(response['data'], 'pairs')
|
|
391
|
+
for i in range(0, len(markets)):
|
|
392
|
+
market = markets[i]
|
|
393
|
+
baseId = self.safe_string(market, 'symbol1')
|
|
394
|
+
quoteId = self.safe_string(market, 'symbol2')
|
|
395
|
+
base = self.safe_currency_code(baseId)
|
|
396
|
+
quote = self.safe_currency_code(quoteId)
|
|
397
|
+
baseCurrency = self.safe_value(currenciesById, baseId, {})
|
|
398
|
+
quoteCurrency = self.safe_value(currenciesById, quoteId, {})
|
|
399
|
+
pricePrecisionString = self.safe_string(quoteCurrency, 'precision', '8')
|
|
400
|
+
for j in range(0, len(pairs)):
|
|
401
|
+
pair = pairs[j]
|
|
402
|
+
if (pair['symbol1'] == baseId) and (pair['symbol2'] == quoteId):
|
|
403
|
+
# we might need to account for `priceScale` here
|
|
404
|
+
pricePrecisionString = self.safe_string(pair, 'pricePrecision', pricePrecisionString)
|
|
405
|
+
baseCurrencyPrecision = self.safe_string(baseCurrency, 'precision', '8')
|
|
406
|
+
baseCurrencyScale = self.safe_string(baseCurrency, 'scale', '0')
|
|
407
|
+
amountPrecisionString = Precise.string_sub(baseCurrencyPrecision, baseCurrencyScale)
|
|
408
|
+
result.append({
|
|
409
|
+
'id': baseId + '/' + quoteId,
|
|
410
|
+
'symbol': base + '/' + quote,
|
|
411
|
+
'base': base,
|
|
412
|
+
'quote': quote,
|
|
413
|
+
'settle': None,
|
|
414
|
+
'baseId': baseId,
|
|
415
|
+
'quoteId': quoteId,
|
|
416
|
+
'settleId': None,
|
|
417
|
+
'type': 'spot',
|
|
418
|
+
'spot': True,
|
|
419
|
+
'margin': None,
|
|
420
|
+
'swap': False,
|
|
421
|
+
'future': False,
|
|
422
|
+
'option': False,
|
|
423
|
+
'active': None,
|
|
424
|
+
'contract': False,
|
|
425
|
+
'linear': None,
|
|
426
|
+
'inverse': None,
|
|
427
|
+
'contractSize': None,
|
|
428
|
+
'expiry': None,
|
|
429
|
+
'expiryDatetime': None,
|
|
430
|
+
'strike': None,
|
|
431
|
+
'optionType': None,
|
|
432
|
+
'precision': {
|
|
433
|
+
'amount': self.parse_number(self.parse_precision(amountPrecisionString)),
|
|
434
|
+
'price': self.parse_number(self.parse_precision(pricePrecisionString)),
|
|
435
|
+
},
|
|
436
|
+
'limits': {
|
|
437
|
+
'leverage': {
|
|
438
|
+
'min': None,
|
|
439
|
+
'max': None,
|
|
440
|
+
},
|
|
441
|
+
'amount': {
|
|
442
|
+
'min': self.safe_number(market, 'minLotSize'),
|
|
443
|
+
'max': self.safe_number(market, 'maxLotSize'),
|
|
444
|
+
},
|
|
445
|
+
'price': {
|
|
446
|
+
'min': self.safe_number(market, 'minPrice'),
|
|
447
|
+
'max': self.safe_number(market, 'maxPrice'),
|
|
448
|
+
},
|
|
449
|
+
'cost': {
|
|
450
|
+
'min': self.safe_number(market, 'minLotSizeS2'),
|
|
451
|
+
'max': None,
|
|
452
|
+
},
|
|
453
|
+
},
|
|
454
|
+
'created': None,
|
|
455
|
+
'info': market,
|
|
456
|
+
})
|
|
457
|
+
return result
|
|
458
|
+
|
|
459
|
+
def parse_balance(self, response) -> Balances:
|
|
460
|
+
result: dict = {'info': response}
|
|
461
|
+
ommited = ['username', 'timestamp']
|
|
462
|
+
balances = self.omit(response, ommited)
|
|
463
|
+
currencyIds = list(balances.keys())
|
|
464
|
+
for i in range(0, len(currencyIds)):
|
|
465
|
+
currencyId = currencyIds[i]
|
|
466
|
+
balance = self.safe_value(balances, currencyId, {})
|
|
467
|
+
account = self.account()
|
|
468
|
+
account['free'] = self.safe_string(balance, 'available')
|
|
469
|
+
# https://github.com/ccxt/ccxt/issues/5484
|
|
470
|
+
account['used'] = self.safe_string(balance, 'orders', '0')
|
|
471
|
+
code = self.safe_currency_code(currencyId)
|
|
472
|
+
result[code] = account
|
|
473
|
+
return self.safe_balance(result)
|
|
474
|
+
|
|
475
|
+
async def fetch_balance(self, params={}) -> Balances:
|
|
476
|
+
"""
|
|
477
|
+
:see: https://docs.cex.io/#account-balance
|
|
478
|
+
query for balance and get the amount of funds available for trading or funds locked in orders
|
|
479
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
480
|
+
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
|
481
|
+
"""
|
|
482
|
+
await self.load_markets()
|
|
483
|
+
response = await self.privatePostBalance(params)
|
|
484
|
+
return self.parse_balance(response)
|
|
485
|
+
|
|
486
|
+
async def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
|
487
|
+
"""
|
|
488
|
+
:see: https://docs.cex.io/#orderbook
|
|
489
|
+
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
|
490
|
+
:param str symbol: unified symbol of the market to fetch the order book for
|
|
491
|
+
:param int [limit]: the maximum amount of order book entries to return
|
|
492
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
493
|
+
:returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
|
|
494
|
+
"""
|
|
495
|
+
await self.load_markets()
|
|
496
|
+
market = self.market(symbol)
|
|
497
|
+
request: dict = {
|
|
498
|
+
'pair': market['id'],
|
|
499
|
+
}
|
|
500
|
+
if limit is not None:
|
|
501
|
+
request['depth'] = limit
|
|
502
|
+
response = await self.publicGetOrderBookPair(self.extend(request, params))
|
|
503
|
+
timestamp = self.safe_timestamp(response, 'timestamp')
|
|
504
|
+
return self.parse_order_book(response, market['symbol'], timestamp)
|
|
505
|
+
|
|
506
|
+
def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
|
|
507
|
+
#
|
|
508
|
+
# [
|
|
509
|
+
# 1591403940,
|
|
510
|
+
# 0.024972,
|
|
511
|
+
# 0.024972,
|
|
512
|
+
# 0.024969,
|
|
513
|
+
# 0.024969,
|
|
514
|
+
# 0.49999900
|
|
515
|
+
# ]
|
|
516
|
+
#
|
|
517
|
+
return [
|
|
518
|
+
self.safe_timestamp(ohlcv, 0),
|
|
519
|
+
self.safe_number(ohlcv, 1),
|
|
520
|
+
self.safe_number(ohlcv, 2),
|
|
521
|
+
self.safe_number(ohlcv, 3),
|
|
522
|
+
self.safe_number(ohlcv, 4),
|
|
523
|
+
self.safe_number(ohlcv, 5),
|
|
524
|
+
]
|
|
525
|
+
|
|
526
|
+
async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
|
527
|
+
"""
|
|
528
|
+
:see: https://docs.cex.io/#historical-ohlcv-chart
|
|
529
|
+
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
530
|
+
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
|
531
|
+
:param str timeframe: the length of time each candle represents
|
|
532
|
+
:param int [since]: timestamp in ms of the earliest candle to fetch
|
|
533
|
+
:param int [limit]: the maximum amount of candles to fetch
|
|
534
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
535
|
+
:returns int[][]: A list of candles ordered, open, high, low, close, volume
|
|
536
|
+
"""
|
|
537
|
+
await self.load_markets()
|
|
538
|
+
market = self.market(symbol)
|
|
539
|
+
if since is None:
|
|
540
|
+
since = self.milliseconds() - 86400000 # yesterday
|
|
541
|
+
else:
|
|
542
|
+
if self.options['fetchOHLCVWarning']:
|
|
543
|
+
raise ExchangeError(self.id + " fetchOHLCV warning: CEX can return historical candles for a certain date only, self might produce an empty or None reply. Set exchange.options['fetchOHLCVWarning'] = False or add({'options': {'fetchOHLCVWarning': False}}) to constructor params to suppress self warning message.")
|
|
544
|
+
request: dict = {
|
|
545
|
+
'pair': market['id'],
|
|
546
|
+
'yyyymmdd': self.yyyymmdd(since, ''),
|
|
547
|
+
}
|
|
548
|
+
try:
|
|
549
|
+
response = await self.publicGetOhlcvHdYyyymmddPair(self.extend(request, params))
|
|
550
|
+
#
|
|
551
|
+
# {
|
|
552
|
+
# "time":20200606,
|
|
553
|
+
# "data1m":"[[1591403940,0.024972,0.024972,0.024969,0.024969,0.49999900]]",
|
|
554
|
+
# }
|
|
555
|
+
#
|
|
556
|
+
key = 'data' + self.safe_string(self.timeframes, timeframe, timeframe)
|
|
557
|
+
data = self.safe_string(response, key)
|
|
558
|
+
ohlcvs = json.loads(data)
|
|
559
|
+
return self.parse_ohlcvs(ohlcvs, market, timeframe, since, limit)
|
|
560
|
+
except Exception as e:
|
|
561
|
+
if isinstance(e, NullResponse):
|
|
562
|
+
return []
|
|
563
|
+
return None
|
|
564
|
+
|
|
565
|
+
def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
|
|
566
|
+
timestamp = self.safe_timestamp(ticker, 'timestamp')
|
|
567
|
+
volume = self.safe_string(ticker, 'volume')
|
|
568
|
+
high = self.safe_string(ticker, 'high')
|
|
569
|
+
low = self.safe_string(ticker, 'low')
|
|
570
|
+
bid = self.safe_string(ticker, 'bid')
|
|
571
|
+
ask = self.safe_string(ticker, 'ask')
|
|
572
|
+
last = self.safe_string(ticker, 'last')
|
|
573
|
+
symbol = self.safe_symbol(None, market)
|
|
574
|
+
return self.safe_ticker({
|
|
575
|
+
'symbol': symbol,
|
|
576
|
+
'timestamp': timestamp,
|
|
577
|
+
'datetime': self.iso8601(timestamp),
|
|
578
|
+
'high': high,
|
|
579
|
+
'low': low,
|
|
580
|
+
'bid': bid,
|
|
581
|
+
'bidVolume': None,
|
|
582
|
+
'ask': ask,
|
|
583
|
+
'askVolume': None,
|
|
584
|
+
'vwap': None,
|
|
585
|
+
'open': None,
|
|
586
|
+
'close': last,
|
|
587
|
+
'last': last,
|
|
588
|
+
'previousClose': None,
|
|
589
|
+
'change': None,
|
|
590
|
+
'percentage': None,
|
|
591
|
+
'average': None,
|
|
592
|
+
'baseVolume': volume,
|
|
593
|
+
'quoteVolume': None,
|
|
594
|
+
'info': ticker,
|
|
595
|
+
}, market)
|
|
596
|
+
|
|
597
|
+
async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
|
598
|
+
"""
|
|
599
|
+
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
600
|
+
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
601
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
602
|
+
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
|
603
|
+
"""
|
|
604
|
+
await self.load_markets()
|
|
605
|
+
symbols = self.market_symbols(symbols)
|
|
606
|
+
currencies = list(self.currencies.keys())
|
|
607
|
+
request: dict = {
|
|
608
|
+
'currencies': '/'.join(currencies),
|
|
609
|
+
}
|
|
610
|
+
response = await self.publicGetTickersCurrencies(self.extend(request, params))
|
|
611
|
+
tickers = self.safe_value(response, 'data', [])
|
|
612
|
+
result: dict = {}
|
|
613
|
+
for t in range(0, len(tickers)):
|
|
614
|
+
ticker = tickers[t]
|
|
615
|
+
marketId = self.safe_string(ticker, 'pair')
|
|
616
|
+
market = self.safe_market(marketId, None, ':')
|
|
617
|
+
symbol = market['symbol']
|
|
618
|
+
result[symbol] = self.parse_ticker(ticker, market)
|
|
619
|
+
return self.filter_by_array_tickers(result, 'symbol', symbols)
|
|
620
|
+
|
|
621
|
+
async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
|
622
|
+
"""
|
|
623
|
+
:see: https://docs.cex.io/#ticker
|
|
624
|
+
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
625
|
+
:param str symbol: unified symbol of the market to fetch the ticker for
|
|
626
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
627
|
+
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
|
628
|
+
"""
|
|
629
|
+
await self.load_markets()
|
|
630
|
+
market = self.market(symbol)
|
|
631
|
+
request: dict = {
|
|
632
|
+
'pair': market['id'],
|
|
633
|
+
}
|
|
634
|
+
ticker = await self.publicGetTickerPair(self.extend(request, params))
|
|
635
|
+
return self.parse_ticker(ticker, market)
|
|
636
|
+
|
|
637
|
+
def parse_trade(self, trade: dict, market: Market = None) -> Trade:
|
|
638
|
+
#
|
|
639
|
+
# fetchTrades(public)
|
|
640
|
+
#
|
|
641
|
+
# {
|
|
642
|
+
# "type": "sell",
|
|
643
|
+
# "date": "1638401878",
|
|
644
|
+
# "amount": "0.401000",
|
|
645
|
+
# "price": "249",
|
|
646
|
+
# "tid": "11922"
|
|
647
|
+
# }
|
|
648
|
+
#
|
|
649
|
+
timestamp = self.safe_timestamp(trade, 'date')
|
|
650
|
+
id = self.safe_string(trade, 'tid')
|
|
651
|
+
type = None
|
|
652
|
+
side = self.safe_string(trade, 'type')
|
|
653
|
+
priceString = self.safe_string(trade, 'price')
|
|
654
|
+
amountString = self.safe_string(trade, 'amount')
|
|
655
|
+
market = self.safe_market(None, market)
|
|
656
|
+
return self.safe_trade({
|
|
657
|
+
'info': trade,
|
|
658
|
+
'id': id,
|
|
659
|
+
'timestamp': timestamp,
|
|
660
|
+
'datetime': self.iso8601(timestamp),
|
|
661
|
+
'symbol': market['symbol'],
|
|
662
|
+
'type': type,
|
|
663
|
+
'side': side,
|
|
664
|
+
'order': None,
|
|
665
|
+
'takerOrMaker': None,
|
|
666
|
+
'price': priceString,
|
|
667
|
+
'amount': amountString,
|
|
668
|
+
'cost': None,
|
|
669
|
+
'fee': None,
|
|
670
|
+
}, market)
|
|
671
|
+
|
|
672
|
+
async def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
|
673
|
+
"""
|
|
674
|
+
:see: https://docs.cex.io/#trade-history
|
|
675
|
+
get the list of most recent trades for a particular symbol
|
|
676
|
+
:param str symbol: unified symbol of the market to fetch trades for
|
|
677
|
+
:param int [since]: timestamp in ms of the earliest trade to fetch
|
|
678
|
+
:param int [limit]: the maximum amount of trades to fetch
|
|
679
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
680
|
+
:returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
|
|
681
|
+
"""
|
|
682
|
+
await self.load_markets()
|
|
683
|
+
market = self.market(symbol)
|
|
684
|
+
request: dict = {
|
|
685
|
+
'pair': market['id'],
|
|
686
|
+
}
|
|
687
|
+
response = await self.publicGetTradeHistoryPair(self.extend(request, params))
|
|
688
|
+
return self.parse_trades(response, market, since, limit)
|
|
689
|
+
|
|
690
|
+
async def fetch_trading_fees(self, params={}) -> TradingFees:
|
|
691
|
+
"""
|
|
692
|
+
:see: https://docs.cex.io/#get-my-fee
|
|
693
|
+
fetch the trading fees for multiple markets
|
|
694
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
695
|
+
:returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
|
|
696
|
+
"""
|
|
697
|
+
await self.load_markets()
|
|
698
|
+
response = await self.privatePostGetMyfee(params)
|
|
699
|
+
#
|
|
700
|
+
# {
|
|
701
|
+
# "e": "get_myfee",
|
|
702
|
+
# "ok": "ok",
|
|
703
|
+
# "data": {
|
|
704
|
+
# 'BTC:USD': {buy: '0.25', sell: '0.25', buyMaker: '0.15', sellMaker: "0.15"},
|
|
705
|
+
# 'ETH:USD': {buy: '0.25', sell: '0.25', buyMaker: '0.15', sellMaker: "0.15"},
|
|
706
|
+
# ..
|
|
707
|
+
# }
|
|
708
|
+
# }
|
|
709
|
+
#
|
|
710
|
+
data = self.safe_value(response, 'data', {})
|
|
711
|
+
result: dict = {}
|
|
712
|
+
for i in range(0, len(self.symbols)):
|
|
713
|
+
symbol = self.symbols[i]
|
|
714
|
+
market = self.market(symbol)
|
|
715
|
+
fee = self.safe_value(data, market['id'], {})
|
|
716
|
+
makerString = self.safe_string(fee, 'buyMaker')
|
|
717
|
+
takerString = self.safe_string(fee, 'buy')
|
|
718
|
+
maker = self.parse_number(Precise.string_div(makerString, '100'))
|
|
719
|
+
taker = self.parse_number(Precise.string_div(takerString, '100'))
|
|
720
|
+
result[symbol] = {
|
|
721
|
+
'info': fee,
|
|
722
|
+
'symbol': symbol,
|
|
723
|
+
'maker': maker,
|
|
724
|
+
'taker': taker,
|
|
725
|
+
'percentage': True,
|
|
726
|
+
}
|
|
727
|
+
return result
|
|
728
|
+
|
|
729
|
+
async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
|
730
|
+
"""
|
|
731
|
+
:see: https://docs.cex.io/#place-order
|
|
732
|
+
create a trade order
|
|
733
|
+
:see: https://cex.io/rest-api#place-order
|
|
734
|
+
:param str symbol: unified symbol of the market to create an order in
|
|
735
|
+
:param str type: 'market' or 'limit'
|
|
736
|
+
:param str side: 'buy' or 'sell'
|
|
737
|
+
:param float amount: how much of currency you want to trade in units of base currency
|
|
738
|
+
:param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
739
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
740
|
+
:param float [params.cost]: the quote quantity that can be used alternative for the amount for market buy orders
|
|
741
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
|
742
|
+
"""
|
|
743
|
+
await self.load_markets()
|
|
744
|
+
market = self.market(symbol)
|
|
745
|
+
request: dict = {
|
|
746
|
+
'pair': market['id'],
|
|
747
|
+
'type': side,
|
|
748
|
+
}
|
|
749
|
+
# for market buy it requires the amount of quote currency to spend
|
|
750
|
+
if (type == 'market') and (side == 'buy'):
|
|
751
|
+
quoteAmount = None
|
|
752
|
+
createMarketBuyOrderRequiresPrice = True
|
|
753
|
+
createMarketBuyOrderRequiresPrice, params = self.handle_option_and_params(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', True)
|
|
754
|
+
cost = self.safe_string(params, 'cost')
|
|
755
|
+
params = self.omit(params, 'cost')
|
|
756
|
+
if cost is not None:
|
|
757
|
+
quoteAmount = self.cost_to_precision(symbol, cost)
|
|
758
|
+
elif createMarketBuyOrderRequiresPrice:
|
|
759
|
+
if price is None:
|
|
760
|
+
raise InvalidOrder(self.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend(amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to False and pass the cost to spend in the amount argument')
|
|
761
|
+
else:
|
|
762
|
+
amountString = self.number_to_string(amount)
|
|
763
|
+
priceString = self.number_to_string(price)
|
|
764
|
+
costRequest = Precise.string_mul(amountString, priceString)
|
|
765
|
+
quoteAmount = self.cost_to_precision(symbol, costRequest)
|
|
766
|
+
else:
|
|
767
|
+
quoteAmount = self.cost_to_precision(symbol, amount)
|
|
768
|
+
request['amount'] = quoteAmount
|
|
769
|
+
else:
|
|
770
|
+
request['amount'] = self.amount_to_precision(symbol, amount)
|
|
771
|
+
if type == 'limit':
|
|
772
|
+
request['price'] = self.number_to_string(price)
|
|
773
|
+
else:
|
|
774
|
+
request['order_type'] = type
|
|
775
|
+
response = await self.privatePostPlaceOrderPair(self.extend(request, params))
|
|
776
|
+
#
|
|
777
|
+
# {
|
|
778
|
+
# "id": "12978363524",
|
|
779
|
+
# "time": 1586610022259,
|
|
780
|
+
# "type": "buy",
|
|
781
|
+
# "price": "0.033934",
|
|
782
|
+
# "amount": "0.10722802",
|
|
783
|
+
# "pending": "0.10722802",
|
|
784
|
+
# "complete": False
|
|
785
|
+
# }
|
|
786
|
+
#
|
|
787
|
+
placedAmount = self.safe_string(response, 'amount')
|
|
788
|
+
remaining = self.safe_string(response, 'pending')
|
|
789
|
+
timestamp = self.safe_value(response, 'time')
|
|
790
|
+
complete = self.safe_value(response, 'complete')
|
|
791
|
+
status = 'closed' if complete else 'open'
|
|
792
|
+
filled = None
|
|
793
|
+
if (placedAmount is not None) and (remaining is not None):
|
|
794
|
+
filled = Precise.string_max(Precise.string_sub(placedAmount, remaining), '0')
|
|
795
|
+
return self.safe_order({
|
|
796
|
+
'id': self.safe_string(response, 'id'),
|
|
797
|
+
'info': response,
|
|
798
|
+
'clientOrderId': None,
|
|
799
|
+
'timestamp': timestamp,
|
|
800
|
+
'datetime': self.iso8601(timestamp),
|
|
801
|
+
'lastTradeTimestamp': None,
|
|
802
|
+
'type': type,
|
|
803
|
+
'side': self.safe_string(response, 'type'),
|
|
804
|
+
'symbol': market['symbol'],
|
|
805
|
+
'status': status,
|
|
806
|
+
'price': self.safe_string(response, 'price'),
|
|
807
|
+
'amount': placedAmount,
|
|
808
|
+
'cost': None,
|
|
809
|
+
'average': None,
|
|
810
|
+
'remaining': remaining,
|
|
811
|
+
'filled': filled,
|
|
812
|
+
'fee': None,
|
|
813
|
+
'trades': None,
|
|
814
|
+
})
|
|
815
|
+
|
|
816
|
+
async def cancel_order(self, id: str, symbol: Str = None, params={}):
|
|
817
|
+
"""
|
|
818
|
+
:see: https://docs.cex.io/#cancel-order
|
|
819
|
+
cancels an open order
|
|
820
|
+
:param str id: order id
|
|
821
|
+
:param str symbol: not used by cex cancelOrder()
|
|
822
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
823
|
+
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
|
824
|
+
"""
|
|
825
|
+
await self.load_markets()
|
|
826
|
+
request: dict = {
|
|
827
|
+
'id': id,
|
|
828
|
+
}
|
|
829
|
+
response = await self.privatePostCancelOrder(self.extend(request, params))
|
|
830
|
+
# 'true'
|
|
831
|
+
return self.extend(self.parse_order({}), {'info': response, 'type': None, 'id': id, 'status': 'canceled'})
|
|
832
|
+
|
|
833
|
+
async def cancel_all_orders(self, symbol: Str = None, params={}):
|
|
834
|
+
"""
|
|
835
|
+
:see: https://docs.cex.io/#cancel-all-orders-for-given-pair
|
|
836
|
+
cancel all open orders in a market
|
|
837
|
+
:param str symbol: unified market symbol of the market to cancel orders in
|
|
838
|
+
:param dict [params]: extra parameters specific to the cex api endpoint
|
|
839
|
+
:param str [params.marginMode]: 'cross' or 'isolated', for spot margin trading
|
|
840
|
+
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
|
841
|
+
"""
|
|
842
|
+
if symbol is None:
|
|
843
|
+
raise ArgumentsRequired(self.id + ' cancelAllOrders requires a symbol.')
|
|
844
|
+
await self.load_markets()
|
|
845
|
+
market = self.market(symbol)
|
|
846
|
+
request: dict = {
|
|
847
|
+
'pair': market['id'],
|
|
848
|
+
}
|
|
849
|
+
orders = await self.privatePostCancelOrdersPair(self.extend(request, params))
|
|
850
|
+
#
|
|
851
|
+
# {
|
|
852
|
+
# "e":"cancel_orders",
|
|
853
|
+
# "ok":"ok",
|
|
854
|
+
# "data":[
|
|
855
|
+
# ]
|
|
856
|
+
# }
|
|
857
|
+
#
|
|
858
|
+
return orders
|
|
859
|
+
|
|
860
|
+
def parse_order(self, order: dict, market: Market = None) -> Order:
|
|
861
|
+
# Depending on the call, 'time' can be a unix int, unix string or ISO string
|
|
862
|
+
# Yes, really
|
|
863
|
+
timestamp = self.safe_value(order, 'time')
|
|
864
|
+
if isinstance(timestamp, str) and timestamp.find('T') >= 0:
|
|
865
|
+
# ISO8601 string
|
|
866
|
+
timestamp = self.parse8601(timestamp)
|
|
867
|
+
elif timestamp is not None:
|
|
868
|
+
# either integer or string integer
|
|
869
|
+
timestamp = int(timestamp)
|
|
870
|
+
symbol = None
|
|
871
|
+
baseId = self.safe_string(order, 'symbol1')
|
|
872
|
+
quoteId = self.safe_string(order, 'symbol2')
|
|
873
|
+
if market is None and baseId is not None and quoteId is not None:
|
|
874
|
+
base = self.safe_currency_code(baseId)
|
|
875
|
+
quote = self.safe_currency_code(quoteId)
|
|
876
|
+
if (base is not None) and (quote is not None):
|
|
877
|
+
symbol = base + '/' + quote
|
|
878
|
+
if symbol in self.markets:
|
|
879
|
+
market = self.market(symbol)
|
|
880
|
+
status = self.parse_order_status(self.safe_string(order, 'status'))
|
|
881
|
+
price = self.safe_string(order, 'price')
|
|
882
|
+
amount = self.omit_zero(self.safe_string(order, 'amount'))
|
|
883
|
+
# sell orders can have a negative amount
|
|
884
|
+
# https://github.com/ccxt/ccxt/issues/5338
|
|
885
|
+
if amount is not None:
|
|
886
|
+
amount = Precise.string_abs(amount)
|
|
887
|
+
elif market is not None:
|
|
888
|
+
amountKey = 'a:' + market['base'] + 'cds:'
|
|
889
|
+
amount = Precise.string_abs(self.safe_string(order, amountKey))
|
|
890
|
+
remaining = self.safe_string_2(order, 'pending', 'remains')
|
|
891
|
+
filled = Precise.string_sub(amount, remaining)
|
|
892
|
+
fee = None
|
|
893
|
+
cost = None
|
|
894
|
+
if market is not None:
|
|
895
|
+
symbol = market['symbol']
|
|
896
|
+
taCost = self.safe_string(order, 'ta:' + market['quote'])
|
|
897
|
+
ttaCost = self.safe_string(order, 'tta:' + market['quote'])
|
|
898
|
+
cost = Precise.string_add(taCost, ttaCost)
|
|
899
|
+
baseFee = 'fa:' + market['base']
|
|
900
|
+
baseTakerFee = 'tfa:' + market['base']
|
|
901
|
+
quoteFee = 'fa:' + market['quote']
|
|
902
|
+
quoteTakerFee = 'tfa:' + market['quote']
|
|
903
|
+
feeRate = self.safe_string(order, 'tradingFeeMaker')
|
|
904
|
+
if not feeRate:
|
|
905
|
+
feeRate = self.safe_string(order, 'tradingFeeTaker', feeRate)
|
|
906
|
+
if feeRate:
|
|
907
|
+
feeRate = Precise.string_div(feeRate, '100') # convert to mathematically-correct percentage coefficients: 1.0 = 100%
|
|
908
|
+
if (baseFee in order) or (baseTakerFee in order):
|
|
909
|
+
baseFeeCost = self.safe_number_2(order, baseFee, baseTakerFee)
|
|
910
|
+
fee = {
|
|
911
|
+
'currency': market['base'],
|
|
912
|
+
'rate': self.parse_number(feeRate),
|
|
913
|
+
'cost': baseFeeCost,
|
|
914
|
+
}
|
|
915
|
+
elif (quoteFee in order) or (quoteTakerFee in order):
|
|
916
|
+
quoteFeeCost = self.safe_number_2(order, quoteFee, quoteTakerFee)
|
|
917
|
+
fee = {
|
|
918
|
+
'currency': market['quote'],
|
|
919
|
+
'rate': self.parse_number(feeRate),
|
|
920
|
+
'cost': quoteFeeCost,
|
|
921
|
+
}
|
|
922
|
+
if not cost:
|
|
923
|
+
cost = Precise.string_mul(price, filled)
|
|
924
|
+
side = self.safe_string(order, 'type')
|
|
925
|
+
trades = None
|
|
926
|
+
orderId = self.safe_string(order, 'id')
|
|
927
|
+
if 'vtx' in order:
|
|
928
|
+
trades = []
|
|
929
|
+
for i in range(0, len(order['vtx'])):
|
|
930
|
+
item = order['vtx'][i]
|
|
931
|
+
tradeSide = self.safe_string(item, 'type')
|
|
932
|
+
if tradeSide == 'cancel':
|
|
933
|
+
# looks like self might represent the cancelled part of an order
|
|
934
|
+
# {"id": "4426729543",
|
|
935
|
+
# "type": "cancel",
|
|
936
|
+
# "time": "2017-09-22T00:24:30.476Z",
|
|
937
|
+
# "user": "up106404164",
|
|
938
|
+
# "c": "user:up106404164:a:BCH",
|
|
939
|
+
# "d": "order:4426728375:a:BCH",
|
|
940
|
+
# "a": "0.09935956",
|
|
941
|
+
# "amount": "0.09935956",
|
|
942
|
+
# "balance": "0.42580261",
|
|
943
|
+
# "symbol": "BCH",
|
|
944
|
+
# "order": "4426728375",
|
|
945
|
+
# "buy": null,
|
|
946
|
+
# "sell": null,
|
|
947
|
+
# "pair": null,
|
|
948
|
+
# "pos": null,
|
|
949
|
+
# "cs": "0.42580261",
|
|
950
|
+
# "ds": 0}
|
|
951
|
+
continue
|
|
952
|
+
tradePrice = self.safe_string(item, 'price')
|
|
953
|
+
if tradePrice is None:
|
|
954
|
+
# self represents the order
|
|
955
|
+
# {
|
|
956
|
+
# "a": "0.47000000",
|
|
957
|
+
# "c": "user:up106404164:a:EUR",
|
|
958
|
+
# "d": "order:6065499239:a:EUR",
|
|
959
|
+
# "cs": "1432.93",
|
|
960
|
+
# "ds": "476.72",
|
|
961
|
+
# "id": "6065499249",
|
|
962
|
+
# "buy": null,
|
|
963
|
+
# "pos": null,
|
|
964
|
+
# "pair": null,
|
|
965
|
+
# "sell": null,
|
|
966
|
+
# "time": "2018-04-22T13:07:22.152Z",
|
|
967
|
+
# "type": "buy",
|
|
968
|
+
# "user": "up106404164",
|
|
969
|
+
# "order": "6065499239",
|
|
970
|
+
# "amount": "-715.97000000",
|
|
971
|
+
# "symbol": "EUR",
|
|
972
|
+
# "balance": "1432.93000000"}
|
|
973
|
+
continue
|
|
974
|
+
# todo: deal with these
|
|
975
|
+
if tradeSide == 'costsNothing':
|
|
976
|
+
continue
|
|
977
|
+
# --
|
|
978
|
+
# if side != tradeSide:
|
|
979
|
+
# raise Error(json.dumps(order, null, 2))
|
|
980
|
+
# if orderId != item['order']:
|
|
981
|
+
# raise Error(json.dumps(order, null, 2))
|
|
982
|
+
# --
|
|
983
|
+
# partial buy trade
|
|
984
|
+
# {
|
|
985
|
+
# "a": "0.01589885",
|
|
986
|
+
# "c": "user:up106404164:a:BTC",
|
|
987
|
+
# "d": "order:6065499239:a:BTC",
|
|
988
|
+
# "cs": "0.36300000",
|
|
989
|
+
# "ds": 0,
|
|
990
|
+
# "id": "6067991213",
|
|
991
|
+
# "buy": "6065499239",
|
|
992
|
+
# "pos": null,
|
|
993
|
+
# "pair": null,
|
|
994
|
+
# "sell": "6067991206",
|
|
995
|
+
# "time": "2018-04-22T23:09:11.773Z",
|
|
996
|
+
# "type": "buy",
|
|
997
|
+
# "user": "up106404164",
|
|
998
|
+
# "order": "6065499239",
|
|
999
|
+
# "price": 7146.5,
|
|
1000
|
+
# "amount": "0.01589885",
|
|
1001
|
+
# "symbol": "BTC",
|
|
1002
|
+
# "balance": "0.36300000",
|
|
1003
|
+
# "symbol2": "EUR",
|
|
1004
|
+
# "fee_amount": "0.19"}
|
|
1005
|
+
# --
|
|
1006
|
+
# trade with zero amount, but non-zero fee
|
|
1007
|
+
# {
|
|
1008
|
+
# "a": "0.00000000",
|
|
1009
|
+
# "c": "user:up106404164:a:EUR",
|
|
1010
|
+
# "d": "order:5840654423:a:EUR",
|
|
1011
|
+
# "cs": 559744,
|
|
1012
|
+
# "ds": 0,
|
|
1013
|
+
# "id": "5840654429",
|
|
1014
|
+
# "buy": "5807238573",
|
|
1015
|
+
# "pos": null,
|
|
1016
|
+
# "pair": null,
|
|
1017
|
+
# "sell": "5840654423",
|
|
1018
|
+
# "time": "2018-03-15T03:20:14.010Z",
|
|
1019
|
+
# "type": "sell",
|
|
1020
|
+
# "user": "up106404164",
|
|
1021
|
+
# "order": "5840654423",
|
|
1022
|
+
# "price": 730,
|
|
1023
|
+
# "amount": "0.00000000",
|
|
1024
|
+
# "symbol": "EUR",
|
|
1025
|
+
# "balance": "5597.44000000",
|
|
1026
|
+
# "symbol2": "BCH",
|
|
1027
|
+
# "fee_amount": "0.01"}
|
|
1028
|
+
# --
|
|
1029
|
+
# trade which should have an amount of exactly 0.002BTC
|
|
1030
|
+
# {
|
|
1031
|
+
# "a": "16.70000000",
|
|
1032
|
+
# "c": "user:up106404164:a:GBP",
|
|
1033
|
+
# "d": "order:9927386681:a:GBP",
|
|
1034
|
+
# "cs": "86.90",
|
|
1035
|
+
# "ds": 0,
|
|
1036
|
+
# "id": "9927401610",
|
|
1037
|
+
# "buy": "9927401601",
|
|
1038
|
+
# "pos": null,
|
|
1039
|
+
# "pair": null,
|
|
1040
|
+
# "sell": "9927386681",
|
|
1041
|
+
# "time": "2019-08-21T15:25:37.777Z",
|
|
1042
|
+
# "type": "sell",
|
|
1043
|
+
# "user": "up106404164",
|
|
1044
|
+
# "order": "9927386681",
|
|
1045
|
+
# "price": 8365,
|
|
1046
|
+
# "amount": "16.70000000",
|
|
1047
|
+
# "office": "UK",
|
|
1048
|
+
# "symbol": "GBP",
|
|
1049
|
+
# "balance": "86.90000000",
|
|
1050
|
+
# "symbol2": "BTC",
|
|
1051
|
+
# "fee_amount": "0.03"
|
|
1052
|
+
# }
|
|
1053
|
+
tradeTimestamp = self.parse8601(self.safe_string(item, 'time'))
|
|
1054
|
+
tradeAmount = self.safe_string(item, 'amount')
|
|
1055
|
+
feeCost = self.safe_string(item, 'fee_amount')
|
|
1056
|
+
absTradeAmount = Precise.string_abs(tradeAmount)
|
|
1057
|
+
tradeCost = None
|
|
1058
|
+
if tradeSide == 'sell':
|
|
1059
|
+
tradeCost = absTradeAmount
|
|
1060
|
+
absTradeAmount = Precise.string_div(Precise.string_add(feeCost, tradeCost), tradePrice)
|
|
1061
|
+
else:
|
|
1062
|
+
tradeCost = Precise.string_mul(absTradeAmount, tradePrice)
|
|
1063
|
+
trades.append({
|
|
1064
|
+
'id': self.safe_string(item, 'id'),
|
|
1065
|
+
'timestamp': tradeTimestamp,
|
|
1066
|
+
'datetime': self.iso8601(tradeTimestamp),
|
|
1067
|
+
'order': orderId,
|
|
1068
|
+
'symbol': symbol,
|
|
1069
|
+
'price': self.parse_number(tradePrice),
|
|
1070
|
+
'amount': self.parse_number(absTradeAmount),
|
|
1071
|
+
'cost': self.parse_number(tradeCost),
|
|
1072
|
+
'side': tradeSide,
|
|
1073
|
+
'fee': {
|
|
1074
|
+
'cost': self.parse_number(feeCost),
|
|
1075
|
+
'currency': market['quote'],
|
|
1076
|
+
},
|
|
1077
|
+
'info': item,
|
|
1078
|
+
'type': None,
|
|
1079
|
+
'takerOrMaker': None,
|
|
1080
|
+
})
|
|
1081
|
+
return self.safe_order({
|
|
1082
|
+
'info': order,
|
|
1083
|
+
'id': orderId,
|
|
1084
|
+
'clientOrderId': None,
|
|
1085
|
+
'datetime': self.iso8601(timestamp),
|
|
1086
|
+
'timestamp': timestamp,
|
|
1087
|
+
'lastTradeTimestamp': None,
|
|
1088
|
+
'status': status,
|
|
1089
|
+
'symbol': symbol,
|
|
1090
|
+
'type': 'market' if (price is None) else 'limit',
|
|
1091
|
+
'timeInForce': None,
|
|
1092
|
+
'postOnly': None,
|
|
1093
|
+
'side': side,
|
|
1094
|
+
'price': price,
|
|
1095
|
+
'stopPrice': None,
|
|
1096
|
+
'triggerPrice': None,
|
|
1097
|
+
'cost': cost,
|
|
1098
|
+
'amount': amount,
|
|
1099
|
+
'filled': filled,
|
|
1100
|
+
'remaining': remaining,
|
|
1101
|
+
'trades': trades,
|
|
1102
|
+
'fee': fee,
|
|
1103
|
+
'average': None,
|
|
1104
|
+
})
|
|
1105
|
+
|
|
1106
|
+
async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
|
1107
|
+
"""
|
|
1108
|
+
:see: https://docs.cex.io/#open-orders
|
|
1109
|
+
fetch all unfilled currently open orders
|
|
1110
|
+
:param str symbol: unified market symbol
|
|
1111
|
+
:param int [since]: the earliest time in ms to fetch open orders for
|
|
1112
|
+
:param int [limit]: the maximum number of open orders structures to retrieve
|
|
1113
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1114
|
+
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
|
1115
|
+
"""
|
|
1116
|
+
await self.load_markets()
|
|
1117
|
+
request: dict = {}
|
|
1118
|
+
market = None
|
|
1119
|
+
orders = None
|
|
1120
|
+
if symbol is not None:
|
|
1121
|
+
market = self.market(symbol)
|
|
1122
|
+
request['pair'] = market['id']
|
|
1123
|
+
orders = await self.privatePostOpenOrdersPair(self.extend(request, params))
|
|
1124
|
+
else:
|
|
1125
|
+
orders = await self.privatePostOpenOrders(self.extend(request, params))
|
|
1126
|
+
for i in range(0, len(orders)):
|
|
1127
|
+
orders[i] = self.extend(orders[i], {'status': 'open'})
|
|
1128
|
+
return self.parse_orders(orders, market, since, limit)
|
|
1129
|
+
|
|
1130
|
+
async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
|
1131
|
+
"""
|
|
1132
|
+
:see: https://docs.cex.io/#archived-orders
|
|
1133
|
+
fetches information on multiple closed orders made by the user
|
|
1134
|
+
:param str symbol: unified market symbol of the market orders were made in
|
|
1135
|
+
:param int [since]: the earliest time in ms to fetch orders for
|
|
1136
|
+
:param int [limit]: the maximum number of order structures to retrieve
|
|
1137
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1138
|
+
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
|
1139
|
+
"""
|
|
1140
|
+
if symbol is None:
|
|
1141
|
+
raise ArgumentsRequired(self.id + ' fetchClosedOrders() requires a symbol argument')
|
|
1142
|
+
await self.load_markets()
|
|
1143
|
+
market = self.market(symbol)
|
|
1144
|
+
request: dict = {'pair': market['id']}
|
|
1145
|
+
response = await self.privatePostArchivedOrdersPair(self.extend(request, params))
|
|
1146
|
+
return self.parse_orders(response, market, since, limit)
|
|
1147
|
+
|
|
1148
|
+
async def fetch_order(self, id: str, symbol: Str = None, params={}):
|
|
1149
|
+
"""
|
|
1150
|
+
:see: https://docs.cex.io/?python#get-order-details
|
|
1151
|
+
fetches information on an order made by the user
|
|
1152
|
+
:param str symbol: not used by cex fetchOrder
|
|
1153
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1154
|
+
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
|
1155
|
+
"""
|
|
1156
|
+
await self.load_markets()
|
|
1157
|
+
request: dict = {
|
|
1158
|
+
'id': str(id),
|
|
1159
|
+
}
|
|
1160
|
+
response = await self.privatePostGetOrderTx(self.extend(request, params))
|
|
1161
|
+
data = self.safe_value(response, 'data', {})
|
|
1162
|
+
#
|
|
1163
|
+
# {
|
|
1164
|
+
# "id": "5442731603",
|
|
1165
|
+
# "type": "sell",
|
|
1166
|
+
# "time": 1516132358071,
|
|
1167
|
+
# "lastTxTime": 1516132378452,
|
|
1168
|
+
# "lastTx": "5442734452",
|
|
1169
|
+
# "pos": null,
|
|
1170
|
+
# "user": "up106404164",
|
|
1171
|
+
# "status": "d",
|
|
1172
|
+
# "symbol1": "ETH",
|
|
1173
|
+
# "symbol2": "EUR",
|
|
1174
|
+
# "amount": "0.50000000",
|
|
1175
|
+
# "kind": "api",
|
|
1176
|
+
# "price": "923.3386",
|
|
1177
|
+
# "tfacf": "1",
|
|
1178
|
+
# "fa:EUR": "0.55",
|
|
1179
|
+
# "ta:EUR": "369.77",
|
|
1180
|
+
# "remains": "0.00000000",
|
|
1181
|
+
# "tfa:EUR": "0.22",
|
|
1182
|
+
# "tta:EUR": "91.95",
|
|
1183
|
+
# "a:ETH:cds": "0.50000000",
|
|
1184
|
+
# "a:EUR:cds": "461.72",
|
|
1185
|
+
# "f:EUR:cds": "0.77",
|
|
1186
|
+
# "tradingFeeMaker": "0.15",
|
|
1187
|
+
# "tradingFeeTaker": "0.23",
|
|
1188
|
+
# "tradingFeeStrategy": "userVolumeAmount",
|
|
1189
|
+
# "tradingFeeUserVolumeAmount": "2896912572",
|
|
1190
|
+
# "orderId": "5442731603",
|
|
1191
|
+
# "next": False,
|
|
1192
|
+
# "vtx": [
|
|
1193
|
+
# {
|
|
1194
|
+
# "id": "5442734452",
|
|
1195
|
+
# "type": "sell",
|
|
1196
|
+
# "time": "2018-01-16T19:52:58.452Z",
|
|
1197
|
+
# "user": "up106404164",
|
|
1198
|
+
# "c": "user:up106404164:a:EUR",
|
|
1199
|
+
# "d": "order:5442731603:a:EUR",
|
|
1200
|
+
# "a": "104.53000000",
|
|
1201
|
+
# "amount": "104.53000000",
|
|
1202
|
+
# "balance": "932.71000000",
|
|
1203
|
+
# "symbol": "EUR",
|
|
1204
|
+
# "order": "5442731603",
|
|
1205
|
+
# "buy": "5442734443",
|
|
1206
|
+
# "sell": "5442731603",
|
|
1207
|
+
# "pair": null,
|
|
1208
|
+
# "pos": null,
|
|
1209
|
+
# "office": null,
|
|
1210
|
+
# "cs": "932.71",
|
|
1211
|
+
# "ds": 0,
|
|
1212
|
+
# "price": 923.3386,
|
|
1213
|
+
# "symbol2": "ETH",
|
|
1214
|
+
# "fee_amount": "0.16"
|
|
1215
|
+
# },
|
|
1216
|
+
# {
|
|
1217
|
+
# "id": "5442731609",
|
|
1218
|
+
# "type": "sell",
|
|
1219
|
+
# "time": "2018-01-16T19:52:38.071Z",
|
|
1220
|
+
# "user": "up106404164",
|
|
1221
|
+
# "c": "user:up106404164:a:EUR",
|
|
1222
|
+
# "d": "order:5442731603:a:EUR",
|
|
1223
|
+
# "a": "91.73000000",
|
|
1224
|
+
# "amount": "91.73000000",
|
|
1225
|
+
# "balance": "563.49000000",
|
|
1226
|
+
# "symbol": "EUR",
|
|
1227
|
+
# "order": "5442731603",
|
|
1228
|
+
# "buy": "5442618127",
|
|
1229
|
+
# "sell": "5442731603",
|
|
1230
|
+
# "pair": null,
|
|
1231
|
+
# "pos": null,
|
|
1232
|
+
# "office": null,
|
|
1233
|
+
# "cs": "563.49",
|
|
1234
|
+
# "ds": 0,
|
|
1235
|
+
# "price": 924.0092,
|
|
1236
|
+
# "symbol2": "ETH",
|
|
1237
|
+
# "fee_amount": "0.22"
|
|
1238
|
+
# },
|
|
1239
|
+
# {
|
|
1240
|
+
# "id": "5442731604",
|
|
1241
|
+
# "type": "sell",
|
|
1242
|
+
# "time": "2018-01-16T19:52:38.071Z",
|
|
1243
|
+
# "user": "up106404164",
|
|
1244
|
+
# "c": "order:5442731603:a:ETH",
|
|
1245
|
+
# "d": "user:up106404164:a:ETH",
|
|
1246
|
+
# "a": "0.50000000",
|
|
1247
|
+
# "amount": "-0.50000000",
|
|
1248
|
+
# "balance": "15.80995000",
|
|
1249
|
+
# "symbol": "ETH",
|
|
1250
|
+
# "order": "5442731603",
|
|
1251
|
+
# "buy": null,
|
|
1252
|
+
# "sell": null,
|
|
1253
|
+
# "pair": null,
|
|
1254
|
+
# "pos": null,
|
|
1255
|
+
# "office": null,
|
|
1256
|
+
# "cs": "0.50000000",
|
|
1257
|
+
# "ds": "15.80995000"
|
|
1258
|
+
# }
|
|
1259
|
+
# ]
|
|
1260
|
+
# }
|
|
1261
|
+
#
|
|
1262
|
+
return self.parse_order(data)
|
|
1263
|
+
|
|
1264
|
+
async def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
|
1265
|
+
"""
|
|
1266
|
+
:see: https://docs.cex.io/#archived-orders
|
|
1267
|
+
fetches information on multiple orders made by the user
|
|
1268
|
+
:param str symbol: unified market symbol of the market orders were made in
|
|
1269
|
+
:param int [since]: the earliest time in ms to fetch orders for
|
|
1270
|
+
:param int [limit]: the maximum number of order structures to retrieve
|
|
1271
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1272
|
+
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
|
1273
|
+
"""
|
|
1274
|
+
await self.load_markets()
|
|
1275
|
+
market = self.market(symbol)
|
|
1276
|
+
request: dict = {
|
|
1277
|
+
'limit': limit,
|
|
1278
|
+
'pair': market['id'],
|
|
1279
|
+
'dateFrom': since,
|
|
1280
|
+
}
|
|
1281
|
+
response = await self.privatePostArchivedOrdersPair(self.extend(request, params))
|
|
1282
|
+
results = []
|
|
1283
|
+
for i in range(0, len(response)):
|
|
1284
|
+
# cancelled(unfilled):
|
|
1285
|
+
# {"id": "4005785516",
|
|
1286
|
+
# "type": "sell",
|
|
1287
|
+
# "time": "2017-07-18T19:08:34.223Z",
|
|
1288
|
+
# "lastTxTime": "2017-07-18T19:08:34.396Z",
|
|
1289
|
+
# "lastTx": "4005785522",
|
|
1290
|
+
# "pos": null,
|
|
1291
|
+
# "status": "c",
|
|
1292
|
+
# "symbol1": "ETH",
|
|
1293
|
+
# "symbol2": "GBP",
|
|
1294
|
+
# "amount": "0.20000000",
|
|
1295
|
+
# "price": "200.5625",
|
|
1296
|
+
# "remains": "0.20000000",
|
|
1297
|
+
# 'a:ETH:cds': "0.20000000",
|
|
1298
|
+
# "tradingFeeMaker": "0",
|
|
1299
|
+
# "tradingFeeTaker": "0.16",
|
|
1300
|
+
# "tradingFeeUserVolumeAmount": "10155061217",
|
|
1301
|
+
# "orderId": "4005785516"}
|
|
1302
|
+
# --
|
|
1303
|
+
# cancelled(partially filled buy):
|
|
1304
|
+
# {"id": "4084911657",
|
|
1305
|
+
# "type": "buy",
|
|
1306
|
+
# "time": "2017-08-05T03:18:39.596Z",
|
|
1307
|
+
# "lastTxTime": "2019-03-19T17:37:46.404Z",
|
|
1308
|
+
# "lastTx": "8459265833",
|
|
1309
|
+
# "pos": null,
|
|
1310
|
+
# "status": "cd",
|
|
1311
|
+
# "symbol1": "BTC",
|
|
1312
|
+
# "symbol2": "GBP",
|
|
1313
|
+
# "amount": "0.05000000",
|
|
1314
|
+
# "price": "2241.4692",
|
|
1315
|
+
# "tfacf": "1",
|
|
1316
|
+
# "remains": "0.03910535",
|
|
1317
|
+
# 'tfa:GBP': "0.04",
|
|
1318
|
+
# 'tta:GBP': "24.39",
|
|
1319
|
+
# 'a:BTC:cds': "0.01089465",
|
|
1320
|
+
# 'a:GBP:cds': "112.26",
|
|
1321
|
+
# 'f:GBP:cds': "0.04",
|
|
1322
|
+
# "tradingFeeMaker": "0",
|
|
1323
|
+
# "tradingFeeTaker": "0.16",
|
|
1324
|
+
# "tradingFeeUserVolumeAmount": "13336396963",
|
|
1325
|
+
# "orderId": "4084911657"}
|
|
1326
|
+
# --
|
|
1327
|
+
# cancelled(partially filled sell):
|
|
1328
|
+
# {"id": "4426728375",
|
|
1329
|
+
# "type": "sell",
|
|
1330
|
+
# "time": "2017-09-22T00:24:20.126Z",
|
|
1331
|
+
# "lastTxTime": "2017-09-22T00:24:30.476Z",
|
|
1332
|
+
# "lastTx": "4426729543",
|
|
1333
|
+
# "pos": null,
|
|
1334
|
+
# "status": "cd",
|
|
1335
|
+
# "symbol1": "BCH",
|
|
1336
|
+
# "symbol2": "BTC",
|
|
1337
|
+
# "amount": "0.10000000",
|
|
1338
|
+
# "price": "0.11757182",
|
|
1339
|
+
# "tfacf": "1",
|
|
1340
|
+
# "remains": "0.09935956",
|
|
1341
|
+
# 'tfa:BTC': "0.00000014",
|
|
1342
|
+
# 'tta:BTC': "0.00007537",
|
|
1343
|
+
# 'a:BCH:cds': "0.10000000",
|
|
1344
|
+
# 'a:BTC:cds': "0.00007537",
|
|
1345
|
+
# 'f:BTC:cds': "0.00000014",
|
|
1346
|
+
# "tradingFeeMaker": "0",
|
|
1347
|
+
# "tradingFeeTaker": "0.18",
|
|
1348
|
+
# "tradingFeeUserVolumeAmount": "3466715450",
|
|
1349
|
+
# "orderId": "4426728375"}
|
|
1350
|
+
# --
|
|
1351
|
+
# filled:
|
|
1352
|
+
# {"id": "5342275378",
|
|
1353
|
+
# "type": "sell",
|
|
1354
|
+
# "time": "2018-01-04T00:28:12.992Z",
|
|
1355
|
+
# "lastTxTime": "2018-01-04T00:28:12.992Z",
|
|
1356
|
+
# "lastTx": "5342275393",
|
|
1357
|
+
# "pos": null,
|
|
1358
|
+
# "status": "d",
|
|
1359
|
+
# "symbol1": "BCH",
|
|
1360
|
+
# "symbol2": "BTC",
|
|
1361
|
+
# "amount": "0.10000000",
|
|
1362
|
+
# "kind": "api",
|
|
1363
|
+
# "price": "0.17",
|
|
1364
|
+
# "remains": "0.00000000",
|
|
1365
|
+
# 'tfa:BTC': "0.00003902",
|
|
1366
|
+
# 'tta:BTC': "0.01699999",
|
|
1367
|
+
# 'a:BCH:cds': "0.10000000",
|
|
1368
|
+
# 'a:BTC:cds': "0.01699999",
|
|
1369
|
+
# 'f:BTC:cds': "0.00003902",
|
|
1370
|
+
# "tradingFeeMaker": "0.15",
|
|
1371
|
+
# "tradingFeeTaker": "0.23",
|
|
1372
|
+
# "tradingFeeUserVolumeAmount": "1525951128",
|
|
1373
|
+
# "orderId": "5342275378"}
|
|
1374
|
+
# --
|
|
1375
|
+
# market order(buy):
|
|
1376
|
+
# {"id": "6281946200",
|
|
1377
|
+
# "pos": null,
|
|
1378
|
+
# "time": "2018-05-23T11:55:43.467Z",
|
|
1379
|
+
# "type": "buy",
|
|
1380
|
+
# "amount": "0.00000000",
|
|
1381
|
+
# "lastTx": "6281946210",
|
|
1382
|
+
# "status": "d",
|
|
1383
|
+
# "amount2": "20.00",
|
|
1384
|
+
# "orderId": "6281946200",
|
|
1385
|
+
# "remains": "0.00000000",
|
|
1386
|
+
# "symbol1": "ETH",
|
|
1387
|
+
# "symbol2": "EUR",
|
|
1388
|
+
# "tfa:EUR": "0.05",
|
|
1389
|
+
# "tta:EUR": "19.94",
|
|
1390
|
+
# "a:ETH:cds": "0.03764100",
|
|
1391
|
+
# "a:EUR:cds": "20.00",
|
|
1392
|
+
# "f:EUR:cds": "0.05",
|
|
1393
|
+
# "lastTxTime": "2018-05-23T11:55:43.467Z",
|
|
1394
|
+
# "tradingFeeTaker": "0.25",
|
|
1395
|
+
# "tradingFeeUserVolumeAmount": "55998097"}
|
|
1396
|
+
# --
|
|
1397
|
+
# market order(sell):
|
|
1398
|
+
# {"id": "6282200948",
|
|
1399
|
+
# "pos": null,
|
|
1400
|
+
# "time": "2018-05-23T12:42:58.315Z",
|
|
1401
|
+
# "type": "sell",
|
|
1402
|
+
# "amount": "-0.05000000",
|
|
1403
|
+
# "lastTx": "6282200958",
|
|
1404
|
+
# "status": "d",
|
|
1405
|
+
# "orderId": "6282200948",
|
|
1406
|
+
# "remains": "0.00000000",
|
|
1407
|
+
# "symbol1": "ETH",
|
|
1408
|
+
# "symbol2": "EUR",
|
|
1409
|
+
# "tfa:EUR": "0.07",
|
|
1410
|
+
# "tta:EUR": "26.49",
|
|
1411
|
+
# "a:ETH:cds": "0.05000000",
|
|
1412
|
+
# "a:EUR:cds": "26.49",
|
|
1413
|
+
# "f:EUR:cds": "0.07",
|
|
1414
|
+
# "lastTxTime": "2018-05-23T12:42:58.315Z",
|
|
1415
|
+
# "tradingFeeTaker": "0.25",
|
|
1416
|
+
# "tradingFeeUserVolumeAmount": "56294576"}
|
|
1417
|
+
order = response[i]
|
|
1418
|
+
status = self.parse_order_status(self.safe_string(order, 'status'))
|
|
1419
|
+
baseId = self.safe_string(order, 'symbol1')
|
|
1420
|
+
quoteId = self.safe_string(order, 'symbol2')
|
|
1421
|
+
base = self.safe_currency_code(baseId)
|
|
1422
|
+
quote = self.safe_currency_code(quoteId)
|
|
1423
|
+
symbolInner = base + '/' + quote
|
|
1424
|
+
side = self.safe_string(order, 'type')
|
|
1425
|
+
baseAmount = self.safe_number(order, 'a:' + baseId + ':cds')
|
|
1426
|
+
quoteAmount = self.safe_number(order, 'a:' + quoteId + ':cds')
|
|
1427
|
+
fee = self.safe_number(order, 'f:' + quoteId + ':cds')
|
|
1428
|
+
amount = self.safe_string(order, 'amount')
|
|
1429
|
+
price = self.safe_string(order, 'price')
|
|
1430
|
+
remaining = self.safe_string(order, 'remains')
|
|
1431
|
+
filled = Precise.string_sub(amount, remaining)
|
|
1432
|
+
orderAmount = None
|
|
1433
|
+
cost = None
|
|
1434
|
+
average = None
|
|
1435
|
+
type = None
|
|
1436
|
+
if not price:
|
|
1437
|
+
type = 'market'
|
|
1438
|
+
orderAmount = baseAmount
|
|
1439
|
+
cost = quoteAmount
|
|
1440
|
+
average = Precise.string_div(orderAmount, cost)
|
|
1441
|
+
else:
|
|
1442
|
+
ta = self.safe_string(order, 'ta:' + quoteId, '0')
|
|
1443
|
+
tta = self.safe_string(order, 'tta:' + quoteId, '0')
|
|
1444
|
+
fa = self.safe_string(order, 'fa:' + quoteId, '0')
|
|
1445
|
+
tfa = self.safe_string(order, 'tfa:' + quoteId, '0')
|
|
1446
|
+
if side == 'sell':
|
|
1447
|
+
cost = Precise.string_add(Precise.string_add(ta, tta), Precise.string_add(fa, tfa))
|
|
1448
|
+
else:
|
|
1449
|
+
cost = Precise.string_sub(Precise.string_add(ta, tta), Precise.string_add(fa, tfa))
|
|
1450
|
+
type = 'limit'
|
|
1451
|
+
orderAmount = amount
|
|
1452
|
+
average = Precise.string_div(cost, filled)
|
|
1453
|
+
time = self.safe_string(order, 'time')
|
|
1454
|
+
lastTxTime = self.safe_string(order, 'lastTxTime')
|
|
1455
|
+
timestamp = self.parse8601(time)
|
|
1456
|
+
safeOrder = self.safe_order({
|
|
1457
|
+
'info': order,
|
|
1458
|
+
'id': self.safe_string(order, 'id'),
|
|
1459
|
+
'timestamp': timestamp,
|
|
1460
|
+
'datetime': self.iso8601(timestamp),
|
|
1461
|
+
'lastUpdated': self.parse8601(lastTxTime),
|
|
1462
|
+
'status': status,
|
|
1463
|
+
'symbol': symbolInner,
|
|
1464
|
+
'side': side,
|
|
1465
|
+
'price': price,
|
|
1466
|
+
'amount': orderAmount,
|
|
1467
|
+
'average': average,
|
|
1468
|
+
'type': type,
|
|
1469
|
+
'filled': filled,
|
|
1470
|
+
'cost': cost,
|
|
1471
|
+
'remaining': remaining,
|
|
1472
|
+
'fee': {
|
|
1473
|
+
'cost': fee,
|
|
1474
|
+
'currency': quote,
|
|
1475
|
+
},
|
|
1476
|
+
})
|
|
1477
|
+
results.append(safeOrder)
|
|
1478
|
+
return results
|
|
1479
|
+
|
|
1480
|
+
def parse_order_status(self, status: Str):
|
|
1481
|
+
return self.safe_string(self.options['order']['status'], status, status)
|
|
1482
|
+
|
|
1483
|
+
async def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
|
|
1484
|
+
"""
|
|
1485
|
+
edit a trade order
|
|
1486
|
+
:see: https://docs.cex.io/#cancel-replace-order
|
|
1487
|
+
:param str id: order id
|
|
1488
|
+
:param str symbol: unified symbol of the market to create an order in
|
|
1489
|
+
:param str type: 'market' or 'limit'
|
|
1490
|
+
:param str side: 'buy' or 'sell'
|
|
1491
|
+
:param float amount: how much of the currency you want to trade in units of the base currency
|
|
1492
|
+
:param float|None [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
1493
|
+
:param dict [params]: extra parameters specific to the cex api endpoint
|
|
1494
|
+
:returns dict: an `order structure <https://docs.ccxt.com/en/latest/manual.html#order-structure>`
|
|
1495
|
+
"""
|
|
1496
|
+
if amount is None:
|
|
1497
|
+
raise ArgumentsRequired(self.id + ' editOrder() requires a amount argument')
|
|
1498
|
+
if price is None:
|
|
1499
|
+
raise ArgumentsRequired(self.id + ' editOrder() requires a price argument')
|
|
1500
|
+
await self.load_markets()
|
|
1501
|
+
market = self.market(symbol)
|
|
1502
|
+
# see: https://cex.io/rest-api#/definitions/CancelReplaceOrderRequest
|
|
1503
|
+
request: dict = {
|
|
1504
|
+
'pair': market['id'],
|
|
1505
|
+
'type': side,
|
|
1506
|
+
'amount': amount,
|
|
1507
|
+
'price': price,
|
|
1508
|
+
'order_id': id,
|
|
1509
|
+
}
|
|
1510
|
+
response = await self.privatePostCancelReplaceOrderPair(self.extend(request, params))
|
|
1511
|
+
return self.parse_order(response, market)
|
|
1512
|
+
|
|
1513
|
+
async def fetch_deposit_address(self, code: str, params={}):
|
|
1514
|
+
"""
|
|
1515
|
+
:see: https://docs.cex.io/#get-crypto-address
|
|
1516
|
+
fetch the deposit address for a currency associated with self account
|
|
1517
|
+
:param str code: unified currency code
|
|
1518
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1519
|
+
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
|
|
1520
|
+
"""
|
|
1521
|
+
await self.load_markets()
|
|
1522
|
+
currency = self.currency(code)
|
|
1523
|
+
request: dict = {
|
|
1524
|
+
'currency': currency['id'],
|
|
1525
|
+
}
|
|
1526
|
+
networkCode, query = self.handle_network_code_and_params(params)
|
|
1527
|
+
# atm, cex doesn't support network in the request
|
|
1528
|
+
response = await self.privatePostGetCryptoAddress(self.extend(request, query))
|
|
1529
|
+
#
|
|
1530
|
+
# {
|
|
1531
|
+
# "e": "get_crypto_address",
|
|
1532
|
+
# "ok": "ok",
|
|
1533
|
+
# "data": {
|
|
1534
|
+
# "name": "BTC",
|
|
1535
|
+
# "addresses": [
|
|
1536
|
+
# {
|
|
1537
|
+
# "blockchain": "Bitcoin",
|
|
1538
|
+
# "address": "2BvKwe1UwrdTjq2nzhscFYXwqCjCaaHCeq"
|
|
1539
|
+
#
|
|
1540
|
+
# # for others coins(i.e. XRP, XLM) other keys are present:
|
|
1541
|
+
# # "destination": "rF1sdh25BJX3qFwneeTBwaq3zPEWYcwjp2",
|
|
1542
|
+
# # "destinationTag": "7519113655",
|
|
1543
|
+
# # "memo": "XLM-memo12345",
|
|
1544
|
+
# }
|
|
1545
|
+
# ]
|
|
1546
|
+
# }
|
|
1547
|
+
# }
|
|
1548
|
+
#
|
|
1549
|
+
data = self.safe_value(response, 'data', {})
|
|
1550
|
+
addresses = self.safe_value(data, 'addresses', [])
|
|
1551
|
+
chainsIndexedById = self.index_by(addresses, 'blockchain')
|
|
1552
|
+
selectedNetworkId = self.select_network_id_from_raw_networks(code, networkCode, chainsIndexedById)
|
|
1553
|
+
addressObject = self.safe_value(chainsIndexedById, selectedNetworkId, {})
|
|
1554
|
+
address = self.safe_string_2(addressObject, 'address', 'destination')
|
|
1555
|
+
self.check_address(address)
|
|
1556
|
+
return {
|
|
1557
|
+
'currency': code,
|
|
1558
|
+
'address': address,
|
|
1559
|
+
'tag': self.safe_string_2(addressObject, 'destinationTag', 'memo'),
|
|
1560
|
+
'network': self.network_id_to_code(selectedNetworkId),
|
|
1561
|
+
'info': data,
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
def nonce(self):
|
|
1565
|
+
return self.milliseconds()
|
|
1566
|
+
|
|
1567
|
+
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
|
1568
|
+
url = self.urls['api']['rest'] + '/' + self.implode_params(path, params)
|
|
1569
|
+
query = self.omit(params, self.extract_params(path))
|
|
1570
|
+
if api == 'public':
|
|
1571
|
+
if query:
|
|
1572
|
+
url += '?' + self.urlencode(query)
|
|
1573
|
+
else:
|
|
1574
|
+
self.check_required_credentials()
|
|
1575
|
+
nonce = str(self.nonce())
|
|
1576
|
+
auth = nonce + self.uid + self.apiKey
|
|
1577
|
+
signature = self.hmac(self.encode(auth), self.encode(self.secret), hashlib.sha256)
|
|
1578
|
+
body = self.json(self.extend({
|
|
1579
|
+
'key': self.apiKey,
|
|
1580
|
+
'signature': signature.upper(),
|
|
1581
|
+
'nonce': nonce,
|
|
1582
|
+
}, query))
|
|
1583
|
+
headers = {
|
|
1584
|
+
'Content-Type': 'application/json',
|
|
1585
|
+
}
|
|
1586
|
+
return {'url': url, 'method': method, 'body': body, 'headers': headers}
|
|
1587
|
+
|
|
1588
|
+
def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
|
|
1589
|
+
if isinstance(response, list):
|
|
1590
|
+
return response # public endpoints may return []-arrays
|
|
1591
|
+
if body == 'true':
|
|
1592
|
+
return None
|
|
1593
|
+
if response is None:
|
|
1594
|
+
raise NullResponse(self.id + ' returned ' + self.json(response))
|
|
1595
|
+
if 'e' in response:
|
|
1596
|
+
if 'ok' in response:
|
|
1597
|
+
if response['ok'] == 'ok':
|
|
1598
|
+
return None
|
|
1599
|
+
if 'error' in response:
|
|
1600
|
+
message = self.safe_string(response, 'error')
|
|
1601
|
+
feedback = self.id + ' ' + body
|
|
1602
|
+
self.throw_exactly_matched_exception(self.exceptions['exact'], message, feedback)
|
|
1603
|
+
self.throw_broadly_matched_exception(self.exceptions['broad'], message, feedback)
|
|
1604
|
+
raise ExchangeError(feedback)
|
|
1605
|
+
return None
|