Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Check contract details has time zone ID #663

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions ib_insync/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,14 +524,15 @@ def liquidSessions(self) -> List[TradingSession]:
return self._parseSessions(self.liquidHours)

def _parseSessions(self, s: str) -> List[TradingSession]:
tz = util.ZoneInfo(self.timeZoneId)
sessions = []
for sess in s.split(';'):
if not sess or 'CLOSED' in sess:
continue
sessions.append(TradingSession(*[
dt.datetime.strptime(t, '%Y%m%d:%H%M').replace(tzinfo=tz)
for t in sess.split('-')]))
if s:
tz = util.ZoneInfo(self.timeZoneId)
for sess in s.split(';'):
if not sess or 'CLOSED' in sess:
continue
sessions.append(TradingSession(*[
dt.datetime.strptime(t, '%Y%m%d:%H%M').replace(tzinfo=tz)
for t in sess.split('-')]))
return sessions


Expand Down