Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check contract details has time zone ID #20

Open
wants to merge 1 commit into
base: main
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
20 changes: 8 additions & 12 deletions ib_async/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,19 +582,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