Version: ib_async 2.1.0
TWS sends execution times zone-less (YYYYMMDD-HH:MM:SS, UTC), but on a non-UTC host they decode to the wrong instant.
In Decoder.execDetails, when TimezoneTWS is unset the parsed time stays naive, then time.astimezone(defaultTimezone) is called and naive.astimezone() presumes system local time, so the UTC time string gets read in the host's zone.
Repro (host = America/Chicago):
from ib_async.util import parseIBDatetime
from zoneinfo import ZoneInfo
t = parseIBDatetime("20260824-20:00:12") # naive
print(t.astimezone(ZoneInfo("America/New_York")))
# -> 2026-08-24 21:00:12-04:00 (wrong; expected 16:00, i.e. 20:00 UTC)
Result silently depends on host timezone. Suggested fix - default the source zone to UTC when there is no timezone information in the string.
TWS seems to send most timestamps with timezone attached to it. Log inspection suggests that timestamps without a timezone are indeed in UTC, but there is no documentation confirming this except here, but it's about their web api.
Version: ib_async 2.1.0
TWS sends execution times zone-less (
YYYYMMDD-HH:MM:SS, UTC), but on a non-UTC host they decode to the wrong instant.In
Decoder.execDetails, whenTimezoneTWSis unset the parsed time stays naive, thentime.astimezone(defaultTimezone)is called andnaive.astimezone()presumes system local time, so the UTC time string gets read in the host's zone.Repro (host =
America/Chicago):Result silently depends on host timezone. Suggested fix - default the source zone to UTC when there is no timezone information in the string.
TWS seems to send most timestamps with timezone attached to it. Log inspection suggests that timestamps without a timezone are indeed in UTC, but there is no documentation confirming this except here, but it's about their web api.