sthewissen / Mynt

An Azure Functions-based crypto currency trading bot; featuring 10 exchanges, 25 indicators, custom strategy support, backtester and more

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doesn't binance send the complete candles?

ASADeveloper opened this issue · comments

Hi,

I just looked again in the last code and doubt about how the last candle found and then eliminated. Do you eliminate the last candle because you don't know if it is complete? Because in that case, what is the CloseTime in binance?

I ran a little test and it went like this:
On 9:35 the 2 last hourly candles had respectively CloseTime 8:28 and 9:28. I assume that I have to use the 9:28 candle for getting buy/sell advice. But in your code it looks for candles between 8:00 and 9:00 and so removes the last one and uses the 8:28 candle for buy/sell advice!

You know that that last candle is extremely important ;-)

To be honest it would be weird if the hourly candle closes at X:28 instead of simply closing at the top of the hour? The current logic in develop uses the current time and compares it to the timestamp of the last candle. Let's say its 09:00 now and the bots runs at 09:01 the candle that started at 09:00 is not interesting. That's the candle that get's eliminated.

Since Binance's maintenance February 8th and 9th, the restart seems to have influenced the new candle open and close times. Binance came up at 9:28:15 AM UTC, and a new hour starts at HH:28:15 since then.

Still, getting a set of candles at a particular time will leave you with one incomplete, last candle. For a good analysis you should time the retrieval and analysis and eliminate the last one. @ASADeveloper, in your case the last candle only comprises data of 7 minutes - not something you'd want to take into account in your decision making.

It is therefore best to time your analysis at HH:29:00 and eliminate the last candle. Or you could make your bot smarter and let it time its moment to run based on the start time of the candles. You never know when Binance changes the things back to the normal conditions.

In addition to the above: Binance has changed the starting time of the candels back again. Five minute candles (the ones used by the back tester) now have a starting time of HH:m0:00 and HH:m5:00 again.