Skip to content
Open
Show file tree
Hide file tree
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
10 changes: 9 additions & 1 deletion ib_async/ib.py
Original file line number Diff line number Diff line change
Expand Up @@ -2502,7 +2502,15 @@ def reqUserInfoAsync(self):
future = self.wrapper.startReq(reqId)
self.client.reqUserInfo(reqId)
return future


def reqPositionsMulti(self,account,modelCode) -> List[Position]:
return self._run(self.reqPositionsMultiAsync(account,modelCode))

def reqPositionsMultiAsync(self,account,modelCode) -> Awaitable[List[Position]]:
reqId = self.client.getReqId()
future = self.wrapper.startReq(reqId, container=[])
self.client.reqPositionsMulti(reqId, account, modelCode)
return future

if __name__ == "__main__":
loop = util.getLoop()
Expand Down
19 changes: 9 additions & 10 deletions ib_async/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,18 +442,14 @@ def positionEnd(self):
self._endReq("positions")

def positionMulti(
self,
reqId: int,
account: str,
modelCode: str,
contract: Contract,
pos: float,
avgCost: float,
):
pass
self, reqId: int, account: str, modelCode: str,
contract: Contract, pos: float, avgCost: float):
results = self._results.get(reqId) ;
if results is not None:
results.append({'account':account,'modelCode':modelCode , 'symbol':contract.symbol,'secType':contract.secType,'currency':contract.currency,'position':pos , 'avgCost':avgCost } )

def positionMultiEnd(self, reqId: int):
pass
self._endReq(reqId)

def pnl(
self, reqId: int, dailyPnL: float, unrealizedPnL: float, realizedPnL: float
Expand Down Expand Up @@ -1495,3 +1491,6 @@ def tcpDataProcessed(self):
ticker.time = self.lastTime
ticker.updateEvent.emit(ticker)
self.ib.pendingTickersEvent.emit(self.pendingTickers)