Hello
It may be that I didn't do my homework on this, but I have a question regarding the SetHoldings(...) function.
It appears that the "buying power" referred to in the documentation is calculated taking only the current cash amount into account, not any other security holdings.
In particular, let's say we trigger a first order with
SetHoldings("MSFT", 0.5).
Then, some time later, I'd expect
SetHoldings("MSFT", 1.0)
to trigger an order of approximately the same size (assuming that the price of the security stays the same, approximately). But this is not what happens. Isn't this a bit counter-intuitive?
Adding "liquidateExistingHoldings = true" doesn't help either, since the cash amount determining the buying power is locked in before the liquidation.
Any thoughts on this?
Cheers
Jared Broad
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.
YoshimiTakano
Jared Broad
int Order(string symbol, int quantity, OrderType type = OrderType.Market, bool asynchronous = false)
I think very few people will need to process asynchronously. But if they do there's also a new event handler - OnOrderEvent() which will fire order status changes when the portfolio is updated. There's one gotcha that might catch some people -- E.g. in the test code attached we have set short IBM 50% in Sept, and then short 50% SPY in October. In the month since the price of IBM changed to more than 50% of the portfolio, meaning SPY order fails because of insufficient funds. You'd need to reset IBM to 50% of portfolio (which would mean selling a few more shares in this case), and that sale would re-balance the 50% for the following SPY order to successfully process.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.
YoshimiTakano
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!