Positions

View as MarkdownOpen in Claude

Request positions for all accounts available to the user.

get_positions(

timeout: Integer. A default value of 10 seconds is supplied.

)

app.get_positions()

All orders from the current day’s trading session are returned in a dictionary, using the orderId as the key to discover the specific order.

Response Object

{
{Account ID}: List. List of all contracts
[{

contract: [Contract Object](/tws-api/doc/contracts-financial-instruments/the-contract-object). Contract to trade.

position: Decimal. The total number of shares held in the account.

avgCost: Float. The average price across executions for the position.

}]

{'U1234567': [{'contract': 2333839861008: ConId: 340216238, Symbol: COIL, SecType: FUT, LastTradeDateOrContractMonth: 20251031, Strike: 0, Right: , Multiplier: 1000, Exchange: IPE, PrimaryExchange: , Currency: , LocalSymbol: COILZ5, TradingClass: COIL, IncludeExpired: False, SecIdType: , SecId: , Description: , IssuerId: Combo:, 'position': Decimal('4'), 'avgCost': 61359.9}]}