Hey, I'm practicing running an algo where I own 100 shares of QQQ and 100 of SPY and sell a naked put on both of them.  The QQQ naked put order runs first and is successful and then the SPY naked put order runs the next minute and the order gets rejected.  It actually doesn't even submit to IB, it is just listed as invalid due to “Insufficient buying power to complete orders” as you will see in my log below.  Issue is that I have PLENTY of margin and buying power.   This is a fraction of my account balance and I'm not invested in anything else.  The proof of that is the very same minute of the failure I'll log into IB and place the order manually without difficulty.  I also asked Interactive Brokers about it and they said they never even saw an order come by for the failed SPY put.  

 

Has anyone run into something like this and can help?  Why is quantconnect rejecting this order and what can I do to stop it?  

This is my log, not code:
QQQ runs and works fine:

2023-02-03 14:35:00 :	Obtaining QQQ naked put contract
2023-02-03 14:35:00 :	QQQ Put contract QQQ 230203P00303000
2023-02-03 14:35:00 :	QQQ Put contract strike price: 303.0
2023-02-03 14:35:02 :   New Order Event: Time: 02/03/2023 14:35:02 OrderID: 3 EventID: 1 Symbol: QQQ 230203P00303000 Status: Submitted Quantity: -1 Message: Interactive Brokers Order Event IsAssignment: False
2023-02-03 14:35:02 :	New Order Event: Time: 02/03/2023 14:35:02 OrderID: 3 EventID: 2 Symbol: QQQ 230203P00303000 Status: Filled Quantity: -1 FillQuantity: -1 FillPrice: 0.77 USD OrderFee: 1.053253 USD Message: Interactive Brokers Order Fill Event IsAssignment: False
2023-02-03 14:35:02 :	Time: 02/03/2023 14:35:02 OrderID: 3 EventID: 1 Symbol: QQQ 230203P00303000 Status: Submitted Quantity: -1 Message: Interactive Brokers Order Event IsAssignment: False
2023-02-03 14:35:02 :	Time: 02/03/2023 14:35:02 OrderID: 3 EventID: 2 Symbol: QQQ 230203P00303000 Status: Filled Quantity: -1 FillQuantity: -1 FillPrice: 0.77 USD OrderFee: 1.053253 USD Message: Interactive Brokers Order Fill Event IsAssignment: False


SPY fails here:

2023-02-03 14:35:02 :	Obtaining SPY naked put contract
2023-02-03 14:35:02 :	SPY Put contract SPY 230203P00409000
2023-02-03 14:35:02 :	SPY Put contract strike price: 409.0
2023-02-03 14:35:03 :	New Order Event: Time: 02/03/2023 14:35:02 OrderID: 4 EventID: 1 Symbol: SPY 230203P00409000 Status: Invalid Quantity: -1 Message: Order Error: ids: [4], Insufficient buying power to complete orders (Value:[-547.5]), Reason: Id: 4, Initial Margin: -548.5, Free Margin: 0. IsAssignment: False
2023-02-03 14:35:03 :	Order Error: ids: [4], Insufficient buying power to complete orders (Value:[-547.5]), Reason: Id: 4, Initial Margin: -548.5, Free Margin: 0.