I'm a little confused by some of the documentation (trading-and-orders) and I was hoping someone could clarify quickly for me.
The documentation shows:
# Set fixed percentages of known tickers:
self.SetHoldings("IBM", 0.25)
self.SetHoldings("GOOG", 0.25)
self.SetHoldings("AAPL", 0.25)
self.SetHoldings("MSFT", 0.25)
so it appears that we give SetHoldings() the ticker symbol as a string. However, a little bit higher in the documentation it states:
self.SetHoldings(Symbol symbol, double percentage, bool liquidateExistingHoldings = false)
Which to me indicates that we should be giving it a Security object (unique security identifier).
Or is it the case that we can use either a string or unique security identifier.
Gurumeher Sawhney
When using SetHoldings(), both the Symbol class object and the ticker as a string can be used to identify to company. While the Symbol class directly identifies the company, the ticker as a string is a reference to the company at its current point in time.
Wei Chian Ong
Thank you for the clarification, and apologies, I think when I said "security object" I should have said "symbol class object" as you have pointed out. Much appreciated.
Wei Chian Ong
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!