Skip to content

Commit

Permalink
Update ibstore.py
Browse files Browse the repository at this point in the history
Looks like IBKR updated format for historical dates
  • Loading branch information
atreyuxtrading authored Nov 1, 2022
1 parent 4cb2052 commit 3b55791
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions atreyu_backtrader_api/ibstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,8 @@ def reqHistoricalDataEx(self, contract, enddate, begindate,
self.conn.reqHistoricalData(
tickerId,
contract,
bytes(intdate.strftime('%Y%m%d %H:%M:%S') + ' GMT'),
#bytes(intdate.strftime('%Y%m%d %H:%M:%S') + ' GMT'),
bytes(intdate.strftime('%Y%m%d-%H:%M:%S')),
bytes(duration),
bytes(barsize),
bytes(what),
Expand Down Expand Up @@ -1270,7 +1271,8 @@ def reqHistoricalData(self, contract, enddate, duration, barsize,
self.conn.reqHistoricalData(
tickerId,
contract,
bytes(enddate.strftime('%Y%m%d %H:%M:%S') + ' GMT'),
# bytes(enddate.strftime('%Y%m%d %H:%M:%S') + ' GMT'),
bytes(enddate.strftime('%Y%m%d-%H:%M:%S')),
bytes(duration),
bytes(barsize),
bytes(what),
Expand Down Expand Up @@ -1328,8 +1330,10 @@ def reqHistoricalTicksEx(self, contract, enddate=None, begindate=None,
self.conn.reqHistoricalTicks(
tickerId,
contract,
bytes(begindate.strftime('%Y%m%d %H:%M:%S') + ' GMT') if begindate else '',
bytes(enddate.strftime('%Y%m%d %H:%M:%S') + ' GMT') if enddate else '',
# bytes(begindate.strftime('%Y%m%d %H:%M:%S') + ' GMT') if begindate else '',
# bytes(enddate.strftime('%Y%m%d %H:%M:%S') + ' GMT') if enddate else '',
bytes(begindate.strftime('%Y%m%d-%H:%M:%S')) if begindate else '',
bytes(enddate.strftime('%Y%m%d-%H:%M:%S')) if enddate else '',
100,
bytes(what),
int(useRTH),
Expand Down Expand Up @@ -1366,9 +1370,11 @@ def reqHistoricalTicks(self, contract, enddate, begindate,
self.conn.reqHistoricalTicks(
tickerId,
contract,
bytes(begindate.strftime('%Y%m%d %H:%M:%S') + ' GMT') if begindate else '',
# bytes(begindate.strftime('%Y%m%d %H:%M:%S') + ' GMT') if begindate else '',
bytes(begindate.strftime('%Y%m%d-%H:%M:%S')) if begindate else '',
# bytes(enddate.strftime('%Y%m%d %H:%M:%S') + ' GMT'),
bytes(enddate.strftime('%Y%m%d %H:%M:%S') + ' GMT') if enddate else '',
# bytes(enddate.strftime('%Y%m%d %H:%M:%S') + ' GMT') if enddate else '',
bytes(enddate.strftime('%Y%m%d-%H:%M:%S')) if enddate else '',
10,
bytes(what),
# int(useRTH),
Expand Down

0 comments on commit 3b55791

Please sign in to comment.