Skip to content
This repository has been archived by the owner on Feb 16, 2020. It is now read-only.

Candle Tick drifts if API fails to return data for X minutes (Kraken) #2872

Closed
IAMtheIAM opened this issue Dec 8, 2019 · 1 comment
Closed
Labels

Comments

@IAMtheIAM
Copy link

IAMtheIAM commented Dec 8, 2019

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

Action taken (what you did)
I started the bot at exactly 00:00 UTC. It ran fine for many weeks with virtually no drift. However, as soon as the Kraken API went down for 50 minutes, a problem occurred with the candle calculation. This is a 4 hour interval.

  • The last tick calculated before the API went down was 08:00 UTC
  • 4 hours later, at the next attempted tick, the kraken API was down at 12:01
  • It retried again 8 times per second (that's a problem in itself), until 12:28. The bot then stopped reporting any errors.
  • The next tick was attempted to be calculated at 12:51, and I have no idea why there was a 23 minute delay from the last error to the time when the next tick was calculated.
  • Even though this tick occurred at 12:51, it calculated the tick at 12:00. It went back in time.
  • The next tick occurred at 16:20, but calculated a candle timestamp of 16:00. I don't know how it arrived at 16:20 when the last attempt was at 12:51
  • The next tick occurred at 20:20, and correctly calculated a candle timestamp of 20:20
  • Every tick after this occurred at XX:20.

So there is a big problem there. After an API failure, the candle timestamp calculation goes wacky, and doesn't correlate correctly to the data coming in until 3 ticks after data has resumed.
In addition, since the API can be down for X number of minutes, the candle calculation is now X number of minutes drifted in time from original start. This throws the entire strategy off.

Expected result (what you hoped would happen)
Candle timestamp calculation should resume after an API failure at the next scheduled interval, based on the interval specified in the strategy settings.

Actual result (unexpected outcome)
Candle timestamp calculation resumes based on the a random time after API data resumes coming in.

Please advise how this can be properly addressed.
I'm thinking the bot needs some internal work on the candle, but in the mean time I think I could check for drift and if drift occurred, automatically stop and restart the bot on the next scheduled tick. I need to think how this could be accomplished.

@stale
Copy link

stale bot commented Feb 6, 2020

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.

@stale stale bot added the wontfix label Feb 6, 2020
@stale stale bot closed this as completed Feb 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant