Positions
Introduction
A limitation of the function EClient.reqAccountUpdates is that it can only be used with a single account at a time. To create a subscription for position updates from multiple accounts, the function EClient.reqPositions is available.
After initially invoking reqPositions, information about all positions in all associated accounts will be returned, followed by the EWrapper.positionEnd callback. Thereafter, when a position has changed an update will be returned to the EWrapper.position function. To cancel a reqPositions subscription, invoke EClient.cancelPositions.
Request Positions
EClient.reqPositions()
Subscribes to position updates for all accessible accounts. All positions sent initially, and then only updates as positions change.
Python
Python (Full Example)
Java
C++
C#
VB.NET
Receive Positions
EWrapper.position(account, contract, pos, avgCost)
Provides the portfolio’s open positions. After the initial callback (only) of all positions, the EWrapper.positionEnd function will be triggered.
The account holding the position.
The position’s Contract.
The number of positions held.
The total average cost of all trades for the currently held position.
Python
Java
C#
VB.NET
EWrapper.positionEnd
EWrapper.positionEnd()
Indicates all the positions have been transmitted. Only returned after the initial callback of EWrapper.position.
Python
Java
C++
C#
VB.NET
Cancel Positions Request
EClient.cancelPositions()
Cancels a previous position subscription request made with EClient.reqPositions().

