symbols = ["MON", "AAPL", "CSRA"]
for symbol in symbols:
qb.AddEquity(symbol)
end_date = datetime.now()
start_date = end_date - timedelta(days=60)
history = qb.History(symbols, start_date, end_date, Resolution.Daily)
I'm running the above code in a notebook. If I try to do any of these, I get an error.
history.loc["MON"]
# KeyError: 'the label [MON] is not in the [index]'
history.loc["CSRA"]
# KeyError: 'the label [CSRA] is not in the [index]'
history.loc["AAPL"]
# works fine
Both MON and CSRA appears to be in your available daily data:
https://www.quantconnect.com/data/file/equity/usa/daily/c*/csra.zip/csra.csv
https://www.quantconnect.com/data/file/equity/usa/daily/m*/mon.zip/mon.csv
How comes this crashes my notebook?
Thanks!
Joseph Cohen Bacchilega
Same error for TWX and WYN. Haven't found anymore of these in the S&P500...
Jing Wu
Hi Joseph,
Data for MON and CSRA are updated until 06-06-2018. Therefore if your request the history for the last 60 data, the data frame returns nothing. The last data point of TWX is on 07-14-2018 and WYN on 05-31-2018. These companies were acquired or merged by the other companies and no longer listed in the market. You can expand the time range to get the history data of those companies.
Joseph Cohen Bacchilega
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!