askmike / gekko

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

TImestamps are wrong and have a major delay #2810

Closed IAMtheIAM closed 5 years ago

IAMtheIAM commented 5 years ago

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

Action taken (what you did) Start a papertrader CLI bot using the 3 hours candle at 8:57AM

Expected result (what you hoped would happen) Bot would start calculating ticks every 3 hours on the house, i.e. 9AM, 12PM, 3PM, etc. (or whenever the tick happened from the exchange)

Actual result (unexpected outcome) Bot runs tick at the same time when started, but every 3 hours, so which tick is being used is known i.e. candleTimestamp: Mon Jul 01 2019 06:57:00 GMT+0000 candleTimestamp: Mon Jul 01 2019 09:57:00 GMT+0000 candleTimestamp: Mon Jul 01 2019 12:57:00 GMT+0000 candleTimestamp: Mon Jul 01 2019 15:57:00 GMT+0000 This comes from candle.start

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

Why is gekko using the minute which I started the bot rather then when the candles actually occur? How am I supposed to know which tick is being used when the timestamp is inbetween the real ticks? Thanks for any help.

IAMtheIAM commented 5 years ago

I figured out that the way gekko works is that it calculates the tick based on whenever you start the bot, at the given interval. So if you want your chart to synchronize with an exchange, you have to start it at the exact time the bar closes on the exchange or chart you're watching. It's easy with at or cron.