Failing to withdraw() with several exchanges
See original GitHub issueGood morning, folks,
I’ve been unable to withdraw from multiple exchanges through ccxt. I know this area is under development, but I wonder if I’m doing something wrong in any of the following circumstances…
my code looks like this…
for x in distribution:
print "Send " + str(x[0]) + " ETH from " + x[1] + " to " + x[2]
for y in exchange_list:
time.sleep(1)
if y.id == x[1] and y.id != 'bitfinex' and y.hasWithdraw: #Bitfinex temporary excluded
y.withdraw('ETH', format(x[0], '8f'), x[3])
(“distribution” is a tuple including the amount I want to move ([x][0]), the exchange to move from ([x][1]) and the exchange to move to ([x][2]), along with the wallet address of the receiving exchange ([x][3]))
exchange_list is a tuple containing the exchange objects. I declare each of them and then put them into exchange_list like so:
tidex = ccxt.tidex({
'apiKey': '[REMOVED]',
'secret': '[REMOVED]',
'nonce': ccxt.Exchange.milliseconds,
'verbose': True
})
bittrex = ccxt.bittrex({
'apiKey': '[REMOVED]',
'secret': '[REMOVED]'
})
exchange_list = [bittrex, poloniex, bitfinex, cex, tidex, gdax, binance, hitbtc]
Bittrex, Poloniex and GDAX, for example, work great:
('https://bittrex.com/api/v1.1/account/withdraw?nonce=1507376565715¤cy=ETH&apikey=[REMOVED]&address=0xf2805cc91932f716cd1b50f2969e96bf9185efc6&quantity=0.1', 'GET', 'https://bittrex.com/api/v1.1/account/withdraw?nonce=1507376565715¤cy=ETH&apikey=[REMOVED]&address=0xf2805cc91932f716cd1b50f2969e96bf9185efc6&quantity=0.1', '\nRequest:', {'apisign': 'b5ceefa3f5be426923af84a8b550faf8dee986a6334b44af3165c38f25c1f2ef6d5e2e3677d8f56ad5d2d334472e8fbb72aaa18c731a366af4427ad28a20c422', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'ccxt/1.9.37 (+https://github.com/kroitor/ccxt) Python/2.7.14'}, None)
('GET', 'https://bittrex.com/api/v1.1/account/withdraw?nonce=1507376565715¤cy=ETH&apikey=[REMOVED]&address=0xf2805cc91932f716cd1b50f2969e96bf9185efc6&quantity=0.1', '\nResponse:', ['Date: Sat, 07 Oct 2017 11:42:46 GMT\r\n', 'Content-Type: application/json; charset=utf-8\r\n', 'Content-Length: 96\r\n', 'Connection: close\r\n', 'Set-Cookie: __cfduid=d48c9c1ba70925d7a9dab2f37fff406cc1507376566; expires=Sun, 07-Oct-18 11:42:46 GMT; path=/; domain=.bittrex.com; HttpOnly\r\n', 'Cache-Control: private\r\n', 'Content-Encoding: gzip\r\n', 'Strict-Transport-Security: max-age=15768000\r\n', 'X-XSS-Protection: 1; mode=block\r\n', 'X-Content-Type-Options: nosniff\r\n', 'X-Download-Options: noopen\r\n', 'Server: cloudflare-nginx\r\n', 'CF-RAY: 3aa099528dff22c4-LAX\r\n'], u'{"success":true,"message":"","result":{"uuid":"[REMOVED]"}}')
{'info': {u'message': u'', u'result': {u'uuid': u'[REMOVED]'}, u'success': True}, 'id': u'[REMOVED]'}
The following tests were done with the following code to simplify the testing process (replacing gdax with the other ccxt exchange objects):
x = (0.1, '0xf2805cc91932f716cd1b50f2969e96bf9185efc6')
print gdax.withdraw('ETH', x[0], x[1])
I’m getting errors such as this for Tidex:
('https://api.tidex.com/tapi', 'POST', 'https://api.tidex.com/tapi', '\nRequest:', {'User-Agent': 'ccxt/1.9.37 (+https://github.com/kroitor/ccxt) Python/2.7.14', 'Content-Type': 'application/x-www-form-urlencoded', 'Accept-Encoding': 'gzip, deflate', 'Key': [REMOVED], 'Sign': '[REMOVED]'}, 'nonce=1507375760&amount=0.034989&coinName=BTC&method=WithdrawCoin&address=19qAGRERXqa9Pe3QvKvKZbRjiSxEyXFvkz')
('POST', 'https://api.tidex.com/tapi', '\nResponse:', ['Date: Sat, 07 Oct 2017 11:29:20 GMT\r\n', 'Content-Type: application/json; charset=utf-8\r\n', 'Transfer-Encoding: chunked\r\n', 'Connection: close\r\n', 'Set-Cookie: __cfduid=[REMOVED]; expires=Sun, 07-Oct-18 11:29:20 GMT; path=/; domain=.tidex.com; HttpOnly\r\n', 'Server: cloudflare-nginx\r\n', 'CF-RAY: 3aa085a8ddbc76d0-LAX\r\n', 'Content-Encoding: gzip\r\n'], u'{"success":0,"code":0,"error":"invalid method"}')
Exception in thread Thread-2:
Traceback (most recent call last):
File "C:\Python27\lib\threading.py", line 801, in __bootstrap_inner
self.run()
File "C:\Python27\lib\threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "C:\Users\Kenneth\eclipse-workspace\Chank\wallet-daemon.py", line 179, in distributeFunds
distributeBTC()
File "C:\Users\Kenneth\eclipse-workspace\Chank\wallet-daemon.py", line 138, in distributeBTC
y.withdraw('BTC', format(x[0], '6f'), x[3])
File "C:\Python27\lib\site-packages\ccxt\exchanges.py", line 14184, in withdraw
}, params))
File "C:\Python27\lib\site-packages\ccxt\exchanges.py", line 14220, in request
raise ExchangeError(self.id + ' ' + self.json(response))
ExchangeError: tidex {"code":0,"success":0,"error":"invalid method"}
This occurs with Bitfinex (@kroitor is currently looking into this one because I hijacked the thread of Issue #199):
('https://api.bitfinex.com/v1/withdraw', 'POST', 'https://api.bitfinex.com/v1/withdraw', '\nRequest:', {'User-Agent': 'ccxt/1.9.37 (+https://github.com/kroitor/ccxt) Python/2.7.14', 'X-BFX-PAYLOAD': [REMOVED]=', 'X-BFX-APIKEY': '[REMOVED]', 'Accept-Encoding': 'gzip, deflate', 'X-BFX-SIGNATURE': '[REMOVED]'}, None)
Traceback (most recent call last):
File "C:\Users\Kenneth\eclipse-workspace\Chank\CCXTtests.py", line 76, in <module>
print bitfinex.withdraw('ETH', x[0], x[1])
File "C:\Python27\lib\site-packages\ccxt\exchanges.py", line 2389, in withdraw
}, params))
File "C:\Python27\lib\site-packages\ccxt\exchanges.py", line 2424, in request
response = self.fetch2(path, api, method, params, headers, body)
File "C:\Python27\lib\site-packages\ccxt\exchange.py", line 225, in fetch2
return self.fetch(request['url'], request['method'], request['headers'], request['body'])
File "C:\Python27\lib\site-packages\ccxt\exchange.py", line 263, in fetch
self.handle_rest_errors(e, e.code, text, url, method)
File "C:\Python27\lib\site-packages\ccxt\exchange.py", line 311, in handle_rest_errors
self.raise_error(error, url, method, exception if exception else str(http_status_code), details)
File "C:\Python27\lib\site-packages\ccxt\exchange.py", line 210, in raise_error
details,
ccxt.errors.ExchangeNotAvailable: bitfinex POST https://api.bitfinex.com/v1/withdraw 400 Bad Request (possible reasons: invalid API keys, bad or old nonce, exchange is down or offline, on maintenance, DDoS protection, rate-limiting,
Also, has anyone got advice for getting around HitBTC’s “Main” wallet that receives deposits and the need to transfer to the trading wallet before it’s accessible to withdrawal or trade? I’d like to fully automate my trades and will need to move funds around regularly to do so.
Thanks so much!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:21 (11 by maintainers)
Top GitHub Comments
Looks good, sir! Thank you very much. I can’t express my appreciation enough. All issues in this thread are resolved.
@PhinixPhire and API key permissions to withdraw are all set to “write”, is that correct? The image below shows them all off on one of my keys (that’ for example, yours should be on for withdrawals):