I just whipped up my first options algo as a learning exercise, and I’d love some feedback. 

I’ve only written in Python once before, around 100 years ago, so I’d appreciate specific pointers on code quality, structure, redundancy (if any), shaving lines of code, speeding up execution, etc. The logic itself is simple enough:

Entry:
30 Mins before market close, if the portfolio is empty, open as many single OTM call options as possible, with strikes that are 10% above the underlying, expiring in 120 days.

Exit:
30 Mins after market open, for each call in the  portfolio, if the call is ITM or there are less than 30 days till expiry, liquidate the position.

I’ve commented the code comprehensively so I hope this also serves as a guide to other n00bs. Open to any questions.

Thanks!

[PS] I’m not looking for feedback on the strategy logic itself —It is deliberately overfit to ZM's 2020 bull run, and I would not live trade as is. However, one could possibly use this strategy in combination with universe selection, to roll 'Mini Leaps' on high momentum stocks that are currenty trending. To avoid overfitting, you could select strikes & expiration dates based on some function of volatility.