Hi There,
just trying to get my head around the Portfolio Construction Model. The documentation section shows that we should create targets with an idea “ how many contracts/stocks should i buy”, but i get confused every-time i am thinking in terms of rebalancing my portfolio, and having to sell part of a position.
example:
If i have two securities A and B. I have 1000 shares of A, and 600 shares of B. And in order to rebalance my portfolio, my end goal is to have 700 shares of A, and 800 shares of B, is it the following code correct?
target_A = PortfolioTarget('A', -300)
target_B = PortfolioTarget('B', 200)
or that second argument Quantity is the amount of stock that i would have at the end rather the incrementals/decrementals that i need?
Jose
Adam W
Assuming you are using `ImmediateExecutionModel`, then the PortfolioTarget should indicate the “end goal"/target amounts (not the change from current holdings). See ImmediateExecutionModel and this. Personally I find `PortfolioTarget.Percent()` more intuitive to work with, which sets the target percent you would like to hold.
If you want to manually close positions in a certain way to free up buying power before rebalancing, might be easier use the classical API instead of framework. The simplest way here is just `SetHoldings([ # list of PortfolioTarget.Percents() ] )`.
Jose David Delgado Mosquera
Hi Adam,
thanks for your help. I am not using the ImmediateExecutionModel, in fact I am building my own PortfolioConstructionModel from scratch, but my confusion comes with that second argument ‘Quantity’. It happens that my strategy rebalances every month so a certain security may incremental or decrement their current amount.
so my question #1 is that what should i put in in as the second argument in PortfolioTarget( Symbol, Quantity), the change in shares (either positive or negative) or the final number of shares after the rebalance?
question #2 is coming from what you said using PortfolioTarget.Percent; somewhere in the documentation says that this will only be valid for Margin Accounts. I am not sure what would be the nature of my account so i just want to do a one-fits-all for it using the regular PortfolioTarget helper method. What would be the implications for a non-margin account?
I would appreciate any help mate - cheers
Jose 🚀
Varad Kabade
Hi Jose,
Best,
Varad Kabade
Jose David Delgado Mosquera
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!