ib_async icon indicating copy to clipboard operation
ib_async copied to clipboard

Check contract details has time zone ID

Open djkelleher opened this issue 1 year ago • 2 comments

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.

djkelleher avatar May 15 '24 17:05 djkelleher

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.

mattsta avatar May 16 '24 01:05 mattsta

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.

djkelleher avatar May 16 '24 01:05 djkelleher