I have two strategies in the same algo. Both enter based on different entry conditions, but both are trading the same symbol (GLD). Both strategies receive an allocation of 0.75. There should be 200% buying power available, based on the Alpaca trading model.
However, when both strategies enter after each other (one filled, the next filled a few days later, without exiting the first position), occasionally, I receive this warning:
‘Warning: Portfolio rebalance result ignored as it resulted in a single share trade recommendation which can generate high fees’
As a result, the second strategy only enters with one share instead of allocating 75% of the buying power to it.
How can I make sure, both strategies enter with 75% each, resulting in an overall allocation of 150%? And why is this warning issued? I have not set any logic for rebalancing. And I'm using set_holdings with a tag to enter each position.
Mia Alissi
To address the issue of ensuring both strategies enter with 75% allocation each, resulting in an overall allocation of 150%, let's consider the following steps based on the information and documentation available:
Review Buying Power Model: Ensure that the Alpaca trading model is correctly set up to allow 200% buying power. This is crucial for supporting the desired allocations. You can set the brokerage model to Alpaca with margin account type using:
Order Submission Logic: Verify that each strategy's order submission logic is correctly using
set_holdings
with the intended allocation. Theset_holdings
method should be used as follows:Ensure that the
liquidate_existing_holdings
parameter is set toFalse
to prevent liquidation of existing positions when setting new holdings.Analyze Warning Message: The warning "Portfolio rebalance result ignored as it resulted in a single share trade recommendation" indicates that the order size was too small, possibly due to insufficient buying power or incorrect calculations.
Adjust Order Size Calculation: Ensure that the order size calculation accounts for the available buying power and does not result in a single share trade, which can trigger the warning. This might involve checking the current portfolio value and ensuring that the calculated order size is above the minimum threshold.
Implement Custom Buying Power Model: If the default Alpaca model does not meet the requirements for your strategy's leverage and allocation needs, consider implementing a custom buying power model.
Log and Debug: Add logging to track the buying power and order sizes at the time of each trade to help identify any discrepancies or issues in the allocation process.
Test with Simulated Data: Run backtests with simulated data to ensure that both strategies can enter positions as expected without triggering the warning, and adjust the logic as necessary.
By following these steps, you should be able to ensure that both strategies can enter with the desired allocations without encountering the warning message.
Sources: A Risk Parity Approach to Leveraged ETFs, Buying Power - QuantConnect.com, Brokerage Model Algorithm, Trading and Orders - QuantConnect.com, Position Sizing - QuantConnect.com
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.
David Maucher
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!