Gekko Forum
Rejected Sell Trades Can Lose 10% Of Your Portfolio... Or More - Printable Version

+- Gekko Forum (https://forum.gekko.wizb.it)
+-- Forum: Gekko (https://forum.gekko.wizb.it/forum-13.html)
+--- Forum: Technical Discussion (https://forum.gekko.wizb.it/forum-23.html)
+--- Thread: Rejected Sell Trades Can Lose 10% Of Your Portfolio... Or More (/thread-57832.html)

Pages: 1 2


RE: Rejected Sell Trades Can Lose 10% Of Your Portfolio... Or More - crypto49er - 01-18-2019

Cool that you saw that about the portfolio issue. You're right. I didn't wait long enough for warm up to complete. I will give it a try. 

On a separate note, these silent rejection errors are definitely a pain. But even the ones that are not silent where it outputs a message to the console doesn't help unless you check the message. This block of code from trader.js starting at line 154 is a good example:

Code:
 if(this.order) {
   if(this.order.side === direction) {
     return log.info('ignoring advice: already in the process to', direction);
   }

   if(this.cancellingOrder) {
     return log.info('ignoring advice: already cancelling previous', this.order.side, 'order');
   }

   log.info('Received advice to', direction, 'however Gekko is already in the process to', this.order.side);
   log.info('Canceling', this.order.side, 'order first');
   return this.cancelOrder(id, advice, () => this.processAdvice(advice));
 }

I have gotten errors where direction is undefined or side is undefined and the trade is ignored. These variables stay undefined so subsequent sell trades are also ignored.
Quote:2019-01-17 17:41:33 (INFO): advice = short
2019-01-17 17:41:33 (INFO): ignoring advice: already cancelling previous undefined order
2019-01-17 17:41:53 (DEBUG): Requested ETH/USD trade data from GDAX ...
2019-01-17 17:41:53 (DEBUG): Processing 3 new trades. From 2019-01-17 17:41:50 UTC to 2019-01-17 17:41:50 UTC. (a few seconds)

I'm probably going to change these to throw {} and have PM2 restart Gekko. At least that will reset these undefined variables.


RE: Rejected Sell Trades Can Lose 10% Of Your Portfolio... Or More - crypto49er - 01-23-2019

All,

I made a video about this issue.

https://www.youtube.com/watch?v=iV4qaYGsV3o

Ultimately, if you experienced a failed trade issue, it is your top priority to get it resolved.

In addition, during bear markets, you should have your strategy issue a sell call first when it starts. The reasoning is there are many other issues and errors, some even from the exchange you use, that will crash Gekko. When paired with PM2 to autorestart Gekko, this will immediately get rid of a potential bag if Gekko happen to crash when the trend turns against you (which is more likely to happen in bear trend) but before your strategy issues a sell signal. Just make sure to reverse this (or at least turn it off) when we finally get out of the bear market in 6 - 12 months.


RE: Rejected Sell Trades Can Lose 10% Of Your Portfolio... Or More - crypto49er - 02-06-2019

All,

I wrote up a much cleaner fix and made a pull request. https://github.com/askmike/gekko/pull/2721

In the tests I ran, Gekko pretty much instantaneously recreate rejected trades, much faster than my old method of having the strategy re-issue a buy/sell order.

If you have Coinbase Pro and know how to access the sandbox, you should definitely test this code. It won't cost you any money and Coinbase Pro gives you $200,000+ fake money to play with in the sandbox. It's harder to run into this issue in the sandbox as the price barely moves compares to the real exchange, but I did come across it once and it worked!