Symbol.MarketHours.TimeTillClose() daylight saving bug?

Created at 12 Nov 2023, 14:58
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
bishbashbosh's avatar

bishbashbosh

Joined 08.08.2018

Symbol.MarketHours.TimeTillClose() daylight saving bug?
12 Nov 2023, 14:58


02/03/2017 00:00:00.000 | CBot instance [DstInvestigationBot, USDJPY, h12] started.
02/03/2017 22:05:00.000 | [Warning] Server-Time: 2017-03-02 22:05:00Z; Open-Time: 2017-03-02 22:00:00Z; Time till close: 23:54:45; Current session: Thursday 22:01:00 - Friday 21:59:45
05/03/2017 22:05:00.000 | [Warning] Server-Time: 2017-03-05 22:05:00Z; Open-Time: 2017-03-05 22:00:00Z; Time till close: 23:54:45; Current session: Sunday 22:01:00 - Monday 21:59:45
06/03/2017 22:05:00.000 | [Warning] Server-Time: 2017-03-06 22:05:00Z; Open-Time: 2017-03-06 22:00:00Z; Time till close: 23:54:45; Current session: Monday 22:01:00 - Tuesday 21:59:45
07/03/2017 22:05:00.000 | [Warning] Server-Time: 2017-03-07 22:05:00Z; Open-Time: 2017-03-07 22:00:00Z; Time till close: 23:54:45; Current session: Tuesday 22:01:00 - Wednesday 21:59:45
08/03/2017 22:05:00.000 | [Warning] Server-Time: 2017-03-08 22:05:00Z; Open-Time: 2017-03-08 22:00:00Z; Time till close: 23:54:45; Current session: Wednesday 22:01:00 - Thursday 21:59:45
09/03/2017 22:05:00.000 | [Warning] Server-Time: 2017-03-09 22:05:00Z; Open-Time: 2017-03-09 22:00:00Z; Time till close: 23:54:45; Current session: Thursday 22:01:00 - Friday 21:59:45
12/03/2017 22:05:00.000 | [Warning] Server-Time: 2017-03-12 22:05:00Z; Open-Time: 2017-03-12 21:00:00Z; Time till close: 23:54:45; Current session: Sunday 22:01:00 - Monday 21:59:45

20/04/2017 21:05:00.000 | [Warning] Server-Time: 2017-04-20 21:05:00Z; Open-Time: 2017-04-20 21:00:00Z; Time till close: 00:54:45; Current session: Thursday 22:01:00 - Friday 21:59:45
23/04/2017 21:05:00.000 | [Warning] Server-Time: 2017-04-23 21:05:00Z; Open-Time: 2017-04-23 21:00:00Z; Time till close: 00:00:00; Current session: Sunday 22:01:00 - Monday 21:59:45
24/04/2017 21:05:00.000 | [Warning] Server-Time: 2017-04-24 21:05:00Z; Open-Time: 2017-04-24 21:00:00Z; Time till close: 00:54:45; Current session: Monday 22:01:00 - Tuesday 21:59:45

You can see on 12-March-2017 when the NYC DST switchover happens and the server starts an hour late for some reason; the open time of 9pm GMT is correct, but the current session from Symbol.MarketHours is still showing 10pm daily rollover. Guessing this is why TimeTillClose is returning 1h too much?

Also, into April and the server is now starting at the correct time - roughly 9pm - but the session info is still an hour out and now TimeTillClose is indicating that there is still an hour left of the previous trading day!

I can code around this using DST information from NodaTime, but thought you might want to fix this.


@bishbashbosh
Replies

PanagiotisCharalampous
13 Nov 2023, 06:34

Hi there,

Market hours are set by the brokers. You might want to contact your broker instead.

Best regards,

Panagiotis


@PanagiotisCharalampous