Hi,

Newbie here, trying out a random strategy just to get the hang of the platform.  Big thanks to the QC team for building such a cool product and for the extensive documentation and tutorials.

My strategy simply writes an OTM call on SPY on each expiration day, if SPY is near it's 52W high.  If it gets assigned it covers the short ASAP the following day.  I notice however that the portfolio ends up still carrying around some older options that should have expired.  These use up the simulated buying power and cause placing further order to fail:

2020-11-18 09:31:00 : SPY 181128C00272500 -5.0 @ 0.03 2020-11-18 09:31:00 : SPY 180725C00284000 -5.0 @ 0.01 2020-11-18 09:31:00 : SPY 181107C00280000 -5.0 @ 0.13 2020-11-18 09:31:00 : SPY 181017C00279000 -5.0 @ 1.63 2020-11-18 09:31:00 : Time: 11/18/2020 14:31:00 OrderID: 1261 EventID: 1 Symbol: SPY 201118C00363000 Status: Invalid Quantity: -5 Message: Order Error: id: 1261, Insufficient buying power to complete order (Value:-117.5), Reason: Id: 1261, Initial Margin: -118.75, Free Margin: 0 IsAssignment: False

The full backtest is also attached.  Please let me know if I can provide anything else to help debug the problem.

Thanks,

Karthik

Author