Skip to content

Commit

Permalink
Update ibbroker.py
Browse files Browse the repository at this point in the history
Date from IBKR was broken
  • Loading branch information
atreyuxtrading authored Nov 1, 2022
1 parent 3b55791 commit 43bdb04
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion atreyu_backtrader_api/ibbroker.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,14 @@ def push_commissionreport(self, cr):

# Use the actual time provided by the execution object
# The report from TWS is in actual local time, not the data's tz
dt = date2num(datetime.strptime(ex.time, '%Y%m%d %H:%M:%S'))
#dt = date2num(datetime.strptime(ex.time, '%Y%m%d %H:%M:%S'))
dt_array = [] if ex.time == None else ex.time.split(" ")
if dt_array and len(dt_array) > 1:
dt_array.pop()
ex_time = " ".join(dt_array)
dt = date2num(datetime.strptime(ex_time, '%Y%m%d %H:%M:%S'))
else:
dt = date2num(datetime.strptime(ex.time, '%Y%m%d %H:%M:%S %A'))

# Need to simulate a margin, but it plays no role, because it is
# controlled by a real broker. Let's set the price of the item
Expand Down

0 comments on commit 43bdb04

Please sign in to comment.