Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Stock specific account value?

Hi,

I am wanting the code for the total value of a specific stock. I am currently using the below, but I want it only to trade a specific stock in the account.

context.portfolio.positions_value

I thought context.portfolio.positions[symbol('XOM')].value would give me what I was looking for, but it doesn't work.

Thanks for the help.

1 response

Try:

context.portfolio.positions[stock].amount*data.current(stock,'price')