askmike / gekko

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

[Binance] Trading Disabled #2437

Closed bobychain closed 6 years ago

bobychain commented 6 years ago

I'm submitting a ... [*] bug report

Action taken Trader Received advice to go long. Buying

Expected result Buying

Actual result I got a "[Binance] Trading Disabled" due to the excessive amount of status change OPEN and MOVING. Regarding to the logs below, it's openning and moving every 2 seconds and I got kicked from Binance. Usually trading works and the delay between openning and moving is every 1 minutes or so. It happenned randomly (2 times only this week) and some trades works correctly with a normal delay.

Other information

Gekko version: v0.6.5 Nodejs version: v8.11.3

2018-08-12 12:52:17 (INFO): Trader Received advice to go long. Buying  NXS
isValidLot 1 true
2018-08-12 12:52:17 (DEBUG):    Creating order to buy 169.28255611709287 NXS
{"status":1,"request":"ef3da581-634f-443a-a614-3150aa9020bb"}
2018-08-12 12:52:22 (DEBUG):    [ORDER] statusChange: SUBMITTED
isValidLot 1 true
2018-08-12 12:52:22 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 12:52:24 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true
2018-08-12 12:52:24 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 12:52:25 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true
2018-08-12 12:52:25 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 12:52:27 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true
2018-08-12 12:52:27 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 12:52:29 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true
2018-08-12 12:52:29 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 12:52:30 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true
2018-08-12 12:52:31 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 12:52:32 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true
2018-08-12 12:52:32 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 12:52:34 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true
2018-08-12 12:52:34 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 12:52:35 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true
2018-08-12 12:52:36 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 12:52:37 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true

[...]

