Gekko: [binance.js] code -1013 Filter failure: LOT_SIZE

Created on 12 Jun 2018  路  12Comments  路  Source: askmike/gekko

I'm submitting a ...
[*] bug report
[ ] question about the decisions made in the repository

Action taken (what you did)
Attempting to BUY 4438.76 ZIL at binance price: 0.00632

Expected result (what you hoped would happen)
Get Order & Buy

Actual result (unexpected outcome)
Gekko encountered an error and can't continue
Error:
[binance.js] Response code 400

Then Gekko crash without making any orders.

Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc)

Here is the complete log, getting an error 1013 + LOT_SIZE:
[binance.js] entering "setOrder" callback after api call, err: [binance.js] Response code 400 data: {"code":-1013,"msg":"Filter failure: LOT_SIZE"}

It seems there is a problem with the lot size + Binance with ZIL currency.
I had never any troubles with any other currencies until now!
Help appreciated!

Version running:
Gekko version: v0.5.14
Nodejs version: v9.11.1

  • npm updated

Most helpful comment

This is fixed in 0.6. Please upgrade Gekko and try again :)

All 12 comments

in the folder util you can find update-binance.js.

run it : node update-binance.js

should fix your problem

Thank you, I did it the other day but I still have the problem...
It seems that the lot_size is wrong sometimes, because some orders works, some not.

It seems like it's not working when there is a decimal:

  • working: BUY 3906 ZIL @0.005766 BNB

  • not worling: BUY 3891.9 ZIL @0.005797 BNB

  • not working: BUY 2197.5 ZIL @0.005749 BNB

p.s.: I found this on ccxt with the same problem, seems like there is a possible fix:
https://github.com/ccxt/ccxt/issues/663

LOT_SIZE criteria on binance enforces us to place orders in specific quantities. I have noticied that for small coins whose Market Price is very low, the buy / sell quantity must be a proper integer( with not decimals) - this I have validated with TRX. So, that is the problem you are facing.

In the market data endpoint for binance, the server sends some filters data for each market. In that you can see the filter 'LOB_SIZE', the quantity we try to buy/sell must meet those filter criteria!

The possible fix found by bobychain in ccxt / ccxt @ 663 seems to be correct.

It seems like it's not working when there is a decimal:

working: BUY 3906 ZIL @0.005766 BNB

not worling: BUY 3891.9 ZIL @0.005797 BNB

not working: BUY 2197.5 ZIL @0.005749 BNB

As these examples above, is failing just when the buy quantity is float type. But works well when the quantity is an integer.

Question is, where can I find and edit the file responsible of generate the quantity order?

Well, I tried to edit these file: gekko/exchanges/binance.js. And make this change in function Trader.prototype.buy:

Original:

Trader.prototype.buy = function(amount, price, callback) {
  this.addOrder('buy', amount, price, callback);
};

Edited

Trader.prototype.buy = function(amount, price, callback) {
  this.addOrder('buy', Math.floor(amount), price, callback);
};

Let's see if that solve the issue...

@felixenzogarofalo I think it is not the right fix. As I mentioned, each currency has its own LOT_SIZE rules. In case, I want to use this to trade BTC, ETH, NEO, LTC(the big guys for that fact) and if the amount I want to sell is <1(something like 0.5, 0.12), then your code makes this amount as 0.

Please let me know if I am interpreting your changes wrongly.

You're right. But implement a condition by the specific asset through in binance.js using this.asset.name, i belive we can do it.

Relying on the filters data sent by Binance and handling each asset on case by case basis is better for optimal amount being used in the orders. The end-goal is to ensure, the user can place order without errors and at the same time, minimise the currency balance which will be kind of stuck due to this LOT_SIZE limitation.

node-binance-api handles this by doing a call to the exchangeInfo API route first, then rounding based on that, see: https://github.com/jaggedsoft/node-binance-api/blob/master/examples/advanced.md#clamp-order-quantities-to-required-amounts-via-minqty-minnotional-stepsize-when-placing-orders

This is fixed in 0.6. Please upgrade Gekko and try again :)

I updated but still getting the same error, did anyone have any luck changing the "amount" within the pair you were trading to "1" (I am just trying to make USDT XLM to work)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

belemaire picture belemaire  路  5Comments

Chroll91 picture Chroll91  路  5Comments

GiordanoFlorian picture GiordanoFlorian  路  4Comments

crypto-kid picture crypto-kid  路  5Comments

burtnderson picture burtnderson  路  5Comments