cryptoeax / arbbot

Arbitrator, a bitcoin/altcoin arbitrage trading bot
https://gitter.im/cryptoeax-arbbot/Lobby
GNU General Public License v3.0
198 stars 78 forks source link

Binance branch: ERROR, try to buy more than the balance #135

Closed ericfraselle closed 6 years ago

ericfraselle commented 6 years ago

I received the following error, the bot try to buy for 0.01413527 BTC but the balance show only 0.0074 BTC on Binance.

17:14:09: ERROR during management task: binance {"code":-2010,"msg":"Account has insufficient balance for requested action."}

0 /var/www/arbbot/lib/composer/vendor/ccxt/ccxt/php/Exchange.php(855): ccxt\binance->handle_errors(0, '', 'https://api.bin...', 'POST', Array, '{"code":-2010,"...')

1 /var/www/arbbot/lib/composer/vendor/ccxt/ccxt/php/Exchange.php(705): ccxt\Exchange->fetch('https://api.bin...', 'POST', Array, 'timestamp=15171...')

2 /var/www/arbbot/lib/composer/vendor/ccxt/ccxt/php/Exchange.php(709): ccxt\Exchange->fetch2('order', 'private', 'POST', Array, NULL, NULL)

3 [internal function]: ccxt\Exchange->request('order', 'private', 'POST', Array)

4 /var/www/arbbot/lib/composer/vendor/ccxt/ccxt/php/Exchange.php(648): call_user_func(Array, 'order', 'private', 'POST', Array)

5 /var/www/arbbot/bot/CCXTAdapter.php(11): ccxt\Exchange->ccxt{closure}(Array)

6 /var/www/arbbot/lib/composer/vendor/ccxt/ccxt/php/binance.php(645): BinanceExchange->__call('privatePostOrde...', Array)

7 /var/www/arbbot/bot/CCXTAdapter.php(166): ccxt\binance->create_order('VIBE/BTC', 'limit', 'buy', '180.61931652', '0.00007826')

8 /var/www/arbbot/bot/CoinManager.php(664): CCXTAdapter->buy('VIBE', 'BTC', '0.00007826', '180.61931652')

9 /var/www/arbbot/bot/CoinManager.php(690): CoinManager->autobuyAltcoins(Object(Arbitrator))

10 /var/www/arbbot/bot/CoinManager.php(57): CoinManager->manageWallets(Object(Arbitrator))

11 /var/www/arbbot/bot/Arbitrator.php(56): CoinManager->doManage(Object(Arbitrator))

12 /var/www/arbbot/bot/Arbitrator.php(590): Arbitrator->loop()

13 /var/www/arbbot/bot/Arbitrator.php(22): Arbitrator->innerRun()

14 [internal function]: Arbitrator->{closure}(Object(React\EventLoop\Timer\Timer))

15 /var/www/arbbot/lib/composer/vendor/react/event-loop/src/Timer/Timers.php(90): call_user_func(Object(Closure), Object(React\EventLoop\Timer\Timer))

16 /var/www/arbbot/lib/composer/vendor/react/event-loop/src/StreamSelectLoop.php(177): React\EventLoop\Timer\Timers->tick()

17 /var/www/arbbot/bot/Arbitrator.php(583): React\EventLoop\StreamSelectLoop->run()

18 /var/www/arbbot/main.php(164): Arbitrator->run()

19 {main}

cryptoeax commented 6 years ago

Hmm, when you restart the bot, do you see it report a different BTC balance than what you see on the exchange in the wallets section?

ericfraselle commented 6 years ago

I reset all the bot (database), and now I see that the BTC wallets are correct, but other wallets are totally wrong, I think it's due to pending_deposits table that are wrong. Half of the entries don't have ID_whithdrawal.

cryptoeax commented 6 years ago

I reset all the bot (database), and now I see that the BTC wallets are correct, but other wallets are totally wrong, I think it's due to pending_deposits table that are wrong. Half of the entries don't have ID_whithdrawal.

That part is expected. It could be that at the time you did the initial creation of the table there were pending deposits which could mess the table up (I also got the same problem which resulted in some of the wallets showing a negative balance, for example. I have since added a warning about this (11dcfa8caa34d4d02a7cf971e4f0f88fd425c3bd) but there isn't much that the bot can do here since even if the bot attempted to detect the situation, it would fail due to the problem this table is trying to solve (#50).

If this was your problem, once you delete the pending_deposits table and restart the bot while making sure there are no pending deposits ongoing, the problem should go away since from that point on the state of the pending deposits on the exchanges will match the bot's notion.

Please reopen if you saw this again...