I feel like this may be a dumb question as it seems basic...

I am linking my IB account to my QC algo and my IB account already has several positions in it.

I wanted to ask how I can loop through all the existing positions in the code

Something like

foreach (stock in Portfolio){ debug(stock.AveragePrice.ToString()); }

But obviously, the code above does not work and I was wondering what modification I need to make.

 

Thanks a lot!

Author