Back to Community
[deleted]

[deleted]

1 response

The context.portfolio.positions object is a dictionary of positions in your portfolio, indexed by Equity objects representing securities. Each Position object has a cost_basis field. You can compare it with the current price of the same security and calculate the profit or loss on it.

This and other information is available on the Quantopian help page at https://www.quantopian.com/help . There is no substitute for reading the manual.