askmike / gekko

A bitcoin trading bot written in node - https://gekko.wizb.it/
MIT License
10.07k stars 3.95k forks source link

Live trade crashed with 'handleCreate [binance.js] Error -1013: Filter failure: LOT_SIZE' sticky.js #2406

Closed ianhord closed 6 years ago

ianhord commented 6 years ago

Note: this is the technical bug tracker, please use other platforms for getting support and starting a (non technical) discussion. See the getting help page for details.

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

**Action taken (what you did)** Running Gekko v0.6.2 commandline trading config on ubuntu 16 Bot had been watching market pair on binance and then wanted to buy long.

**Expected result (what you hoped would happen)**

Trade should have bought currency

**Actual result (unexpected outcome)**

The strat crashed sticky.js with the following

'handleCreate [binance.js] Error -1013: Filter failure: LOT_SIZE

did some research and thought is may be a fraction issue in the buy amount.

I was using NULS BNB pair and checked the exchange/wrappers/binance-markets.json compared minimal order amounts with values in binance https://support.binance.com/hc/en-us/articles/115000594711-Trading-Rule and everything looked good.

Read that another possible issue might be differences between clock on the gekko server and the binance server. I am running gekko on google compute instance so don't know how to do that. Unlikely as I have successfully traded other coins on this instance.

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

I am trading another coin pair on the same gekko instance via the UI. That has been trading fine.

Looking for suggestions on what I can do to resolve.

Thanks,

askmike commented 6 years ago

Read that another possible issue might be differences between clock on the gekko server and the binance server. I am running gekko on google compute instance so don't know how to do that.

That's not the issue here.

I was using NULS BNB pair and checked the exchange/wrappers/binance-markets.json compared minimal order amounts with values in binance

Yes, Gekko should check lot requirements on binance and not create when they are not met. Do you have more logs available? I'm specifically interested in the amount Gekko tried to trade.

ianhord commented 6 years ago

Hi Mike, Unfortunately I lost the console output - are there anymore logs I can check? The full amount in the account BNB account was around 300 BNB, but mostly reserved on another trade. The available amount was 74.02616855 BNB Hope this helps, Ian

xbromy commented 6 years ago

That's the error I have since last week. Gekko is not live trading on binance. This is with version 0.6.4 started yesterday...

2018-08-07 03:11:56 (DEBUG): syncing private data 2018-08-07 03:21:56 (DEBUG): syncing private data 2018-08-07 03:31:56 (DEBUG): syncing private data 2018-08-07 03:33:41 (DEBUG): Buy - Predicted variation: 0.3049657110318164 2018-08-07 03:33:41 (DEBUG): Buy - Predicted variation: 0.24002033650587393 2018-08-07 03:41:56 (DEBUG): syncing private data 2018-08-07 03:47:22 (DEBUG): Sell - Predicted variation: -0.3277180334148252 5 2018-08-07 03:47:22 (INFO): Trader Received advice to go short. Selling ONT 2018-08-07 03:47:22 (DEBUG): Creating order to sell 48.9333866 ONT 2018-08-07 03:47:27 (DEBUG): [ORDER] statusChange: SUBMITTED 2018-08-07 03:47:28 (DEBUG): [ORDER] statusChange: ERROR 2018-08-07 03:47:28 (ERROR): [ORDER] Gekko received error from GB: Error -101 3: Filter failure: LOT_SIZE 2018-08-07 03:47:28 (DEBUG): Error: Error -1013: Filter failure: LOT_SIZE at /home/username/gekko/exchange/wrappers/binance.js:79:15 at Request.request [as _callback] (/home/username/gekko/exchange/node_module s/binance/lib/rest.js:90:25) at Request.self.callback (/home/username/gekko/exchange/node_modules/request /request.js:185:22) at Request.emit (events.js:182:13) at Request. (/home/username/gekko/exchange/node_modules/request/r equest.js:1157:10) at Request.emit (events.js:182:13) at IncomingMessage. (/home/username/gekko/exchange/node_modules/r equest/request.js:1079:12) at Object.onceWrapper (events.js:273:13) at IncomingMessage.emit (events.js:187:15) at endReadableNT (_stream_readable.js:1081:12) 2018-08-07 03:51:56 (DEBUG): syncing private data 2018-08-07 04:01:56 (DEBUG): syncing private data 2018-08-07 04:09:43 (DEBUG): Sell - Predicted variation: -0.2580880740840026 4 2018-08-07 04:09:43 (DEBUG): Sell - Predicted variation: -0.1923448465823899 2018-08-07 04:11:56 (DEBUG): syncing private data 2018-08-07 04:21:56 (DEBUG): syncing private data 2018-08-07 04:30:44 (DEBUG): Sell - Predicted variation: -0.2421686312036846 5 2018-08-07 04:30:44 (DEBUG): Sell - Predicted variation: -0.1874466807037789 2018-08-07 04:31:56 (DEBUG): syncing private data 2018-08-07 04:41:56 (DEBUG): syncing private data 2018-08-07 04:51:56 (DEBUG): syncing private data 2018-08-07 04:54:25 (DEBUG): Buy - Predicted variation: 0.2622833929962699 2018-08-07 04:54:25 (INFO): NOT buying, already exposed 2018-08-07 05:01:56 (DEBUG): syncing private data 2018-08-07 05:02:05 (DEBUG): Buy - Predicted variation: 0.2582448486457039 2018-08-07 05:11:56 (DEBUG): syncing private data

