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/upbit.py
ADDED
|
@@ -0,0 +1,1833 @@
|
|
|
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.upbit import ImplicitAPI
|
|
8
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, 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 AddressPending
|
|
17
|
+
from ccxt.base.errors import InvalidOrder
|
|
18
|
+
from ccxt.base.errors import OrderNotFound
|
|
19
|
+
from ccxt.base.decimal_to_precision import TICK_SIZE
|
|
20
|
+
from ccxt.base.precise import Precise
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class upbit(Exchange, ImplicitAPI):
|
|
24
|
+
|
|
25
|
+
def describe(self):
|
|
26
|
+
return self.deep_extend(super(upbit, self).describe(), {
|
|
27
|
+
'id': 'upbit',
|
|
28
|
+
'name': 'Upbit',
|
|
29
|
+
'countries': ['KR'],
|
|
30
|
+
'version': 'v1',
|
|
31
|
+
'rateLimit': 1000,
|
|
32
|
+
'pro': True,
|
|
33
|
+
# new metainfo interface
|
|
34
|
+
'has': {
|
|
35
|
+
'CORS': True,
|
|
36
|
+
'spot': True,
|
|
37
|
+
'margin': None,
|
|
38
|
+
'swap': False,
|
|
39
|
+
'future': False,
|
|
40
|
+
'option': False,
|
|
41
|
+
'cancelOrder': True,
|
|
42
|
+
'createDepositAddress': True,
|
|
43
|
+
'createMarketBuyOrderWithCost': True,
|
|
44
|
+
'createMarketOrder': True,
|
|
45
|
+
'createMarketOrderWithCost': False,
|
|
46
|
+
'createMarketSellOrderWithCost': False,
|
|
47
|
+
'createOrder': True,
|
|
48
|
+
'fetchBalance': True,
|
|
49
|
+
'fetchCanceledOrders': True,
|
|
50
|
+
'fetchClosedOrders': True,
|
|
51
|
+
'fetchDeposit': True,
|
|
52
|
+
'fetchDepositAddress': True,
|
|
53
|
+
'fetchDepositAddresses': True,
|
|
54
|
+
'fetchDeposits': True,
|
|
55
|
+
'fetchFundingHistory': False,
|
|
56
|
+
'fetchFundingRate': False,
|
|
57
|
+
'fetchFundingRateHistory': False,
|
|
58
|
+
'fetchFundingRates': False,
|
|
59
|
+
'fetchIndexOHLCV': False,
|
|
60
|
+
'fetchMarginMode': False,
|
|
61
|
+
'fetchMarkets': True,
|
|
62
|
+
'fetchMarkOHLCV': False,
|
|
63
|
+
'fetchMyTrades': False,
|
|
64
|
+
'fetchOHLCV': True,
|
|
65
|
+
'fetchOpenInterestHistory': False,
|
|
66
|
+
'fetchOpenOrders': True,
|
|
67
|
+
'fetchOrder': True,
|
|
68
|
+
'fetchOrderBook': True,
|
|
69
|
+
'fetchOrderBooks': True,
|
|
70
|
+
'fetchOrders': False,
|
|
71
|
+
'fetchPositionMode': False,
|
|
72
|
+
'fetchPremiumIndexOHLCV': False,
|
|
73
|
+
'fetchTicker': True,
|
|
74
|
+
'fetchTickers': True,
|
|
75
|
+
'fetchTrades': True,
|
|
76
|
+
'fetchTradingFee': True,
|
|
77
|
+
'fetchTradingFees': False,
|
|
78
|
+
'fetchTransactions': False,
|
|
79
|
+
'fetchWithdrawal': True,
|
|
80
|
+
'fetchWithdrawals': True,
|
|
81
|
+
'transfer': False,
|
|
82
|
+
'withdraw': True,
|
|
83
|
+
},
|
|
84
|
+
'timeframes': {
|
|
85
|
+
'1m': 'minutes',
|
|
86
|
+
'3m': 'minutes',
|
|
87
|
+
'5m': 'minutes',
|
|
88
|
+
'10m': 'minutes',
|
|
89
|
+
'15m': 'minutes',
|
|
90
|
+
'30m': 'minutes',
|
|
91
|
+
'1h': 'minutes',
|
|
92
|
+
'4h': 'minutes',
|
|
93
|
+
'1d': 'days',
|
|
94
|
+
'1w': 'weeks',
|
|
95
|
+
'1M': 'months',
|
|
96
|
+
},
|
|
97
|
+
'hostname': 'api.upbit.com',
|
|
98
|
+
'urls': {
|
|
99
|
+
'logo': 'https://user-images.githubusercontent.com/1294454/49245610-eeaabe00-f423-11e8-9cba-4b0aed794799.jpg',
|
|
100
|
+
'api': {
|
|
101
|
+
'public': 'https://{hostname}',
|
|
102
|
+
'private': 'https://{hostname}',
|
|
103
|
+
},
|
|
104
|
+
'www': 'https://upbit.com',
|
|
105
|
+
'doc': 'https://docs.upbit.com/docs/%EC%9A%94%EC%B2%AD-%EC%88%98-%EC%A0%9C%ED%95%9C',
|
|
106
|
+
'fees': 'https://upbit.com/service_center/guide',
|
|
107
|
+
},
|
|
108
|
+
'api': {
|
|
109
|
+
'public': {
|
|
110
|
+
'get': [
|
|
111
|
+
'market/all',
|
|
112
|
+
'candles/{timeframe}',
|
|
113
|
+
'candles/{timeframe}/{unit}',
|
|
114
|
+
'candles/minutes/{unit}',
|
|
115
|
+
'candles/minutes/1',
|
|
116
|
+
'candles/minutes/3',
|
|
117
|
+
'candles/minutes/5',
|
|
118
|
+
'candles/minutes/10',
|
|
119
|
+
'candles/minutes/15',
|
|
120
|
+
'candles/minutes/30',
|
|
121
|
+
'candles/minutes/60',
|
|
122
|
+
'candles/minutes/240',
|
|
123
|
+
'candles/days',
|
|
124
|
+
'candles/weeks',
|
|
125
|
+
'candles/months',
|
|
126
|
+
'trades/ticks',
|
|
127
|
+
'ticker',
|
|
128
|
+
'orderbook',
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
'private': {
|
|
132
|
+
'get': [
|
|
133
|
+
'accounts',
|
|
134
|
+
'orders/chance',
|
|
135
|
+
'order',
|
|
136
|
+
'orders',
|
|
137
|
+
'withdraws',
|
|
138
|
+
'withdraw',
|
|
139
|
+
'withdraws/chance',
|
|
140
|
+
'deposits',
|
|
141
|
+
'deposit',
|
|
142
|
+
'deposits/coin_addresses',
|
|
143
|
+
'deposits/coin_address',
|
|
144
|
+
],
|
|
145
|
+
'post': [
|
|
146
|
+
'orders',
|
|
147
|
+
'withdraws/coin',
|
|
148
|
+
'withdraws/krw',
|
|
149
|
+
'deposits/generate_coin_address',
|
|
150
|
+
],
|
|
151
|
+
'delete': [
|
|
152
|
+
'order',
|
|
153
|
+
],
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
'fees': {
|
|
157
|
+
'trading': {
|
|
158
|
+
'tierBased': False,
|
|
159
|
+
'percentage': True,
|
|
160
|
+
'maker': self.parse_number('0.0025'),
|
|
161
|
+
'taker': self.parse_number('0.0025'),
|
|
162
|
+
},
|
|
163
|
+
'funding': {
|
|
164
|
+
'tierBased': False,
|
|
165
|
+
'percentage': False,
|
|
166
|
+
'withdraw': {},
|
|
167
|
+
'deposit': {},
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
'precisionMode': TICK_SIZE,
|
|
171
|
+
'exceptions': {
|
|
172
|
+
'exact': {
|
|
173
|
+
'This key has expired.': AuthenticationError,
|
|
174
|
+
'Missing request parameter error. Check the required parameters!': BadRequest,
|
|
175
|
+
'side is missing, side does not have a valid value': InvalidOrder,
|
|
176
|
+
},
|
|
177
|
+
'broad': {
|
|
178
|
+
'thirdparty_agreement_required': PermissionDenied,
|
|
179
|
+
'out_of_scope': PermissionDenied,
|
|
180
|
+
'order_not_found': OrderNotFound,
|
|
181
|
+
'insufficient_funds': InsufficientFunds,
|
|
182
|
+
'invalid_access_key': AuthenticationError,
|
|
183
|
+
'jwt_verification': AuthenticationError,
|
|
184
|
+
'create_ask_error': ExchangeError,
|
|
185
|
+
'create_bid_error': ExchangeError,
|
|
186
|
+
'volume_too_large': InvalidOrder,
|
|
187
|
+
'invalid_funds': InvalidOrder,
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
'options': {
|
|
191
|
+
'createMarketBuyOrderRequiresPrice': True,
|
|
192
|
+
'fetchTickersMaxLength': 4096, # 2048,
|
|
193
|
+
'fetchOrderBooksMaxLength': 4096, # 2048,
|
|
194
|
+
'tradingFeesByQuoteCurrency': {
|
|
195
|
+
'KRW': 0.0005,
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
'commonCurrencies': {
|
|
199
|
+
'TON': 'Tokamak Network',
|
|
200
|
+
},
|
|
201
|
+
})
|
|
202
|
+
|
|
203
|
+
def fetch_currency(self, code: str, params={}):
|
|
204
|
+
# self method is for retrieving funding fees and limits per currency
|
|
205
|
+
# it requires private access and API keys properly set up
|
|
206
|
+
self.load_markets()
|
|
207
|
+
currency = self.currency(code)
|
|
208
|
+
return self.fetch_currency_by_id(currency['id'], params)
|
|
209
|
+
|
|
210
|
+
def fetch_currency_by_id(self, id: str, params={}):
|
|
211
|
+
# self method is for retrieving funding fees and limits per currency
|
|
212
|
+
# it requires private access and API keys properly set up
|
|
213
|
+
request: dict = {
|
|
214
|
+
'currency': id,
|
|
215
|
+
}
|
|
216
|
+
response = self.privateGetWithdrawsChance(self.extend(request, params))
|
|
217
|
+
#
|
|
218
|
+
# {
|
|
219
|
+
# "member_level": {
|
|
220
|
+
# "security_level": 3,
|
|
221
|
+
# "fee_level": 0,
|
|
222
|
+
# "email_verified": True,
|
|
223
|
+
# "identity_auth_verified": True,
|
|
224
|
+
# "bank_account_verified": True,
|
|
225
|
+
# "kakao_pay_auth_verified": False,
|
|
226
|
+
# "locked": False,
|
|
227
|
+
# "wallet_locked": False
|
|
228
|
+
# },
|
|
229
|
+
# "currency": {
|
|
230
|
+
# "code": "BTC",
|
|
231
|
+
# "withdraw_fee": "0.0005",
|
|
232
|
+
# "is_coin": True,
|
|
233
|
+
# "wallet_state": "working",
|
|
234
|
+
# "wallet_support": ["deposit", "withdraw"]
|
|
235
|
+
# },
|
|
236
|
+
# "account": {
|
|
237
|
+
# "currency": "BTC",
|
|
238
|
+
# "balance": "10.0",
|
|
239
|
+
# "locked": "0.0",
|
|
240
|
+
# "avg_krw_buy_price": "8042000",
|
|
241
|
+
# "modified": False
|
|
242
|
+
# },
|
|
243
|
+
# "withdraw_limit": {
|
|
244
|
+
# "currency": "BTC",
|
|
245
|
+
# "minimum": null,
|
|
246
|
+
# "onetime": null,
|
|
247
|
+
# "daily": "10.0",
|
|
248
|
+
# "remaining_daily": "10.0",
|
|
249
|
+
# "remaining_daily_krw": "0.0",
|
|
250
|
+
# "fixed": null,
|
|
251
|
+
# "can_withdraw": True
|
|
252
|
+
# }
|
|
253
|
+
# }
|
|
254
|
+
#
|
|
255
|
+
memberInfo = self.safe_value(response, 'member_level', {})
|
|
256
|
+
currencyInfo = self.safe_value(response, 'currency', {})
|
|
257
|
+
withdrawLimits = self.safe_value(response, 'withdraw_limit', {})
|
|
258
|
+
canWithdraw = self.safe_value(withdrawLimits, 'can_withdraw')
|
|
259
|
+
walletState = self.safe_string(currencyInfo, 'wallet_state')
|
|
260
|
+
walletLocked = self.safe_value(memberInfo, 'wallet_locked')
|
|
261
|
+
locked = self.safe_value(memberInfo, 'locked')
|
|
262
|
+
active = True
|
|
263
|
+
if (canWithdraw is not None) and not canWithdraw:
|
|
264
|
+
active = False
|
|
265
|
+
elif walletState != 'working':
|
|
266
|
+
active = False
|
|
267
|
+
elif (walletLocked is not None) and walletLocked:
|
|
268
|
+
active = False
|
|
269
|
+
elif (locked is not None) and locked:
|
|
270
|
+
active = False
|
|
271
|
+
maxOnetimeWithdrawal = self.safe_string(withdrawLimits, 'onetime')
|
|
272
|
+
maxDailyWithdrawal = self.safe_string(withdrawLimits, 'daily', maxOnetimeWithdrawal)
|
|
273
|
+
remainingDailyWithdrawal = self.safe_string(withdrawLimits, 'remaining_daily', maxDailyWithdrawal)
|
|
274
|
+
maxWithdrawLimit = None
|
|
275
|
+
if Precise.string_gt(remainingDailyWithdrawal, '0'):
|
|
276
|
+
maxWithdrawLimit = remainingDailyWithdrawal
|
|
277
|
+
else:
|
|
278
|
+
maxWithdrawLimit = maxDailyWithdrawal
|
|
279
|
+
currencyId = self.safe_string(currencyInfo, 'code')
|
|
280
|
+
code = self.safe_currency_code(currencyId)
|
|
281
|
+
return {
|
|
282
|
+
'info': response,
|
|
283
|
+
'id': currencyId,
|
|
284
|
+
'code': code,
|
|
285
|
+
'name': code,
|
|
286
|
+
'active': active,
|
|
287
|
+
'fee': self.safe_number(currencyInfo, 'withdraw_fee'),
|
|
288
|
+
'precision': None,
|
|
289
|
+
'limits': {
|
|
290
|
+
'withdraw': {
|
|
291
|
+
'min': self.safe_number(withdrawLimits, 'minimum'),
|
|
292
|
+
'max': self.parse_number(maxWithdrawLimit),
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
def fetch_market(self, symbol: str, params={}):
|
|
298
|
+
# self method is for retrieving trading fees and limits per market
|
|
299
|
+
# it requires private access and API keys properly set up
|
|
300
|
+
self.load_markets()
|
|
301
|
+
market = self.market(symbol)
|
|
302
|
+
return self.fetch_market_by_id(market['id'], params)
|
|
303
|
+
|
|
304
|
+
def fetch_market_by_id(self, id: str, params={}):
|
|
305
|
+
# self method is for retrieving trading fees and limits per market
|
|
306
|
+
# it requires private access and API keys properly set up
|
|
307
|
+
request: dict = {
|
|
308
|
+
'market': id,
|
|
309
|
+
}
|
|
310
|
+
response = self.privateGetOrdersChance(self.extend(request, params))
|
|
311
|
+
#
|
|
312
|
+
# {
|
|
313
|
+
# "bid_fee": "0.0015",
|
|
314
|
+
# "ask_fee": "0.0015",
|
|
315
|
+
# "market": {
|
|
316
|
+
# "id": "KRW-BTC",
|
|
317
|
+
# "name": "BTC/KRW",
|
|
318
|
+
# "order_types": ["limit"],
|
|
319
|
+
# "order_sides": ["ask", "bid"],
|
|
320
|
+
# "bid": {"currency": "KRW", "price_unit": null, "min_total": 1000},
|
|
321
|
+
# "ask": {"currency": "BTC", "price_unit": null, "min_total": 1000},
|
|
322
|
+
# "max_total": "100000000.0",
|
|
323
|
+
# "state": "active",
|
|
324
|
+
# },
|
|
325
|
+
# "bid_account": {
|
|
326
|
+
# "currency": "KRW",
|
|
327
|
+
# "balance": "0.0",
|
|
328
|
+
# "locked": "0.0",
|
|
329
|
+
# "avg_buy_price": "0",
|
|
330
|
+
# "avg_buy_price_modified": False,
|
|
331
|
+
# "unit_currency": "KRW",
|
|
332
|
+
# },
|
|
333
|
+
# "ask_account": {
|
|
334
|
+
# "currency": "BTC",
|
|
335
|
+
# "balance": "10.0",
|
|
336
|
+
# "locked": "0.0",
|
|
337
|
+
# "avg_buy_price": "8042000",
|
|
338
|
+
# "avg_buy_price_modified": False,
|
|
339
|
+
# "unit_currency": "KRW",
|
|
340
|
+
# }
|
|
341
|
+
# }
|
|
342
|
+
#
|
|
343
|
+
marketInfo = self.safe_value(response, 'market')
|
|
344
|
+
bid = self.safe_value(marketInfo, 'bid')
|
|
345
|
+
ask = self.safe_value(marketInfo, 'ask')
|
|
346
|
+
marketId = self.safe_string(marketInfo, 'id')
|
|
347
|
+
baseId = self.safe_string(ask, 'currency')
|
|
348
|
+
quoteId = self.safe_string(bid, 'currency')
|
|
349
|
+
base = self.safe_currency_code(baseId)
|
|
350
|
+
quote = self.safe_currency_code(quoteId)
|
|
351
|
+
state = self.safe_string(marketInfo, 'state')
|
|
352
|
+
bidFee = self.safe_string(response, 'bid_fee')
|
|
353
|
+
askFee = self.safe_string(response, 'ask_fee')
|
|
354
|
+
fee = self.parse_number(Precise.string_max(bidFee, askFee))
|
|
355
|
+
return self.safe_market_structure({
|
|
356
|
+
'id': marketId,
|
|
357
|
+
'symbol': base + '/' + quote,
|
|
358
|
+
'base': base,
|
|
359
|
+
'quote': quote,
|
|
360
|
+
'settle': None,
|
|
361
|
+
'baseId': baseId,
|
|
362
|
+
'quoteId': quoteId,
|
|
363
|
+
'settleId': None,
|
|
364
|
+
'type': 'spot',
|
|
365
|
+
'spot': True,
|
|
366
|
+
'margin': False,
|
|
367
|
+
'swap': False,
|
|
368
|
+
'future': False,
|
|
369
|
+
'option': False,
|
|
370
|
+
'active': (state == 'active'),
|
|
371
|
+
'contract': False,
|
|
372
|
+
'linear': None,
|
|
373
|
+
'inverse': None,
|
|
374
|
+
'taker': fee,
|
|
375
|
+
'maker': fee,
|
|
376
|
+
'contractSize': None,
|
|
377
|
+
'expiry': None,
|
|
378
|
+
'expiryDatetime': None,
|
|
379
|
+
'strike': None,
|
|
380
|
+
'optionType': None,
|
|
381
|
+
'precision': {
|
|
382
|
+
'amount': self.parse_number('1e-8'),
|
|
383
|
+
'price': self.parse_number('1e-8'),
|
|
384
|
+
},
|
|
385
|
+
'limits': {
|
|
386
|
+
'leverage': {
|
|
387
|
+
'min': None,
|
|
388
|
+
'max': None,
|
|
389
|
+
},
|
|
390
|
+
'amount': {
|
|
391
|
+
'min': self.safe_number(ask, 'min_total'),
|
|
392
|
+
'max': None,
|
|
393
|
+
},
|
|
394
|
+
'price': {
|
|
395
|
+
'min': None,
|
|
396
|
+
'max': None,
|
|
397
|
+
},
|
|
398
|
+
'cost': {
|
|
399
|
+
'min': self.safe_number(bid, 'min_total'),
|
|
400
|
+
'max': self.safe_number(marketInfo, 'max_total'),
|
|
401
|
+
},
|
|
402
|
+
'info': response,
|
|
403
|
+
},
|
|
404
|
+
})
|
|
405
|
+
|
|
406
|
+
def fetch_markets(self, params={}) -> List[Market]:
|
|
407
|
+
"""
|
|
408
|
+
:see: https://docs.upbit.com/reference/%EB%A7%88%EC%BC%93-%EC%BD%94%EB%93%9C-%EC%A1%B0%ED%9A%8C
|
|
409
|
+
retrieves data on all markets for upbit
|
|
410
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
411
|
+
:returns dict[]: an array of objects representing market data
|
|
412
|
+
"""
|
|
413
|
+
response = self.publicGetMarketAll(params)
|
|
414
|
+
#
|
|
415
|
+
# [
|
|
416
|
+
# {
|
|
417
|
+
# "market": "KRW-BTC",
|
|
418
|
+
# "korean_name": "비트코인",
|
|
419
|
+
# "english_name": "Bitcoin"
|
|
420
|
+
# },
|
|
421
|
+
# ...,
|
|
422
|
+
# ]
|
|
423
|
+
#
|
|
424
|
+
return self.parse_markets(response)
|
|
425
|
+
|
|
426
|
+
def parse_market(self, market: dict) -> Market:
|
|
427
|
+
id = self.safe_string(market, 'market')
|
|
428
|
+
quoteId, baseId = id.split('-')
|
|
429
|
+
base = self.safe_currency_code(baseId)
|
|
430
|
+
quote = self.safe_currency_code(quoteId)
|
|
431
|
+
return self.safe_market_structure({
|
|
432
|
+
'id': id,
|
|
433
|
+
'symbol': base + '/' + quote,
|
|
434
|
+
'base': base,
|
|
435
|
+
'quote': quote,
|
|
436
|
+
'settle': None,
|
|
437
|
+
'baseId': baseId,
|
|
438
|
+
'quoteId': quoteId,
|
|
439
|
+
'settleId': None,
|
|
440
|
+
'type': 'spot',
|
|
441
|
+
'spot': True,
|
|
442
|
+
'margin': False,
|
|
443
|
+
'swap': False,
|
|
444
|
+
'future': False,
|
|
445
|
+
'option': False,
|
|
446
|
+
'active': True,
|
|
447
|
+
'contract': False,
|
|
448
|
+
'linear': None,
|
|
449
|
+
'inverse': None,
|
|
450
|
+
'taker': self.safe_number(self.options['tradingFeesByQuoteCurrency'], quote, self.fees['trading']['taker']),
|
|
451
|
+
'maker': self.safe_number(self.options['tradingFeesByQuoteCurrency'], quote, self.fees['trading']['maker']),
|
|
452
|
+
'contractSize': None,
|
|
453
|
+
'expiry': None,
|
|
454
|
+
'expiryDatetime': None,
|
|
455
|
+
'strike': None,
|
|
456
|
+
'optionType': None,
|
|
457
|
+
'precision': {
|
|
458
|
+
'price': self.parse_number('1e-8'),
|
|
459
|
+
'amount': self.parse_number('1e-8'),
|
|
460
|
+
},
|
|
461
|
+
'limits': {
|
|
462
|
+
'leverage': {
|
|
463
|
+
'min': None,
|
|
464
|
+
'max': None,
|
|
465
|
+
},
|
|
466
|
+
'amount': {
|
|
467
|
+
'min': None,
|
|
468
|
+
'max': None,
|
|
469
|
+
},
|
|
470
|
+
'price': {
|
|
471
|
+
'min': None,
|
|
472
|
+
'max': None,
|
|
473
|
+
},
|
|
474
|
+
'cost': {
|
|
475
|
+
'min': None,
|
|
476
|
+
'max': None,
|
|
477
|
+
},
|
|
478
|
+
},
|
|
479
|
+
'created': None,
|
|
480
|
+
'info': market,
|
|
481
|
+
})
|
|
482
|
+
|
|
483
|
+
def parse_balance(self, response) -> Balances:
|
|
484
|
+
result: dict = {
|
|
485
|
+
'info': response,
|
|
486
|
+
'timestamp': None,
|
|
487
|
+
'datetime': None,
|
|
488
|
+
}
|
|
489
|
+
for i in range(0, len(response)):
|
|
490
|
+
balance = response[i]
|
|
491
|
+
currencyId = self.safe_string(balance, 'currency')
|
|
492
|
+
code = self.safe_currency_code(currencyId)
|
|
493
|
+
account = self.account()
|
|
494
|
+
account['free'] = self.safe_string(balance, 'balance')
|
|
495
|
+
account['used'] = self.safe_string(balance, 'locked')
|
|
496
|
+
result[code] = account
|
|
497
|
+
return self.safe_balance(result)
|
|
498
|
+
|
|
499
|
+
def fetch_balance(self, params={}) -> Balances:
|
|
500
|
+
"""
|
|
501
|
+
:see: https://docs.upbit.com/reference/%EC%A0%84%EC%B2%B4-%EA%B3%84%EC%A2%8C-%EC%A1%B0%ED%9A%8C
|
|
502
|
+
query for balance and get the amount of funds available for trading or funds locked in orders
|
|
503
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
504
|
+
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
|
505
|
+
"""
|
|
506
|
+
self.load_markets()
|
|
507
|
+
response = self.privateGetAccounts(params)
|
|
508
|
+
#
|
|
509
|
+
# [{ currency: "BTC",
|
|
510
|
+
# "balance": "0.005",
|
|
511
|
+
# "locked": "0.0",
|
|
512
|
+
# "avg_krw_buy_price": "7446000",
|
|
513
|
+
# "modified": False },
|
|
514
|
+
# { currency: "ETH",
|
|
515
|
+
# "balance": "0.1",
|
|
516
|
+
# "locked": "0.0",
|
|
517
|
+
# "avg_krw_buy_price": "250000",
|
|
518
|
+
# "modified": False } ]
|
|
519
|
+
#
|
|
520
|
+
return self.parse_balance(response)
|
|
521
|
+
|
|
522
|
+
def fetch_order_books(self, symbols: Strings = None, limit: Int = None, params={}):
|
|
523
|
+
"""
|
|
524
|
+
:see: https://docs.upbit.com/reference/%ED%98%B8%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C
|
|
525
|
+
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data for multiple markets
|
|
526
|
+
:param str[]|None symbols: list of unified market symbols, all symbols fetched if None, default is None
|
|
527
|
+
:param int [limit]: not used by upbit fetchOrderBooks()
|
|
528
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
529
|
+
:returns dict: a dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbol
|
|
530
|
+
"""
|
|
531
|
+
self.load_markets()
|
|
532
|
+
ids = None
|
|
533
|
+
if symbols is None:
|
|
534
|
+
ids = ','.join(self.ids)
|
|
535
|
+
# max URL length is 2083 symbols, including http schema, hostname, tld, etc...
|
|
536
|
+
if len(ids) > self.options['fetchOrderBooksMaxLength']:
|
|
537
|
+
numIds = len(self.ids)
|
|
538
|
+
raise ExchangeError(self.id + ' fetchOrderBooks() has ' + str(numIds) + ' symbols(' + str(len(ids)) + ' characters) exceeding max URL length(' + str(self.options['fetchOrderBooksMaxLength']) + ' characters), you are required to specify a list of symbols in the first argument to fetchOrderBooks')
|
|
539
|
+
else:
|
|
540
|
+
ids = self.market_ids(symbols)
|
|
541
|
+
ids = ','.join(ids)
|
|
542
|
+
request: dict = {
|
|
543
|
+
'markets': ids,
|
|
544
|
+
}
|
|
545
|
+
response = self.publicGetOrderbook(self.extend(request, params))
|
|
546
|
+
#
|
|
547
|
+
# [{ market: "BTC-ETH",
|
|
548
|
+
# "timestamp": 1542899030043,
|
|
549
|
+
# "total_ask_size": 109.57065201,
|
|
550
|
+
# "total_bid_size": 125.74430631,
|
|
551
|
+
# "orderbook_units": [{ask_price: 0.02926679,
|
|
552
|
+
# "bid_price": 0.02919904,
|
|
553
|
+
# "ask_size": 4.20293961,
|
|
554
|
+
# "bid_size": 11.65043576},
|
|
555
|
+
# ...,
|
|
556
|
+
# {ask_price: 0.02938209,
|
|
557
|
+
# "bid_price": 0.0291231,
|
|
558
|
+
# "ask_size": 0.05135782,
|
|
559
|
+
# "bid_size": 13.5595 } ]},
|
|
560
|
+
# { market: "KRW-BTC",
|
|
561
|
+
# "timestamp": 1542899034662,
|
|
562
|
+
# "total_ask_size": 12.89790974,
|
|
563
|
+
# "total_bid_size": 4.88395783,
|
|
564
|
+
# "orderbook_units": [{ask_price: 5164000,
|
|
565
|
+
# "bid_price": 5162000,
|
|
566
|
+
# "ask_size": 2.57606495,
|
|
567
|
+
# "bid_size": 0.214 },
|
|
568
|
+
# ...,
|
|
569
|
+
# {ask_price: 5176000,
|
|
570
|
+
# "bid_price": 5152000,
|
|
571
|
+
# "ask_size": 2.752,
|
|
572
|
+
# "bid_size": 0.4650305} ]} ]
|
|
573
|
+
#
|
|
574
|
+
result: dict = {}
|
|
575
|
+
for i in range(0, len(response)):
|
|
576
|
+
orderbook = response[i]
|
|
577
|
+
marketId = self.safe_string(orderbook, 'market')
|
|
578
|
+
symbol = self.safe_symbol(marketId, None, '-')
|
|
579
|
+
timestamp = self.safe_integer(orderbook, 'timestamp')
|
|
580
|
+
result[symbol] = {
|
|
581
|
+
'symbol': symbol,
|
|
582
|
+
'bids': self.sort_by(self.parse_bids_asks(orderbook['orderbook_units'], 'bid_price', 'bid_size'), 0, True),
|
|
583
|
+
'asks': self.sort_by(self.parse_bids_asks(orderbook['orderbook_units'], 'ask_price', 'ask_size'), 0),
|
|
584
|
+
'timestamp': timestamp,
|
|
585
|
+
'datetime': self.iso8601(timestamp),
|
|
586
|
+
'nonce': None,
|
|
587
|
+
}
|
|
588
|
+
return result
|
|
589
|
+
|
|
590
|
+
def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
|
591
|
+
"""
|
|
592
|
+
:see: https://docs.upbit.com/reference/%ED%98%B8%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C
|
|
593
|
+
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
|
594
|
+
:param str symbol: unified symbol of the market to fetch the order book for
|
|
595
|
+
:param int [limit]: the maximum amount of order book entries to return
|
|
596
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
597
|
+
:returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
|
|
598
|
+
"""
|
|
599
|
+
orderbooks = self.fetch_order_books([symbol], limit, params)
|
|
600
|
+
return self.safe_value(orderbooks, symbol)
|
|
601
|
+
|
|
602
|
+
def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
|
|
603
|
+
#
|
|
604
|
+
# { market: "BTC-ETH",
|
|
605
|
+
# "trade_date": "20181122",
|
|
606
|
+
# "trade_time": "104543",
|
|
607
|
+
# "trade_date_kst": "20181122",
|
|
608
|
+
# "trade_time_kst": "194543",
|
|
609
|
+
# "trade_timestamp": 1542883543096,
|
|
610
|
+
# "opening_price": 0.02976455,
|
|
611
|
+
# "high_price": 0.02992577,
|
|
612
|
+
# "low_price": 0.02934283,
|
|
613
|
+
# "trade_price": 0.02947773,
|
|
614
|
+
# "prev_closing_price": 0.02966,
|
|
615
|
+
# "change": "FALL",
|
|
616
|
+
# "change_price": 0.00018227,
|
|
617
|
+
# "change_rate": 0.0061453136,
|
|
618
|
+
# "signed_change_price": -0.00018227,
|
|
619
|
+
# "signed_change_rate": -0.0061453136,
|
|
620
|
+
# "trade_volume": 1.00000005,
|
|
621
|
+
# "acc_trade_price": 100.95825586,
|
|
622
|
+
# "acc_trade_price_24h": 289.58650166,
|
|
623
|
+
# "acc_trade_volume": 3409.85311036,
|
|
624
|
+
# "acc_trade_volume_24h": 9754.40510513,
|
|
625
|
+
# "highest_52_week_price": 0.12345678,
|
|
626
|
+
# "highest_52_week_date": "2018-02-01",
|
|
627
|
+
# "lowest_52_week_price": 0.023936,
|
|
628
|
+
# "lowest_52_week_date": "2017-12-08",
|
|
629
|
+
# "timestamp": 1542883543813 }
|
|
630
|
+
#
|
|
631
|
+
timestamp = self.safe_integer(ticker, 'trade_timestamp')
|
|
632
|
+
marketId = self.safe_string_2(ticker, 'market', 'code')
|
|
633
|
+
market = self.safe_market(marketId, market, '-')
|
|
634
|
+
last = self.safe_string(ticker, 'trade_price')
|
|
635
|
+
return self.safe_ticker({
|
|
636
|
+
'symbol': market['symbol'],
|
|
637
|
+
'timestamp': timestamp,
|
|
638
|
+
'datetime': self.iso8601(timestamp),
|
|
639
|
+
'high': self.safe_string(ticker, 'high_price'),
|
|
640
|
+
'low': self.safe_string(ticker, 'low_price'),
|
|
641
|
+
'bid': None,
|
|
642
|
+
'bidVolume': None,
|
|
643
|
+
'ask': None,
|
|
644
|
+
'askVolume': None,
|
|
645
|
+
'vwap': None,
|
|
646
|
+
'open': self.safe_string(ticker, 'opening_price'),
|
|
647
|
+
'close': last,
|
|
648
|
+
'last': last,
|
|
649
|
+
'previousClose': self.safe_string(ticker, 'prev_closing_price'),
|
|
650
|
+
'change': self.safe_string(ticker, 'signed_change_price'),
|
|
651
|
+
'percentage': self.safe_string(ticker, 'signed_change_rate'),
|
|
652
|
+
'average': None,
|
|
653
|
+
'baseVolume': self.safe_string(ticker, 'acc_trade_volume_24h'),
|
|
654
|
+
'quoteVolume': self.safe_string(ticker, 'acc_trade_price_24h'),
|
|
655
|
+
'info': ticker,
|
|
656
|
+
}, market)
|
|
657
|
+
|
|
658
|
+
def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
|
659
|
+
"""
|
|
660
|
+
:see: https://docs.upbit.com/reference/ticker%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4
|
|
661
|
+
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
662
|
+
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
663
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
664
|
+
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
|
665
|
+
"""
|
|
666
|
+
self.load_markets()
|
|
667
|
+
symbols = self.market_symbols(symbols)
|
|
668
|
+
ids = None
|
|
669
|
+
if symbols is None:
|
|
670
|
+
ids = ','.join(self.ids)
|
|
671
|
+
# max URL length is 2083 symbols, including http schema, hostname, tld, etc...
|
|
672
|
+
if len(ids) > self.options['fetchTickersMaxLength']:
|
|
673
|
+
numIds = len(self.ids)
|
|
674
|
+
raise ExchangeError(self.id + ' fetchTickers() has ' + str(numIds) + ' symbols exceeding max URL length, you are required to specify a list of symbols in the first argument to fetchTickers')
|
|
675
|
+
else:
|
|
676
|
+
ids = self.market_ids(symbols)
|
|
677
|
+
ids = ','.join(ids)
|
|
678
|
+
request: dict = {
|
|
679
|
+
'markets': ids,
|
|
680
|
+
}
|
|
681
|
+
response = self.publicGetTicker(self.extend(request, params))
|
|
682
|
+
#
|
|
683
|
+
# [{ market: "BTC-ETH",
|
|
684
|
+
# "trade_date": "20181122",
|
|
685
|
+
# "trade_time": "104543",
|
|
686
|
+
# "trade_date_kst": "20181122",
|
|
687
|
+
# "trade_time_kst": "194543",
|
|
688
|
+
# "trade_timestamp": 1542883543097,
|
|
689
|
+
# "opening_price": 0.02976455,
|
|
690
|
+
# "high_price": 0.02992577,
|
|
691
|
+
# "low_price": 0.02934283,
|
|
692
|
+
# "trade_price": 0.02947773,
|
|
693
|
+
# "prev_closing_price": 0.02966,
|
|
694
|
+
# "change": "FALL",
|
|
695
|
+
# "change_price": 0.00018227,
|
|
696
|
+
# "change_rate": 0.0061453136,
|
|
697
|
+
# "signed_change_price": -0.00018227,
|
|
698
|
+
# "signed_change_rate": -0.0061453136,
|
|
699
|
+
# "trade_volume": 1.00000005,
|
|
700
|
+
# "acc_trade_price": 100.95825586,
|
|
701
|
+
# "acc_trade_price_24h": 289.58650166,
|
|
702
|
+
# "acc_trade_volume": 3409.85311036,
|
|
703
|
+
# "acc_trade_volume_24h": 9754.40510513,
|
|
704
|
+
# "highest_52_week_price": 0.12345678,
|
|
705
|
+
# "highest_52_week_date": "2018-02-01",
|
|
706
|
+
# "lowest_52_week_price": 0.023936,
|
|
707
|
+
# "lowest_52_week_date": "2017-12-08",
|
|
708
|
+
# "timestamp": 1542883543813 }]
|
|
709
|
+
#
|
|
710
|
+
result: dict = {}
|
|
711
|
+
for t in range(0, len(response)):
|
|
712
|
+
ticker = self.parse_ticker(response[t])
|
|
713
|
+
symbol = ticker['symbol']
|
|
714
|
+
result[symbol] = ticker
|
|
715
|
+
return self.filter_by_array_tickers(result, 'symbol', symbols)
|
|
716
|
+
|
|
717
|
+
def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
|
718
|
+
"""
|
|
719
|
+
:see: https://docs.upbit.com/reference/ticker%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4
|
|
720
|
+
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
721
|
+
:param str symbol: unified symbol of the market to fetch the ticker for
|
|
722
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
723
|
+
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
|
724
|
+
"""
|
|
725
|
+
tickers = self.fetch_tickers([symbol], params)
|
|
726
|
+
return self.safe_value(tickers, symbol)
|
|
727
|
+
|
|
728
|
+
def parse_trade(self, trade: dict, market: Market = None) -> Trade:
|
|
729
|
+
#
|
|
730
|
+
# fetchTrades
|
|
731
|
+
#
|
|
732
|
+
# { market: "BTC-ETH",
|
|
733
|
+
# "trade_date_utc": "2018-11-22",
|
|
734
|
+
# "trade_time_utc": "13:55:24",
|
|
735
|
+
# "timestamp": 1542894924397,
|
|
736
|
+
# "trade_price": 0.02914289,
|
|
737
|
+
# "trade_volume": 0.20074397,
|
|
738
|
+
# "prev_closing_price": 0.02966,
|
|
739
|
+
# "change_price": -0.00051711,
|
|
740
|
+
# "ask_bid": "ASK",
|
|
741
|
+
# "sequential_id": 15428949259430000}
|
|
742
|
+
#
|
|
743
|
+
# fetchOrder trades
|
|
744
|
+
#
|
|
745
|
+
# {
|
|
746
|
+
# "market": "KRW-BTC",
|
|
747
|
+
# "uuid": "78162304-1a4d-4524-b9e6-c9a9e14d76c3",
|
|
748
|
+
# "price": "101000.0",
|
|
749
|
+
# "volume": "0.77368323",
|
|
750
|
+
# "funds": "78142.00623",
|
|
751
|
+
# "ask_fee": "117.213009345",
|
|
752
|
+
# "bid_fee": "117.213009345",
|
|
753
|
+
# "created_at": "2018-04-05T14:09:15+09:00",
|
|
754
|
+
# "side": "bid",
|
|
755
|
+
# }
|
|
756
|
+
#
|
|
757
|
+
id = self.safe_string_2(trade, 'sequential_id', 'uuid')
|
|
758
|
+
orderId = None
|
|
759
|
+
timestamp = self.safe_integer(trade, 'timestamp')
|
|
760
|
+
if timestamp is None:
|
|
761
|
+
timestamp = self.parse8601(self.safe_string(trade, 'created_at'))
|
|
762
|
+
side = None
|
|
763
|
+
askOrBid = self.safe_string_lower_2(trade, 'ask_bid', 'side')
|
|
764
|
+
if askOrBid == 'ask':
|
|
765
|
+
side = 'sell'
|
|
766
|
+
elif askOrBid == 'bid':
|
|
767
|
+
side = 'buy'
|
|
768
|
+
cost = self.safe_string(trade, 'funds')
|
|
769
|
+
price = self.safe_string_2(trade, 'trade_price', 'price')
|
|
770
|
+
amount = self.safe_string_2(trade, 'trade_volume', 'volume')
|
|
771
|
+
marketId = self.safe_string_2(trade, 'market', 'code')
|
|
772
|
+
market = self.safe_market(marketId, market, '-')
|
|
773
|
+
fee = None
|
|
774
|
+
feeCost = self.safe_string(trade, askOrBid + '_fee')
|
|
775
|
+
if feeCost is not None:
|
|
776
|
+
fee = {
|
|
777
|
+
'currency': market['quote'],
|
|
778
|
+
'cost': feeCost,
|
|
779
|
+
}
|
|
780
|
+
return self.safe_trade({
|
|
781
|
+
'id': id,
|
|
782
|
+
'info': trade,
|
|
783
|
+
'order': orderId,
|
|
784
|
+
'timestamp': timestamp,
|
|
785
|
+
'datetime': self.iso8601(timestamp),
|
|
786
|
+
'symbol': market['symbol'],
|
|
787
|
+
'type': None,
|
|
788
|
+
'side': side,
|
|
789
|
+
'takerOrMaker': None,
|
|
790
|
+
'price': price,
|
|
791
|
+
'amount': amount,
|
|
792
|
+
'cost': cost,
|
|
793
|
+
'fee': fee,
|
|
794
|
+
}, market)
|
|
795
|
+
|
|
796
|
+
def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
|
797
|
+
"""
|
|
798
|
+
:see: https://docs.upbit.com/reference/%EC%B5%9C%EA%B7%BC-%EC%B2%B4%EA%B2%B0-%EB%82%B4%EC%97%AD
|
|
799
|
+
get the list of most recent trades for a particular symbol
|
|
800
|
+
:param str symbol: unified symbol of the market to fetch trades for
|
|
801
|
+
:param int [since]: timestamp in ms of the earliest trade to fetch
|
|
802
|
+
:param int [limit]: the maximum amount of trades to fetch
|
|
803
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
804
|
+
:returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
|
|
805
|
+
"""
|
|
806
|
+
self.load_markets()
|
|
807
|
+
market = self.market(symbol)
|
|
808
|
+
if limit is None:
|
|
809
|
+
limit = 200
|
|
810
|
+
request: dict = {
|
|
811
|
+
'market': market['id'],
|
|
812
|
+
'count': limit,
|
|
813
|
+
}
|
|
814
|
+
response = self.publicGetTradesTicks(self.extend(request, params))
|
|
815
|
+
#
|
|
816
|
+
# [{ market: "BTC-ETH",
|
|
817
|
+
# "trade_date_utc": "2018-11-22",
|
|
818
|
+
# "trade_time_utc": "13:55:24",
|
|
819
|
+
# "timestamp": 1542894924397,
|
|
820
|
+
# "trade_price": 0.02914289,
|
|
821
|
+
# "trade_volume": 0.20074397,
|
|
822
|
+
# "prev_closing_price": 0.02966,
|
|
823
|
+
# "change_price": -0.00051711,
|
|
824
|
+
# "ask_bid": "ASK",
|
|
825
|
+
# "sequential_id": 15428949259430000},
|
|
826
|
+
# { market: "BTC-ETH",
|
|
827
|
+
# "trade_date_utc": "2018-11-22",
|
|
828
|
+
# "trade_time_utc": "13:03:10",
|
|
829
|
+
# "timestamp": 1542891790123,
|
|
830
|
+
# "trade_price": 0.02917,
|
|
831
|
+
# "trade_volume": 7.392,
|
|
832
|
+
# "prev_closing_price": 0.02966,
|
|
833
|
+
# "change_price": -0.00049,
|
|
834
|
+
# "ask_bid": "ASK",
|
|
835
|
+
# "sequential_id": 15428917910540000} ]
|
|
836
|
+
#
|
|
837
|
+
return self.parse_trades(response, market, since, limit)
|
|
838
|
+
|
|
839
|
+
def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
|
|
840
|
+
"""
|
|
841
|
+
:see: https://docs.upbit.com/reference/%EC%A3%BC%EB%AC%B8-%EA%B0%80%EB%8A%A5-%EC%A0%95%EB%B3%B4
|
|
842
|
+
fetch the trading fees for a market
|
|
843
|
+
:param str symbol: unified market symbol
|
|
844
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
845
|
+
:returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
|
|
846
|
+
"""
|
|
847
|
+
self.load_markets()
|
|
848
|
+
market = self.market(symbol)
|
|
849
|
+
request: dict = {
|
|
850
|
+
'market': market['id'],
|
|
851
|
+
}
|
|
852
|
+
response = self.privateGetOrdersChance(self.extend(request, params))
|
|
853
|
+
#
|
|
854
|
+
# {
|
|
855
|
+
# "bid_fee": "0.0005",
|
|
856
|
+
# "ask_fee": "0.0005",
|
|
857
|
+
# "maker_bid_fee": "0.0005",
|
|
858
|
+
# "maker_ask_fee": "0.0005",
|
|
859
|
+
# "market": {
|
|
860
|
+
# "id": "KRW-BTC",
|
|
861
|
+
# "name": "BTC/KRW",
|
|
862
|
+
# "order_types": ["limit"],
|
|
863
|
+
# "order_sides": ["ask", "bid"],
|
|
864
|
+
# "bid": {"currency": "KRW", "price_unit": null, "min_total": 5000},
|
|
865
|
+
# "ask": {"currency": "BTC", "price_unit": null, "min_total": 5000},
|
|
866
|
+
# "max_total": "1000000000.0",
|
|
867
|
+
# "state": "active"
|
|
868
|
+
# },
|
|
869
|
+
# "bid_account": {
|
|
870
|
+
# "currency": "KRW",
|
|
871
|
+
# "balance": "0.34202414",
|
|
872
|
+
# "locked": "4999.99999922",
|
|
873
|
+
# "avg_buy_price": "0",
|
|
874
|
+
# "avg_buy_price_modified": True,
|
|
875
|
+
# "unit_currency": "KRW"
|
|
876
|
+
# },
|
|
877
|
+
# "ask_account": {
|
|
878
|
+
# "currency": "BTC",
|
|
879
|
+
# "balance": "0.00048",
|
|
880
|
+
# "locked": "0.0",
|
|
881
|
+
# "avg_buy_price": "20870000",
|
|
882
|
+
# "avg_buy_price_modified": False,
|
|
883
|
+
# "unit_currency": "KRW"
|
|
884
|
+
# }
|
|
885
|
+
# }
|
|
886
|
+
#
|
|
887
|
+
askFee = self.safe_string(response, 'ask_fee')
|
|
888
|
+
bidFee = self.safe_string(response, 'bid_fee')
|
|
889
|
+
taker = Precise.string_max(askFee, bidFee)
|
|
890
|
+
makerAskFee = self.safe_string(response, 'maker_ask_fee')
|
|
891
|
+
makerBidFee = self.safe_string(response, 'maker_bid_fee')
|
|
892
|
+
maker = Precise.string_max(makerAskFee, makerBidFee)
|
|
893
|
+
return {
|
|
894
|
+
'info': response,
|
|
895
|
+
'symbol': symbol,
|
|
896
|
+
'maker': self.parse_number(maker),
|
|
897
|
+
'taker': self.parse_number(taker),
|
|
898
|
+
'percentage': True,
|
|
899
|
+
'tierBased': False,
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
|
|
903
|
+
#
|
|
904
|
+
# {
|
|
905
|
+
# "market": "BTC-ETH",
|
|
906
|
+
# "candle_date_time_utc": "2018-11-22T13:47:00",
|
|
907
|
+
# "candle_date_time_kst": "2018-11-22T22:47:00",
|
|
908
|
+
# "opening_price": 0.02915963,
|
|
909
|
+
# "high_price": 0.02915963,
|
|
910
|
+
# "low_price": 0.02915448,
|
|
911
|
+
# "trade_price": 0.02915448,
|
|
912
|
+
# "timestamp": 1542894473674,
|
|
913
|
+
# "candle_acc_trade_price": 0.0981629437535248,
|
|
914
|
+
# "candle_acc_trade_volume": 3.36693173,
|
|
915
|
+
# "unit": 1
|
|
916
|
+
# }
|
|
917
|
+
#
|
|
918
|
+
return [
|
|
919
|
+
self.parse8601(self.safe_string(ohlcv, 'candle_date_time_utc')),
|
|
920
|
+
self.safe_number(ohlcv, 'opening_price'),
|
|
921
|
+
self.safe_number(ohlcv, 'high_price'),
|
|
922
|
+
self.safe_number(ohlcv, 'low_price'),
|
|
923
|
+
self.safe_number(ohlcv, 'trade_price'),
|
|
924
|
+
self.safe_number(ohlcv, 'candle_acc_trade_volume'), # base volume
|
|
925
|
+
]
|
|
926
|
+
|
|
927
|
+
def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
|
928
|
+
"""
|
|
929
|
+
:see: https://docs.upbit.com/reference/%EB%B6%84minute-%EC%BA%94%EB%93%A4-1
|
|
930
|
+
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
931
|
+
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
|
932
|
+
:param str timeframe: the length of time each candle represents
|
|
933
|
+
:param int [since]: timestamp in ms of the earliest candle to fetch
|
|
934
|
+
:param int [limit]: the maximum amount of candles to fetch
|
|
935
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
936
|
+
:returns int[][]: A list of candles ordered, open, high, low, close, volume
|
|
937
|
+
"""
|
|
938
|
+
self.load_markets()
|
|
939
|
+
market = self.market(symbol)
|
|
940
|
+
timeframePeriod = self.parse_timeframe(timeframe)
|
|
941
|
+
timeframeValue = self.safe_string(self.timeframes, timeframe, timeframe)
|
|
942
|
+
if limit is None:
|
|
943
|
+
limit = 200
|
|
944
|
+
request: dict = {
|
|
945
|
+
'market': market['id'],
|
|
946
|
+
'timeframe': timeframeValue,
|
|
947
|
+
'count': limit,
|
|
948
|
+
}
|
|
949
|
+
response = None
|
|
950
|
+
if since is not None:
|
|
951
|
+
# convert `since` to `to` value
|
|
952
|
+
request['to'] = self.iso8601(self.sum(since, timeframePeriod * limit * 1000))
|
|
953
|
+
if timeframeValue == 'minutes':
|
|
954
|
+
numMinutes = int(round(timeframePeriod / 60))
|
|
955
|
+
request['unit'] = numMinutes
|
|
956
|
+
response = self.publicGetCandlesTimeframeUnit(self.extend(request, params))
|
|
957
|
+
else:
|
|
958
|
+
response = self.publicGetCandlesTimeframe(self.extend(request, params))
|
|
959
|
+
#
|
|
960
|
+
# [
|
|
961
|
+
# {
|
|
962
|
+
# "market": "BTC-ETH",
|
|
963
|
+
# "candle_date_time_utc": "2018-11-22T13:47:00",
|
|
964
|
+
# "candle_date_time_kst": "2018-11-22T22:47:00",
|
|
965
|
+
# "opening_price": 0.02915963,
|
|
966
|
+
# "high_price": 0.02915963,
|
|
967
|
+
# "low_price": 0.02915448,
|
|
968
|
+
# "trade_price": 0.02915448,
|
|
969
|
+
# "timestamp": 1542894473674,
|
|
970
|
+
# "candle_acc_trade_price": 0.0981629437535248,
|
|
971
|
+
# "candle_acc_trade_volume": 3.36693173,
|
|
972
|
+
# "unit": 1
|
|
973
|
+
# },
|
|
974
|
+
# {
|
|
975
|
+
# "market": "BTC-ETH",
|
|
976
|
+
# "candle_date_time_utc": "2018-11-22T10:06:00",
|
|
977
|
+
# "candle_date_time_kst": "2018-11-22T19:06:00",
|
|
978
|
+
# "opening_price": 0.0294,
|
|
979
|
+
# "high_price": 0.02940882,
|
|
980
|
+
# "low_price": 0.02934283,
|
|
981
|
+
# "trade_price": 0.02937354,
|
|
982
|
+
# "timestamp": 1542881219276,
|
|
983
|
+
# "candle_acc_trade_price": 0.0762597110943884,
|
|
984
|
+
# "candle_acc_trade_volume": 2.5949617,
|
|
985
|
+
# "unit": 1
|
|
986
|
+
# }
|
|
987
|
+
# ]
|
|
988
|
+
#
|
|
989
|
+
return self.parse_ohlcvs(response, market, timeframe, since, limit)
|
|
990
|
+
|
|
991
|
+
def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
|
992
|
+
"""
|
|
993
|
+
create a trade order
|
|
994
|
+
:see: https://docs.upbit.com/reference/%EC%A3%BC%EB%AC%B8%ED%95%98%EA%B8%B0
|
|
995
|
+
:see: https://global-docs.upbit.com/reference/order
|
|
996
|
+
:param str symbol: unified symbol of the market to create an order in
|
|
997
|
+
:param str type: 'market' or 'limit'
|
|
998
|
+
:param str side: 'buy' or 'sell'
|
|
999
|
+
:param float amount: how much you want to trade in units of the base currency
|
|
1000
|
+
:param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
1001
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1002
|
+
:param float [params.cost]: for market buy orders, the quote quantity that can be used alternative for the amount
|
|
1003
|
+
:param str [params.timeInForce]: 'IOC' or 'FOK'
|
|
1004
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
|
1005
|
+
"""
|
|
1006
|
+
self.load_markets()
|
|
1007
|
+
market = self.market(symbol)
|
|
1008
|
+
orderSide = None
|
|
1009
|
+
if side == 'buy':
|
|
1010
|
+
orderSide = 'bid'
|
|
1011
|
+
elif side == 'sell':
|
|
1012
|
+
orderSide = 'ask'
|
|
1013
|
+
else:
|
|
1014
|
+
raise InvalidOrder(self.id + ' createOrder() allows buy or sell side only!')
|
|
1015
|
+
request: dict = {
|
|
1016
|
+
'market': market['id'],
|
|
1017
|
+
'side': orderSide,
|
|
1018
|
+
}
|
|
1019
|
+
if type == 'limit':
|
|
1020
|
+
request['price'] = self.price_to_precision(symbol, price)
|
|
1021
|
+
if (type == 'market') and (side == 'buy'):
|
|
1022
|
+
# for market buy it requires the amount of quote currency to spend
|
|
1023
|
+
quoteAmount = None
|
|
1024
|
+
createMarketBuyOrderRequiresPrice = True
|
|
1025
|
+
createMarketBuyOrderRequiresPrice, params = self.handle_option_and_params(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', True)
|
|
1026
|
+
cost = self.safe_number(params, 'cost')
|
|
1027
|
+
params = self.omit(params, 'cost')
|
|
1028
|
+
if cost is not None:
|
|
1029
|
+
quoteAmount = self.cost_to_precision(symbol, cost)
|
|
1030
|
+
elif createMarketBuyOrderRequiresPrice:
|
|
1031
|
+
if price is None:
|
|
1032
|
+
raise InvalidOrder(self.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend(amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to False and pass the cost to spend(quote quantity) in the amount argument')
|
|
1033
|
+
else:
|
|
1034
|
+
amountString = self.number_to_string(amount)
|
|
1035
|
+
priceString = self.number_to_string(price)
|
|
1036
|
+
costRequest = Precise.string_mul(amountString, priceString)
|
|
1037
|
+
quoteAmount = self.cost_to_precision(symbol, costRequest)
|
|
1038
|
+
else:
|
|
1039
|
+
quoteAmount = self.cost_to_precision(symbol, amount)
|
|
1040
|
+
request['ord_type'] = 'price'
|
|
1041
|
+
request['price'] = quoteAmount
|
|
1042
|
+
else:
|
|
1043
|
+
request['ord_type'] = type
|
|
1044
|
+
request['volume'] = self.amount_to_precision(symbol, amount)
|
|
1045
|
+
clientOrderId = self.safe_string_2(params, 'clientOrderId', 'identifier')
|
|
1046
|
+
if clientOrderId is not None:
|
|
1047
|
+
request['identifier'] = clientOrderId
|
|
1048
|
+
if type != 'market':
|
|
1049
|
+
timeInForce = self.safe_string_lower_2(params, 'timeInForce', 'time_in_force')
|
|
1050
|
+
params = self.omit(params, 'timeInForce')
|
|
1051
|
+
if timeInForce is not None:
|
|
1052
|
+
request['time_in_force'] = timeInForce
|
|
1053
|
+
params = self.omit(params, ['clientOrderId', 'identifier'])
|
|
1054
|
+
response = self.privatePostOrders(self.extend(request, params))
|
|
1055
|
+
#
|
|
1056
|
+
# {
|
|
1057
|
+
# "uuid": "cdd92199-2897-4e14-9448-f923320408ad",
|
|
1058
|
+
# "side": "bid",
|
|
1059
|
+
# "ord_type": "limit",
|
|
1060
|
+
# "price": "100.0",
|
|
1061
|
+
# "avg_price": "0.0",
|
|
1062
|
+
# "state": "wait",
|
|
1063
|
+
# "market": "KRW-BTC",
|
|
1064
|
+
# "created_at": "2018-04-10T15:42:23+09:00",
|
|
1065
|
+
# "volume": "0.01",
|
|
1066
|
+
# "remaining_volume": "0.01",
|
|
1067
|
+
# "reserved_fee": "0.0015",
|
|
1068
|
+
# "remaining_fee": "0.0015",
|
|
1069
|
+
# "paid_fee": "0.0",
|
|
1070
|
+
# "locked": "1.0015",
|
|
1071
|
+
# "executed_volume": "0.0",
|
|
1072
|
+
# "trades_count": 0
|
|
1073
|
+
# }
|
|
1074
|
+
#
|
|
1075
|
+
return self.parse_order(response)
|
|
1076
|
+
|
|
1077
|
+
def cancel_order(self, id: str, symbol: Str = None, params={}):
|
|
1078
|
+
"""
|
|
1079
|
+
:see: https://docs.upbit.com/reference/%EC%A3%BC%EB%AC%B8-%EC%B7%A8%EC%86%8C
|
|
1080
|
+
cancels an open order
|
|
1081
|
+
:param str id: order id
|
|
1082
|
+
:param str symbol: not used by upbit cancelOrder()
|
|
1083
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1084
|
+
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
|
1085
|
+
"""
|
|
1086
|
+
self.load_markets()
|
|
1087
|
+
request: dict = {
|
|
1088
|
+
'uuid': id,
|
|
1089
|
+
}
|
|
1090
|
+
response = self.privateDeleteOrder(self.extend(request, params))
|
|
1091
|
+
#
|
|
1092
|
+
# {
|
|
1093
|
+
# "uuid": "cdd92199-2897-4e14-9448-f923320408ad",
|
|
1094
|
+
# "side": "bid",
|
|
1095
|
+
# "ord_type": "limit",
|
|
1096
|
+
# "price": "100.0",
|
|
1097
|
+
# "state": "wait",
|
|
1098
|
+
# "market": "KRW-BTC",
|
|
1099
|
+
# "created_at": "2018-04-10T15:42:23+09:00",
|
|
1100
|
+
# "volume": "0.01",
|
|
1101
|
+
# "remaining_volume": "0.01",
|
|
1102
|
+
# "reserved_fee": "0.0015",
|
|
1103
|
+
# "remaining_fee": "0.0015",
|
|
1104
|
+
# "paid_fee": "0.0",
|
|
1105
|
+
# "locked": "1.0015",
|
|
1106
|
+
# "executed_volume": "0.0",
|
|
1107
|
+
# "trades_count": 0
|
|
1108
|
+
# }
|
|
1109
|
+
#
|
|
1110
|
+
return self.parse_order(response)
|
|
1111
|
+
|
|
1112
|
+
def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
|
1113
|
+
"""
|
|
1114
|
+
:see: https://docs.upbit.com/reference/%EC%9E%85%EA%B8%88-%EB%A6%AC%EC%8A%A4%ED%8A%B8-%EC%A1%B0%ED%9A%8C
|
|
1115
|
+
fetch all deposits made to an account
|
|
1116
|
+
:param str code: unified currency code
|
|
1117
|
+
:param int [since]: the earliest time in ms to fetch deposits for
|
|
1118
|
+
:param int [limit]: the maximum number of deposits structures to retrieve
|
|
1119
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1120
|
+
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
|
|
1121
|
+
"""
|
|
1122
|
+
self.load_markets()
|
|
1123
|
+
request: dict = {
|
|
1124
|
+
# 'page': 1,
|
|
1125
|
+
# 'order_by': 'asc', # 'desc'
|
|
1126
|
+
}
|
|
1127
|
+
currency = None
|
|
1128
|
+
if code is not None:
|
|
1129
|
+
currency = self.currency(code)
|
|
1130
|
+
request['currency'] = currency['id']
|
|
1131
|
+
if limit is not None:
|
|
1132
|
+
request['limit'] = limit # default is 100
|
|
1133
|
+
response = self.privateGetDeposits(self.extend(request, params))
|
|
1134
|
+
#
|
|
1135
|
+
# [
|
|
1136
|
+
# {
|
|
1137
|
+
# "type": "deposit",
|
|
1138
|
+
# "uuid": "94332e99-3a87-4a35-ad98-28b0c969f830",
|
|
1139
|
+
# "currency": "KRW",
|
|
1140
|
+
# "txid": "9e37c537-6849-4c8b-a134-57313f5dfc5a",
|
|
1141
|
+
# "state": "ACCEPTED",
|
|
1142
|
+
# "created_at": "2017-12-08T15:38:02+09:00",
|
|
1143
|
+
# "done_at": "2017-12-08T15:38:02+09:00",
|
|
1144
|
+
# "amount": "100000.0",
|
|
1145
|
+
# "fee": "0.0"
|
|
1146
|
+
# },
|
|
1147
|
+
# ...,
|
|
1148
|
+
# ]
|
|
1149
|
+
#
|
|
1150
|
+
return self.parse_transactions(response, currency, since, limit)
|
|
1151
|
+
|
|
1152
|
+
def fetch_deposit(self, id: str, code: Str = None, params={}):
|
|
1153
|
+
"""
|
|
1154
|
+
fetch information on a deposit
|
|
1155
|
+
:see: https://global-docs.upbit.com/reference/individual-deposit-inquiry
|
|
1156
|
+
:param str id: the unique id for the deposit
|
|
1157
|
+
:param str [code]: unified currency code of the currency deposited
|
|
1158
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1159
|
+
:param str [params.txid]: withdrawal transaction id, the id argument is reserved for uuid
|
|
1160
|
+
:returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
|
|
1161
|
+
"""
|
|
1162
|
+
self.load_markets()
|
|
1163
|
+
request: dict = {
|
|
1164
|
+
'uuid': id,
|
|
1165
|
+
}
|
|
1166
|
+
currency = None
|
|
1167
|
+
if code is not None:
|
|
1168
|
+
currency = self.currency(code)
|
|
1169
|
+
request['currency'] = currency['id']
|
|
1170
|
+
response = self.privateGetDeposit(self.extend(request, params))
|
|
1171
|
+
#
|
|
1172
|
+
# {
|
|
1173
|
+
# "type": "deposit",
|
|
1174
|
+
# "uuid": "7f54527e-2eee-4268-860e-fd8b9d7fe3c7",
|
|
1175
|
+
# "currency": "ADA",
|
|
1176
|
+
# "net_type": "ADA",
|
|
1177
|
+
# "txid": "99795bbfeca91eaa071068bb659b33eeb65d8aaff2551fdf7c78f345d188952b",
|
|
1178
|
+
# "state": "ACCEPTED",
|
|
1179
|
+
# "created_at": "2023-12-12T04:58:41Z",
|
|
1180
|
+
# "done_at": "2023-12-12T05:31:50Z",
|
|
1181
|
+
# "amount": "35.72344",
|
|
1182
|
+
# "fee": "0.0",
|
|
1183
|
+
# "transaction_type": "default"
|
|
1184
|
+
# }
|
|
1185
|
+
#
|
|
1186
|
+
return self.parse_transaction(response, currency)
|
|
1187
|
+
|
|
1188
|
+
def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
|
1189
|
+
"""
|
|
1190
|
+
:see: https://docs.upbit.com/reference/%EC%A0%84%EC%B2%B4-%EC%B6%9C%EA%B8%88-%EC%A1%B0%ED%9A%8C
|
|
1191
|
+
fetch all withdrawals made from an account
|
|
1192
|
+
:param str code: unified currency code
|
|
1193
|
+
:param int [since]: the earliest time in ms to fetch withdrawals for
|
|
1194
|
+
:param int [limit]: the maximum number of withdrawals structures to retrieve
|
|
1195
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1196
|
+
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
|
|
1197
|
+
"""
|
|
1198
|
+
self.load_markets()
|
|
1199
|
+
request: dict = {
|
|
1200
|
+
# 'state': 'submitting', # 'submitted', 'almost_accepted', 'rejected', 'accepted', 'processing', 'done', 'canceled'
|
|
1201
|
+
}
|
|
1202
|
+
currency = None
|
|
1203
|
+
if code is not None:
|
|
1204
|
+
currency = self.currency(code)
|
|
1205
|
+
request['currency'] = currency['id']
|
|
1206
|
+
if limit is not None:
|
|
1207
|
+
request['limit'] = limit # default is 100
|
|
1208
|
+
response = self.privateGetWithdraws(self.extend(request, params))
|
|
1209
|
+
#
|
|
1210
|
+
# [
|
|
1211
|
+
# {
|
|
1212
|
+
# "type": "withdraw",
|
|
1213
|
+
# "uuid": "9f432943-54e0-40b7-825f-b6fec8b42b79",
|
|
1214
|
+
# "currency": "BTC",
|
|
1215
|
+
# "txid": null,
|
|
1216
|
+
# "state": "processing",
|
|
1217
|
+
# "created_at": "2018-04-13T11:24:01+09:00",
|
|
1218
|
+
# "done_at": null,
|
|
1219
|
+
# "amount": "0.01",
|
|
1220
|
+
# "fee": "0.0",
|
|
1221
|
+
# "krw_amount": "80420.0"
|
|
1222
|
+
# },
|
|
1223
|
+
# ...,
|
|
1224
|
+
# ]
|
|
1225
|
+
#
|
|
1226
|
+
return self.parse_transactions(response, currency, since, limit)
|
|
1227
|
+
|
|
1228
|
+
def fetch_withdrawal(self, id: str, code: Str = None, params={}):
|
|
1229
|
+
"""
|
|
1230
|
+
fetch data on a currency withdrawal via the withdrawal id
|
|
1231
|
+
:see: https://global-docs.upbit.com/reference/individual-withdrawal-inquiry
|
|
1232
|
+
:param str id: the unique id for the withdrawal
|
|
1233
|
+
:param str [code]: unified currency code of the currency withdrawn
|
|
1234
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1235
|
+
:param str [params.txid]: withdrawal transaction id, the id argument is reserved for uuid
|
|
1236
|
+
:returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
|
|
1237
|
+
"""
|
|
1238
|
+
self.load_markets()
|
|
1239
|
+
request: dict = {
|
|
1240
|
+
'uuid': id,
|
|
1241
|
+
}
|
|
1242
|
+
currency = None
|
|
1243
|
+
if code is not None:
|
|
1244
|
+
currency = self.currency(code)
|
|
1245
|
+
request['currency'] = currency['id']
|
|
1246
|
+
response = self.privateGetWithdraw(self.extend(request, params))
|
|
1247
|
+
#
|
|
1248
|
+
# {
|
|
1249
|
+
# "type": "withdraw",
|
|
1250
|
+
# "uuid": "95ef274b-23a6-4de4-95b0-5cbef4ca658f",
|
|
1251
|
+
# "currency": "ADA",
|
|
1252
|
+
# "net_type": "ADA",
|
|
1253
|
+
# "txid": "b1528f149297a71671b86636f731f8fdb0ff53da0f1d8c19093d59df96f34583",
|
|
1254
|
+
# "state": "DONE",
|
|
1255
|
+
# "created_at": "2023-12-14T02:46:52Z",
|
|
1256
|
+
# "done_at": "2023-12-14T03:10:11Z",
|
|
1257
|
+
# "amount": "35.22344",
|
|
1258
|
+
# "fee": "0.5",
|
|
1259
|
+
# "transaction_type": "default"
|
|
1260
|
+
# }
|
|
1261
|
+
#
|
|
1262
|
+
return self.parse_transaction(response, currency)
|
|
1263
|
+
|
|
1264
|
+
def parse_transaction_status(self, status: Str):
|
|
1265
|
+
statuses: dict = {
|
|
1266
|
+
'submitting': 'pending', # 처리 중
|
|
1267
|
+
'submitted': 'pending', # 처리 완료
|
|
1268
|
+
'almost_accepted': 'pending', # 출금대기중
|
|
1269
|
+
'rejected': 'failed', # 거부
|
|
1270
|
+
'accepted': 'ok', # 승인됨
|
|
1271
|
+
'processing': 'pending', # 처리 중
|
|
1272
|
+
'done': 'ok', # 완료
|
|
1273
|
+
'canceled': 'canceled', # 취소됨
|
|
1274
|
+
}
|
|
1275
|
+
return self.safe_string(statuses, status, status)
|
|
1276
|
+
|
|
1277
|
+
def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
|
|
1278
|
+
#
|
|
1279
|
+
# fetchDeposits, fetchDeposit
|
|
1280
|
+
#
|
|
1281
|
+
# {
|
|
1282
|
+
# "type": "deposit",
|
|
1283
|
+
# "uuid": "94332e99-3a87-4a35-ad98-28b0c969f830",
|
|
1284
|
+
# "currency": "KRW",
|
|
1285
|
+
# "txid": "9e37c537-6849-4c8b-a134-57313f5dfc5a",
|
|
1286
|
+
# "state": "ACCEPTED",
|
|
1287
|
+
# "created_at": "2017-12-08T15:38:02+09:00",
|
|
1288
|
+
# "done_at": "2017-12-08T15:38:02+09:00",
|
|
1289
|
+
# "amount": "100000.0",
|
|
1290
|
+
# "fee": "0.0"
|
|
1291
|
+
# }
|
|
1292
|
+
#
|
|
1293
|
+
# fetchWithdrawals, fetchWithdrawal
|
|
1294
|
+
#
|
|
1295
|
+
# {
|
|
1296
|
+
# "type": "withdraw",
|
|
1297
|
+
# "uuid": "9f432943-54e0-40b7-825f-b6fec8b42b79",
|
|
1298
|
+
# "currency": "BTC",
|
|
1299
|
+
# "txid": "cd81e9b45df8da29f936836e58c907a106057e454a45767a7b06fcb19b966bba",
|
|
1300
|
+
# "state": "processing",
|
|
1301
|
+
# "created_at": "2018-04-13T11:24:01+09:00",
|
|
1302
|
+
# "done_at": null,
|
|
1303
|
+
# "amount": "0.01",
|
|
1304
|
+
# "fee": "0.0",
|
|
1305
|
+
# "krw_amount": "80420.0"
|
|
1306
|
+
# }
|
|
1307
|
+
#
|
|
1308
|
+
address = None # not present in the data structure received from the exchange
|
|
1309
|
+
tag = None # not present in the data structure received from the exchange
|
|
1310
|
+
updatedRaw = self.safe_string(transaction, 'done_at')
|
|
1311
|
+
timestamp = self.parse8601(self.safe_string(transaction, 'created_at', updatedRaw))
|
|
1312
|
+
type = self.safe_string(transaction, 'type')
|
|
1313
|
+
if type == 'withdraw':
|
|
1314
|
+
type = 'withdrawal'
|
|
1315
|
+
currencyId = self.safe_string(transaction, 'currency')
|
|
1316
|
+
code = self.safe_currency_code(currencyId, currency)
|
|
1317
|
+
return {
|
|
1318
|
+
'info': transaction,
|
|
1319
|
+
'id': self.safe_string(transaction, 'uuid'),
|
|
1320
|
+
'currency': code,
|
|
1321
|
+
'amount': self.safe_number(transaction, 'amount'),
|
|
1322
|
+
'network': None,
|
|
1323
|
+
'address': address,
|
|
1324
|
+
'addressTo': None,
|
|
1325
|
+
'addressFrom': None,
|
|
1326
|
+
'tag': tag,
|
|
1327
|
+
'tagTo': None,
|
|
1328
|
+
'tagFrom': None,
|
|
1329
|
+
'status': self.parse_transaction_status(self.safe_string_lower(transaction, 'state')),
|
|
1330
|
+
'type': type,
|
|
1331
|
+
'updated': self.parse8601(updatedRaw),
|
|
1332
|
+
'txid': self.safe_string(transaction, 'txid'),
|
|
1333
|
+
'timestamp': timestamp,
|
|
1334
|
+
'datetime': self.iso8601(timestamp),
|
|
1335
|
+
'internal': None,
|
|
1336
|
+
'comment': None,
|
|
1337
|
+
'fee': {
|
|
1338
|
+
'currency': code,
|
|
1339
|
+
'cost': self.safe_number(transaction, 'fee'),
|
|
1340
|
+
},
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
def parse_order_status(self, status: Str):
|
|
1344
|
+
statuses: dict = {
|
|
1345
|
+
'wait': 'open',
|
|
1346
|
+
'done': 'closed',
|
|
1347
|
+
'cancel': 'canceled',
|
|
1348
|
+
}
|
|
1349
|
+
return self.safe_string(statuses, status, status)
|
|
1350
|
+
|
|
1351
|
+
def parse_order(self, order: dict, market: Market = None) -> Order:
|
|
1352
|
+
#
|
|
1353
|
+
# {
|
|
1354
|
+
# "uuid": "a08f09b1-1718-42e2-9358-f0e5e083d3ee",
|
|
1355
|
+
# "side": "bid",
|
|
1356
|
+
# "ord_type": "limit",
|
|
1357
|
+
# "price": "17417000.0",
|
|
1358
|
+
# "state": "done",
|
|
1359
|
+
# "market": "KRW-BTC",
|
|
1360
|
+
# "created_at": "2018-04-05T14:09:14+09:00",
|
|
1361
|
+
# "volume": "1.0",
|
|
1362
|
+
# "remaining_volume": "0.0",
|
|
1363
|
+
# "reserved_fee": "26125.5",
|
|
1364
|
+
# "remaining_fee": "25974.0",
|
|
1365
|
+
# "paid_fee": "151.5",
|
|
1366
|
+
# "locked": "17341974.0",
|
|
1367
|
+
# "executed_volume": "1.0",
|
|
1368
|
+
# "trades_count": 2,
|
|
1369
|
+
# "trades": [
|
|
1370
|
+
# {
|
|
1371
|
+
# "market": "KRW-BTC",
|
|
1372
|
+
# "uuid": "78162304-1a4d-4524-b9e6-c9a9e14d76c3",
|
|
1373
|
+
# "price": "101000.0",
|
|
1374
|
+
# "volume": "0.77368323",
|
|
1375
|
+
# "funds": "78142.00623",
|
|
1376
|
+
# "ask_fee": "117.213009345",
|
|
1377
|
+
# "bid_fee": "117.213009345",
|
|
1378
|
+
# "created_at": "2018-04-05T14:09:15+09:00",
|
|
1379
|
+
# "side": "bid",
|
|
1380
|
+
# },
|
|
1381
|
+
# {
|
|
1382
|
+
# "market": "KRW-BTC",
|
|
1383
|
+
# "uuid": "f73da467-c42f-407d-92fa-e10d86450a20",
|
|
1384
|
+
# "price": "101000.0",
|
|
1385
|
+
# "volume": "0.22631677",
|
|
1386
|
+
# "funds": "22857.99377",
|
|
1387
|
+
# "ask_fee": "34.286990655", # missing in market orders
|
|
1388
|
+
# "bid_fee": "34.286990655", # missing in market orders
|
|
1389
|
+
# "created_at": "2018-04-05T14:09:15+09:00", # missing in market orders
|
|
1390
|
+
# "side": "bid",
|
|
1391
|
+
# },
|
|
1392
|
+
# ],
|
|
1393
|
+
# }
|
|
1394
|
+
#
|
|
1395
|
+
id = self.safe_string(order, 'uuid')
|
|
1396
|
+
side = self.safe_string(order, 'side')
|
|
1397
|
+
if side == 'bid':
|
|
1398
|
+
side = 'buy'
|
|
1399
|
+
else:
|
|
1400
|
+
side = 'sell'
|
|
1401
|
+
type = self.safe_string(order, 'ord_type')
|
|
1402
|
+
timestamp = self.parse8601(self.safe_string(order, 'created_at'))
|
|
1403
|
+
status = self.parse_order_status(self.safe_string(order, 'state'))
|
|
1404
|
+
lastTradeTimestamp = None
|
|
1405
|
+
price = self.safe_string(order, 'price')
|
|
1406
|
+
amount = self.safe_string(order, 'volume')
|
|
1407
|
+
remaining = self.safe_string(order, 'remaining_volume')
|
|
1408
|
+
filled = self.safe_string(order, 'executed_volume')
|
|
1409
|
+
cost = None
|
|
1410
|
+
if type == 'price':
|
|
1411
|
+
type = 'market'
|
|
1412
|
+
cost = price
|
|
1413
|
+
price = None
|
|
1414
|
+
average = None
|
|
1415
|
+
fee = None
|
|
1416
|
+
feeCost = self.safe_string(order, 'paid_fee')
|
|
1417
|
+
marketId = self.safe_string(order, 'market')
|
|
1418
|
+
market = self.safe_market(marketId, market)
|
|
1419
|
+
trades = self.safe_value(order, 'trades', [])
|
|
1420
|
+
trades = self.parse_trades(trades, market, None, None, {
|
|
1421
|
+
'order': id,
|
|
1422
|
+
'type': type,
|
|
1423
|
+
})
|
|
1424
|
+
numTrades = len(trades)
|
|
1425
|
+
if numTrades > 0:
|
|
1426
|
+
# the timestamp in fetchOrder trades is missing
|
|
1427
|
+
lastTradeTimestamp = trades[numTrades - 1]['timestamp']
|
|
1428
|
+
getFeesFromTrades = False
|
|
1429
|
+
if feeCost is None:
|
|
1430
|
+
getFeesFromTrades = True
|
|
1431
|
+
feeCost = '0'
|
|
1432
|
+
cost = '0'
|
|
1433
|
+
for i in range(0, numTrades):
|
|
1434
|
+
trade = trades[i]
|
|
1435
|
+
cost = Precise.string_add(cost, self.safe_string(trade, 'cost'))
|
|
1436
|
+
if getFeesFromTrades:
|
|
1437
|
+
tradeFee = self.safe_value(trades[i], 'fee', {})
|
|
1438
|
+
tradeFeeCost = self.safe_string(tradeFee, 'cost')
|
|
1439
|
+
if tradeFeeCost is not None:
|
|
1440
|
+
feeCost = Precise.string_add(feeCost, tradeFeeCost)
|
|
1441
|
+
average = Precise.string_div(cost, filled)
|
|
1442
|
+
if feeCost is not None:
|
|
1443
|
+
fee = {
|
|
1444
|
+
'currency': market['quote'],
|
|
1445
|
+
'cost': feeCost,
|
|
1446
|
+
}
|
|
1447
|
+
return self.safe_order({
|
|
1448
|
+
'info': order,
|
|
1449
|
+
'id': id,
|
|
1450
|
+
'clientOrderId': None,
|
|
1451
|
+
'timestamp': timestamp,
|
|
1452
|
+
'datetime': self.iso8601(timestamp),
|
|
1453
|
+
'lastTradeTimestamp': lastTradeTimestamp,
|
|
1454
|
+
'symbol': market['symbol'],
|
|
1455
|
+
'type': type,
|
|
1456
|
+
'timeInForce': None,
|
|
1457
|
+
'postOnly': None,
|
|
1458
|
+
'side': side,
|
|
1459
|
+
'price': price,
|
|
1460
|
+
'stopPrice': None,
|
|
1461
|
+
'triggerPrice': None,
|
|
1462
|
+
'cost': self.parse_number(cost),
|
|
1463
|
+
'average': self.parse_number(average),
|
|
1464
|
+
'amount': amount,
|
|
1465
|
+
'filled': filled,
|
|
1466
|
+
'remaining': remaining,
|
|
1467
|
+
'status': status,
|
|
1468
|
+
'fee': fee,
|
|
1469
|
+
'trades': trades,
|
|
1470
|
+
})
|
|
1471
|
+
|
|
1472
|
+
def fetch_orders_by_state(self, state, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
|
1473
|
+
self.load_markets()
|
|
1474
|
+
request: dict = {
|
|
1475
|
+
# 'market': self.market_id(symbol),
|
|
1476
|
+
'state': state,
|
|
1477
|
+
# 'page': 1,
|
|
1478
|
+
# 'order_by': 'asc',
|
|
1479
|
+
}
|
|
1480
|
+
market = None
|
|
1481
|
+
if symbol is not None:
|
|
1482
|
+
market = self.market(symbol)
|
|
1483
|
+
request['market'] = market['id']
|
|
1484
|
+
response = self.privateGetOrders(self.extend(request, params))
|
|
1485
|
+
#
|
|
1486
|
+
# [
|
|
1487
|
+
# {
|
|
1488
|
+
# "uuid": "a08f09b1-1718-42e2-9358-f0e5e083d3ee",
|
|
1489
|
+
# "side": "bid",
|
|
1490
|
+
# "ord_type": "limit",
|
|
1491
|
+
# "price": "17417000.0",
|
|
1492
|
+
# "state": "done",
|
|
1493
|
+
# "market": "KRW-BTC",
|
|
1494
|
+
# "created_at": "2018-04-05T14:09:14+09:00",
|
|
1495
|
+
# "volume": "1.0",
|
|
1496
|
+
# "remaining_volume": "0.0",
|
|
1497
|
+
# "reserved_fee": "26125.5",
|
|
1498
|
+
# "remaining_fee": "25974.0",
|
|
1499
|
+
# "paid_fee": "151.5",
|
|
1500
|
+
# "locked": "17341974.0",
|
|
1501
|
+
# "executed_volume": "1.0",
|
|
1502
|
+
# "trades_count":2
|
|
1503
|
+
# },
|
|
1504
|
+
# ]
|
|
1505
|
+
#
|
|
1506
|
+
return self.parse_orders(response, market, since, limit)
|
|
1507
|
+
|
|
1508
|
+
def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
|
1509
|
+
"""
|
|
1510
|
+
:see: https://docs.upbit.com/reference/%EC%A3%BC%EB%AC%B8-%EB%A6%AC%EC%8A%A4%ED%8A%B8-%EC%A1%B0%ED%9A%8C
|
|
1511
|
+
fetch all unfilled currently open orders
|
|
1512
|
+
:param str symbol: unified market symbol
|
|
1513
|
+
:param int [since]: the earliest time in ms to fetch open orders for
|
|
1514
|
+
:param int [limit]: the maximum number of open orders structures to retrieve
|
|
1515
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1516
|
+
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
|
1517
|
+
"""
|
|
1518
|
+
return self.fetch_orders_by_state('wait', symbol, since, limit, params)
|
|
1519
|
+
|
|
1520
|
+
def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
|
1521
|
+
"""
|
|
1522
|
+
:see: https://docs.upbit.com/reference/%EC%A3%BC%EB%AC%B8-%EB%A6%AC%EC%8A%A4%ED%8A%B8-%EC%A1%B0%ED%9A%8C
|
|
1523
|
+
fetches information on multiple closed orders made by the user
|
|
1524
|
+
:param str symbol: unified market symbol of the market orders were made in
|
|
1525
|
+
:param int [since]: the earliest time in ms to fetch orders for
|
|
1526
|
+
:param int [limit]: the maximum number of order structures to retrieve
|
|
1527
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1528
|
+
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
|
1529
|
+
"""
|
|
1530
|
+
return self.fetch_orders_by_state('done', symbol, since, limit, params)
|
|
1531
|
+
|
|
1532
|
+
def fetch_canceled_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
|
1533
|
+
"""
|
|
1534
|
+
:see: https://docs.upbit.com/reference/%EC%A3%BC%EB%AC%B8-%EB%A6%AC%EC%8A%A4%ED%8A%B8-%EC%A1%B0%ED%9A%8C
|
|
1535
|
+
fetches information on multiple canceled orders made by the user
|
|
1536
|
+
:param str symbol: unified market symbol of the market orders were made in
|
|
1537
|
+
:param int [since]: timestamp in ms of the earliest order, default is None
|
|
1538
|
+
:param int [limit]: max number of orders to return, default is None
|
|
1539
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1540
|
+
:returns dict: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
|
1541
|
+
"""
|
|
1542
|
+
return self.fetch_orders_by_state('cancel', symbol, since, limit, params)
|
|
1543
|
+
|
|
1544
|
+
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
|
1545
|
+
"""
|
|
1546
|
+
:see: https://docs.upbit.com/reference/%EA%B0%9C%EB%B3%84-%EC%A3%BC%EB%AC%B8-%EC%A1%B0%ED%9A%8C
|
|
1547
|
+
fetches information on an order made by the user
|
|
1548
|
+
:param str symbol: not used by upbit fetchOrder
|
|
1549
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1550
|
+
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
|
1551
|
+
"""
|
|
1552
|
+
self.load_markets()
|
|
1553
|
+
request: dict = {
|
|
1554
|
+
'uuid': id,
|
|
1555
|
+
}
|
|
1556
|
+
response = self.privateGetOrder(self.extend(request, params))
|
|
1557
|
+
#
|
|
1558
|
+
# {
|
|
1559
|
+
# "uuid": "a08f09b1-1718-42e2-9358-f0e5e083d3ee",
|
|
1560
|
+
# "side": "bid",
|
|
1561
|
+
# "ord_type": "limit",
|
|
1562
|
+
# "price": "17417000.0",
|
|
1563
|
+
# "state": "done",
|
|
1564
|
+
# "market": "KRW-BTC",
|
|
1565
|
+
# "created_at": "2018-04-05T14:09:14+09:00",
|
|
1566
|
+
# "volume": "1.0",
|
|
1567
|
+
# "remaining_volume": "0.0",
|
|
1568
|
+
# "reserved_fee": "26125.5",
|
|
1569
|
+
# "remaining_fee": "25974.0",
|
|
1570
|
+
# "paid_fee": "151.5",
|
|
1571
|
+
# "locked": "17341974.0",
|
|
1572
|
+
# "executed_volume": "1.0",
|
|
1573
|
+
# "trades_count": 2,
|
|
1574
|
+
# "trades": [
|
|
1575
|
+
# {
|
|
1576
|
+
# "market": "KRW-BTC",
|
|
1577
|
+
# "uuid": "78162304-1a4d-4524-b9e6-c9a9e14d76c3",
|
|
1578
|
+
# "price": "101000.0",
|
|
1579
|
+
# "volume": "0.77368323",
|
|
1580
|
+
# "funds": "78142.00623",
|
|
1581
|
+
# "ask_fee": "117.213009345",
|
|
1582
|
+
# "bid_fee": "117.213009345",
|
|
1583
|
+
# "created_at": "2018-04-05T14:09:15+09:00",
|
|
1584
|
+
# "side": "bid"
|
|
1585
|
+
# },
|
|
1586
|
+
# {
|
|
1587
|
+
# "market": "KRW-BTC",
|
|
1588
|
+
# "uuid": "f73da467-c42f-407d-92fa-e10d86450a20",
|
|
1589
|
+
# "price": "101000.0",
|
|
1590
|
+
# "volume": "0.22631677",
|
|
1591
|
+
# "funds": "22857.99377",
|
|
1592
|
+
# "ask_fee": "34.286990655",
|
|
1593
|
+
# "bid_fee": "34.286990655",
|
|
1594
|
+
# "created_at": "2018-04-05T14:09:15+09:00",
|
|
1595
|
+
# "side": "bid"
|
|
1596
|
+
# }
|
|
1597
|
+
# ]
|
|
1598
|
+
# }
|
|
1599
|
+
#
|
|
1600
|
+
return self.parse_order(response)
|
|
1601
|
+
|
|
1602
|
+
def fetch_deposit_addresses(self, codes: Strings = None, params={}):
|
|
1603
|
+
"""
|
|
1604
|
+
:see: https://docs.upbit.com/reference/%EC%A0%84%EC%B2%B4-%EC%9E%85%EA%B8%88-%EC%A3%BC%EC%86%8C-%EC%A1%B0%ED%9A%8C
|
|
1605
|
+
fetch deposit addresses for multiple currencies and chain types
|
|
1606
|
+
:param str[]|None codes: list of unified currency codes, default is None
|
|
1607
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1608
|
+
:returns dict: a list of `address structures <https://docs.ccxt.com/#/?id=address-structure>`
|
|
1609
|
+
"""
|
|
1610
|
+
self.load_markets()
|
|
1611
|
+
response = self.privateGetDepositsCoinAddresses(params)
|
|
1612
|
+
#
|
|
1613
|
+
# [
|
|
1614
|
+
# {
|
|
1615
|
+
# "currency": "BTC",
|
|
1616
|
+
# "deposit_address": "3EusRwybuZUhVDeHL7gh3HSLmbhLcy7NqD",
|
|
1617
|
+
# "secondary_address": null
|
|
1618
|
+
# },
|
|
1619
|
+
# {
|
|
1620
|
+
# "currency": "ETH",
|
|
1621
|
+
# "deposit_address": "0x0d73e0a482b8cf568976d2e8688f4a899d29301c",
|
|
1622
|
+
# "secondary_address": null
|
|
1623
|
+
# },
|
|
1624
|
+
# {
|
|
1625
|
+
# "currency": "XRP",
|
|
1626
|
+
# "deposit_address": "rN9qNpgnBaZwqCg8CvUZRPqCcPPY7wfWep",
|
|
1627
|
+
# "secondary_address": "3057887915"
|
|
1628
|
+
# }
|
|
1629
|
+
# ]
|
|
1630
|
+
#
|
|
1631
|
+
return self.parse_deposit_addresses(response, codes)
|
|
1632
|
+
|
|
1633
|
+
def parse_deposit_address(self, depositAddress, currency: Currency = None):
|
|
1634
|
+
#
|
|
1635
|
+
# {
|
|
1636
|
+
# currency: 'XRP',
|
|
1637
|
+
# net_type: 'XRP',
|
|
1638
|
+
# deposit_address: 'raQwCVAJVqjrVm1Nj5SFRcX8i22BhdC9WA',
|
|
1639
|
+
# secondary_address: '167029435'
|
|
1640
|
+
# }
|
|
1641
|
+
#
|
|
1642
|
+
address = self.safe_string(depositAddress, 'deposit_address')
|
|
1643
|
+
tag = self.safe_string(depositAddress, 'secondary_address')
|
|
1644
|
+
currencyId = self.safe_string(depositAddress, 'currency')
|
|
1645
|
+
code = self.safe_currency_code(currencyId)
|
|
1646
|
+
networkId = self.safe_string(depositAddress, 'net_type')
|
|
1647
|
+
self.check_address(address)
|
|
1648
|
+
return {
|
|
1649
|
+
'currency': code,
|
|
1650
|
+
'address': address,
|
|
1651
|
+
'tag': tag,
|
|
1652
|
+
'network': self.network_id_to_code(networkId),
|
|
1653
|
+
'info': depositAddress,
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
def fetch_deposit_address(self, code: str, params={}):
|
|
1657
|
+
"""
|
|
1658
|
+
:see: https://docs.upbit.com/reference/%EC%A0%84%EC%B2%B4-%EC%9E%85%EA%B8%88-%EC%A3%BC%EC%86%8C-%EC%A1%B0%ED%9A%8C
|
|
1659
|
+
fetch the deposit address for a currency associated with self account
|
|
1660
|
+
:param str code: unified currency code
|
|
1661
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1662
|
+
:param str params['network']: deposit chain, can view all chains via self.publicGetWalletAssets, default is eth, unless the currency has a default chain within self.options['networks']
|
|
1663
|
+
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
|
|
1664
|
+
"""
|
|
1665
|
+
self.load_markets()
|
|
1666
|
+
currency = self.currency(code)
|
|
1667
|
+
networkCode = None
|
|
1668
|
+
networkCode, params = self.handle_network_code_and_params(params)
|
|
1669
|
+
if networkCode is None:
|
|
1670
|
+
raise ArgumentsRequired(self.id + ' fetchDepositAddress requires params["network"]')
|
|
1671
|
+
response = self.privateGetDepositsCoinAddress(self.extend({
|
|
1672
|
+
'currency': currency['id'],
|
|
1673
|
+
'net_type': self.network_code_to_id(networkCode, currency['code']),
|
|
1674
|
+
}, params))
|
|
1675
|
+
#
|
|
1676
|
+
# {
|
|
1677
|
+
# currency: 'XRP',
|
|
1678
|
+
# net_type: 'XRP',
|
|
1679
|
+
# deposit_address: 'raQwCVAJVqjrVm1Nj5SFRcX8i22BhdC9WA',
|
|
1680
|
+
# secondary_address: '167029435'
|
|
1681
|
+
# }
|
|
1682
|
+
#
|
|
1683
|
+
return self.parse_deposit_address(response)
|
|
1684
|
+
|
|
1685
|
+
def create_deposit_address(self, code: str, params={}):
|
|
1686
|
+
"""
|
|
1687
|
+
:see: https://docs.upbit.com/reference/%EC%9E%85%EA%B8%88-%EC%A3%BC%EC%86%8C-%EC%83%9D%EC%84%B1-%EC%9A%94%EC%B2%AD
|
|
1688
|
+
create a currency deposit address
|
|
1689
|
+
:param str code: unified currency code of the currency for the deposit address
|
|
1690
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1691
|
+
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
|
|
1692
|
+
"""
|
|
1693
|
+
self.load_markets()
|
|
1694
|
+
currency = self.currency(code)
|
|
1695
|
+
request: dict = {
|
|
1696
|
+
'currency': currency['id'],
|
|
1697
|
+
}
|
|
1698
|
+
# https://github.com/ccxt/ccxt/issues/6452
|
|
1699
|
+
response = self.privatePostDepositsGenerateCoinAddress(self.extend(request, params))
|
|
1700
|
+
#
|
|
1701
|
+
# https://docs.upbit.com/v1.0/reference#%EC%9E%85%EA%B8%88-%EC%A3%BC%EC%86%8C-%EC%83%9D%EC%84%B1-%EC%9A%94%EC%B2%AD
|
|
1702
|
+
# can be any of the two responses:
|
|
1703
|
+
#
|
|
1704
|
+
# {
|
|
1705
|
+
# "success" : True,
|
|
1706
|
+
# "message" : "Creating BTC deposit address."
|
|
1707
|
+
# }
|
|
1708
|
+
#
|
|
1709
|
+
# {
|
|
1710
|
+
# "currency": "BTC",
|
|
1711
|
+
# "deposit_address": "3EusRwybuZUhVDeHL7gh3HSLmbhLcy7NqD",
|
|
1712
|
+
# "secondary_address": null
|
|
1713
|
+
# }
|
|
1714
|
+
#
|
|
1715
|
+
message = self.safe_string(response, 'message')
|
|
1716
|
+
if message is not None:
|
|
1717
|
+
raise AddressPending(self.id + ' is generating ' + code + ' deposit address, call fetchDepositAddress or createDepositAddress one more time later to retrieve the generated address')
|
|
1718
|
+
return self.parse_deposit_address(response)
|
|
1719
|
+
|
|
1720
|
+
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
|
1721
|
+
"""
|
|
1722
|
+
:see: https://docs.upbit.com/reference/디지털자산-출금하기
|
|
1723
|
+
:see: https://docs.upbit.com/reference/%EC%9B%90%ED%99%94-%EC%B6%9C%EA%B8%88%ED%95%98%EA%B8%B0
|
|
1724
|
+
make a withdrawal
|
|
1725
|
+
:param str code: unified currency code
|
|
1726
|
+
:param float amount: the amount to withdraw
|
|
1727
|
+
:param str address: the address to withdraw to
|
|
1728
|
+
:param str tag:
|
|
1729
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1730
|
+
:returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
|
|
1731
|
+
"""
|
|
1732
|
+
tag, params = self.handle_withdraw_tag_and_params(tag, params)
|
|
1733
|
+
self.load_markets()
|
|
1734
|
+
currency = self.currency(code)
|
|
1735
|
+
request: dict = {
|
|
1736
|
+
'amount': amount,
|
|
1737
|
+
}
|
|
1738
|
+
response = None
|
|
1739
|
+
if code != 'KRW':
|
|
1740
|
+
self.check_address(address)
|
|
1741
|
+
# 2023-05-23 Change to required parameters for digital assets
|
|
1742
|
+
network = self.safe_string_upper_2(params, 'network', 'net_type')
|
|
1743
|
+
if network is None:
|
|
1744
|
+
raise ArgumentsRequired(self.id + ' withdraw() requires a network argument')
|
|
1745
|
+
params = self.omit(params, ['network'])
|
|
1746
|
+
request['net_type'] = network
|
|
1747
|
+
request['currency'] = currency['id']
|
|
1748
|
+
request['address'] = address
|
|
1749
|
+
if tag is not None:
|
|
1750
|
+
request['secondary_address'] = tag
|
|
1751
|
+
params = self.omit(params, 'network')
|
|
1752
|
+
response = self.privatePostWithdrawsCoin(self.extend(request, params))
|
|
1753
|
+
else:
|
|
1754
|
+
response = self.privatePostWithdrawsKrw(self.extend(request, params))
|
|
1755
|
+
#
|
|
1756
|
+
# {
|
|
1757
|
+
# "type": "withdraw",
|
|
1758
|
+
# "uuid": "9f432943-54e0-40b7-825f-b6fec8b42b79",
|
|
1759
|
+
# "currency": "BTC",
|
|
1760
|
+
# "txid": "ebe6937b-130e-4066-8ac6-4b0e67f28adc",
|
|
1761
|
+
# "state": "processing",
|
|
1762
|
+
# "created_at": "2018-04-13T11:24:01+09:00",
|
|
1763
|
+
# "done_at": null,
|
|
1764
|
+
# "amount": "0.01",
|
|
1765
|
+
# "fee": "0.0",
|
|
1766
|
+
# "krw_amount": "80420.0"
|
|
1767
|
+
# }
|
|
1768
|
+
#
|
|
1769
|
+
return self.parse_transaction(response)
|
|
1770
|
+
|
|
1771
|
+
def nonce(self):
|
|
1772
|
+
return self.milliseconds()
|
|
1773
|
+
|
|
1774
|
+
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
|
1775
|
+
url = self.implode_params(self.urls['api'][api], {
|
|
1776
|
+
'hostname': self.hostname,
|
|
1777
|
+
})
|
|
1778
|
+
url += '/' + self.version + '/' + self.implode_params(path, params)
|
|
1779
|
+
query = self.omit(params, self.extract_params(path))
|
|
1780
|
+
if method != 'POST':
|
|
1781
|
+
if query:
|
|
1782
|
+
url += '?' + self.urlencode(query)
|
|
1783
|
+
if api == 'private':
|
|
1784
|
+
self.check_required_credentials()
|
|
1785
|
+
headers = {}
|
|
1786
|
+
nonce = self.uuid()
|
|
1787
|
+
request: dict = {
|
|
1788
|
+
'access_key': self.apiKey,
|
|
1789
|
+
'nonce': nonce,
|
|
1790
|
+
}
|
|
1791
|
+
hasQuery = query
|
|
1792
|
+
auth = None
|
|
1793
|
+
if (method != 'GET') and (method != 'DELETE'):
|
|
1794
|
+
body = self.json(params)
|
|
1795
|
+
headers['Content-Type'] = 'application/json'
|
|
1796
|
+
if hasQuery:
|
|
1797
|
+
auth = self.urlencode(query)
|
|
1798
|
+
else:
|
|
1799
|
+
if hasQuery:
|
|
1800
|
+
auth = self.urlencode(self.keysort(query))
|
|
1801
|
+
if auth is not None:
|
|
1802
|
+
hash = self.hash(self.encode(auth), 'sha512')
|
|
1803
|
+
request['query_hash'] = hash
|
|
1804
|
+
request['query_hash_alg'] = 'SHA512'
|
|
1805
|
+
token = self.jwt(request, self.encode(self.secret), 'sha256')
|
|
1806
|
+
headers['Authorization'] = 'Bearer ' + token
|
|
1807
|
+
return {'url': url, 'method': method, 'body': body, 'headers': headers}
|
|
1808
|
+
|
|
1809
|
+
def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
|
|
1810
|
+
if response is None:
|
|
1811
|
+
return None # fallback to default error handler
|
|
1812
|
+
#
|
|
1813
|
+
# {'error': {'message': "Missing request parameter error. Check the required parameters!", 'name': 400}},
|
|
1814
|
+
# {'error': {'message': "side is missing, side does not have a valid value", 'name': "validation_error"}},
|
|
1815
|
+
# {'error': {'message': "개인정보 제 3자 제공 동의가 필요합니다.", 'name': "thirdparty_agreement_required"}},
|
|
1816
|
+
# {'error': {'message': "권한이 부족합니다.", 'name': "out_of_scope"}},
|
|
1817
|
+
# {'error': {'message': "주문을 찾지 못했습니다.", 'name': "order_not_found"}},
|
|
1818
|
+
# {'error': {'message': "주문가능한 금액(ETH)이 부족합니다.", 'name': "insufficient_funds_ask"}},
|
|
1819
|
+
# {'error': {'message': "주문가능한 금액(BTC)이 부족합니다.", 'name': "insufficient_funds_bid"}},
|
|
1820
|
+
# {'error': {'message': "잘못된 엑세스 키입니다.", 'name': "invalid_access_key"}},
|
|
1821
|
+
# {'error': {'message': "Jwt 토큰 검증에 실패했습니다.", 'name': "jwt_verification"}}
|
|
1822
|
+
#
|
|
1823
|
+
error = self.safe_value(response, 'error')
|
|
1824
|
+
if error is not None:
|
|
1825
|
+
message = self.safe_string(error, 'message')
|
|
1826
|
+
name = self.safe_string(error, 'name')
|
|
1827
|
+
feedback = self.id + ' ' + body
|
|
1828
|
+
self.throw_exactly_matched_exception(self.exceptions['exact'], message, feedback)
|
|
1829
|
+
self.throw_exactly_matched_exception(self.exceptions['exact'], name, feedback)
|
|
1830
|
+
self.throw_broadly_matched_exception(self.exceptions['broad'], message, feedback)
|
|
1831
|
+
self.throw_broadly_matched_exception(self.exceptions['broad'], name, feedback)
|
|
1832
|
+
raise ExchangeError(feedback) # unknown message
|
|
1833
|
+
return None
|