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
ccxt/onetrading.py
ADDED
|
@@ -0,0 +1,1911 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
|
|
4
|
+
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
|
|
5
|
+
|
|
6
|
+
from ccxt.base.exchange import Exchange
|
|
7
|
+
from ccxt.abstract.onetrading import ImplicitAPI
|
|
8
|
+
from ccxt.base.types import Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction
|
|
9
|
+
from typing import List
|
|
10
|
+
from ccxt.base.errors import ExchangeError
|
|
11
|
+
from ccxt.base.errors import AuthenticationError
|
|
12
|
+
from ccxt.base.errors import PermissionDenied
|
|
13
|
+
from ccxt.base.errors import ArgumentsRequired
|
|
14
|
+
from ccxt.base.errors import BadRequest
|
|
15
|
+
from ccxt.base.errors import InsufficientFunds
|
|
16
|
+
from ccxt.base.errors import InvalidAddress
|
|
17
|
+
from ccxt.base.errors import InvalidOrder
|
|
18
|
+
from ccxt.base.errors import OrderNotFound
|
|
19
|
+
from ccxt.base.errors import DDoSProtection
|
|
20
|
+
from ccxt.base.errors import ExchangeNotAvailable
|
|
21
|
+
from ccxt.base.decimal_to_precision import TICK_SIZE
|
|
22
|
+
from ccxt.base.precise import Precise
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class onetrading(Exchange, ImplicitAPI):
|
|
26
|
+
|
|
27
|
+
def describe(self):
|
|
28
|
+
return self.deep_extend(super(onetrading, self).describe(), {
|
|
29
|
+
'id': 'onetrading',
|
|
30
|
+
'name': 'One Trading',
|
|
31
|
+
'countries': ['AT'], # Austria
|
|
32
|
+
'rateLimit': 300,
|
|
33
|
+
'version': 'v1',
|
|
34
|
+
'pro': True,
|
|
35
|
+
# new metainfo interface
|
|
36
|
+
'has': {
|
|
37
|
+
'CORS': None,
|
|
38
|
+
'spot': True,
|
|
39
|
+
'margin': False,
|
|
40
|
+
'swap': False,
|
|
41
|
+
'future': False,
|
|
42
|
+
'option': False,
|
|
43
|
+
'addMargin': False,
|
|
44
|
+
'cancelAllOrders': True,
|
|
45
|
+
'cancelOrder': True,
|
|
46
|
+
'cancelOrders': True,
|
|
47
|
+
'closeAllPositions': False,
|
|
48
|
+
'closePosition': False,
|
|
49
|
+
'createDepositAddress': True,
|
|
50
|
+
'createOrder': True,
|
|
51
|
+
'createReduceOnlyOrder': False,
|
|
52
|
+
'createStopLimitOrder': True,
|
|
53
|
+
'createStopMarketOrder': False,
|
|
54
|
+
'createStopOrder': True,
|
|
55
|
+
'fetchAccounts': False,
|
|
56
|
+
'fetchBalance': True,
|
|
57
|
+
'fetchBorrowRateHistories': False,
|
|
58
|
+
'fetchBorrowRateHistory': False,
|
|
59
|
+
'fetchClosedOrders': True,
|
|
60
|
+
'fetchCrossBorrowRate': False,
|
|
61
|
+
'fetchCrossBorrowRates': False,
|
|
62
|
+
'fetchCurrencies': True,
|
|
63
|
+
'fetchDeposit': False,
|
|
64
|
+
'fetchDepositAddress': True,
|
|
65
|
+
'fetchDepositAddresses': False,
|
|
66
|
+
'fetchDeposits': True,
|
|
67
|
+
'fetchDepositsWithdrawals': False,
|
|
68
|
+
'fetchFundingHistory': False,
|
|
69
|
+
'fetchFundingRate': False,
|
|
70
|
+
'fetchFundingRateHistory': False,
|
|
71
|
+
'fetchFundingRates': False,
|
|
72
|
+
'fetchIndexOHLCV': False,
|
|
73
|
+
'fetchIsolatedBorrowRate': False,
|
|
74
|
+
'fetchIsolatedBorrowRates': False,
|
|
75
|
+
'fetchLedger': False,
|
|
76
|
+
'fetchLeverage': False,
|
|
77
|
+
'fetchMarginMode': False,
|
|
78
|
+
'fetchMarkets': True,
|
|
79
|
+
'fetchMarkOHLCV': False,
|
|
80
|
+
'fetchMyTrades': True,
|
|
81
|
+
'fetchOHLCV': True,
|
|
82
|
+
'fetchOpenInterestHistory': False,
|
|
83
|
+
'fetchOpenOrders': True,
|
|
84
|
+
'fetchOrder': True,
|
|
85
|
+
'fetchOrderBook': True,
|
|
86
|
+
'fetchOrders': False,
|
|
87
|
+
'fetchOrderTrades': True,
|
|
88
|
+
'fetchPosition': False,
|
|
89
|
+
'fetchPositionHistory': False,
|
|
90
|
+
'fetchPositionMode': False,
|
|
91
|
+
'fetchPositions': False,
|
|
92
|
+
'fetchPositionsForSymbol': False,
|
|
93
|
+
'fetchPositionsHistory': False,
|
|
94
|
+
'fetchPositionsRisk': False,
|
|
95
|
+
'fetchPremiumIndexOHLCV': False,
|
|
96
|
+
'fetchTicker': True,
|
|
97
|
+
'fetchTickers': True,
|
|
98
|
+
'fetchTime': True,
|
|
99
|
+
'fetchTrades': True,
|
|
100
|
+
'fetchTradingFee': False,
|
|
101
|
+
'fetchTradingFees': True,
|
|
102
|
+
'fetchTransactionFee': False,
|
|
103
|
+
'fetchTransactionFees': False,
|
|
104
|
+
'fetchTransactions': False,
|
|
105
|
+
'fetchTransfer': False,
|
|
106
|
+
'fetchTransfers': False,
|
|
107
|
+
'fetchWithdrawal': False,
|
|
108
|
+
'fetchWithdrawals': True,
|
|
109
|
+
'reduceMargin': False,
|
|
110
|
+
'setLeverage': False,
|
|
111
|
+
'setMargin': False,
|
|
112
|
+
'setMarginMode': False,
|
|
113
|
+
'setPositionMode': False,
|
|
114
|
+
'transfer': False,
|
|
115
|
+
'withdraw': True,
|
|
116
|
+
},
|
|
117
|
+
'timeframes': {
|
|
118
|
+
'1m': '1/MINUTES',
|
|
119
|
+
'5m': '5/MINUTES',
|
|
120
|
+
'15m': '15/MINUTES',
|
|
121
|
+
'30m': '30/MINUTES',
|
|
122
|
+
'1h': '1/HOURS',
|
|
123
|
+
'4h': '4/HOURS',
|
|
124
|
+
'1d': '1/DAYS',
|
|
125
|
+
'1w': '1/WEEKS',
|
|
126
|
+
'1M': '1/MONTHS',
|
|
127
|
+
},
|
|
128
|
+
'urls': {
|
|
129
|
+
'logo': 'https://github.com/ccxt/ccxt/assets/43336371/bdbc26fd-02f2-4ca7-9f1e-17333690bb1c',
|
|
130
|
+
'api': {
|
|
131
|
+
'public': 'https://api.onetrading.com/public',
|
|
132
|
+
'private': 'https://api.onetrading.com/public',
|
|
133
|
+
},
|
|
134
|
+
'www': 'https://onetrading.com/',
|
|
135
|
+
'doc': [
|
|
136
|
+
'https://docs.onetrading.com',
|
|
137
|
+
],
|
|
138
|
+
'fees': 'https://onetrading.com/fees',
|
|
139
|
+
},
|
|
140
|
+
'api': {
|
|
141
|
+
'public': {
|
|
142
|
+
'get': [
|
|
143
|
+
'currencies',
|
|
144
|
+
'candlesticks/{instrument_code}',
|
|
145
|
+
'fees',
|
|
146
|
+
'instruments',
|
|
147
|
+
'order-book/{instrument_code}',
|
|
148
|
+
'market-ticker',
|
|
149
|
+
'market-ticker/{instrument_code}',
|
|
150
|
+
'price-ticks/{instrument_code}',
|
|
151
|
+
'time',
|
|
152
|
+
],
|
|
153
|
+
},
|
|
154
|
+
'private': {
|
|
155
|
+
'get': [
|
|
156
|
+
'account/balances',
|
|
157
|
+
'account/deposit/crypto/{currency_code}',
|
|
158
|
+
'account/deposit/fiat/EUR',
|
|
159
|
+
'account/deposits',
|
|
160
|
+
'account/deposits/bitpanda',
|
|
161
|
+
'account/withdrawals',
|
|
162
|
+
'account/withdrawals/bitpanda',
|
|
163
|
+
'account/fees',
|
|
164
|
+
'account/orders',
|
|
165
|
+
'account/orders/{order_id}',
|
|
166
|
+
'account/orders/{order_id}/trades',
|
|
167
|
+
'account/trades',
|
|
168
|
+
'account/trades/{trade_id}',
|
|
169
|
+
'account/trading-volume',
|
|
170
|
+
],
|
|
171
|
+
'post': [
|
|
172
|
+
'account/deposit/crypto',
|
|
173
|
+
'account/withdraw/crypto',
|
|
174
|
+
'account/withdraw/fiat',
|
|
175
|
+
'account/fees',
|
|
176
|
+
'account/orders',
|
|
177
|
+
],
|
|
178
|
+
'delete': [
|
|
179
|
+
'account/orders',
|
|
180
|
+
'account/orders/{order_id}',
|
|
181
|
+
'account/orders/client/{client_id}',
|
|
182
|
+
],
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
'fees': {
|
|
186
|
+
'trading': {
|
|
187
|
+
'tierBased': True,
|
|
188
|
+
'percentage': True,
|
|
189
|
+
'taker': self.parse_number('0.0015'),
|
|
190
|
+
'maker': self.parse_number('0.001'),
|
|
191
|
+
'tiers': [
|
|
192
|
+
# volume in BTC
|
|
193
|
+
{
|
|
194
|
+
'taker': [
|
|
195
|
+
[self.parse_number('0'), self.parse_number('0.0015')],
|
|
196
|
+
[self.parse_number('100'), self.parse_number('0.0013')],
|
|
197
|
+
[self.parse_number('250'), self.parse_number('0.0013')],
|
|
198
|
+
[self.parse_number('1000'), self.parse_number('0.001')],
|
|
199
|
+
[self.parse_number('5000'), self.parse_number('0.0009')],
|
|
200
|
+
[self.parse_number('10000'), self.parse_number('0.00075')],
|
|
201
|
+
[self.parse_number('20000'), self.parse_number('0.00065')],
|
|
202
|
+
],
|
|
203
|
+
'maker': [
|
|
204
|
+
[self.parse_number('0'), self.parse_number('0.001')],
|
|
205
|
+
[self.parse_number('100'), self.parse_number('0.001')],
|
|
206
|
+
[self.parse_number('250'), self.parse_number('0.0009')],
|
|
207
|
+
[self.parse_number('1000'), self.parse_number('0.00075')],
|
|
208
|
+
[self.parse_number('5000'), self.parse_number('0.0006')],
|
|
209
|
+
[self.parse_number('10000'), self.parse_number('0.0005')],
|
|
210
|
+
[self.parse_number('20000'), self.parse_number('0.0005')],
|
|
211
|
+
],
|
|
212
|
+
},
|
|
213
|
+
],
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
'requiredCredentials': {
|
|
217
|
+
'apiKey': True,
|
|
218
|
+
'secret': False,
|
|
219
|
+
},
|
|
220
|
+
'precisionMode': TICK_SIZE,
|
|
221
|
+
'exceptions': {
|
|
222
|
+
'exact': {
|
|
223
|
+
'INVALID_CLIENT_UUID': InvalidOrder,
|
|
224
|
+
'ORDER_NOT_FOUND': OrderNotFound,
|
|
225
|
+
'ONLY_ONE_ERC20_ADDRESS_ALLOWED': InvalidAddress,
|
|
226
|
+
'DEPOSIT_ADDRESS_NOT_USED': InvalidAddress,
|
|
227
|
+
'INVALID_CREDENTIALS': AuthenticationError,
|
|
228
|
+
'MISSING_CREDENTIALS': AuthenticationError,
|
|
229
|
+
'INVALID_APIKEY': AuthenticationError,
|
|
230
|
+
'INVALID_SCOPES': AuthenticationError,
|
|
231
|
+
'INVALID_SUBJECT': AuthenticationError,
|
|
232
|
+
'INVALID_ISSUER': AuthenticationError,
|
|
233
|
+
'INVALID_AUDIENCE': AuthenticationError,
|
|
234
|
+
'INVALID_DEVICE_ID': AuthenticationError,
|
|
235
|
+
'INVALID_IP_RESTRICTION': AuthenticationError,
|
|
236
|
+
'APIKEY_REVOKED': AuthenticationError,
|
|
237
|
+
'APIKEY_EXPIRED': AuthenticationError,
|
|
238
|
+
'SYNCHRONIZER_TOKEN_MISMATCH': AuthenticationError,
|
|
239
|
+
'SESSION_EXPIRED': AuthenticationError,
|
|
240
|
+
'INTERNAL_ERROR': AuthenticationError,
|
|
241
|
+
'CLIENT_IP_BLOCKED': PermissionDenied,
|
|
242
|
+
'MISSING_PERMISSION': PermissionDenied,
|
|
243
|
+
'ILLEGAL_CHARS': BadRequest,
|
|
244
|
+
'UNSUPPORTED_MEDIA_TYPE': BadRequest,
|
|
245
|
+
'ACCOUNT_HISTORY_TIME_RANGE_TOO_BIG': BadRequest,
|
|
246
|
+
'CANDLESTICKS_TIME_RANGE_TOO_BIG': BadRequest,
|
|
247
|
+
'INVALID_INSTRUMENT_CODE': BadRequest,
|
|
248
|
+
'INVALID_ORDER_TYPE': BadRequest,
|
|
249
|
+
'INVALID_UNIT': BadRequest,
|
|
250
|
+
'INVALID_PERIOD': BadRequest,
|
|
251
|
+
'INVALID_TIME': BadRequest,
|
|
252
|
+
'INVALID_DATE': BadRequest,
|
|
253
|
+
'INVALID_CURRENCY': BadRequest,
|
|
254
|
+
'INVALID_AMOUNT': BadRequest,
|
|
255
|
+
'INVALID_PRICE': BadRequest,
|
|
256
|
+
'INVALID_LIMIT': BadRequest,
|
|
257
|
+
'INVALID_QUERY': BadRequest,
|
|
258
|
+
'INVALID_CURSOR': BadRequest,
|
|
259
|
+
'INVALID_ACCOUNT_ID': BadRequest,
|
|
260
|
+
'INVALID_SIDE': InvalidOrder,
|
|
261
|
+
'INVALID_ACCOUNT_HISTORY_FROM_TIME': BadRequest,
|
|
262
|
+
'INVALID_ACCOUNT_HISTORY_MAX_PAGE_SIZE': BadRequest,
|
|
263
|
+
'INVALID_ACCOUNT_HISTORY_TIME_PERIOD': BadRequest,
|
|
264
|
+
'INVALID_ACCOUNT_HISTORY_TO_TIME': BadRequest,
|
|
265
|
+
'INVALID_CANDLESTICKS_GRANULARITY': BadRequest,
|
|
266
|
+
'INVALID_CANDLESTICKS_UNIT': BadRequest,
|
|
267
|
+
'INVALID_ORDER_BOOK_DEPTH': BadRequest,
|
|
268
|
+
'INVALID_ORDER_BOOK_LEVEL': BadRequest,
|
|
269
|
+
'INVALID_PAGE_CURSOR': BadRequest,
|
|
270
|
+
'INVALID_TIME_RANGE': BadRequest,
|
|
271
|
+
'INVALID_TRADE_ID': BadRequest,
|
|
272
|
+
'INVALID_UI_ACCOUNT_SETTINGS': BadRequest,
|
|
273
|
+
'NEGATIVE_AMOUNT': InvalidOrder,
|
|
274
|
+
'NEGATIVE_PRICE': InvalidOrder,
|
|
275
|
+
'MIN_SIZE_NOT_SATISFIED': InvalidOrder,
|
|
276
|
+
'BAD_AMOUNT_PRECISION': InvalidOrder,
|
|
277
|
+
'BAD_PRICE_PRECISION': InvalidOrder,
|
|
278
|
+
'BAD_TRIGGER_PRICE_PRECISION': InvalidOrder,
|
|
279
|
+
'MAX_OPEN_ORDERS_EXCEEDED': BadRequest,
|
|
280
|
+
'MISSING_PRICE': InvalidOrder,
|
|
281
|
+
'MISSING_ORDER_TYPE': InvalidOrder,
|
|
282
|
+
'MISSING_SIDE': InvalidOrder,
|
|
283
|
+
'MISSING_CANDLESTICKS_PERIOD_PARAM': ArgumentsRequired,
|
|
284
|
+
'MISSING_CANDLESTICKS_UNIT_PARAM': ArgumentsRequired,
|
|
285
|
+
'MISSING_FROM_PARAM': ArgumentsRequired,
|
|
286
|
+
'MISSING_INSTRUMENT_CODE': ArgumentsRequired,
|
|
287
|
+
'MISSING_ORDER_ID': InvalidOrder,
|
|
288
|
+
'MISSING_TO_PARAM': ArgumentsRequired,
|
|
289
|
+
'MISSING_TRADE_ID': ArgumentsRequired,
|
|
290
|
+
'INVALID_ORDER_ID': OrderNotFound,
|
|
291
|
+
'NOT_FOUND': OrderNotFound,
|
|
292
|
+
'INSUFFICIENT_LIQUIDITY': InsufficientFunds,
|
|
293
|
+
'INSUFFICIENT_FUNDS': InsufficientFunds,
|
|
294
|
+
'NO_TRADING': ExchangeNotAvailable,
|
|
295
|
+
'SERVICE_UNAVAILABLE': ExchangeNotAvailable,
|
|
296
|
+
'GATEWAY_TIMEOUT': ExchangeNotAvailable,
|
|
297
|
+
'RATELIMIT': DDoSProtection,
|
|
298
|
+
'CF_RATELIMIT': DDoSProtection,
|
|
299
|
+
'INTERNAL_SERVER_ERROR': ExchangeError,
|
|
300
|
+
},
|
|
301
|
+
'broad': {
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
'commonCurrencies': {
|
|
305
|
+
'MIOTA': 'IOTA', # https://github.com/ccxt/ccxt/issues/7487
|
|
306
|
+
},
|
|
307
|
+
# exchange-specific options
|
|
308
|
+
'options': {
|
|
309
|
+
'fetchTradingFees': {
|
|
310
|
+
'method': 'fetchPrivateTradingFees', # or 'fetchPublicTradingFees'
|
|
311
|
+
},
|
|
312
|
+
'fiat': ['EUR', 'CHF'],
|
|
313
|
+
},
|
|
314
|
+
})
|
|
315
|
+
|
|
316
|
+
def fetch_time(self, params={}):
|
|
317
|
+
"""
|
|
318
|
+
fetches the current integer timestamp in milliseconds from the exchange server
|
|
319
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
320
|
+
:returns int: the current integer timestamp in milliseconds from the exchange server
|
|
321
|
+
"""
|
|
322
|
+
response = self.publicGetTime(params)
|
|
323
|
+
#
|
|
324
|
+
# {
|
|
325
|
+
# "iso": "2020-07-10T05:17:26.716Z",
|
|
326
|
+
# "epoch_millis": 1594358246716,
|
|
327
|
+
# }
|
|
328
|
+
#
|
|
329
|
+
return self.safe_integer(response, 'epoch_millis')
|
|
330
|
+
|
|
331
|
+
def fetch_currencies(self, params={}) -> Currencies:
|
|
332
|
+
"""
|
|
333
|
+
fetches all available currencies on an exchange
|
|
334
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
335
|
+
:returns dict: an associative dictionary of currencies
|
|
336
|
+
"""
|
|
337
|
+
response = self.publicGetCurrencies(params)
|
|
338
|
+
#
|
|
339
|
+
# [
|
|
340
|
+
# {
|
|
341
|
+
# "code":"BEST",
|
|
342
|
+
# "precision":8
|
|
343
|
+
# }
|
|
344
|
+
# ]
|
|
345
|
+
#
|
|
346
|
+
result: dict = {}
|
|
347
|
+
for i in range(0, len(response)):
|
|
348
|
+
currency = response[i]
|
|
349
|
+
id = self.safe_string(currency, 'code')
|
|
350
|
+
code = self.safe_currency_code(id)
|
|
351
|
+
result[code] = {
|
|
352
|
+
'id': id,
|
|
353
|
+
'code': code,
|
|
354
|
+
'name': None,
|
|
355
|
+
'info': currency, # the original payload
|
|
356
|
+
'active': None,
|
|
357
|
+
'fee': None,
|
|
358
|
+
'precision': self.parse_number(self.parse_precision(self.safe_string(currency, 'precision'))),
|
|
359
|
+
'withdraw': None,
|
|
360
|
+
'deposit': None,
|
|
361
|
+
'limits': {
|
|
362
|
+
'amount': {'min': None, 'max': None},
|
|
363
|
+
'withdraw': {'min': None, 'max': None},
|
|
364
|
+
},
|
|
365
|
+
'networks': {},
|
|
366
|
+
}
|
|
367
|
+
return result
|
|
368
|
+
|
|
369
|
+
def fetch_markets(self, params={}) -> List[Market]:
|
|
370
|
+
"""
|
|
371
|
+
retrieves data on all markets for onetrading
|
|
372
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
373
|
+
:returns dict[]: an array of objects representing market data
|
|
374
|
+
"""
|
|
375
|
+
response = self.publicGetInstruments(params)
|
|
376
|
+
#
|
|
377
|
+
# [
|
|
378
|
+
# {
|
|
379
|
+
# "state": "ACTIVE",
|
|
380
|
+
# "base": {code: "ETH", precision: 8},
|
|
381
|
+
# "quote": {code: "CHF", precision: 2},
|
|
382
|
+
# "amount_precision": 4,
|
|
383
|
+
# "market_precision": 2,
|
|
384
|
+
# "min_size": "10.0"
|
|
385
|
+
# }
|
|
386
|
+
# ]
|
|
387
|
+
#
|
|
388
|
+
return self.parse_markets(response)
|
|
389
|
+
|
|
390
|
+
def parse_market(self, market: dict) -> Market:
|
|
391
|
+
baseAsset = self.safe_value(market, 'base', {})
|
|
392
|
+
quoteAsset = self.safe_value(market, 'quote', {})
|
|
393
|
+
baseId = self.safe_string(baseAsset, 'code')
|
|
394
|
+
quoteId = self.safe_string(quoteAsset, 'code')
|
|
395
|
+
id = baseId + '_' + quoteId
|
|
396
|
+
base = self.safe_currency_code(baseId)
|
|
397
|
+
quote = self.safe_currency_code(quoteId)
|
|
398
|
+
state = self.safe_string(market, 'state')
|
|
399
|
+
return {
|
|
400
|
+
'id': id,
|
|
401
|
+
'symbol': base + '/' + quote,
|
|
402
|
+
'base': base,
|
|
403
|
+
'quote': quote,
|
|
404
|
+
'settle': None,
|
|
405
|
+
'baseId': baseId,
|
|
406
|
+
'quoteId': quoteId,
|
|
407
|
+
'settleId': None,
|
|
408
|
+
'type': 'spot',
|
|
409
|
+
'spot': True,
|
|
410
|
+
'margin': False,
|
|
411
|
+
'swap': False,
|
|
412
|
+
'future': False,
|
|
413
|
+
'option': False,
|
|
414
|
+
'active': (state == 'ACTIVE'),
|
|
415
|
+
'contract': False,
|
|
416
|
+
'linear': None,
|
|
417
|
+
'inverse': None,
|
|
418
|
+
'contractSize': None,
|
|
419
|
+
'expiry': None,
|
|
420
|
+
'expiryDatetime': None,
|
|
421
|
+
'strike': None,
|
|
422
|
+
'optionType': None,
|
|
423
|
+
'precision': {
|
|
424
|
+
'amount': self.parse_number(self.parse_precision(self.safe_string(market, 'amount_precision'))),
|
|
425
|
+
'price': self.parse_number(self.parse_precision(self.safe_string(market, 'market_precision'))),
|
|
426
|
+
},
|
|
427
|
+
'limits': {
|
|
428
|
+
'leverage': {
|
|
429
|
+
'min': None,
|
|
430
|
+
'max': None,
|
|
431
|
+
},
|
|
432
|
+
'amount': {
|
|
433
|
+
'min': None,
|
|
434
|
+
'max': None,
|
|
435
|
+
},
|
|
436
|
+
'price': {
|
|
437
|
+
'min': None,
|
|
438
|
+
'max': None,
|
|
439
|
+
},
|
|
440
|
+
'cost': {
|
|
441
|
+
'min': self.safe_number(market, 'min_size'),
|
|
442
|
+
'max': None,
|
|
443
|
+
},
|
|
444
|
+
},
|
|
445
|
+
'created': None,
|
|
446
|
+
'info': market,
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
def fetch_trading_fees(self, params={}) -> TradingFees:
|
|
450
|
+
"""
|
|
451
|
+
fetch the trading fees for multiple markets
|
|
452
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
453
|
+
:returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
|
|
454
|
+
"""
|
|
455
|
+
method = self.safe_string(params, 'method')
|
|
456
|
+
params = self.omit(params, 'method')
|
|
457
|
+
if method is None:
|
|
458
|
+
options = self.safe_value(self.options, 'fetchTradingFees', {})
|
|
459
|
+
method = self.safe_string(options, 'method', 'fetchPrivateTradingFees')
|
|
460
|
+
return getattr(self, method)(params)
|
|
461
|
+
|
|
462
|
+
def fetch_public_trading_fees(self, params={}):
|
|
463
|
+
self.load_markets()
|
|
464
|
+
response = self.publicGetFees(params)
|
|
465
|
+
#
|
|
466
|
+
# [
|
|
467
|
+
# {
|
|
468
|
+
# "fee_group_id":"default",
|
|
469
|
+
# "display_text":"The standard fee plan.",
|
|
470
|
+
# "fee_tiers":[
|
|
471
|
+
# {"volume":"0.0","fee_group_id":"default","maker_fee":"0.1","taker_fee":"0.15"},
|
|
472
|
+
# {"volume":"100.0","fee_group_id":"default","maker_fee":"0.1","taker_fee":"0.13"},
|
|
473
|
+
# {"volume":"250.0","fee_group_id":"default","maker_fee":"0.09","taker_fee":"0.13"},
|
|
474
|
+
# {"volume":"1000.0","fee_group_id":"default","maker_fee":"0.075","taker_fee":"0.1"},
|
|
475
|
+
# {"volume":"5000.0","fee_group_id":"default","maker_fee":"0.06","taker_fee":"0.09"},
|
|
476
|
+
# {"volume":"10000.0","fee_group_id":"default","maker_fee":"0.05","taker_fee":"0.075"},
|
|
477
|
+
# {"volume":"20000.0","fee_group_id":"default","maker_fee":"0.05","taker_fee":"0.065"}
|
|
478
|
+
# ],
|
|
479
|
+
# "fee_discount_rate":"25.0",
|
|
480
|
+
# "minimum_price_value":"0.12"
|
|
481
|
+
# }
|
|
482
|
+
# ]
|
|
483
|
+
#
|
|
484
|
+
first = self.safe_value(response, 0, {})
|
|
485
|
+
feeTiers = self.safe_value(first, 'fee_tiers')
|
|
486
|
+
tiers = self.parse_fee_tiers(feeTiers)
|
|
487
|
+
firstTier = self.safe_value(feeTiers, 0, {})
|
|
488
|
+
result: dict = {}
|
|
489
|
+
for i in range(0, len(self.symbols)):
|
|
490
|
+
symbol = self.symbols[i]
|
|
491
|
+
result[symbol] = {
|
|
492
|
+
'info': first,
|
|
493
|
+
'symbol': symbol,
|
|
494
|
+
'maker': self.safe_number(firstTier, 'maker_fee'),
|
|
495
|
+
'taker': self.safe_number(firstTier, 'taker_fee'),
|
|
496
|
+
'percentage': True,
|
|
497
|
+
'tierBased': True,
|
|
498
|
+
'tiers': tiers,
|
|
499
|
+
}
|
|
500
|
+
return result
|
|
501
|
+
|
|
502
|
+
def fetch_private_trading_fees(self, params={}):
|
|
503
|
+
self.load_markets()
|
|
504
|
+
response = self.privateGetAccountFees(params)
|
|
505
|
+
#
|
|
506
|
+
# {
|
|
507
|
+
# "account_id": "ed524d00-820a-11e9-8f1e-69602df16d85",
|
|
508
|
+
# "running_trading_volume": "0.0",
|
|
509
|
+
# "fee_group_id": "default",
|
|
510
|
+
# "collect_fees_in_best": False,
|
|
511
|
+
# "fee_discount_rate": "25.0",
|
|
512
|
+
# "minimum_price_value": "0.12",
|
|
513
|
+
# "fee_tiers": [
|
|
514
|
+
# {"volume": "0.0", "fee_group_id": "default", "maker_fee": "0.1", "taker_fee": "0.1"},
|
|
515
|
+
# {"volume": "100.0", "fee_group_id": "default", "maker_fee": "0.09", "taker_fee": "0.1"},
|
|
516
|
+
# {"volume": "250.0", "fee_group_id": "default", "maker_fee": "0.08", "taker_fee": "0.1"},
|
|
517
|
+
# {"volume": "1000.0", "fee_group_id": "default", "maker_fee": "0.07", "taker_fee": "0.09"},
|
|
518
|
+
# {"volume": "5000.0", "fee_group_id": "default", "maker_fee": "0.06", "taker_fee": "0.08"},
|
|
519
|
+
# {"volume": "10000.0", "fee_group_id": "default", "maker_fee": "0.05", "taker_fee": "0.07"},
|
|
520
|
+
# {"volume": "20000.0", "fee_group_id": "default", "maker_fee": "0.05", "taker_fee": "0.06"},
|
|
521
|
+
# {"volume": "50000.0", "fee_group_id": "default", "maker_fee": "0.05", "taker_fee": "0.05"}
|
|
522
|
+
# ],
|
|
523
|
+
# "active_fee_tier": {"volume": "0.0", "fee_group_id": "default", "maker_fee": "0.1", "taker_fee": "0.1"}
|
|
524
|
+
# }
|
|
525
|
+
#
|
|
526
|
+
activeFeeTier = self.safe_value(response, 'active_fee_tier', {})
|
|
527
|
+
makerFee = self.safe_string(activeFeeTier, 'maker_fee')
|
|
528
|
+
takerFee = self.safe_string(activeFeeTier, 'taker_fee')
|
|
529
|
+
makerFee = Precise.string_div(makerFee, '100')
|
|
530
|
+
takerFee = Precise.string_div(takerFee, '100')
|
|
531
|
+
feeTiers = self.safe_value(response, 'fee_tiers')
|
|
532
|
+
result: dict = {}
|
|
533
|
+
tiers = self.parse_fee_tiers(feeTiers)
|
|
534
|
+
for i in range(0, len(self.symbols)):
|
|
535
|
+
symbol = self.symbols[i]
|
|
536
|
+
result[symbol] = {
|
|
537
|
+
'info': response,
|
|
538
|
+
'symbol': symbol,
|
|
539
|
+
'maker': self.parse_number(makerFee),
|
|
540
|
+
'taker': self.parse_number(takerFee),
|
|
541
|
+
'percentage': True,
|
|
542
|
+
'tierBased': True,
|
|
543
|
+
'tiers': tiers,
|
|
544
|
+
}
|
|
545
|
+
return result
|
|
546
|
+
|
|
547
|
+
def parse_fee_tiers(self, feeTiers, market: Market = None):
|
|
548
|
+
takerFees = []
|
|
549
|
+
makerFees = []
|
|
550
|
+
for i in range(0, len(feeTiers)):
|
|
551
|
+
tier = feeTiers[i]
|
|
552
|
+
volume = self.safe_number(tier, 'volume')
|
|
553
|
+
taker = self.safe_string(tier, 'taker_fee')
|
|
554
|
+
maker = self.safe_string(tier, 'maker_fee')
|
|
555
|
+
maker = Precise.string_div(maker, '100')
|
|
556
|
+
taker = Precise.string_div(taker, '100')
|
|
557
|
+
makerFees.append([volume, self.parse_number(maker)])
|
|
558
|
+
takerFees.append([volume, self.parse_number(taker)])
|
|
559
|
+
return {
|
|
560
|
+
'maker': makerFees,
|
|
561
|
+
'taker': takerFees,
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
|
|
565
|
+
#
|
|
566
|
+
# fetchTicker, fetchTickers
|
|
567
|
+
#
|
|
568
|
+
# {
|
|
569
|
+
# "instrument_code":"BTC_EUR",
|
|
570
|
+
# "sequence":602562,
|
|
571
|
+
# "time":"2020-07-10T06:27:34.951Z",
|
|
572
|
+
# "state":"ACTIVE",
|
|
573
|
+
# "is_frozen":0,
|
|
574
|
+
# "quote_volume":"1695555.1783768",
|
|
575
|
+
# "base_volume":"205.67436",
|
|
576
|
+
# "last_price":"8143.91",
|
|
577
|
+
# "best_bid":"8143.71",
|
|
578
|
+
# "best_ask":"8156.9",
|
|
579
|
+
# "price_change":"-147.47",
|
|
580
|
+
# "price_change_percentage":"-1.78",
|
|
581
|
+
# "high":"8337.45",
|
|
582
|
+
# "low":"8110.0"
|
|
583
|
+
# }
|
|
584
|
+
#
|
|
585
|
+
timestamp = self.parse8601(self.safe_string(ticker, 'time'))
|
|
586
|
+
marketId = self.safe_string(ticker, 'instrument_code')
|
|
587
|
+
symbol = self.safe_symbol(marketId, market, '_')
|
|
588
|
+
last = self.safe_string(ticker, 'last_price')
|
|
589
|
+
percentage = self.safe_string(ticker, 'price_change_percentage')
|
|
590
|
+
change = self.safe_string(ticker, 'price_change')
|
|
591
|
+
baseVolume = self.safe_string(ticker, 'base_volume')
|
|
592
|
+
quoteVolume = self.safe_string(ticker, 'quote_volume')
|
|
593
|
+
return self.safe_ticker({
|
|
594
|
+
'symbol': symbol,
|
|
595
|
+
'timestamp': timestamp,
|
|
596
|
+
'datetime': self.iso8601(timestamp),
|
|
597
|
+
'high': self.safe_string(ticker, 'high'),
|
|
598
|
+
'low': self.safe_string(ticker, 'low'),
|
|
599
|
+
'bid': self.safe_string(ticker, 'best_bid'),
|
|
600
|
+
'bidVolume': None,
|
|
601
|
+
'ask': self.safe_string(ticker, 'best_ask'),
|
|
602
|
+
'askVolume': None,
|
|
603
|
+
'vwap': None,
|
|
604
|
+
'open': None,
|
|
605
|
+
'close': last,
|
|
606
|
+
'last': last,
|
|
607
|
+
'previousClose': None,
|
|
608
|
+
'change': change,
|
|
609
|
+
'percentage': percentage,
|
|
610
|
+
'average': None,
|
|
611
|
+
'baseVolume': baseVolume,
|
|
612
|
+
'quoteVolume': quoteVolume,
|
|
613
|
+
'info': ticker,
|
|
614
|
+
}, market)
|
|
615
|
+
|
|
616
|
+
def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
|
617
|
+
"""
|
|
618
|
+
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
619
|
+
:param str symbol: unified symbol of the market to fetch the ticker for
|
|
620
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
621
|
+
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
|
622
|
+
"""
|
|
623
|
+
self.load_markets()
|
|
624
|
+
market = self.market(symbol)
|
|
625
|
+
request: dict = {
|
|
626
|
+
'instrument_code': market['id'],
|
|
627
|
+
}
|
|
628
|
+
response = self.publicGetMarketTickerInstrumentCode(self.extend(request, params))
|
|
629
|
+
#
|
|
630
|
+
# {
|
|
631
|
+
# "instrument_code":"BTC_EUR",
|
|
632
|
+
# "sequence":602562,
|
|
633
|
+
# "time":"2020-07-10T06:27:34.951Z",
|
|
634
|
+
# "state":"ACTIVE",
|
|
635
|
+
# "is_frozen":0,
|
|
636
|
+
# "quote_volume":"1695555.1783768",
|
|
637
|
+
# "base_volume":"205.67436",
|
|
638
|
+
# "last_price":"8143.91",
|
|
639
|
+
# "best_bid":"8143.71",
|
|
640
|
+
# "best_ask":"8156.9",
|
|
641
|
+
# "price_change":"-147.47",
|
|
642
|
+
# "price_change_percentage":"-1.78",
|
|
643
|
+
# "high":"8337.45",
|
|
644
|
+
# "low":"8110.0"
|
|
645
|
+
# }
|
|
646
|
+
#
|
|
647
|
+
return self.parse_ticker(response, market)
|
|
648
|
+
|
|
649
|
+
def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
|
650
|
+
"""
|
|
651
|
+
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
652
|
+
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
653
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
654
|
+
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
|
655
|
+
"""
|
|
656
|
+
self.load_markets()
|
|
657
|
+
symbols = self.market_symbols(symbols)
|
|
658
|
+
response = self.publicGetMarketTicker(params)
|
|
659
|
+
#
|
|
660
|
+
# [
|
|
661
|
+
# {
|
|
662
|
+
# "instrument_code":"BTC_EUR",
|
|
663
|
+
# "sequence":602562,
|
|
664
|
+
# "time":"2020-07-10T06:27:34.951Z",
|
|
665
|
+
# "state":"ACTIVE",
|
|
666
|
+
# "is_frozen":0,
|
|
667
|
+
# "quote_volume":"1695555.1783768",
|
|
668
|
+
# "base_volume":"205.67436",
|
|
669
|
+
# "last_price":"8143.91",
|
|
670
|
+
# "best_bid":"8143.71",
|
|
671
|
+
# "best_ask":"8156.9",
|
|
672
|
+
# "price_change":"-147.47",
|
|
673
|
+
# "price_change_percentage":"-1.78",
|
|
674
|
+
# "high":"8337.45",
|
|
675
|
+
# "low":"8110.0"
|
|
676
|
+
# }
|
|
677
|
+
# ]
|
|
678
|
+
#
|
|
679
|
+
result: dict = {}
|
|
680
|
+
for i in range(0, len(response)):
|
|
681
|
+
ticker = self.parse_ticker(response[i])
|
|
682
|
+
symbol = ticker['symbol']
|
|
683
|
+
result[symbol] = ticker
|
|
684
|
+
return self.filter_by_array_tickers(result, 'symbol', symbols)
|
|
685
|
+
|
|
686
|
+
def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
|
687
|
+
"""
|
|
688
|
+
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
|
689
|
+
:param str symbol: unified symbol of the market to fetch the order book for
|
|
690
|
+
:param int [limit]: the maximum amount of order book entries to return
|
|
691
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
692
|
+
:returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
|
|
693
|
+
"""
|
|
694
|
+
self.load_markets()
|
|
695
|
+
market = self.market(symbol)
|
|
696
|
+
request: dict = {
|
|
697
|
+
'instrument_code': market['id'],
|
|
698
|
+
# level 1 means only the best bid and ask
|
|
699
|
+
# level 2 is a compiled order book up to market precision
|
|
700
|
+
# level 3 is a full orderbook
|
|
701
|
+
# if you wish to get regular updates about orderbooks please use the Websocket channel
|
|
702
|
+
# heavy usage of self endpoint may result in limited access according to rate limits rules
|
|
703
|
+
# 'level': 3, # default
|
|
704
|
+
}
|
|
705
|
+
if limit is not None:
|
|
706
|
+
request['depth'] = limit
|
|
707
|
+
response = self.publicGetOrderBookInstrumentCode(self.extend(request, params))
|
|
708
|
+
#
|
|
709
|
+
# level 1
|
|
710
|
+
#
|
|
711
|
+
# {
|
|
712
|
+
# "instrument_code":"BTC_EUR",
|
|
713
|
+
# "time":"2020-07-10T07:39:06.343Z",
|
|
714
|
+
# "asks":{
|
|
715
|
+
# "value":{
|
|
716
|
+
# "price":"8145.29",
|
|
717
|
+
# "amount":"0.96538",
|
|
718
|
+
# "number_of_orders":1
|
|
719
|
+
# }
|
|
720
|
+
# },
|
|
721
|
+
# "bids":{
|
|
722
|
+
# "value":{
|
|
723
|
+
# "price":"8134.0",
|
|
724
|
+
# "amount":"1.5978",
|
|
725
|
+
# "number_of_orders":5
|
|
726
|
+
# }
|
|
727
|
+
# }
|
|
728
|
+
# }
|
|
729
|
+
#
|
|
730
|
+
# level 2
|
|
731
|
+
#
|
|
732
|
+
# {
|
|
733
|
+
# "instrument_code":"BTC_EUR","time":"2020-07-10T07:36:43.538Z",
|
|
734
|
+
# "asks":[
|
|
735
|
+
# {"price":"8146.59","amount":"0.89691","number_of_orders":1},
|
|
736
|
+
# {"price":"8146.89","amount":"1.92062","number_of_orders":1},
|
|
737
|
+
# {"price":"8169.5","amount":"0.0663","number_of_orders":1},
|
|
738
|
+
# ],
|
|
739
|
+
# "bids":[
|
|
740
|
+
# {"price":"8143.49","amount":"0.01329","number_of_orders":1},
|
|
741
|
+
# {"price":"8137.01","amount":"5.34748","number_of_orders":1},
|
|
742
|
+
# {"price":"8137.0","amount":"2.0","number_of_orders":1},
|
|
743
|
+
# ]
|
|
744
|
+
# }
|
|
745
|
+
#
|
|
746
|
+
# level 3
|
|
747
|
+
#
|
|
748
|
+
# {
|
|
749
|
+
# "instrument_code":"BTC_EUR",
|
|
750
|
+
# "time":"2020-07-10T07:32:31.525Z",
|
|
751
|
+
# "bids":[
|
|
752
|
+
# {"price":"8146.79","amount":"0.01537","order_id":"5d717da1-a8f4-422d-afcc-03cb6ab66825"},
|
|
753
|
+
# {"price":"8139.32","amount":"3.66009","order_id":"d0715c68-f28d-4cf1-a450-d56cf650e11c"},
|
|
754
|
+
# {"price":"8137.51","amount":"2.61049","order_id":"085fd6f4-e835-4ca5-9449-a8f165772e60"},
|
|
755
|
+
# ],
|
|
756
|
+
# "asks":[
|
|
757
|
+
# {"price":"8153.49","amount":"0.93384","order_id":"755d3aa3-42b5-46fa-903d-98f42e9ae6c4"},
|
|
758
|
+
# {"price":"8153.79","amount":"1.80456","order_id":"62034cf3-b70d-45ff-b285-ba6307941e7c"},
|
|
759
|
+
# {"price":"8167.9","amount":"0.0018","order_id":"036354e0-71cd-492f-94f2-01f7d4b66422"},
|
|
760
|
+
# ]
|
|
761
|
+
# }
|
|
762
|
+
#
|
|
763
|
+
timestamp = self.parse8601(self.safe_string(response, 'time'))
|
|
764
|
+
return self.parse_order_book(response, market['symbol'], timestamp, 'bids', 'asks', 'price', 'amount')
|
|
765
|
+
|
|
766
|
+
def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
|
|
767
|
+
#
|
|
768
|
+
# {
|
|
769
|
+
# "instrument_code":"BTC_EUR",
|
|
770
|
+
# "granularity":{"unit":"HOURS","period":1},
|
|
771
|
+
# "high":"9252.65",
|
|
772
|
+
# "low":"9115.27",
|
|
773
|
+
# "open":"9250.0",
|
|
774
|
+
# "close":"9132.35",
|
|
775
|
+
# "total_amount":"33.85924",
|
|
776
|
+
# "volume":"311958.9635744",
|
|
777
|
+
# "time":"2020-05-08T22:59:59.999Z",
|
|
778
|
+
# "last_sequence":461123
|
|
779
|
+
# }
|
|
780
|
+
#
|
|
781
|
+
granularity = self.safe_value(ohlcv, 'granularity')
|
|
782
|
+
unit = self.safe_string(granularity, 'unit')
|
|
783
|
+
period = self.safe_string(granularity, 'period')
|
|
784
|
+
units: dict = {
|
|
785
|
+
'MINUTES': 'm',
|
|
786
|
+
'HOURS': 'h',
|
|
787
|
+
'DAYS': 'd',
|
|
788
|
+
'WEEKS': 'w',
|
|
789
|
+
'MONTHS': 'M',
|
|
790
|
+
}
|
|
791
|
+
lowercaseUnit = self.safe_string(units, unit)
|
|
792
|
+
timeframe = period + lowercaseUnit
|
|
793
|
+
durationInSeconds = self.parse_timeframe(timeframe)
|
|
794
|
+
duration = durationInSeconds * 1000
|
|
795
|
+
timestamp = self.parse8601(self.safe_string(ohlcv, 'time'))
|
|
796
|
+
alignedTimestamp = duration * self.parse_to_int(timestamp / duration)
|
|
797
|
+
options = self.safe_value(self.options, 'fetchOHLCV', {})
|
|
798
|
+
volumeField = self.safe_string(options, 'volume', 'total_amount')
|
|
799
|
+
return [
|
|
800
|
+
alignedTimestamp,
|
|
801
|
+
self.safe_number(ohlcv, 'open'),
|
|
802
|
+
self.safe_number(ohlcv, 'high'),
|
|
803
|
+
self.safe_number(ohlcv, 'low'),
|
|
804
|
+
self.safe_number(ohlcv, 'close'),
|
|
805
|
+
self.safe_number(ohlcv, volumeField),
|
|
806
|
+
]
|
|
807
|
+
|
|
808
|
+
def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
|
809
|
+
"""
|
|
810
|
+
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
811
|
+
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
|
812
|
+
:param str timeframe: the length of time each candle represents
|
|
813
|
+
:param int [since]: timestamp in ms of the earliest candle to fetch
|
|
814
|
+
:param int [limit]: the maximum amount of candles to fetch
|
|
815
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
816
|
+
:returns int[][]: A list of candles ordered, open, high, low, close, volume
|
|
817
|
+
"""
|
|
818
|
+
self.load_markets()
|
|
819
|
+
market = self.market(symbol)
|
|
820
|
+
periodUnit = self.safe_string(self.timeframes, timeframe)
|
|
821
|
+
period, unit = periodUnit.split('/')
|
|
822
|
+
durationInSeconds = self.parse_timeframe(timeframe)
|
|
823
|
+
duration = durationInSeconds * 1000
|
|
824
|
+
if limit is None:
|
|
825
|
+
limit = 1500
|
|
826
|
+
request: dict = {
|
|
827
|
+
'instrument_code': market['id'],
|
|
828
|
+
# 'from': self.iso8601(since),
|
|
829
|
+
# 'to': self.iso8601(self.milliseconds()),
|
|
830
|
+
'period': period,
|
|
831
|
+
'unit': unit,
|
|
832
|
+
}
|
|
833
|
+
if since is None:
|
|
834
|
+
now = self.milliseconds()
|
|
835
|
+
request['to'] = self.iso8601(now)
|
|
836
|
+
request['from'] = self.iso8601(now - limit * duration)
|
|
837
|
+
else:
|
|
838
|
+
request['from'] = self.iso8601(since)
|
|
839
|
+
request['to'] = self.iso8601(self.sum(since, limit * duration))
|
|
840
|
+
response = self.publicGetCandlesticksInstrumentCode(self.extend(request, params))
|
|
841
|
+
#
|
|
842
|
+
# [
|
|
843
|
+
# {"instrument_code":"BTC_EUR","granularity":{"unit":"HOURS","period":1},"high":"9252.65","low":"9115.27","open":"9250.0","close":"9132.35","total_amount":"33.85924","volume":"311958.9635744","time":"2020-05-08T22:59:59.999Z","last_sequence":461123},
|
|
844
|
+
# {"instrument_code":"BTC_EUR","granularity":{"unit":"HOURS","period":1},"high":"9162.49","low":"9040.0","open":"9132.53","close":"9083.69","total_amount":"26.19685","volume":"238553.7812365","time":"2020-05-08T23:59:59.999Z","last_sequence":461376},
|
|
845
|
+
# {"instrument_code":"BTC_EUR","granularity":{"unit":"HOURS","period":1},"high":"9135.7","low":"9002.59","open":"9055.45","close":"9133.98","total_amount":"26.21919","volume":"238278.8724959","time":"2020-05-09T00:59:59.999Z","last_sequence":461521},
|
|
846
|
+
# ]
|
|
847
|
+
#
|
|
848
|
+
return self.parse_ohlcvs(response, market, timeframe, since, limit)
|
|
849
|
+
|
|
850
|
+
def parse_trade(self, trade: dict, market: Market = None) -> Trade:
|
|
851
|
+
#
|
|
852
|
+
# fetchTrades(public)
|
|
853
|
+
#
|
|
854
|
+
# {
|
|
855
|
+
# "instrument_code":"BTC_EUR",
|
|
856
|
+
# "price":"8137.28",
|
|
857
|
+
# "amount":"0.22269",
|
|
858
|
+
# "taker_side":"BUY",
|
|
859
|
+
# "volume":"1812.0908832",
|
|
860
|
+
# "time":"2020-07-10T14:44:32.299Z",
|
|
861
|
+
# "trade_timestamp":1594392272299,
|
|
862
|
+
# "sequence":603047
|
|
863
|
+
# }
|
|
864
|
+
#
|
|
865
|
+
# fetchMyTrades, fetchOrder, fetchOpenOrders, fetchClosedOrders trades(private)
|
|
866
|
+
#
|
|
867
|
+
# {
|
|
868
|
+
# "fee": {
|
|
869
|
+
# "fee_amount": "0.0014",
|
|
870
|
+
# "fee_currency": "BTC",
|
|
871
|
+
# "fee_percentage": "0.1",
|
|
872
|
+
# "fee_group_id": "default",
|
|
873
|
+
# "fee_type": "TAKER",
|
|
874
|
+
# "running_trading_volume": "0.0"
|
|
875
|
+
# },
|
|
876
|
+
# "trade": {
|
|
877
|
+
# "trade_id": "fdff2bcc-37d6-4a2d-92a5-46e09c868664",
|
|
878
|
+
# "order_id": "36bb2437-7402-4794-bf26-4bdf03526439",
|
|
879
|
+
# "account_id": "a4c699f6-338d-4a26-941f-8f9853bfc4b9",
|
|
880
|
+
# "amount": "1.4",
|
|
881
|
+
# "side": "BUY",
|
|
882
|
+
# "instrument_code": "BTC_EUR",
|
|
883
|
+
# "price": "7341.4",
|
|
884
|
+
# "time": "2019-09-27T15:05:32.564Z",
|
|
885
|
+
# "sequence": 48670
|
|
886
|
+
# }
|
|
887
|
+
# }
|
|
888
|
+
#
|
|
889
|
+
feeInfo = self.safe_value(trade, 'fee', {})
|
|
890
|
+
trade = self.safe_value(trade, 'trade', trade)
|
|
891
|
+
timestamp = self.safe_integer(trade, 'trade_timestamp')
|
|
892
|
+
if timestamp is None:
|
|
893
|
+
timestamp = self.parse8601(self.safe_string(trade, 'time'))
|
|
894
|
+
side = self.safe_string_lower_2(trade, 'side', 'taker_side')
|
|
895
|
+
priceString = self.safe_string(trade, 'price')
|
|
896
|
+
amountString = self.safe_string(trade, 'amount')
|
|
897
|
+
costString = self.safe_string(trade, 'volume')
|
|
898
|
+
marketId = self.safe_string(trade, 'instrument_code')
|
|
899
|
+
symbol = self.safe_symbol(marketId, market, '_')
|
|
900
|
+
feeCostString = self.safe_string(feeInfo, 'fee_amount')
|
|
901
|
+
takerOrMaker = None
|
|
902
|
+
fee = None
|
|
903
|
+
if feeCostString is not None:
|
|
904
|
+
feeCurrencyId = self.safe_string(feeInfo, 'fee_currency')
|
|
905
|
+
feeCurrencyCode = self.safe_currency_code(feeCurrencyId)
|
|
906
|
+
feeRateString = self.safe_string(feeInfo, 'fee_percentage')
|
|
907
|
+
fee = {
|
|
908
|
+
'cost': feeCostString,
|
|
909
|
+
'currency': feeCurrencyCode,
|
|
910
|
+
'rate': feeRateString,
|
|
911
|
+
}
|
|
912
|
+
takerOrMaker = self.safe_string_lower(feeInfo, 'fee_type')
|
|
913
|
+
return self.safe_trade({
|
|
914
|
+
'id': self.safe_string_2(trade, 'trade_id', 'sequence'),
|
|
915
|
+
'order': self.safe_string(trade, 'order_id'),
|
|
916
|
+
'timestamp': timestamp,
|
|
917
|
+
'datetime': self.iso8601(timestamp),
|
|
918
|
+
'symbol': symbol,
|
|
919
|
+
'type': None,
|
|
920
|
+
'side': side,
|
|
921
|
+
'price': priceString,
|
|
922
|
+
'amount': amountString,
|
|
923
|
+
'cost': costString,
|
|
924
|
+
'takerOrMaker': takerOrMaker,
|
|
925
|
+
'fee': fee,
|
|
926
|
+
'info': trade,
|
|
927
|
+
}, market)
|
|
928
|
+
|
|
929
|
+
def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
|
930
|
+
"""
|
|
931
|
+
get the list of most recent trades for a particular symbol
|
|
932
|
+
:param str symbol: unified symbol of the market to fetch trades for
|
|
933
|
+
:param int [since]: timestamp in ms of the earliest trade to fetch
|
|
934
|
+
:param int [limit]: the maximum amount of trades to fetch
|
|
935
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
936
|
+
:returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
|
|
937
|
+
"""
|
|
938
|
+
self.load_markets()
|
|
939
|
+
market = self.market(symbol)
|
|
940
|
+
request: dict = {
|
|
941
|
+
'instrument_code': market['id'],
|
|
942
|
+
# 'from': self.iso8601(since),
|
|
943
|
+
# 'to': self.iso8601(self.milliseconds()),
|
|
944
|
+
}
|
|
945
|
+
if since is not None:
|
|
946
|
+
# returns price ticks for a specific market with an interval of maximum of 4 hours
|
|
947
|
+
# sorted by latest first
|
|
948
|
+
request['from'] = self.iso8601(since)
|
|
949
|
+
request['to'] = self.iso8601(self.sum(since, 14400000))
|
|
950
|
+
response = self.publicGetPriceTicksInstrumentCode(self.extend(request, params))
|
|
951
|
+
#
|
|
952
|
+
# [
|
|
953
|
+
# {
|
|
954
|
+
# "instrument_code":"BTC_EUR",
|
|
955
|
+
# "price":"8137.28",
|
|
956
|
+
# "amount":"0.22269",
|
|
957
|
+
# "taker_side":"BUY",
|
|
958
|
+
# "volume":"1812.0908832",
|
|
959
|
+
# "time":"2020-07-10T14:44:32.299Z",
|
|
960
|
+
# "trade_timestamp":1594392272299,
|
|
961
|
+
# "sequence":603047
|
|
962
|
+
# }
|
|
963
|
+
# ]
|
|
964
|
+
#
|
|
965
|
+
return self.parse_trades(response, market, since, limit)
|
|
966
|
+
|
|
967
|
+
def parse_balance(self, response) -> Balances:
|
|
968
|
+
balances = self.safe_value(response, 'balances', [])
|
|
969
|
+
result: dict = {'info': response}
|
|
970
|
+
for i in range(0, len(balances)):
|
|
971
|
+
balance = balances[i]
|
|
972
|
+
currencyId = self.safe_string(balance, 'currency_code')
|
|
973
|
+
code = self.safe_currency_code(currencyId)
|
|
974
|
+
account = self.account()
|
|
975
|
+
account['free'] = self.safe_string(balance, 'available')
|
|
976
|
+
account['used'] = self.safe_string(balance, 'locked')
|
|
977
|
+
result[code] = account
|
|
978
|
+
return self.safe_balance(result)
|
|
979
|
+
|
|
980
|
+
def fetch_balance(self, params={}) -> Balances:
|
|
981
|
+
"""
|
|
982
|
+
query for balance and get the amount of funds available for trading or funds locked in orders
|
|
983
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
984
|
+
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
|
985
|
+
"""
|
|
986
|
+
self.load_markets()
|
|
987
|
+
response = self.privateGetAccountBalances(params)
|
|
988
|
+
#
|
|
989
|
+
# {
|
|
990
|
+
# "account_id":"4b95934f-55f1-460c-a525-bd5afc0cf071",
|
|
991
|
+
# "balances":[
|
|
992
|
+
# {
|
|
993
|
+
# "account_id":"4b95934f-55f1-460c-a525-bd5afc0cf071",
|
|
994
|
+
# "currency_code":"BTC",
|
|
995
|
+
# "change":"10.0",
|
|
996
|
+
# "available":"10.0",
|
|
997
|
+
# "locked":"0.0",
|
|
998
|
+
# "sequence":142135994,
|
|
999
|
+
# "time":"2020-07-01T10:57:32.959Z"
|
|
1000
|
+
# }
|
|
1001
|
+
# ]
|
|
1002
|
+
# }
|
|
1003
|
+
#
|
|
1004
|
+
return self.parse_balance(response)
|
|
1005
|
+
|
|
1006
|
+
def parse_deposit_address(self, depositAddress, currency: Currency = None):
|
|
1007
|
+
code = None
|
|
1008
|
+
if currency is not None:
|
|
1009
|
+
code = currency['code']
|
|
1010
|
+
address = self.safe_string(depositAddress, 'address')
|
|
1011
|
+
tag = self.safe_string(depositAddress, 'destination_tag')
|
|
1012
|
+
self.check_address(address)
|
|
1013
|
+
return {
|
|
1014
|
+
'currency': code,
|
|
1015
|
+
'address': address,
|
|
1016
|
+
'tag': tag,
|
|
1017
|
+
'network': None,
|
|
1018
|
+
'info': depositAddress,
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
def create_deposit_address(self, code: str, params={}):
|
|
1022
|
+
"""
|
|
1023
|
+
create a currency deposit address
|
|
1024
|
+
:param str code: unified currency code of the currency for the deposit address
|
|
1025
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1026
|
+
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
|
|
1027
|
+
"""
|
|
1028
|
+
self.load_markets()
|
|
1029
|
+
currency = self.currency(code)
|
|
1030
|
+
request: dict = {
|
|
1031
|
+
'currency': currency['id'],
|
|
1032
|
+
}
|
|
1033
|
+
response = self.privatePostAccountDepositCrypto(self.extend(request, params))
|
|
1034
|
+
#
|
|
1035
|
+
# {
|
|
1036
|
+
# "address":"rBnNhk95FrdNisZtXcStzriFS8vEzz53DM",
|
|
1037
|
+
# "destination_tag":"865690307",
|
|
1038
|
+
# "enabled":true,
|
|
1039
|
+
# "is_smart_contract":false
|
|
1040
|
+
# }
|
|
1041
|
+
#
|
|
1042
|
+
return self.parse_deposit_address(response, currency)
|
|
1043
|
+
|
|
1044
|
+
def fetch_deposit_address(self, code: str, params={}):
|
|
1045
|
+
"""
|
|
1046
|
+
fetch the deposit address for a currency associated with self account
|
|
1047
|
+
:param str code: unified currency code
|
|
1048
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1049
|
+
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
|
|
1050
|
+
"""
|
|
1051
|
+
self.load_markets()
|
|
1052
|
+
currency = self.currency(code)
|
|
1053
|
+
request: dict = {
|
|
1054
|
+
'currency_code': currency['id'],
|
|
1055
|
+
}
|
|
1056
|
+
response = self.privateGetAccountDepositCryptoCurrencyCode(self.extend(request, params))
|
|
1057
|
+
#
|
|
1058
|
+
# {
|
|
1059
|
+
# "address":"rBnNhk95FrdNisZtXcStzriFS8vEzz53DM",
|
|
1060
|
+
# "destination_tag":"865690307",
|
|
1061
|
+
# "enabled":true,
|
|
1062
|
+
# "is_smart_contract":false,
|
|
1063
|
+
# "can_create_more":false
|
|
1064
|
+
# }
|
|
1065
|
+
#
|
|
1066
|
+
return self.parse_deposit_address(response, currency)
|
|
1067
|
+
|
|
1068
|
+
def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
|
1069
|
+
"""
|
|
1070
|
+
fetch all deposits made to an account
|
|
1071
|
+
:param str code: unified currency code
|
|
1072
|
+
:param int [since]: the earliest time in ms to fetch deposits for
|
|
1073
|
+
:param int [limit]: the maximum number of deposits structures to retrieve
|
|
1074
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1075
|
+
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
|
|
1076
|
+
"""
|
|
1077
|
+
self.load_markets()
|
|
1078
|
+
request: dict = {
|
|
1079
|
+
# 'cursor': 'string', # pointer specifying the position from which the next pages should be returned
|
|
1080
|
+
}
|
|
1081
|
+
currency = None
|
|
1082
|
+
if code is not None:
|
|
1083
|
+
currency = self.currency(code)
|
|
1084
|
+
request['currency_code'] = currency['id']
|
|
1085
|
+
if limit is not None:
|
|
1086
|
+
request['max_page_size'] = limit
|
|
1087
|
+
if since is not None:
|
|
1088
|
+
to = self.safe_string(params, 'to')
|
|
1089
|
+
if to is None:
|
|
1090
|
+
raise ArgumentsRequired(self.id + ' fetchDeposits() requires a "to" iso8601 string param with the since argument is specified')
|
|
1091
|
+
request['from'] = self.iso8601(since)
|
|
1092
|
+
response = self.privateGetAccountDeposits(self.extend(request, params))
|
|
1093
|
+
#
|
|
1094
|
+
# {
|
|
1095
|
+
# "deposit_history": [
|
|
1096
|
+
# {
|
|
1097
|
+
# "transaction_id": "e5342efcd-d5b7-4a56-8e12-b69ffd68c5ef",
|
|
1098
|
+
# "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
|
|
1099
|
+
# "amount": "100",
|
|
1100
|
+
# "type": "CRYPTO",
|
|
1101
|
+
# "funds_source": "INTERNAL",
|
|
1102
|
+
# "time": "2020-04-22T09:57:47Z",
|
|
1103
|
+
# "currency": "BTC",
|
|
1104
|
+
# "fee_amount": "0.0",
|
|
1105
|
+
# "fee_currency": "BTC"
|
|
1106
|
+
# },
|
|
1107
|
+
# {
|
|
1108
|
+
# "transaction_id": "79793d00-2899-4a4d-95b7-73ae6b31384f",
|
|
1109
|
+
# "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
|
|
1110
|
+
# "time": "2020-05-05T11:22:07.925Z",
|
|
1111
|
+
# "currency": "EUR",
|
|
1112
|
+
# "funds_source": "EXTERNAL",
|
|
1113
|
+
# "type": "FIAT",
|
|
1114
|
+
# "amount": "50.0",
|
|
1115
|
+
# "fee_amount": "0.01",
|
|
1116
|
+
# "fee_currency": "EUR"
|
|
1117
|
+
# }
|
|
1118
|
+
# ],
|
|
1119
|
+
# "max_page_size": 2,
|
|
1120
|
+
# "cursor": "eyJhY2NvdW50X2lkIjp7InMiOiJlMzY5YWM4MC00NTc3LTExZTktYWUwOC05YmVkYzQ3OTBiODQiLCJzcyI6W10sIm5zIjpbXSwiYnMiOltdLCJtIjp7fSwibCI6W119LCJpdGVtX2tleSI6eyJzIjoiV0lUSERSQVdBTDo6MmFlMjYwY2ItOTk3MC00YmNiLTgxNmEtZGY4MDVmY2VhZTY1Iiwic3MiOltdLCJucyI6W10sImJzIjpbXSwibSI6e30sImwiOltdfSwiZ2xvYmFsX3dpdGhkcmF3YWxfaW5kZXhfaGFzaF9rZXkiOnsicyI6ImUzNjlhYzgwLTQ1NzctMTFlOS1hZTA4LTliZWRjNDc5MGI4NCIsInNzIjpbXSwibnMiOltdLCJicyI6W10sIm0iOnt9LCJsIjpbXX0sInRpbWVzdGFtcCI6eyJuIjoiMTU4ODA1ODc2Nzk0OCIsInNzIjpbXSwibnMiOltdLCJicyI6W10sIm0iOnt9LCJsIjpbXX19"
|
|
1121
|
+
# }
|
|
1122
|
+
#
|
|
1123
|
+
depositHistory = self.safe_list(response, 'deposit_history', [])
|
|
1124
|
+
return self.parse_transactions(depositHistory, currency, since, limit, {'type': 'deposit'})
|
|
1125
|
+
|
|
1126
|
+
def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
|
1127
|
+
"""
|
|
1128
|
+
fetch all withdrawals made from an account
|
|
1129
|
+
:param str code: unified currency code
|
|
1130
|
+
:param int [since]: the earliest time in ms to fetch withdrawals for
|
|
1131
|
+
:param int [limit]: the maximum number of withdrawals structures to retrieve
|
|
1132
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1133
|
+
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
|
|
1134
|
+
"""
|
|
1135
|
+
self.load_markets()
|
|
1136
|
+
request: dict = {
|
|
1137
|
+
# 'cursor': 'string', # pointer specifying the position from which the next pages should be returned
|
|
1138
|
+
}
|
|
1139
|
+
currency = None
|
|
1140
|
+
if code is not None:
|
|
1141
|
+
currency = self.currency(code)
|
|
1142
|
+
request['currency_code'] = currency['id']
|
|
1143
|
+
if limit is not None:
|
|
1144
|
+
request['max_page_size'] = limit
|
|
1145
|
+
if since is not None:
|
|
1146
|
+
to = self.safe_string(params, 'to')
|
|
1147
|
+
if to is None:
|
|
1148
|
+
raise ArgumentsRequired(self.id + ' fetchWithdrawals() requires a "to" iso8601 string param with the since argument is specified')
|
|
1149
|
+
request['from'] = self.iso8601(since)
|
|
1150
|
+
response = self.privateGetAccountWithdrawals(self.extend(request, params))
|
|
1151
|
+
#
|
|
1152
|
+
# {
|
|
1153
|
+
# "withdrawal_history": [
|
|
1154
|
+
# {
|
|
1155
|
+
# "account_id": "e369ac80-4577-11e9-ae08-9bedc4790b84",
|
|
1156
|
+
# "amount": "0.1",
|
|
1157
|
+
# "currency": "BTC",
|
|
1158
|
+
# "fee_amount": "0.00002",
|
|
1159
|
+
# "fee_currency": "BTC",
|
|
1160
|
+
# "funds_source": "EXTERNAL",
|
|
1161
|
+
# "related_transaction_id": "e298341a-3855-405e-bce3-92db368a3157",
|
|
1162
|
+
# "time": "2020-05-05T11:11:32.110Z",
|
|
1163
|
+
# "transaction_id": "6693ff40-bb10-4dcf-ada7-3b287727c882",
|
|
1164
|
+
# "type": "CRYPTO"
|
|
1165
|
+
# },
|
|
1166
|
+
# {
|
|
1167
|
+
# "account_id": "e369ac80-4577-11e9-ae08-9bedc4790b84",
|
|
1168
|
+
# "amount": "0.1",
|
|
1169
|
+
# "currency": "BTC",
|
|
1170
|
+
# "fee_amount": "0.0",
|
|
1171
|
+
# "fee_currency": "BTC",
|
|
1172
|
+
# "funds_source": "INTERNAL",
|
|
1173
|
+
# "time": "2020-05-05T10:29:53.464Z",
|
|
1174
|
+
# "transaction_id": "ec9703b1-954b-4f76-adea-faac66eabc0b",
|
|
1175
|
+
# "type": "CRYPTO"
|
|
1176
|
+
# }
|
|
1177
|
+
# ],
|
|
1178
|
+
# "cursor": "eyJhY2NvdW50X2lkIjp7InMiOiJlMzY5YWM4MC00NTc3LTExZTktYWUwOC05YmVkYzQ3OTBiODQiLCJzcyI6W10sIm5zIjpbXSwiYnMiOltdLCJtIjp7fSwibCI6W119LCJpdGVtX2tleSI6eyJzIjoiV0lUSERSQVdBTDo6ZWM5NzAzYjEtOTU0Yi00Zjc2LWFkZWEtZmFhYzY2ZWFiYzBiIiwic3MiOltdLCJucyI6W10sImJzIjpbXSwibSI6e30sImwiOltdfSwiZ2xvYmFsX3dpdGhkcmF3YWxfaW5kZXhfaGFzaF9rZXkiOnsicyI6ImUzNjlhYzgwLTQ1NzctMTFlOS1hZTA4LTliZWRjNDc5MGI4NCIsInNzIjpbXSwibnMiOltdLCJicyI6W10sIm0iOnt9LCJsIjpbXX0sInRpbWVzdGFtcCI6eyJuIjoiMTU4ODY3NDU5MzQ2NCIsInNzIjpbXSwibnMiOltdLCJicyI6W10sIm0iOnt9LCJsIjpbXX19",
|
|
1179
|
+
# "max_page_size": 2
|
|
1180
|
+
# }
|
|
1181
|
+
#
|
|
1182
|
+
withdrawalHistory = self.safe_list(response, 'withdrawal_history', [])
|
|
1183
|
+
return self.parse_transactions(withdrawalHistory, currency, since, limit, {'type': 'withdrawal'})
|
|
1184
|
+
|
|
1185
|
+
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
|
1186
|
+
"""
|
|
1187
|
+
make a withdrawal
|
|
1188
|
+
:param str code: unified currency code
|
|
1189
|
+
:param float amount: the amount to withdraw
|
|
1190
|
+
:param str address: the address to withdraw to
|
|
1191
|
+
:param str tag:
|
|
1192
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1193
|
+
:returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
|
|
1194
|
+
"""
|
|
1195
|
+
tag, params = self.handle_withdraw_tag_and_params(tag, params)
|
|
1196
|
+
self.check_address(address)
|
|
1197
|
+
self.load_markets()
|
|
1198
|
+
currency = self.currency(code)
|
|
1199
|
+
request: dict = {
|
|
1200
|
+
'currency': code,
|
|
1201
|
+
'amount': self.currency_to_precision(code, amount),
|
|
1202
|
+
# 'payout_account_id': '66756a10-3e86-48f4-9678-b634c4b135b2', # fiat only
|
|
1203
|
+
# 'recipient': { # crypto only
|
|
1204
|
+
# 'address': address,
|
|
1205
|
+
# # 'destination_tag': '',
|
|
1206
|
+
# },
|
|
1207
|
+
}
|
|
1208
|
+
options = self.safe_value(self.options, 'fiat', [])
|
|
1209
|
+
isFiat = self.in_array(code, options)
|
|
1210
|
+
method = 'privatePostAccountWithdrawFiat' if isFiat else 'privatePostAccountWithdrawCrypto'
|
|
1211
|
+
if isFiat:
|
|
1212
|
+
payoutAccountId = self.safe_string(params, 'payout_account_id')
|
|
1213
|
+
if payoutAccountId is None:
|
|
1214
|
+
raise ArgumentsRequired(self.id + ' withdraw() requires a payout_account_id param for fiat ' + code + ' withdrawals')
|
|
1215
|
+
else:
|
|
1216
|
+
recipient: dict = {'address': address}
|
|
1217
|
+
if tag is not None:
|
|
1218
|
+
recipient['destination_tag'] = tag
|
|
1219
|
+
request['recipient'] = recipient
|
|
1220
|
+
response = getattr(self, method)(self.extend(request, params))
|
|
1221
|
+
#
|
|
1222
|
+
# crypto
|
|
1223
|
+
#
|
|
1224
|
+
# {
|
|
1225
|
+
# "amount": "1234.5678",
|
|
1226
|
+
# "fee": "1234.5678",
|
|
1227
|
+
# "recipient": "3NacQ7rzZdhfyAtfJ5a11k8jFPdcMP2Bq7",
|
|
1228
|
+
# "destination_tag": "",
|
|
1229
|
+
# "transaction_id": "d0f8529f-f832-4e6a-9dc5-b8d5797badb2"
|
|
1230
|
+
# }
|
|
1231
|
+
#
|
|
1232
|
+
# fiat
|
|
1233
|
+
#
|
|
1234
|
+
# {
|
|
1235
|
+
# "transaction_id": "54236cd0-4413-11e9-93fb-5fea7e5b5df6"
|
|
1236
|
+
# }
|
|
1237
|
+
#
|
|
1238
|
+
return self.parse_transaction(response, currency)
|
|
1239
|
+
|
|
1240
|
+
def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
|
|
1241
|
+
#
|
|
1242
|
+
# fetchDeposits, fetchWithdrawals
|
|
1243
|
+
#
|
|
1244
|
+
# {
|
|
1245
|
+
# "transaction_id": "C2b42efcd-d5b7-4a56-8e12-b69ffd68c5ef",
|
|
1246
|
+
# "type": "FIAT",
|
|
1247
|
+
# "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
|
|
1248
|
+
# "amount": "1234.5678",
|
|
1249
|
+
# "time": "2019-08-24T14:15:22Z",
|
|
1250
|
+
# "funds_source": "INTERNAL",
|
|
1251
|
+
# "currency": "BTC",
|
|
1252
|
+
# "fee_amount": "1234.5678",
|
|
1253
|
+
# "fee_currency": "BTC",
|
|
1254
|
+
# "blockchain_transaction_id": "f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16",
|
|
1255
|
+
# "related_transaction_id": "e298341a-3855-405e-bce3-92db368a3157"
|
|
1256
|
+
# }
|
|
1257
|
+
#
|
|
1258
|
+
# withdraw
|
|
1259
|
+
#
|
|
1260
|
+
#
|
|
1261
|
+
# crypto
|
|
1262
|
+
#
|
|
1263
|
+
# {
|
|
1264
|
+
# "amount": "1234.5678",
|
|
1265
|
+
# "fee": "1234.5678",
|
|
1266
|
+
# "recipient": "3NacQ7rzZdhfyAtfJ5a11k8jFPdcMP2Bq7",
|
|
1267
|
+
# "destination_tag": "",
|
|
1268
|
+
# "transaction_id": "d0f8529f-f832-4e6a-9dc5-b8d5797badb2"
|
|
1269
|
+
# }
|
|
1270
|
+
#
|
|
1271
|
+
# fiat
|
|
1272
|
+
#
|
|
1273
|
+
# {
|
|
1274
|
+
# "transaction_id": "54236cd0-4413-11e9-93fb-5fea7e5b5df6"
|
|
1275
|
+
# }
|
|
1276
|
+
#
|
|
1277
|
+
id = self.safe_string(transaction, 'transaction_id')
|
|
1278
|
+
amount = self.safe_number(transaction, 'amount')
|
|
1279
|
+
timestamp = self.parse8601(self.safe_string(transaction, 'time'))
|
|
1280
|
+
currencyId = self.safe_string(transaction, 'currency')
|
|
1281
|
+
currency = self.safe_currency(currencyId, currency)
|
|
1282
|
+
status = 'ok' # the exchange returns cleared transactions only
|
|
1283
|
+
feeCost = self.safe_number_2(transaction, 'fee_amount', 'fee')
|
|
1284
|
+
fee = None
|
|
1285
|
+
addressTo = self.safe_string(transaction, 'recipient')
|
|
1286
|
+
tagTo = self.safe_string(transaction, 'destination_tag')
|
|
1287
|
+
if feeCost is not None:
|
|
1288
|
+
feeCurrencyId = self.safe_string(transaction, 'fee_currency', currencyId)
|
|
1289
|
+
feeCurrencyCode = self.safe_currency_code(feeCurrencyId)
|
|
1290
|
+
fee = {
|
|
1291
|
+
'cost': feeCost,
|
|
1292
|
+
'currency': feeCurrencyCode,
|
|
1293
|
+
}
|
|
1294
|
+
return {
|
|
1295
|
+
'info': transaction,
|
|
1296
|
+
'id': id,
|
|
1297
|
+
'currency': currency['code'],
|
|
1298
|
+
'amount': amount,
|
|
1299
|
+
'network': None,
|
|
1300
|
+
'address': addressTo,
|
|
1301
|
+
'addressFrom': None,
|
|
1302
|
+
'addressTo': addressTo,
|
|
1303
|
+
'tag': tagTo,
|
|
1304
|
+
'tagFrom': None,
|
|
1305
|
+
'tagTo': tagTo,
|
|
1306
|
+
'status': status,
|
|
1307
|
+
'type': None,
|
|
1308
|
+
'updated': None,
|
|
1309
|
+
'txid': self.safe_string(transaction, 'blockchain_transaction_id'),
|
|
1310
|
+
'comment': None,
|
|
1311
|
+
'internal': None,
|
|
1312
|
+
'timestamp': timestamp,
|
|
1313
|
+
'datetime': self.iso8601(timestamp),
|
|
1314
|
+
'fee': fee,
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
def parse_order_status(self, status: Str):
|
|
1318
|
+
statuses: dict = {
|
|
1319
|
+
'FILLED': 'open',
|
|
1320
|
+
'FILLED_FULLY': 'closed',
|
|
1321
|
+
'FILLED_CLOSED': 'canceled',
|
|
1322
|
+
'FILLED_REJECTED': 'rejected',
|
|
1323
|
+
'OPEN': 'open',
|
|
1324
|
+
'REJECTED': 'rejected',
|
|
1325
|
+
'CLOSED': 'canceled',
|
|
1326
|
+
'FAILED': 'failed',
|
|
1327
|
+
'STOP_TRIGGERED': 'triggered',
|
|
1328
|
+
}
|
|
1329
|
+
return self.safe_string(statuses, status, status)
|
|
1330
|
+
|
|
1331
|
+
def parse_order(self, order: dict, market: Market = None) -> Order:
|
|
1332
|
+
#
|
|
1333
|
+
# createOrder
|
|
1334
|
+
#
|
|
1335
|
+
# {
|
|
1336
|
+
# "order_id": "d5492c24-2995-4c18-993a-5b8bf8fffc0d",
|
|
1337
|
+
# "client_id": "d75fb03b-b599-49e9-b926-3f0b6d103206",
|
|
1338
|
+
# "account_id": "a4c699f6-338d-4a26-941f-8f9853bfc4b9",
|
|
1339
|
+
# "instrument_code": "BTC_EUR",
|
|
1340
|
+
# "time": "2019-08-01T08:00:44.026Z",
|
|
1341
|
+
# "side": "BUY",
|
|
1342
|
+
# "price": "5000",
|
|
1343
|
+
# "amount": "1",
|
|
1344
|
+
# "filled_amount": "0.5",
|
|
1345
|
+
# "type": "LIMIT",
|
|
1346
|
+
# "time_in_force": "GOOD_TILL_CANCELLED"
|
|
1347
|
+
# }
|
|
1348
|
+
#
|
|
1349
|
+
# fetchOrder, fetchOpenOrders, fetchClosedOrders
|
|
1350
|
+
#
|
|
1351
|
+
# {
|
|
1352
|
+
# "order": {
|
|
1353
|
+
# "order_id": "66756a10-3e86-48f4-9678-b634c4b135b2",
|
|
1354
|
+
# "account_id": "1eb2ad5d-55f1-40b5-bc92-7dc05869e905",
|
|
1355
|
+
# "instrument_code": "BTC_EUR",
|
|
1356
|
+
# "amount": "1234.5678",
|
|
1357
|
+
# "filled_amount": "1234.5678",
|
|
1358
|
+
# "side": "BUY",
|
|
1359
|
+
# "type": "LIMIT",
|
|
1360
|
+
# "status": "OPEN",
|
|
1361
|
+
# "sequence": 123456789,
|
|
1362
|
+
# "price": "1234.5678",
|
|
1363
|
+
# "average_price": "1234.5678",
|
|
1364
|
+
# "reason": "INSUFFICIENT_FUNDS",
|
|
1365
|
+
# "time": "2019-08-24T14:15:22Z",
|
|
1366
|
+
# "time_in_force": "GOOD_TILL_CANCELLED",
|
|
1367
|
+
# "time_last_updated": "2019-08-24T14:15:22Z",
|
|
1368
|
+
# "expire_after": "2019-08-24T14:15:22Z",
|
|
1369
|
+
# "is_post_only": False,
|
|
1370
|
+
# "time_triggered": "2019-08-24T14:15:22Z",
|
|
1371
|
+
# "trigger_price": "1234.5678"
|
|
1372
|
+
# },
|
|
1373
|
+
# "trades": [
|
|
1374
|
+
# {
|
|
1375
|
+
# "fee": {
|
|
1376
|
+
# "fee_amount": "0.0014",
|
|
1377
|
+
# "fee_currency": "BTC",
|
|
1378
|
+
# "fee_percentage": "0.1",
|
|
1379
|
+
# "fee_group_id": "default",
|
|
1380
|
+
# "fee_type": "TAKER",
|
|
1381
|
+
# "running_trading_volume": "0.0"
|
|
1382
|
+
# },
|
|
1383
|
+
# "trade": {
|
|
1384
|
+
# "trade_id": "fdff2bcc-37d6-4a2d-92a5-46e09c868664",
|
|
1385
|
+
# "order_id": "36bb2437-7402-4794-bf26-4bdf03526439",
|
|
1386
|
+
# "account_id": "a4c699f6-338d-4a26-941f-8f9853bfc4b9",
|
|
1387
|
+
# "amount": "1.4",
|
|
1388
|
+
# "side": "BUY",
|
|
1389
|
+
# "instrument_code": "BTC_EUR",
|
|
1390
|
+
# "price": "7341.4",
|
|
1391
|
+
# "time": "2019-09-27T15:05:32.564Z",
|
|
1392
|
+
# "sequence": 48670
|
|
1393
|
+
# }
|
|
1394
|
+
# }
|
|
1395
|
+
# ]
|
|
1396
|
+
# }
|
|
1397
|
+
#
|
|
1398
|
+
rawOrder = self.safe_value(order, 'order', order)
|
|
1399
|
+
id = self.safe_string(rawOrder, 'order_id')
|
|
1400
|
+
clientOrderId = self.safe_string(rawOrder, 'client_id')
|
|
1401
|
+
timestamp = self.parse8601(self.safe_string(rawOrder, 'time'))
|
|
1402
|
+
rawStatus = self.parse_order_status(self.safe_string(rawOrder, 'status'))
|
|
1403
|
+
status = self.parse_order_status(rawStatus)
|
|
1404
|
+
marketId = self.safe_string(rawOrder, 'instrument_code')
|
|
1405
|
+
symbol = self.safe_symbol(marketId, market, '_')
|
|
1406
|
+
price = self.safe_string(rawOrder, 'price')
|
|
1407
|
+
amount = self.safe_string(rawOrder, 'amount')
|
|
1408
|
+
filled = self.safe_string(rawOrder, 'filled_amount')
|
|
1409
|
+
side = self.safe_string_lower(rawOrder, 'side')
|
|
1410
|
+
type = self.safe_string_lower(rawOrder, 'type')
|
|
1411
|
+
timeInForce = self.parse_time_in_force(self.safe_string(rawOrder, 'time_in_force'))
|
|
1412
|
+
stopPrice = self.safe_number(rawOrder, 'trigger_price')
|
|
1413
|
+
postOnly = self.safe_value(rawOrder, 'is_post_only')
|
|
1414
|
+
rawTrades = self.safe_value(order, 'trades', [])
|
|
1415
|
+
return self.safe_order({
|
|
1416
|
+
'id': id,
|
|
1417
|
+
'clientOrderId': clientOrderId,
|
|
1418
|
+
'info': order,
|
|
1419
|
+
'timestamp': timestamp,
|
|
1420
|
+
'datetime': self.iso8601(timestamp),
|
|
1421
|
+
'lastTradeTimestamp': None,
|
|
1422
|
+
'symbol': symbol,
|
|
1423
|
+
'type': type,
|
|
1424
|
+
'timeInForce': timeInForce,
|
|
1425
|
+
'postOnly': postOnly,
|
|
1426
|
+
'side': side,
|
|
1427
|
+
'price': price,
|
|
1428
|
+
'stopPrice': stopPrice,
|
|
1429
|
+
'triggerPrice': stopPrice,
|
|
1430
|
+
'amount': amount,
|
|
1431
|
+
'cost': None,
|
|
1432
|
+
'average': None,
|
|
1433
|
+
'filled': filled,
|
|
1434
|
+
'remaining': None,
|
|
1435
|
+
'status': status,
|
|
1436
|
+
# 'fee': None,
|
|
1437
|
+
'trades': rawTrades,
|
|
1438
|
+
}, market)
|
|
1439
|
+
|
|
1440
|
+
def parse_time_in_force(self, timeInForce: Str):
|
|
1441
|
+
timeInForces: dict = {
|
|
1442
|
+
'GOOD_TILL_CANCELLED': 'GTC',
|
|
1443
|
+
'GOOD_TILL_TIME': 'GTT',
|
|
1444
|
+
'IMMEDIATE_OR_CANCELLED': 'IOC',
|
|
1445
|
+
'FILL_OR_KILL': 'FOK',
|
|
1446
|
+
}
|
|
1447
|
+
return self.safe_string(timeInForces, timeInForce, timeInForce)
|
|
1448
|
+
|
|
1449
|
+
def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
|
1450
|
+
"""
|
|
1451
|
+
create a trade order
|
|
1452
|
+
:see: https://docs.onetrading.com/#create-order
|
|
1453
|
+
:param str symbol: unified symbol of the market to create an order in
|
|
1454
|
+
:param str type: 'market' or 'limit'
|
|
1455
|
+
:param str side: 'buy' or 'sell'
|
|
1456
|
+
:param float amount: how much of currency you want to trade in units of base currency
|
|
1457
|
+
:param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
1458
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1459
|
+
:param float [params.triggerPrice]: onetrading only does stop limit orders and does not do stop market
|
|
1460
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
|
1461
|
+
"""
|
|
1462
|
+
self.load_markets()
|
|
1463
|
+
market = self.market(symbol)
|
|
1464
|
+
uppercaseType = type.upper()
|
|
1465
|
+
request: dict = {
|
|
1466
|
+
'instrument_code': market['id'],
|
|
1467
|
+
'type': uppercaseType, # LIMIT, MARKET, STOP
|
|
1468
|
+
'side': side.upper(), # or SELL
|
|
1469
|
+
'amount': self.amount_to_precision(symbol, amount),
|
|
1470
|
+
# "price": "1234.5678", # required for LIMIT and STOP orders
|
|
1471
|
+
# "client_id": "d75fb03b-b599-49e9-b926-3f0b6d103206", # optional
|
|
1472
|
+
# "time_in_force": "GOOD_TILL_CANCELLED", # limit orders only, GOOD_TILL_CANCELLED, GOOD_TILL_TIME, IMMEDIATE_OR_CANCELLED and FILL_OR_KILL
|
|
1473
|
+
# "expire_after": "2020-07-02T19:40:13Z", # required for GOOD_TILL_TIME
|
|
1474
|
+
# "is_post_only": False, # limit orders only, optional
|
|
1475
|
+
# "trigger_price": "1234.5678" # required for stop orders
|
|
1476
|
+
}
|
|
1477
|
+
priceIsRequired = False
|
|
1478
|
+
if uppercaseType == 'LIMIT' or uppercaseType == 'STOP':
|
|
1479
|
+
priceIsRequired = True
|
|
1480
|
+
triggerPrice = self.safe_number_n(params, ['triggerPrice', 'trigger_price', 'stopPrice'])
|
|
1481
|
+
if triggerPrice is not None:
|
|
1482
|
+
if uppercaseType == 'MARKET':
|
|
1483
|
+
raise BadRequest(self.id + ' createOrder() cannot place stop market orders, only stop limit')
|
|
1484
|
+
request['trigger_price'] = self.price_to_precision(symbol, triggerPrice)
|
|
1485
|
+
request['type'] = 'STOP'
|
|
1486
|
+
params = self.omit(params, ['triggerPrice', 'trigger_price', 'stopPrice'])
|
|
1487
|
+
elif uppercaseType == 'STOP':
|
|
1488
|
+
raise ArgumentsRequired(self.id + ' createOrder() requires a triggerPrice param for ' + type + ' orders')
|
|
1489
|
+
if priceIsRequired:
|
|
1490
|
+
request['price'] = self.price_to_precision(symbol, price)
|
|
1491
|
+
clientOrderId = self.safe_string_2(params, 'clientOrderId', 'client_id')
|
|
1492
|
+
if clientOrderId is not None:
|
|
1493
|
+
request['client_id'] = clientOrderId
|
|
1494
|
+
params = self.omit(params, ['clientOrderId', 'client_id'])
|
|
1495
|
+
response = self.privatePostAccountOrders(self.extend(request, params))
|
|
1496
|
+
#
|
|
1497
|
+
# {
|
|
1498
|
+
# "order_id": "d5492c24-2995-4c18-993a-5b8bf8fffc0d",
|
|
1499
|
+
# "client_id": "d75fb03b-b599-49e9-b926-3f0b6d103206",
|
|
1500
|
+
# "account_id": "a4c699f6-338d-4a26-941f-8f9853bfc4b9",
|
|
1501
|
+
# "instrument_code": "BTC_EUR",
|
|
1502
|
+
# "time": "2019-08-01T08:00:44.026Z",
|
|
1503
|
+
# "side": "BUY",
|
|
1504
|
+
# "price": "5000",
|
|
1505
|
+
# "amount": "1",
|
|
1506
|
+
# "filled_amount": "0.5",
|
|
1507
|
+
# "type": "LIMIT",
|
|
1508
|
+
# "time_in_force": "GOOD_TILL_CANCELLED"
|
|
1509
|
+
# }
|
|
1510
|
+
#
|
|
1511
|
+
return self.parse_order(response, market)
|
|
1512
|
+
|
|
1513
|
+
def cancel_order(self, id: str, symbol: Str = None, params={}):
|
|
1514
|
+
"""
|
|
1515
|
+
cancels an open order
|
|
1516
|
+
:param str id: order id
|
|
1517
|
+
:param str symbol: not used by bitmex cancelOrder()
|
|
1518
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1519
|
+
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
|
1520
|
+
"""
|
|
1521
|
+
self.load_markets()
|
|
1522
|
+
clientOrderId = self.safe_string_2(params, 'clientOrderId', 'client_id')
|
|
1523
|
+
params = self.omit(params, ['clientOrderId', 'client_id'])
|
|
1524
|
+
method = 'privateDeleteAccountOrdersOrderId'
|
|
1525
|
+
request: dict = {}
|
|
1526
|
+
if clientOrderId is not None:
|
|
1527
|
+
method = 'privateDeleteAccountOrdersClientClientId'
|
|
1528
|
+
request['client_id'] = clientOrderId
|
|
1529
|
+
else:
|
|
1530
|
+
request['order_id'] = id
|
|
1531
|
+
response = getattr(self, method)(self.extend(request, params))
|
|
1532
|
+
#
|
|
1533
|
+
# responds with an empty body
|
|
1534
|
+
#
|
|
1535
|
+
return response
|
|
1536
|
+
|
|
1537
|
+
def cancel_all_orders(self, symbol: Str = None, params={}):
|
|
1538
|
+
"""
|
|
1539
|
+
cancel all open orders
|
|
1540
|
+
:param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
|
|
1541
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1542
|
+
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
|
1543
|
+
"""
|
|
1544
|
+
self.load_markets()
|
|
1545
|
+
request: dict = {}
|
|
1546
|
+
if symbol is not None:
|
|
1547
|
+
market = self.market(symbol)
|
|
1548
|
+
request['instrument_code'] = market['id']
|
|
1549
|
+
response = self.privateDeleteAccountOrders(self.extend(request, params))
|
|
1550
|
+
#
|
|
1551
|
+
# [
|
|
1552
|
+
# "a10e9bd1-8f72-4cfe-9f1b-7f1c8a9bd8ee"
|
|
1553
|
+
# ]
|
|
1554
|
+
#
|
|
1555
|
+
return response
|
|
1556
|
+
|
|
1557
|
+
def cancel_orders(self, ids, symbol: Str = None, params={}):
|
|
1558
|
+
"""
|
|
1559
|
+
cancel multiple orders
|
|
1560
|
+
:param str[] ids: order ids
|
|
1561
|
+
:param str symbol: unified market symbol, default is None
|
|
1562
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1563
|
+
:returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
|
1564
|
+
"""
|
|
1565
|
+
self.load_markets()
|
|
1566
|
+
request: dict = {
|
|
1567
|
+
'ids': ','.join(ids),
|
|
1568
|
+
}
|
|
1569
|
+
response = self.privateDeleteAccountOrders(self.extend(request, params))
|
|
1570
|
+
#
|
|
1571
|
+
# [
|
|
1572
|
+
# "a10e9bd1-8f72-4cfe-9f1b-7f1c8a9bd8ee"
|
|
1573
|
+
# ]
|
|
1574
|
+
#
|
|
1575
|
+
return response
|
|
1576
|
+
|
|
1577
|
+
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
|
1578
|
+
"""
|
|
1579
|
+
fetches information on an order made by the user
|
|
1580
|
+
:param str symbol: not used by onetrading fetchOrder
|
|
1581
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1582
|
+
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
|
1583
|
+
"""
|
|
1584
|
+
self.load_markets()
|
|
1585
|
+
request: dict = {
|
|
1586
|
+
'order_id': id,
|
|
1587
|
+
}
|
|
1588
|
+
response = self.privateGetAccountOrdersOrderId(self.extend(request, params))
|
|
1589
|
+
#
|
|
1590
|
+
# {
|
|
1591
|
+
# "order": {
|
|
1592
|
+
# "order_id": "36bb2437-7402-4794-bf26-4bdf03526439",
|
|
1593
|
+
# "account_id": "a4c699f6-338d-4a26-941f-8f9853bfc4b9",
|
|
1594
|
+
# "time_last_updated": "2019-09-27T15:05:35.096Z",
|
|
1595
|
+
# "sequence": 48782,
|
|
1596
|
+
# "price": "7349.2",
|
|
1597
|
+
# "filled_amount": "100.0",
|
|
1598
|
+
# "status": "FILLED_FULLY",
|
|
1599
|
+
# "amount": "100.0",
|
|
1600
|
+
# "instrument_code": "BTC_EUR",
|
|
1601
|
+
# "side": "BUY",
|
|
1602
|
+
# "time": "2019-09-27T15:05:32.063Z",
|
|
1603
|
+
# "type": "MARKET"
|
|
1604
|
+
# },
|
|
1605
|
+
# "trades": [
|
|
1606
|
+
# {
|
|
1607
|
+
# "fee": {
|
|
1608
|
+
# "fee_amount": "0.0014",
|
|
1609
|
+
# "fee_currency": "BTC",
|
|
1610
|
+
# "fee_percentage": "0.1",
|
|
1611
|
+
# "fee_group_id": "default",
|
|
1612
|
+
# "fee_type": "TAKER",
|
|
1613
|
+
# "running_trading_volume": "0.0"
|
|
1614
|
+
# },
|
|
1615
|
+
# "trade": {
|
|
1616
|
+
# "trade_id": "fdff2bcc-37d6-4a2d-92a5-46e09c868664",
|
|
1617
|
+
# "order_id": "36bb2437-7402-4794-bf26-4bdf03526439",
|
|
1618
|
+
# "account_id": "a4c699f6-338d-4a26-941f-8f9853bfc4b9",
|
|
1619
|
+
# "amount": "1.4",
|
|
1620
|
+
# "side": "BUY",
|
|
1621
|
+
# "instrument_code": "BTC_EUR",
|
|
1622
|
+
# "price": "7341.4",
|
|
1623
|
+
# "time": "2019-09-27T15:05:32.564Z",
|
|
1624
|
+
# "sequence": 48670
|
|
1625
|
+
# }
|
|
1626
|
+
# }
|
|
1627
|
+
# ]
|
|
1628
|
+
# }
|
|
1629
|
+
#
|
|
1630
|
+
return self.parse_order(response)
|
|
1631
|
+
|
|
1632
|
+
def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
|
1633
|
+
"""
|
|
1634
|
+
fetch all unfilled currently open orders
|
|
1635
|
+
:param str symbol: unified market symbol
|
|
1636
|
+
:param int [since]: the earliest time in ms to fetch open orders for
|
|
1637
|
+
:param int [limit]: the maximum number of open orders structures to retrieve
|
|
1638
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1639
|
+
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
|
1640
|
+
"""
|
|
1641
|
+
self.load_markets()
|
|
1642
|
+
request: dict = {
|
|
1643
|
+
# 'from': self.iso8601(since),
|
|
1644
|
+
# 'to': self.iso8601(self.milliseconds()), # max range is 100 days
|
|
1645
|
+
# 'instrument_code': market['id'],
|
|
1646
|
+
# 'with_cancelled_and_rejected': False, # default is False, orders which have been cancelled by the user before being filled or rejected by the system, additionally, all inactive filled orders which would return with "with_just_filled_inactive"
|
|
1647
|
+
# 'with_just_filled_inactive': False, # orders which have been filled and are no longer open, use of "with_cancelled_and_rejected" extends "with_just_filled_inactive" and in case both are specified the latter is ignored
|
|
1648
|
+
# 'with_just_orders': False, # do not return any trades corresponsing to the orders, it may be significanly faster and should be used if user is not interesting in trade information
|
|
1649
|
+
# 'max_page_size': 100,
|
|
1650
|
+
# 'cursor': 'string', # pointer specifying the position from which the next pages should be returned
|
|
1651
|
+
}
|
|
1652
|
+
market = None
|
|
1653
|
+
if symbol is not None:
|
|
1654
|
+
market = self.market(symbol)
|
|
1655
|
+
request['instrument_code'] = market['id']
|
|
1656
|
+
if since is not None:
|
|
1657
|
+
to = self.safe_string(params, 'to')
|
|
1658
|
+
if to is None:
|
|
1659
|
+
raise ArgumentsRequired(self.id + ' fetchOpenOrders() requires a "to" iso8601 string param with the since argument is specified, max range is 100 days')
|
|
1660
|
+
request['from'] = self.iso8601(since)
|
|
1661
|
+
if limit is not None:
|
|
1662
|
+
request['max_page_size'] = limit
|
|
1663
|
+
response = self.privateGetAccountOrders(self.extend(request, params))
|
|
1664
|
+
#
|
|
1665
|
+
# {
|
|
1666
|
+
# "order_history": [
|
|
1667
|
+
# {
|
|
1668
|
+
# "order": {
|
|
1669
|
+
# "trigger_price": "12089.88",
|
|
1670
|
+
# "order_id": "d453ca12-c650-46dd-9dee-66910d96bfc0",
|
|
1671
|
+
# "account_id": "ef3a5f4c-cfcd-415e-ba89-5a9abf47b28a",
|
|
1672
|
+
# "instrument_code": "BTC_USDT",
|
|
1673
|
+
# "time": "2019-08-23T10:02:31.663Z",
|
|
1674
|
+
# "side": "SELL",
|
|
1675
|
+
# "price": "10159.76",
|
|
1676
|
+
# "average_price": "10159.76",
|
|
1677
|
+
# "amount": "0.2",
|
|
1678
|
+
# "filled_amount": "0.2",
|
|
1679
|
+
# "type": "STOP",
|
|
1680
|
+
# "sequence": 8,
|
|
1681
|
+
# "status": "FILLED_FULLY"
|
|
1682
|
+
# },
|
|
1683
|
+
# "trades": [
|
|
1684
|
+
# {
|
|
1685
|
+
# "fee": {
|
|
1686
|
+
# "fee_amount": "0.4188869",
|
|
1687
|
+
# "fee_currency": "USDT",
|
|
1688
|
+
# "fee_percentage": "0.1",
|
|
1689
|
+
# "fee_group_id": "default",
|
|
1690
|
+
# "fee_type": "TAKER",
|
|
1691
|
+
# "running_trading_volume": "0.0"
|
|
1692
|
+
# },
|
|
1693
|
+
# "trade": {
|
|
1694
|
+
# "trade_id": "ec82896f-fd1b-4cbb-89df-a9da85ccbb4b",
|
|
1695
|
+
# "order_id": "d453ca12-c650-46dd-9dee-66910d96bfc0",
|
|
1696
|
+
# "account_id": "ef3a5f4c-cfcd-415e-ba89-5a9abf47b28a",
|
|
1697
|
+
# "amount": "0.2",
|
|
1698
|
+
# "side": "SELL",
|
|
1699
|
+
# "instrument_code": "BTC_USDT",
|
|
1700
|
+
# "price": "10159.76",
|
|
1701
|
+
# "time": "2019-08-23T10:02:32.663Z",
|
|
1702
|
+
# "sequence": 9
|
|
1703
|
+
# }
|
|
1704
|
+
# }
|
|
1705
|
+
# ]
|
|
1706
|
+
# },
|
|
1707
|
+
# {
|
|
1708
|
+
# "order": {
|
|
1709
|
+
# "order_id": "5151a99e-f414-418f-8cf1-2568d0a63ea5",
|
|
1710
|
+
# "account_id": "ef3a5f4c-cfcd-415e-ba89-5a9abf47b28a",
|
|
1711
|
+
# "instrument_code": "BTC_USDT",
|
|
1712
|
+
# "time": "2019-08-23T10:01:36.773Z",
|
|
1713
|
+
# "side": "SELL",
|
|
1714
|
+
# "price": "12289.88",
|
|
1715
|
+
# "amount": "0.5",
|
|
1716
|
+
# "filled_amount": "0.0",
|
|
1717
|
+
# "type": "LIMIT",
|
|
1718
|
+
# "sequence": 7,
|
|
1719
|
+
# "status": "OPEN"
|
|
1720
|
+
# },
|
|
1721
|
+
# "trades": []
|
|
1722
|
+
# },
|
|
1723
|
+
# {
|
|
1724
|
+
# "order": {
|
|
1725
|
+
# "order_id": "ac80d857-75e1-4733-9070-fd4288395fdc",
|
|
1726
|
+
# "account_id": "ef3a5f4c-cfcd-415e-ba89-5a9abf47b28a",
|
|
1727
|
+
# "instrument_code": "BTC_USDT",
|
|
1728
|
+
# "time": "2019-08-23T10:01:25.031Z",
|
|
1729
|
+
# "side": "SELL",
|
|
1730
|
+
# "price": "11089.88",
|
|
1731
|
+
# "amount": "0.1",
|
|
1732
|
+
# "filled_amount": "0.0",
|
|
1733
|
+
# "type": "LIMIT",
|
|
1734
|
+
# "sequence": 6,
|
|
1735
|
+
# "status": "OPEN"
|
|
1736
|
+
# },
|
|
1737
|
+
# "trades": []
|
|
1738
|
+
# }
|
|
1739
|
+
# ],
|
|
1740
|
+
# "max_page_size": 100
|
|
1741
|
+
# }
|
|
1742
|
+
#
|
|
1743
|
+
orderHistory = self.safe_list(response, 'order_history', [])
|
|
1744
|
+
return self.parse_orders(orderHistory, market, since, limit)
|
|
1745
|
+
|
|
1746
|
+
def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
|
1747
|
+
"""
|
|
1748
|
+
fetches information on multiple closed orders made by the user
|
|
1749
|
+
:param str symbol: unified market symbol of the market orders were made in
|
|
1750
|
+
:param int [since]: the earliest time in ms to fetch orders for
|
|
1751
|
+
:param int [limit]: the maximum number of order structures to retrieve
|
|
1752
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1753
|
+
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
|
1754
|
+
"""
|
|
1755
|
+
request: dict = {
|
|
1756
|
+
'with_cancelled_and_rejected': True, # default is False, orders which have been cancelled by the user before being filled or rejected by the system, additionally, all inactive filled orders which would return with "with_just_filled_inactive"
|
|
1757
|
+
}
|
|
1758
|
+
return self.fetch_open_orders(symbol, since, limit, self.extend(request, params))
|
|
1759
|
+
|
|
1760
|
+
def fetch_order_trades(self, id: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
|
1761
|
+
"""
|
|
1762
|
+
fetch all the trades made from a single order
|
|
1763
|
+
:param str id: order id
|
|
1764
|
+
:param str symbol: unified market symbol
|
|
1765
|
+
:param int [since]: the earliest time in ms to fetch trades for
|
|
1766
|
+
:param int [limit]: the maximum number of trades to retrieve
|
|
1767
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1768
|
+
:returns dict[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
|
|
1769
|
+
"""
|
|
1770
|
+
self.load_markets()
|
|
1771
|
+
request: dict = {
|
|
1772
|
+
'order_id': id,
|
|
1773
|
+
# 'max_page_size': 100,
|
|
1774
|
+
# 'cursor': 'string', # pointer specifying the position from which the next pages should be returned
|
|
1775
|
+
}
|
|
1776
|
+
if limit is not None:
|
|
1777
|
+
request['max_page_size'] = limit
|
|
1778
|
+
response = self.privateGetAccountOrdersOrderIdTrades(self.extend(request, params))
|
|
1779
|
+
#
|
|
1780
|
+
# {
|
|
1781
|
+
# "trade_history": [
|
|
1782
|
+
# {
|
|
1783
|
+
# "trade": {
|
|
1784
|
+
# "trade_id": "2b42efcd-d5b7-4a56-8e12-b69ffd68c5ef",
|
|
1785
|
+
# "order_id": "66756a10-3e86-48f4-9678-b634c4b135b2",
|
|
1786
|
+
# "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
|
|
1787
|
+
# "amount": "1234.5678",
|
|
1788
|
+
# "side": "BUY",
|
|
1789
|
+
# "instrument_code": "BTC_EUR",
|
|
1790
|
+
# "price": "1234.5678",
|
|
1791
|
+
# "time": "2019-08-24T14:15:22Z",
|
|
1792
|
+
# "price_tick_sequence": 0,
|
|
1793
|
+
# "sequence": 123456789
|
|
1794
|
+
# },
|
|
1795
|
+
# "fee": {
|
|
1796
|
+
# "fee_amount": "1234.5678",
|
|
1797
|
+
# "fee_percentage": "1234.5678",
|
|
1798
|
+
# "fee_group_id": "default",
|
|
1799
|
+
# "running_trading_volume": "1234.5678",
|
|
1800
|
+
# "fee_currency": "BTC",
|
|
1801
|
+
# "fee_type": "TAKER"
|
|
1802
|
+
# }
|
|
1803
|
+
# }
|
|
1804
|
+
# ],
|
|
1805
|
+
# "max_page_size": 0,
|
|
1806
|
+
# "cursor": "string"
|
|
1807
|
+
# }
|
|
1808
|
+
#
|
|
1809
|
+
tradeHistory = self.safe_value(response, 'trade_history', [])
|
|
1810
|
+
market = None
|
|
1811
|
+
if symbol is not None:
|
|
1812
|
+
market = self.market(symbol)
|
|
1813
|
+
return self.parse_trades(tradeHistory, market, since, limit)
|
|
1814
|
+
|
|
1815
|
+
def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
|
1816
|
+
"""
|
|
1817
|
+
fetch all trades made by the user
|
|
1818
|
+
:param str symbol: unified market symbol
|
|
1819
|
+
:param int [since]: the earliest time in ms to fetch trades for
|
|
1820
|
+
:param int [limit]: the maximum number of trades structures to retrieve
|
|
1821
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1822
|
+
:returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
|
|
1823
|
+
"""
|
|
1824
|
+
self.load_markets()
|
|
1825
|
+
request: dict = {
|
|
1826
|
+
# 'from': self.iso8601(since),
|
|
1827
|
+
# 'to': self.iso8601(self.milliseconds()), # max range is 100 days
|
|
1828
|
+
# 'instrument_code': market['id'],
|
|
1829
|
+
# 'max_page_size': 100,
|
|
1830
|
+
# 'cursor': 'string', # pointer specifying the position from which the next pages should be returned
|
|
1831
|
+
}
|
|
1832
|
+
market = None
|
|
1833
|
+
if symbol is not None:
|
|
1834
|
+
market = self.market(symbol)
|
|
1835
|
+
request['instrument_code'] = market['id']
|
|
1836
|
+
if since is not None:
|
|
1837
|
+
to = self.safe_string(params, 'to')
|
|
1838
|
+
if to is None:
|
|
1839
|
+
raise ArgumentsRequired(self.id + ' fetchMyTrades() requires a "to" iso8601 string param with the since argument is specified, max range is 100 days')
|
|
1840
|
+
request['from'] = self.iso8601(since)
|
|
1841
|
+
if limit is not None:
|
|
1842
|
+
request['max_page_size'] = limit
|
|
1843
|
+
response = self.privateGetAccountTrades(self.extend(request, params))
|
|
1844
|
+
#
|
|
1845
|
+
# {
|
|
1846
|
+
# "trade_history": [
|
|
1847
|
+
# {
|
|
1848
|
+
# "trade": {
|
|
1849
|
+
# "trade_id": "2b42efcd-d5b7-4a56-8e12-b69ffd68c5ef",
|
|
1850
|
+
# "order_id": "66756a10-3e86-48f4-9678-b634c4b135b2",
|
|
1851
|
+
# "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
|
|
1852
|
+
# "amount": "1234.5678",
|
|
1853
|
+
# "side": "BUY",
|
|
1854
|
+
# "instrument_code": "BTC_EUR",
|
|
1855
|
+
# "price": "1234.5678",
|
|
1856
|
+
# "time": "2019-08-24T14:15:22Z",
|
|
1857
|
+
# "price_tick_sequence": 0,
|
|
1858
|
+
# "sequence": 123456789
|
|
1859
|
+
# },
|
|
1860
|
+
# "fee": {
|
|
1861
|
+
# "fee_amount": "1234.5678",
|
|
1862
|
+
# "fee_percentage": "1234.5678",
|
|
1863
|
+
# "fee_group_id": "default",
|
|
1864
|
+
# "running_trading_volume": "1234.5678",
|
|
1865
|
+
# "fee_currency": "BTC",
|
|
1866
|
+
# "fee_type": "TAKER"
|
|
1867
|
+
# }
|
|
1868
|
+
# }
|
|
1869
|
+
# ],
|
|
1870
|
+
# "max_page_size": 0,
|
|
1871
|
+
# "cursor": "string"
|
|
1872
|
+
# }
|
|
1873
|
+
#
|
|
1874
|
+
tradeHistory = self.safe_list(response, 'trade_history', [])
|
|
1875
|
+
return self.parse_trades(tradeHistory, market, since, limit)
|
|
1876
|
+
|
|
1877
|
+
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
|
1878
|
+
url = self.urls['api'][api] + '/' + self.version + '/' + self.implode_params(path, params)
|
|
1879
|
+
query = self.omit(params, self.extract_params(path))
|
|
1880
|
+
if api == 'public':
|
|
1881
|
+
if query:
|
|
1882
|
+
url += '?' + self.urlencode(query)
|
|
1883
|
+
elif api == 'private':
|
|
1884
|
+
self.check_required_credentials()
|
|
1885
|
+
headers = {
|
|
1886
|
+
'Accept': 'application/json',
|
|
1887
|
+
'Authorization': 'Bearer ' + self.apiKey,
|
|
1888
|
+
}
|
|
1889
|
+
if method == 'POST':
|
|
1890
|
+
body = self.json(query)
|
|
1891
|
+
headers['Content-Type'] = 'application/json'
|
|
1892
|
+
else:
|
|
1893
|
+
if query:
|
|
1894
|
+
url += '?' + self.urlencode(query)
|
|
1895
|
+
return {'url': url, 'method': method, 'body': body, 'headers': headers}
|
|
1896
|
+
|
|
1897
|
+
def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
|
|
1898
|
+
if response is None:
|
|
1899
|
+
return None
|
|
1900
|
+
#
|
|
1901
|
+
# {"error":"MISSING_FROM_PARAM"}
|
|
1902
|
+
# {"error":"MISSING_TO_PARAM"}
|
|
1903
|
+
# {"error":"CANDLESTICKS_TIME_RANGE_TOO_BIG"}
|
|
1904
|
+
#
|
|
1905
|
+
message = self.safe_string(response, 'error')
|
|
1906
|
+
if message is not None:
|
|
1907
|
+
feedback = self.id + ' ' + body
|
|
1908
|
+
self.throw_exactly_matched_exception(self.exceptions['exact'], message, feedback)
|
|
1909
|
+
self.throw_broadly_matched_exception(self.exceptions['broad'], message, feedback)
|
|
1910
|
+
raise ExchangeError(feedback) # unknown message
|
|
1911
|
+
return None
|