API Support Forum
OEC API > Market Data > LastDateTime is old
Author Topic: LastDateTime is old
(4 messages, Page 1 of 1)
Moderators: VPfau
VLuc
Posts: 5
Joined: Jul 17, 2020


Posted: Oct 13, 2020 @ 05:49 AM             Msg. 1 of 4
I'm subscribing to some priceTick and expect real time value:

client.Subscriptions.Price.Subscribe(ContractID);

And when I check the LastDateTime value in the GFClient_OnPriceTick, it is 2 hours old at minimum.
Debug.WriteLine(e.Price.LastDateTime.ToUniversalTime());

Example: we have 13/10/2020 08:22:16 when we expect 13/10/2020 10:22:16 in UTC, with local time being 13/10/2020 12:22:16 (GMT+2).
SRuscak
Posts: 30
Joined: Aug 24, 2017


Posted: Oct 13, 2020 @ 12:28 PM             Msg. 2 of 4
The time is already in UTC, so I suspect you just need to remove the ToUniversalTime call.
VLuc
Posts: 5
Joined: Jul 17, 2020


Posted: Oct 14, 2020 @ 08:22 AM             Msg. 3 of 4
If the ToUniversalTime call change the time, that mean it isn't in UTC, you might have a wrong initialization of your DateTime object here.
SRuscak
Posts: 30
Joined: Aug 24, 2017


Posted: Oct 14, 2020 @ 09:00 AM             Msg. 4 of 4
The DateTime is UTC, it's just that the DateTime.Kind is set to DateTimeKind.Unspecified when the message from the server is deserialized. But you are right, it would be more correct as DateTimeKind.Utc, and we plan to address this in a future release.