Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

southxchange & bleutrade fetch_balance error (ccxt v. 1.9.174, Python 2.7) #341

Closed
PhinixPhire opened this issue Oct 18, 2017 · 9 comments
Closed
Assignees

Comments

@PhinixPhire
Copy link

The fetch_balance() function in southxchange and bleutrade seems to result in this error:

Traceback (most recent call last):
  File "C:\xampp\cgi-bin\TheChankReport.py", line 71, in <module>
    fetch_wallet()
  File "C:\xampp\cgi-bin\TheChankReport.py", line 22, in fetch_wallet
    balance = x.fetch_balance()
  File "C:\Python27\lib\site-packages\ccxt\exchanges.py", line 5482, in fetch_balance
    account['used'] = balance['Balance'] - balance['Available']
TypeError: unsupported operand type(s) for -: 'unicode' and 'unicode'

I have bittrex, anxpro and hitbtc working with the same code.

@kroitor kroitor self-assigned this Oct 18, 2017
@kroitor
Copy link
Member

kroitor commented Oct 18, 2017

@PhinixPhire got it, will fix it... Unfortunately, Python is very sensitive... No problem, just a sec.

@kroitor
Copy link
Member

kroitor commented Oct 18, 2017

I did a fix for bleutrade, should be ready soon. In the meantime, can you please paste verbose output for the error you were getting with southxchange?

kroitor added a commit that referenced this issue Oct 18, 2017
@PhinixPhire
Copy link
Author

PhinixPhire commented Oct 18, 2017

('https://www.southxchange.com/api/markets', 'GET', 'https://www.southxchange.com/api/markets', '\nRequest:', {'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'ccxt/1.9.174 (+https://github.com/ccxt-dev/ccxt) Python/2.7.14'}, None)
('GET', 'https://www.southxchange.com/api/markets', '\nResponse:', 'Date: Wed, 18 Oct 2017 10:39:03 GMT\r\nContent-Type: application/json; charset=utf-8\r\nTransfer-Encoding: chunked\r\nConnection: close\r\nSet-Cookie: __cfduid=[REMOVED]; expires=Thu, 18-Oct-18 10:39:03 GMT; path=/; domain=.southxchange.com; HttpOnly\r\nCache-Control: no-cache, no-store, must-revalidate\r\nPragma: no-cache\r\nExpires: -1\r\nSet-Cookie: _culture=en-US; path=/\r\nX-AspNetMvc-Version: 5.2\r\nAccess-Control-Allow-Origin: *\r\nX-AspNet-Version: 4.0.30319\r\nX-Powered-By: ASP.NET\r\nX-Frame-Options: DENY\r\nSet-Cookie: ARRAffinity=[REMOVED];Path=/;HttpOnly;Domain=www.southxchange.com\r\nServer: cloudflare-nginx\r\nCF-RAY: [REMOVED]-ORD\r\nContent-Encoding: gzip\r\n', u'[["BCH","BTC"],["BSD","BTC"],["BTA","BTC"],["CHA","BTC"],["DASH","BTC"],["DOGE","BTC"],["ETH","BTC"],["FLB","BTC"],["GRT","BTC"],["ICE","BTC"],["LTC","BTC"],["MINT","BTC"],["MRN","BTC"],["MSR","BTC"],["NMC","BTC"],["NXT","BTC"],["PPC","BTC"],["PTC","BTC"],["STRAT","BTC"],["SUP","BTC"],["VTC","BTC"],["VUC","BTC"],["XMR","BTC"],["XVG","BTC"],["ZEIT","BTC"],["CHRC","LTC"],["ZEIT","LTC"],["BCH","USD"],["BTC","USD"],["DASH","USD"],["ETH","USD"],["GRT","USD"],["ICE","USD"],["LTC","USD"],["MRN","USD"],["MSR","USD"],["STRAT","USD"],["USNBT","USD"],["XMR","USD"],["BTC","USNBT"]]')
('https://www.southxchange.com/api/listBalances', 'POST', 'https://www.southxchange.com/api/listBalances', '\nRequest:', {'Hash': '[REMOVED]', 'Content-Type': 'application/json', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'ccxt/1.9.174 (+https://github.com/ccxt-dev/ccxt) Python/2.7.14'}, '{"nonce":1508323142,"key":"[REMOVED]"}')
('POST', 'https://www.southxchange.com/api/listBalances', '\nResponse:', 'Date: Wed, 18 Oct 2017 10:39:04 GMT\r\nContent-Type: application/json; charset=utf-8\r\nContent-Length: 2\r\nConnection: close\r\nSet-Cookie: __cfduid=[REMOVED]; expires=Thu, 18-Oct-18 10:39:03 GMT; path=/; domain=.southxchange.com; HttpOnly\r\nCache-Control: no-cache, no-store, must-revalidate\r\nPragma: no-cache\r\nExpires: -1\r\nSet-Cookie: _culture=en-US; path=/\r\nX-AspNetMvc-Version: 5.2\r\nAccess-Control-Allow-Origin: *\r\nX-AspNet-Version: 4.0.30319\r\nX-Powered-By: ASP.NET\r\nX-Frame-Options: DENY\r\nSet-Cookie: ARRAffinity=[REMOVED];Path=/;HttpOnly;Domain=www.southxchange.com\r\nServer: cloudflare-nginx\r\nCF-RAY: [REMOVED]-ORD\r\n', u'[]')

Traceback (most recent call last):
  File "C:\xampp\cgi-bin\TheChankReport.py", line 71, in <module>
    fetch_wallet()
  File "C:\xampp\cgi-bin\TheChankReport.py", line 22, in fetch_wallet
    balance = x.fetch_balance()
  File "C:\Python27\lib\site-packages\ccxt\exchanges.py", line 5500, in fetch_balance
    account['used'] = balance['Balance'] - balance['Available']
TypeError: unsupported operand type(s) for -: 'unicode' and 'unicode'
>>> 

@kroitor
Copy link
Member

kroitor commented Oct 18, 2017

@PhinixPhire sorry, but File "C:\Python27\lib\site-packages\ccxt\exchanges.py", line 5500, in fetch_balance is the location of bleutrade, not southxchange... I can't find any problem with southxchange currently... In fact their calls should look completely different, so your output does not seem to be the output for southxchange... Are you sure that your code calls from southxchange correspond to that verbose output?

@PhinixPhire
Copy link
Author

Ohhh... I see what's happening. southxchange is working, but I have no balance, so it provides no output aside from the verbose pasted above.

bleutrade is next in the exchange_list array, so it errors out and I mistakenly interpreted it as southxchange's error. Then I tested bleutrade in another script and found it to have the error.

Sorry for the confusion!

@kroitor
Copy link
Member

kroitor commented Oct 18, 2017

Oh, now I see. No problem, that happens. My advice is: put an explicit line "empty balance" there instead of nothing, when the balance is empty, following that rule for all undefined variables will save you hours of debugging, really. ;)

So, I guess, the only problem is bleutrade and it should be fixed by the upcoming build in 5 minutes, right? Let me know if it works for you or not, please. )

@PhinixPhire
Copy link
Author

Yep, that should be it. I'll confirm if working as soon as the update comes through. Thank You so much!

@kroitor
Copy link
Member

kroitor commented Oct 18, 2017

It's there, will stand by to hear from you.

@PhinixPhire
Copy link
Author

Working great! I appreciate the help, as always.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants