Hello
In the attached algo, its context.portfolio.position keeps accumulating positions of stocks it once had a position in, but have 0 positions now.
Can anyone have a look if the attached code incorrectly causing len(context.portfolio.position) to increase indefinitely and causing the backtest to run out of memory
The backtest log records number of positions at market close, and prints len(context.portfolio.position) daily.