Back

Buying Power After Submitting LimitOrder

Hi,
Would love to know how I could get Buying Power after Submitting LimitOrders.
Both "Portfolio.GetBuyingPower(Symbol, OrderDirection.Buy)" and "Portfolio.Cash" change only after a LimitOrder has been filled and neglect calculations of trade value after submission.

Thanks,
Michael
Update Backtest








You're right we don't discount buying power for outstanding orders. I think brokerages have different behavior on this -- some validate at fill time while others before submitting the order.

Currently the only way to get the buying would be to get outstanding orders and discount their value. The impact on buying power has many factors including the ticker and direction of the order and your current holdings. We do have "GetBuyingPower(Symbol symbol, OrderDirection direction = OrderDirection.Buy)" method in the Portfolio class which might help. This is typically used to validate if we can submit a new order.

You could write your own MarginModel which factors in existing orders then set it to the security object: security.MarginModel

MyMM : SecurityMarginModel {
public override GetMarginRemaining(SecurityPortfolioManager portfolio, Security security, OrderDirection direction)
}
0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Thanks for the reply!
So things I have to consider while applying this:
1) I update LimitOrders Price (Should change the My Buying Power Counter)
2) I cancel LimitOrders (Which results in zero quantity when getting the order and makes it much harder to track) .
3) Fees
4) The Fact that the limit price != execution price (when submitting an order that get executed right away).

:(
0

If you make your own margin model based on open orders most of this should be calculated automatically. Check out the SecurityMarginModel as a starting point.
0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed