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

0.9 currency problem

Open Jagermeister56 opened this issue 7 years ago • 6 comments

Can't trade for any currencies under 1.0 screen shot 2018-01-07 at 11 55 17 pm

Jagermeister56 avatar Jan 08 '18 05:01 Jagermeister56

Hey @Jagermeister56,

thank you for reporting. Which parameter do you try to configure to 0.5?

Thanks Johannes

unterstein avatar Jan 08 '18 06:01 unterstein

for this example i used BTC as Base ETh as trading .06 Trade Amount .7% Profit

Jagermeister56 avatar Jan 08 '18 18:01 Jagermeister56

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.

bnuccio avatar Feb 17 '18 02:02 bnuccio

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!!!

glennoid avatar Feb 26 '18 03:02 glennoid

.. 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.

glennoid avatar Feb 27 '18 18:02 glennoid

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)

dengo1905 avatar Mar 04 '18 02:03 dengo1905