Portfolio
Request portfolio details for the selected account or accounts available to the user.
get_portfolio(
account_code: String. The accountID to pull portfolio information for. If an empty string is passed, all accounts are requested.
timeout: Integer. A default value of 10 seconds is supplied.
)
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.
marketPrice: Float. The current market price of the instrument.
marketValue: Float. The current value of the total position.
averageCost: Float. The average price across executions for the position.
unrealizedPNL: Float. The unrealized profit and loss for the instrument.
realizedPNL: Float. The realized profit and loss for the instrument.
accountName: String. The account identifier that holds the given position.
}]

