Hi,
I'm starting off by printing strings but I'm having trouble doing this with the following code:
// Instantiate a QuantBook
var qb = new QuantBook();
// Select the desired tickers for research.
var assets = new List<string>() {"ES","NQ"};
// // Call the AddEquity method with the tickers, and their corresponding resolution.
foreach(var ticker in assets){
qb.AddFuture(ticker, Resolution.Tick);
}
// Call the History method with qb.Securities.Keys for all tickers, time argument(s), and resolution to request historical data for the symbol.
// var history = qb.History<Tick>("ES", new DateTime(2021, 1, 19,9,40,0), new DateTime(2021, 1, 19,9,50,0), Resolution.Tick);
var history = qb.History<Tick>(qb.Securities.Keys, new DateTime(2021, 1, 19), new DateTime(2021, 1, 19), Resolution.Tick);
foreach(var slice in history){
// foreach(var symbol in slice.Bars.Keys){
// Console.WriteLine(slice);
// }
Console.WriteLine(slice);
}
I've tried a few different methods (including regular/tradebars version of history, removing multiple tickers etc. The only thing I got at any point was a print of the class of history, but once I try iterate on it nothing happens.
Any help much appreciated! ThanksĀ
Alexandre Catarino
Hi Desmond Conlon ,
Please increase the date range:
The History method doesn't round down the start date and rounds up the end date, so when we provide the same date, it doesn't fetch data.
Best regards,
Alex
Dizzy
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!