ib_async
ib_async copied to clipboard
Check contract details has time zone ID
Contracts about to expire may not have tradingHours, liquidHours, and timeZoneId set. This was causing an error when _parseSessions is called:
Exception has occurred: ValueError
ZoneInfo keys must be normalized relative paths, got:
A simple way to avoid the error would be to check if the argument string is empty.
Is this related to the input s or only the self.timeZoneId value?
Perhaps when s is empty then self.timeZoneId is also empty or invalid?
It looks like the fix works either way, but technically the s.split() already skips an empty s, so we are actually just checking if self.timeZoneId is a problem.
It's currently written for the expected behavior: if s is non-empty then timeZoneId should be valid. If s is empty then timeZoneId may not be valid.