Binance Exception -1013 : LOT_SIZE
When placing an order on Binance, I get the error below.
Have tried both, version 4.3.1 and the development source, but no luck. Also checked the Binance API description directly, but could not find any useful references.
Any suggestions how to resolve this issue would be greatly appreciated.
Exception in thread "main" org.knowm.xchange.binance.dto.BinanceException: -1013: Filter failure: LOT_SIZE at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.fasterxml.jackson.databind.introspect.AnnotatedConstructor.call(AnnotatedConstructor.java:124) at com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createFromObjectWith(StdValueInstantiator.java:274) at com.fasterxml.jackson.databind.deser.ValueInstantiator.createFromObjectWith(ValueInstantiator.java:228) at com.fasterxml.jackson.databind.deser.impl.PropertyBasedCreator.build(PropertyBasedCreator.java:189) at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:421) at com.fasterxml.jackson.databind.deser.std.ThrowableDeserializer.deserializeFromObject(ThrowableDeserializer.java:65) at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:159) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4001) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3030) at si.mazi.rescu.serialization.jackson.JacksonResponseReader.read(JacksonResponseReader.java:53) at si.mazi.rescu.serialization.jackson.JacksonResponseReader.readException(JacksonResponseReader.java:58) at si.mazi.rescu.ResponseReader.read(ResponseReader.java:82) at si.mazi.rescu.RestInvocationHandler.mapInvocationResult(RestInvocationHandler.java:169) at si.mazi.rescu.RestInvocationHandler.receiveAndMap(RestInvocationHandler.java:157) at si.mazi.rescu.RestInvocationHandler.invoke(RestInvocationHandler.java:120) at com.sun.proxy.$Proxy16.newOrder(Unknown Source) at org.knowm.xchange.binance.service.BinanceTradeServiceRaw.newOrder(BinanceTradeServiceRaw.java:32) at org.knowm.xchange.binance.service.BinanceTradeService.placeLimitOrder(BinanceTradeService.java:70) ...
I had the same problem placing orders on binance using amounts like 762.223344. I think they only accept 2 digits after the point. I think they have some pre-defined sizes depending on the currency you want to place an order on.
I found something similar via google: https://www.reddit.com/r/binance/comments/7ej5cn/api_error_code1013_filter_falinure_price_filter/
There is a list of pais with min amount, etc. here: https://support.binance.com/hc/en-us/articles/115000594711-Trading-Rule, which someone could compile in the binance.json file to make it available via the MetaData.
I'll offer 0.5 LTC for anyone who can come up with an elegant solution to this problem.
This project doesn't deal with lot size. The way I deal with the problem in my app is that I have my own per-exchange configuration in which I place stuff that isn't covered my xchange. In it I set the number of decimal places (which technically isn't quite the same thing as lot size) for the quantity on the order, per market, per exchange. It works unless the lot size is a whole number greater than 1 (such as XRP on hitbtc for example, which has a lot size of 100 i think).
Hmm well I guess its final then. I was hoping not that to have to write a massive switch statement, such that:
public BigDecimal amountToLotSize(CurrencyPair cp, BigDecimal amount){...
@DEichEich i can offer my code ;) wallet: La9PWY6UHo5VK3mY7vYXKhbT959dw2SVqS
@sirilicious is your solution just a big if statement? Or does it work with the existing XChange framework? Similar to how bitfinex addresses this with this json. Also does verifyOrder work properly? If it is just a big if statement I already wrote one of those for myself. Thanks
no it is not a clunky if statement - it is utilizing Binance's exchangeInfo endpoint: /api/v1/exchangeInfo
however, i do not use verifyOrder, since i need a mvp 👍
sent
@DEichEich https://github.com/timmolter/XChange/pull/2206
what's the point of verifyOrder? ok, it gives insights which order is invalid, nevertheless it would be much more useful, if all rules are applied to the order, so it would go through.
@timmolter it seems like, at least on Binance, that exchange.getExchangeInfo() allows to see all the necessary information to round up our quantities or prices accordingly with Xchange?
Was it a recent implementation? If yes, I would be interested to see the commits, to know if it applies to more exchanges than Binance :)
For all, here is the utility Java class I've prepared to automatically round my prices or quantities accordingly to the exchange and coins being traded (first version here is only for Binance for now): https://pastebin.com/rNiwK9h9
i i wonder if rounding should be done automatically, eg gnt/btc 100 ok, 100.1 not ok lot error
BinanceException: -1013: Filter failure: LOT_SIZE
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
java.lang.reflect.Constructor.newInstance(Constructor.java:423)