Hi, community!

I love this project, but I was not able to find any relevant tutorials about options trading, so I decided to do it by myself. The underlying idea is pretty simple, but I stuck in realization. I want to buy a call or put at the begging of each week based on the moving average of TLT, then on each Thursday close all options positions, because I don't want to exercise them and sell it with their theta.  I've got a pretty strange error:

Runtime Error: In Scheduled Event 'Monday: SPY: 120 min after MarketOpen', IndexError : list index out of range at OpenPosition in main.py:line 99 IndexError : list index out of range

Can someone help me to find where an error is?