binance-trader icon indicating copy to clipboard operation
binance-trader copied to clipboard

error, the bot is trying to resell the full amount of what we bought. not taking account fees ?

Open DokRaphael opened this issue 7 years ago • 3 comments

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.

DokRaphael avatar Jan 04 '18 20:01 DokRaphael

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.

lhilarides avatar Jan 05 '18 20:01 lhilarides

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.

dengo1905 avatar Mar 04 '18 02:03 dengo1905

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.

gu3nter avatar Mar 06 '18 09:03 gu3nter