ccxt / ccxt

A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading API with support for more than 100 bitcoin/altcoin exchanges
https://docs.ccxt.com
MIT License
33.03k stars 7.54k forks source link

binance wallet status #3347

Closed fonzmeister closed 6 years ago

fonzmeister commented 6 years ago

The fetchCurrencies method of binance does not report a wallet status, if you're enable to withdraw or deposit. This is probably because it is hard to implement.

The data that has the wallet status can be found here: https://www.binance.com/assetWithdraw/getAllAsset.html

for example NANO is disabled and has the output

{"id":"153","assetCode":"NANO","assetName":"NANO","unit":"","transactionFee":0.01,"commissionRate":0.0,"freeAuditWithdrawAmt":0.0,"freeUserChargeAmount":1.0E7,"minProductWithdraw":"1.000000000000000000","withdrawIntegerMultiple":"0E-18","confirmTimes":"1","chargeLockConfirmTimes":null,"createTime":null,"test":0,"url":"https://www.nanode.co/block/","addressUrl":"https://www.nanode.co/account/","blockUrl":"","enableCharge":false,"enableWithdraw":true,"regEx":"^(xrb_)[13456789abcdefghijkmnopqrstuwxyz]{60}","regExTag":"","gas":1.0,"parentCode":"NANO","isLegalMoney":false,"reconciliationAmount":0.0,"seqNum":"99","chineseName":"NANO","cnLink":"","enLink":"","logoUrl":"/file/resources/img/20180202/image_1517565888589.png","fullLogoUrl":"https://ex.bnbstatic.com/file/resources/img/20180202/image_1517565888589.png","forceStatus":false,"resetAddressStatus":false,"chargeDescCn":null,"chargeDescEn":null,"assetLabel":null,"sameAddress":false,"depositTipStatus":true,"dynamicFeeStatus":false,"depositTipEn":null,"depositTipCn":null,"assetLabelEn":null,"supportMarket":null,"feeReferenceAsset":"","feeRate":null,"feeDigit":null,"legalMoney":false},

the enableCharge & enableWithdraw is the status of the wallet (deposits/withdrawals). Maybe this can be implemented in the fetchCurrencies method?

PS: I know there is a way to call all the non-unified api urls that are available, but I cannot find this one for some reason

kroitor commented 6 years ago

PS: I know there is a way to call all the non-unified api urls that are available, but I cannot find this one for some reason

I've added the endpoint in question, you should be able to call it with exchange.wapiGetAllAsset or exchange.wapi_get_all_asset with CCXT version 1.15.31.

Maybe this can be implemented in the fetchCurrencies method?

Yep, we will consider adding that info where appropriate. Thx for the suggestion!

fonzmeister commented 6 years ago

Thanks for your quick response and help. There seems to be something wrong though. I am getting the error below when I call exchange.wapiGetAllAsset()

PS: There are some small bugs in the code. I am seeing also wapiGetAllassets (nog camelcase) and it does nothing. Same for binance.wapiGetSystemstatus and binance.wapiGetSystemStatus. There might be more, if you need me to create a list let me know. Happy to help a bit (my js sucks, so I am staying away from the code)

ExchangeNotAvailable: binance https://api.binance.com/wapi/v3/getAllAsset.html?timestamp=1531162546317&recvWindow=5000&signature=--- GET 404 Client Error: Not Found for url: https://api.binance.com/wapi/v3/getAllAsset.html?timestamp=1531162546317&recvWindow=5000&signature=--- <html><head><title>Apache Tomcat/7.0.64 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 404 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The requested resource is not available.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.64</h3></body></html>

fonzmeister commented 6 years ago

@kroitor sorry to tag you, but maybe you've unfollowed this thread

kroitor commented 6 years ago

@fonzmeister nope, will add a fix for it soon, nothing is forgotten.

kroitor commented 6 years ago

@fonzmeister

With CCXT 1.15.37 (will be available in 5-10 minutes):

mbp:ccxt igorkroitor$ cd python/
mbp:python igorkroitor$ python
Python 2.7.13 (default, Jun  5 2017, 10:04:07)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ccxt
>>> ccxt.__version__
'1.15.37'  # ←--------------------------------- don't forget to update
>>> from pprint import pprint
>>> b = ccxt.binance ()
>>> pprint([x for x in dir(b) if 'withdraw' in x])
['wapi_get_withdrawfee',
 'wapi_get_withdrawhistory',
 'wapi_post_withdraw',
 'webGetAssetwithdrawGetallassetHtml',
 'web_get_assetwithdraw_getallasset_html',
 'withdraw']
>>> b.web_get_assetwithdraw_getallasset_html ()
# or
>>> b.webGetAssetwithdrawGetallassetHtml ()

It will return the JSON you want. Hope this helps.

fonzmeister commented 6 years ago

like a charm, thnx!