binance-trader
binance-trader copied to clipboard
0.9 currency problem
Can't trade for any currencies under 1.0
Hey @Jagermeister56,
thank you for reporting. Which parameter do you try to configure to 0.5
?
Thanks Johannes
for this example i used BTC as Base ETh as trading .06 Trade Amount .7% Profit
I came across this too. The coin amount is expecting an integer data type. .06 is a float, so code would need to be changed.
I solved this in my version by changing the tradeAmount from int to double in BinanceTrader.java, as well as the amount variable in the client API wrapper TradingClient.java. String formatting also needs to be changed from %d to %.8f as applicable. I just starting using this, trading BTC against alts like DGD or others where I need fractional amounts (esp for testing).
Thanks for making this!!!
.. as an update to my last comment, I realize there needs to be a little more logic in there with respect to trade amounts and balances < 1. I was trading with DGD and amount less than 1.. and after buying, the bot apparently forgot it had bought DGD and didn't sell. I tweaked this modified version a little more, changing the function tradingBalanceAvailable to check for > 0.001 instead of 1. BUT this caused problems when trading with other currencies that don't allow trading of fractional amounts. Not sure yet if there is a Binance function to also check the minimum trade amount for that currency, but if there is, we could use this instead of a hardcoded value.
In class BinanceTrader
I have changed this (there is another check also): ("0".equals("" + tradingBalance.getLocked().charAt(0)) && lastAsk >= currentlyBoughtPrice)
to this:
("0.000".equals("" + tradingBalance.getLocked().substring(0,5)) && lastAsk >= currentlyBoughtPrice)