mikolajmikolajczyk commented 6 years ago

Hi, I just got same issue. I have Gekko running in VirtualBox on Ubuntu. I cloned stable branch. I was trading BNB-ADX on binance. My logs:

2018-08-06 22:22:19 (DEBUG):    syncing private data
2018-08-06 22:32:19 (DEBUG):    syncing private data
2018-08-06 22:42:19 (DEBUG):    syncing private data
2018-08-06 22:52:19 (DEBUG):    syncing private data
2018-08-06 23:02:19 (DEBUG):    syncing private data
2018-08-06 23:04:27 (DEBUG):    Buy - Predicted variation:  0.6748976790579392
2018-08-06 23:04:27 (INFO): Trader Received advice to go long. Buying  ADX
2018-08-06 23:04:27 (DEBUG):    Creating order to buy 82.42482010943911 ADX
2018-08-06 23:04:27 (DEBUG):    Buy - Predicted variation:  0.539910560920409
2018-08-06 23:04:33 (DEBUG):    [ORDER] statusChange: SUBMITTED
2018-08-06 23:04:33 (DEBUG):    [ORDER] statusChange: ERROR
2018-08-06 23:04:33 (ERROR):    [ORDER] Gekko received error from GB: Error -1013: Filter failure: LOT_SIZE
2018-08-06 23:04:33 (DEBUG):    Error: Error -1013: Filter failure: LOT_SIZE
    at /opt/gekko/exchange/wrappers/binance.js:74:15
    at Request.request [as _callback] (/opt/gekko/exchange/node_modules/binance/lib/rest.js:90:25)
    at Request.self.callback (/opt/gekko/exchange/node_modules/request/request.js:185:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (/opt/gekko/exchange/node_modules/request/request.js:1157:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (/opt/gekko/exchange/node_modules/request/request.js:1079:12)
    at Object.onceWrapper (events.js:313:30)
2018-08-06 23:12:19 (DEBUG):    syncing private data
2018-08-06 23:14:28 (DEBUG):    Buy - Predicted variation:  0.5936628648836934
2018-08-06 23:20:28 (DEBUG):    Buy - Predicted variation:  0.6049053758506472
2018-08-06 23:22:19 (DEBUG):    syncing private data
2018-08-06 23:26:48 (DEBUG):    Sell - Predicted variation:  -0.5579014493068554
2018-08-06 23:26:48 (INFO): NOT selling, already no exposure
2018-08-06 23:32:19 (DEBUG):    syncing private data
2018-08-06 23:42:19 (DEBUG):    syncing private data
xbromy commented 6 years ago

Additional info: My gekko v0.6.2 dev stopped last week during live trading without change on the system. So there must be a change on binance (nothing else changed...)

Has it to do with BNB? Is there someone having good trades right now with BNB or other currencies?

xbromy commented 6 years ago

This is output with current dev branch:

2018-08-07 21:45:40 (DEBUG): Sell - Predicted variation: -0.5083041454253294 2018-08-07 21:45:40 (INFO): Trader Received advice to go short. Selling ONT 2018-08-07 21:45:40 (DEBUG): Creating order to sell 52.163386599999995 ONT 2018-08-07 21:45:45 (DEBUG): [ORDER] statusChange: SUBMITTED 2018-08-07 21:45:45 (DEBUG): [ORDER] statusChange: ERROR 2018-08-07 21:45:45 (ERROR): [ORDER] Gekko received error from GB: Error -1013: Filter failure: LOT_SIZE 2018-08-07 21:45:45 (DEBUG): Error: Error -1013: Filter failure: LOT_SIZE at /home/username/gekko/exchange/wrappers/binance.js:79:15 at Request.request [as _callback] (/home/username/gekko/exchange/node_modules/binance/lib/rest.js:90:25) at Request.self.callback (/home/username/gekko/exchange/node_modules/request/request.js:185:22) at Request.emit (events.js:182:13) at Request. (/home/username/gekko/exchange/node_modules/request/request.js:1157:10) at Request.emit (events.js:182:13) at IncomingMessage. (/home/username/gekko/exchange/node_modules/request/request.js:1079:12) at Object.onceWrapper (events.js:273:13) at IncomingMessage.emit (events.js:187:15) at endReadableNT (_stream_readable.js:1081:12)

ianhord commented 6 years ago

@askmike Hi mike, had another crash same algo and coin pair., available BNB balance was 73.82880521 Let me know if you need more info to investigate. Thanks here is the console output `2018-08-08 17:17:19 (INFO): We have new trading advice! 2018-08-08 17:17:19 (INFO): Position: long 2018-08-08 17:17:19 (INFO): Market price: 0.12151 2018-08-08 17:17:19 (INFO): Based on market time: 2018-08-08 17:13:00

2018-08-08 17:17:19 (INFO): Trader Received advice to go long. Buying NULS 2018-08-08 17:17:24 (DEBUG): [ORDER] statusChange: SUBMITTED handleCreate [binance.js] Error -1013: Filter failure: LOT_SIZE

/home/ianhord/gekko/exchange/orders/sticky.js:122 throw err; ^ Error at Object. (/home/ianhord/gekko/exchange/exchangeErrors.js:34:24) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. (/home/ianhord/gekko/exchange/exchangeChecker.js:4:16) at Module._compile (module.js:652:30) ianhord@gekko2:~/gekko$ `

askmike commented 6 years ago

@ianhord @xbromy @blackwolf102 I've pushed 2 updates in the hopes of fixing this to the develop branch, please try that one. Read here how: https://gekko.wizb.it/docs/installation/updating_gekko.html#Updating-the-develop-branch

The fixes are:

xbromy commented 6 years ago

@askmike Looks good on my instance. I've only glitches with refresh on pages / and two total crashes of live gekko. (after a few minutes it was gone to nowhere together with marked-watcher). But this issue seems to be fixed.

ianhord commented 6 years ago

@askmike Many thanks for the fix and instructions on how to install. Testing now.

ianhord commented 6 years ago

@askmike FYI Started a live trade on Binance BNB NULS via the UI Checked console and got the following, seems like it restarted - doesn't look like it has tried to trade yet. Off to bed will check again tomorrow.

2018-08-09 17:46 Gekko 2018-08-09-17-46-watcher-162863810294486 started. --> POST /api/startGekko 200 72ms 1.23kb <-- POST /api/startGekko 2018-08-09 17:46 Gekko 2018-08-09-17-46-tradebot-189080549812882 started. --> POST /api/startGekko 200 11ms 1.81kb RECEIVED ERROR IN GEKKO INSTANCE 2018-08-09-17-46-watcher-162863810294486 { errno: 5, code: 'SQLITE_BUSY' } 2018-08-09 17:46 A gekko watcher crashed. 2018-08-09 17:46 1 leecher(s) were depending on this watcher. 2018-08-09 17:46 Watcher had recent data, starting a new one in a minute. <-- POST /api/getCandles --> POST /api/getCandles 200 327ms 8.85kb <-- POST /api/getCandles --> POST /api/getCandles 200 277ms 8.85kb 2018-08-09 17:47 Gekko 2018-08-09-17-47-watcher-291863787203669 started.

ianhord commented 6 years ago

@askmike Hi Just checked and found it crashed again. Here is the console output following on from the one above The trade should have been around 73 BNB I have binance account set to use BNB for fees. Wondering if taking my BNB wallet to zero with the trade causes a problem?

--> POST /api/getCandles 200 279ms 11.48kb handleCreate Error -1013: Filter failure: LOT_SIZE RECEIVED ERROR IN GEKKO INSTANCE 2018-08-09-17-46-tradebot-189080549812882 {} <-- GET /api/imports

Also got the following in the UI This is an archived Gekko, it is currently not running anymore. This is Gekko crashed with the following error: {}

Any thoughts?

xbromy commented 6 years ago

@askmike I've increased the Candle from 1 minute to 5 minutes. With that it's stable since 9 hours and trading. (9 trades). Before with 1 minute candle it went away after 1-2 hours after 1 or 3 trades... so it works but not 100%. And I still have UI issues. I don't see a difference after follow the npm install on vue stuff like you wrote.

Damn, also the 5 minute trader just died. (together with the market watcher I created manually before the live trader) Over the night is was working fine. Is there a problem watching the trader by UI? (I didn't do in night :-) )

askmike commented 6 years ago

@ianhord that's a different error, don't think it's related to binance. It's in the bug tracker already but I haven't been able to nail down the cause.

Damn, also the 5 minute trader just died. (together with the market watcher I created manually before the live trader) Over the night is was working fine.

Do you get the same error as in OP? Not sure what you mean with:

Is there a problem watching the trader by UI? (I didn't do in night :-) )

xbromy commented 6 years ago

Hi @askmike, I now tried command line the whole day with 1 minute candles. It's working well with binance and BNB. I don't know what you mean with OP? I thought it might be a problem with watching the status in web ui taht leads the gekko to die. But it also dies without having the browser open. And it dies together with market watcher. So trader and watcher are not there in UI from one second to next. There is no same end in logs. So I don't get an error. I'm now on command line. That working for me.

askmike commented 6 years ago

I don't know what you mean with OP?

with OP I mean opening post: so the first post in this issue.

I thought it might be a problem with watching the status in web ui taht leads the gekko to die. But it also dies without having the browser open. And it dies together with market watcher. So trader and watcher are not there in UI from one second to next. There is no same end in logs. So I don't get an error. I'm now on command line. That working for me.

So Gekko runs the same code whether you start something through the bUI or not, the only difference is that gekkos from the UI run in a child process where CLI gekkos don't. But this really should NOT make any difference. Also note that looking at the UI or not does not make any difference in regards to this bug.

I'm now on command line. That working for me.

Great, but please report back if you encounter the error again. I think the error was fixed when I updated the market file, but if you see it again please do let me know and post logs!

On Fri, Aug 10, 2018 at 11:03 PM, xbromy notifications@github.com wrote:

Hi @askmike https://github.com/askmike, I now tried command line the whole day with 1 minute candles. It's working well with binance and BNB. I don't know what you mean with OP? I thought it might be a problem with watching the status in web ui taht leads the gekko to die. But it also dies without having the browser open. And it dies together with market watcher. So trader and watcher are not there in UI from one second to next. There is no same end in logs. So I don't get an error. I'm now on command line. That working for me.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/askmike/gekko/issues/2406#issuecomment-412110112, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7MD4y7LkqTtRF_-mgCMCiWd9q04nbYks5uPaCwgaJpZM4VuMI7 .

-- PGP key at keybase.io/mikevanrossum https://keybase.io/mikevanrossum/key.asc

xbromy commented 6 years ago

Hi @askmike Then yes the OP is fixed I think. But UI is unstable since 0.6.2.

askmike commented 6 years ago

@xbromy I might close this issue to make it clear to everyone this is probably fixed.

As to your UI problem. If you run into issues again regarding a stale UI that doesn't seem to update. Can you please open the develop console in your browser (assuming chrome or firefox: right click - "select element" - go to "console" tab) and post a screenshot of all errors and warnings and such in a new issue on Github?

On Fri, Aug 10, 2018 at 11:13 PM, xbromy notifications@github.com wrote:

Hi @askmike https://github.com/askmike Then yes the OP is fixed I think. But UI is unstable since 0.6.2.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/askmike/gekko/issues/2406#issuecomment-412113193, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7MD4LvYM9-Ue37js07zUeunV56BeBOks5uPaMWgaJpZM4VuMI7 .

-- PGP key at keybase.io/mikevanrossum https://keybase.io/mikevanrossum/key.asc

askmike commented 6 years ago

If anyone is still encountering this error on v0.6.5 (or later) please open a new issue and I shall investigate further!

AniketArora commented 5 years ago

I'm getting this error again, can someone look please? I have v0.6.7. I use Binance for my exchange.

2018-11-05T19:36:57.737Z 'sticky create' 'buy' (node:8092) [DEP0079] DeprecationWarning: Custom inspection function on Objects via .inspect() is deprecated 2018-11-05T19:36:58.002Z 'Error -1013: Filter failure: MIN_NOTIONAL' 2018-11-05T19:36:58.017Z '[sticky order] FATAL ERROR' 'Error -1013: Filter failure: MIN_NOTIONAL' 2018-11-05T19:36:58.017Z Error: Error -1013: Filter failure: MIN_NOTIONAL at C:\Users\Aniket\Documents\gekko\exchange\wrappers\binance.js:101:15 at Request.request [as _callback] (C:\Users\Aniket\Documents\gekko\exchange\node_modules\binance\lib\rest.js:90:25) at Request.self.callback (C:\Users\Aniket\Documents\gekko\exchange\node_modules\request\request.js:185:22) at Request.emit (events.js:182:13) at Request. (C:\Users\Aniket\Documents\gekko\exchange\node_modules\request\request.js:1157:10) at Request.emit (events.js:182:13) at IncomingMessage. (C:\Users\Aniket\Documents\gekko\exchange\node_modules\request\request.js:1079:12) at Object.onceWrapper (events.js:273:13) at IncomingMessage.emit (events.js:187:15) at endReadableNT (_stream_readable.js:1094:12) at process._tickCallback (internal/process/next_tick.js:63:19) 2018-11-05T19:36:58.017Z 'handleCreate error'

askmike commented 5 years ago

@AniketArora1 please manually run the following:

cd exchange/util/genMarketFiles
node update-binance.js