-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[GDAX] Strategy Execution Delayed or Never Starts #1689
Comments
What makes you think the strategy didn't start in this case? |
@askmike I have a lot of logging. I should have been more clear in that the "check" method of a strategy is delayed or never starts. It seems like once the bot runs for the "requiredHistory" amount of time, in real time, it will work. Sometimes the history does work, sometimes it does not. |
I believe I have narrowed this down a bit and I don't think it is necessarily unique to GDAX. Once a strategy gets sufficiently complicated it seems like if certain things can't happen fast enough between the "tickrate" timeframe, Gekko starts to act strange. In this case of this snippet the tickrate was set to 5. If I increased it to 20, it behaved more like I expected. Once my strategy got even more complicated, I had to increase the tickrate to 30, otherwise even if the strategy did start to execute the "check" method, the results of about 10% of my tulip indicators would come back with NaN as a result. It seems that adjusting the tickrate to exceed the time it takes for the "update" method to fully complete is a workaround. |
So I did a bit more testing and this time I used Binance and I am still able to re-create the issue. I am honestly not sure exactly what one must do to re-create the issue but it happens to be pretty regularly. I usually do a fresh import just before I try to run Gekko to ensure it has as much locally available history as possible. In my config I have requiredHistory set to 60 and candlesize set to either 1 or 5. tickrate is set at the default of 20 I added a line to baseTradingMethod.js at line 224 just below the definition of The output is attached at the bottom of this comment. My suspicion is that relatively complex strategies have an update method that exceeds some amount of time to complete and it breaks something, but I am not 100% sure.
|
I can confirm this issue with Kraken. Not too complicated a strategy either. Looks to me from that output that the importer doesn't get a chance to finish grabbing history before the tradeadvisor starts, and then it doesn't bother after that. |
I was experiencing a similar issue because my this.requiredHistory = this.tradingAdvisor.historySize; So the second similar issue I was facing was that, even though it was priming the isPremature = candle.start < startTime; If it's premature, it doesn't start trading, though the first whole live candle was being called premature, although I wanted to start trading right away. The way I use the bot I need it to instantly start trading, so I modified // in live mode we might receive more candles
// than minimally needed. In that case check
// whether candle start time is > startTime
var isPremature;
// Subtract number of minutes in current candle for instant start
let startTimeMinusCandleSize = startTime.clone();
startTimeMinusCandleSize.subtract(this.tradingAdvisor.candleSize, "minutes");
if(mode === 'realtime'){
isPremature = candle.start < startTimeMinusCandleSize;
}
else{
isPremature = false;
} This causes it to start trading on the first live candle. Perhaps this is related to your issue? |
No, that's not the issue for either of us. We've discussed it on Discord and it seems to be a race condition caused by the use of tulip indicators. |
I'm running into this problem also. I'm not using TALIB or Tulip, so I think the problem may be something else. I don't have any recent local data, so it's only exchange data fetching. I'm setting candleSize to 1 and historySize to 10 as a test. I'm reading through Here is my CLI output. Strategy's check() isn't getting called for a long time.
|
#2112 fixes my problem. However, I'm not sure it closes this issue. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If you feel this is very a important issue please reach out the maintainer of this project directly via e-mail: gekko at mvr dot me. |
Note: for support questions, please join our Discord server
I'm submitting a ...
[x] bug report
[ ] feature request
[ ] question about the decisions made in the repository
Action taken (what you did)
Started a cli instance of gekko against a working config file
Expected result (what you hoped would happen)
Gekko fills in the needed history to meet "requiredHistory" and starts the strategy.
Actual result (unexpected outcome)
Gekko just collects new trades during the present timeframe but does not start the strategy. Occassionally after some time (10-30 minutes) the strategy will start, others it seems to go on like this indefinitely.
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc)
The text was updated successfully, but these errors were encountered: