binance-trader
binance-trader copied to clipboard
error, the bot is trying to resell the full amount of what we bought. not taking account fees ?
Hi The bot bought 500 XVG When he tries to sell I get :
2018-01-04 20:13:26.570 INFO 15 --- [pool-1-thread-1] io.github.unterstein.BinanceTrader : Tradingbalance: AssetBalance[asset=XVG,free=499.50000000,locked=0.00000000]
2018-01-04 20:13:26.570 INFO 15 --- [pool-1-thread-1] io.github.unterstein.BinanceTrader : Order filled, let`s sell!
2018-01-04 20:13:26.570 INFO 15 --- [pool-1-thread-1] io.github.unterstein.TradingClient : Selling 500 for 0.00017219
2018-01-04 20:13:27.962 ERROR 15 --- [pool-1-thread-1] io.github.unterstein.BinanceTrader : Unable to perform ticker
com.binance.api.client.exception.BinanceApiException: Account has insufficient balance for requested action.
As a temporary workaround you could use BNB coins to pay for fees (see binance settings), so the fee is not subtracted from the coins when you buy them. This way the buy amount will equal the sell amount.
I have the same problem...and I'm using BNB but still got that error when selling and buying and most of the times exception happens when I'm low on funds... I think that calculates fees somewhere.
as workaround (for BTC trading too) you can change in TradingClient.java:
NewOrder order = new NewOrder(symbol, OrderSide.SELL, OrderType.LIMIT, TimeInForce.GTC, "" + quantity, priceString);
to:
NewOrder order = new NewOrder(symbol, OrderSide.SELL, OrderType.LIMIT, TimeInForce.GTC, "" + Double.valueOf(getTradingBalance().getFree()).intValue(), priceString);
But note: After the change, all currencies >1 gets sold, so i you want to hold funds than do not change TradingClient.java.