isValidLot 1 true
2018-08-12 13:08:47 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 13:08:48 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true
2018-08-12 13:08:48 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 13:08:50 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true
2018-08-12 13:08:50 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 13:08:51 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true
2018-08-12 13:08:51 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 13:08:57 (DEBUG):    Requested NXS/BNB trade data from Binance ...
2018-08-12 13:08:57 (DEBUG):    No new trades.
2018-08-12 13:08:59 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true
2018-08-12 13:08:59 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 13:09:01 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true
2018-08-12 13:09:01 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 13:09:02 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true
2018-08-12 13:09:02 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 13:09:04 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true
2018-08-12 13:09:04 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 13:09:10 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true
2018-08-12 13:09:10 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 13:09:12 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true
2018-08-12 13:09:12 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 13:09:14 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true
2018-08-12 13:09:14 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 13:09:15 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true
2018-08-12 13:09:15 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 13:09:17 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true
2018-08-12 13:09:17 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 13:09:17 (DEBUG):    Requested NXS/BNB trade data from Binance ...
2018-08-12 13:09:17 (DEBUG):    No new trades.
2018-08-12 13:09:19 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true
2018-08-12 13:09:19 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 13:09:21 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true
2018-08-12 13:09:21 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 13:09:23 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true
2018-08-12 13:09:23 (DEBUG):    [ORDER] statusChange: OPEN
2018-08-12 13:09:25 (DEBUG):    [ORDER] statusChange: MOVING
isValidLot 1 true
2018-08-12T13:09:25.344Z '[sticky order] FATAL ERROR' 'Error -2015: Invalid API-key, IP, or permissions for action.'
2018-08-12T13:09:25.345Z Error: Error -2015: Invalid API-key, IP, or permissions for action.
    at /home/admin/gekko/exchange/wrappers/binance.js:94:15
    at Request.request [as _callback] (/home/admin/gekko/exchange/node_modules/binance/lib/rest.js:90:25)
    at Request.self.callback (/home/admin/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> (/home/admin/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> (/home/admin/gekko/exchange/node_modules/request/request.js:1079:12)
    at Object.onceWrapper (events.js:313:30)
2018-08-12 13:09:25 (DEBUG):    [ORDER] statusChange: ERROR
2018-08-12 13:09:25 (DEBUG):    Error: Error -2015: Invalid API-key, IP, or permissions for action.
    at /home/admin/gekko/exchange/wrappers/binance.js:94:15
    at Request.request [as _callback] (/home/admin/gekko/exchange/node_modules/binance/lib/rest.js:90:25)
    at Request.self.callback (/home/admin/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> (/home/admin/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> (/home/admin/gekko/exchange/node_modules/request/request.js:1079:12)
    at Object.onceWrapper (events.js:313:30)
bobychain commented 6 years ago

I wonder if this is related because Gekko has not enough Dataset for the strategy or? This strategy need an amount larger of warmup than the SMA_long.

Is SMA_long has to be equal to Warmup or Warmup has to be superior? It seems there is not enough Dataset: 950min needed 216 to 184 min provided by the Exchange.

What do you think?

2018-08-11 19:38:07 (INFO): Setting up Gekko in realtime mode
2018-08-11 19:38:07 (INFO): 
2018-08-11 19:38:07 (INFO): Setting up:
2018-08-11 19:38:07 (INFO):      Trading Advisor
2018-08-11 19:38:07 (INFO):      Calculate trading advice
2018-08-11 19:38:08 (INFO):      Using the strategy: RSI_BULL_BEAR_ADX
2018-08-11 19:38:08 (INFO): ====================================
2018-08-11 19:38:08 (INFO): Running RSI Bull and Bear + ADX
2018-08-11 19:38:08 (INFO): ====================================
2018-08-11 19:38:08 (INFO): Make sure your warmup period matches SMA_long and that Gekko downloads data if needed
2018-08-11 19:38:08 (INFO):     The trading method requests 950 minutes of historic data. Checking availablity..
2018-08-11 19:38:08 (INFO): 

2018-08-11 19:38:08 (INFO):     No usable local data available, trying to get as much as possible from the exchange..
2018-08-11 19:38:08 (INFO):     Preventing Gekko from requesting 950 minutes of history.
2018-08-11 19:38:08 (DEBUG):        Fetching exchange data since 240 minutes ago
2018-08-11 19:38:08 (DEBUG):        Available exchange data:
2018-08-11 19:38:08 (DEBUG):            from: 216 minutes ago
2018-08-11 19:38:08 (DEBUG):            to: 184 minutes ago
2018-08-11 19:38:08 (DEBUG):        Unable to stitch datasets.
2018-08-11 19:38:08 (INFO):     Not seeding locally available data to the trading method.
2018-08-11 19:38:08 (INFO): Setting up:
2018-08-11 19:38:08 (INFO):      Pushover
2018-08-11 19:38:08 (INFO):      Sends pushover.
2018-08-11 19:38:08 (DEBUG):    Setup pushover adviser.
2018-08-11 19:38:08 (INFO): 

2018-08-11 19:38:08 (INFO): Setting up:
2018-08-11 19:38:08 (INFO):      Trader
2018-08-11 19:38:08 (INFO):      Follows the advice and create real orders.

2018-08-11 19:38:13 (DEBUG):    Processing 500 new trades. From 2018-08-05 14:47:20 UTC to 2018-08-11 18:00:45 UTC. (6 days)
cstegmann commented 6 years ago

This happened to me too. It was a combination of two things:

  1. It was a low volume pair so my trades weren't being taken quick enough.
  2. There was a bot that was always undercutting/overbidding me and that caused the bot to keep on moving trades.

Enough cancelling and putting trades back in without any trades being accepted is considered spam by Binance and will get you a 5 minute ban the first time I think. I just gave up on the pair and picked one with at least $800k volume.

bobychain commented 6 years ago

Yes, it makes sense, thank you for your reply

askmike commented 6 years ago

@cstegmann woa that's great feedback, thanks!

Small markets are very tricky to trade profitable on, mostly due to a lack of liquidity. Read this: https://github.com/askmike/gekko/issues/2380#issuecomment-408744682

Enough cancelling and putting trades back in without any trades being accepted is considered spam by Binance and will get you a 5 minute ban the first time I think. I just gave up on the pair and picked one with at least $800k volume.

@cstegmann thanks for letting me know, I was not aware of this!

I'll work to work on more aggressive orders (that also take), which is just very hard to do properly on tiny markets since you'll get insane slippage quite easily.

The act of on upping a price is only considered spam on binance, on all other exchanges this is normal/expected behavior called "price discovery". Really weird imo.