Skip to content

Commit 9429c8a

Browse files
committed
Fixes issue backtrader2#61: self.positions throws attibute error when IB Broker used.
self.positions = collections.defaultdict(Position) is consistent in all the other brokers, was missed in IB.
1 parent 2877a25 commit 9429c8a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

backtrader/brokers/ibbroker.py

+1
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ def __init__(self, **kwargs):
276276
self.ordstatus = collections.defaultdict(dict)
277277
self.notifs = queue.Queue() # holds orders which are notified
278278
self.tonotify = collections.deque() # hold oids to be notified
279+
self.positions = self.ib.positions
279280

280281
def start(self):
281282
super(IBBroker, self).start()

0 commit comments

Comments
 (0)