I'm seeing an Insufficient buying power issue. My account is 2x leverage, and total cash is 50k, after bought 48.5k stocks, the remaining margin should be around 50k + 1.5k(remaining cash), right?But the algorithm forbids me to submit a $1.5k buying order, the error is the following:
New Order Event: Time: 12/11/2020 15:33:09 OrderID: 20 EventID: 1 Symbol: YALA Status: Invalid Quantity: 71 Message: Order Error: id: 20, Insufficient buying power to complete order (Value:1578.33), Reason: Id: 20, Initial Margin: 1578.33, Free Margin: 1377.3612

account setting:SetBrokerageModel(BrokerageName.Alpaca, AccountType.Margin);Please help.

Thank you in advance, I appreciate your help.