sonvister / Binance

A .NET Standard Binance API library.
MIT License
229 stars 77 forks source link

Place order return Filter Failure: PERCENT_CHANGE #114

Closed evo11x closed 5 years ago

evo11x commented 5 years ago

After I have updated to the latest binance api most orders cannot be placed anymore, I get this error frequently on buys and sells for alts like MTL, TETHA, OST, and others (some gets executed normally, but more than half of the orders return this error) Bad Request: Filter Failure: PERCENT_CHANGE (-1013)

The orders are much higher than minimum allowed and the number of coins are fixed on some alts (without decimal places), but place order still returns this error.

This is the way I try to fix the order amount, (worked fine until the last binance api update).

// place order                         
Symbol symbol = Symbol.Cache.Get(order.CurrencyPair);
InclusiveRange range = symbol.Quantity;

// fix min amount of coins
if (order.Coins < (double)range.Minimum) order.Coins = (double)range.Minimum; 
else order.Coins = (double)range.GetLowerValidValue((decimal)order.Coins);

Here is one example of failed order amount Buy THETA_BTC, Amount: 846.00000000 at Price: 0.00001368

I don't know if the problem comes from the binance api changes or from this api. Maybe the PriceRange GetLowerValidValue and GetValidValue should be fixed to include the latest PERCENT_PRICE multiplier

evo11x commented 5 years ago

Looks like the order book last buy or sell price returns 0 and my app then tries to move the order (cancel and place new order) at the price 0, I will investigate more this problem to see from where it comes