Hi I am trying to test universe selection via indicators by using tick data, and I am getting this
Runtime Error: Calling History method with Resolution.Tick will return an empty result. Please use the generic version with Tick type parameter or provide a list of Symbols to use the Slice history request API.
The following is the related code -
public override void Initialize()
{
SetStartDate(2020, 7, 3);
SetEndDate(2020, 7, 14);
SetCash(100000);
AddUniverse(CoarseSelectionFilter);
UniverseSettings.Resolution = Resolution.Tick;
}
public IEnumerable<Symbol> CoarseSelectionFilter(IEnumerable<CoarseFundamental> universe)
{
var selected = new List<Symbol>();
universe = universe
.Where(x => x.Price > 10)
.OrderByDescending(x => x.DollarVolume).Take(100);
foreach (var coarse in universe)
{
var symbol = coarse.Symbol;
if (!averages.ContainsKey(symbol))
{
//1. Call history to get an array of 200 tick of history data
var history = History(symbol, 200, Resolution.Tick);
//2. Adjust SelectionData to pass in the history result
averages[symbol] = new SelectionData(history);
}
averages[symbol].Update(Time, coarse.AdjustedPrice);
if (averages[symbol].IsReady() && averages[symbol].Fast > averages[symbol].Slow)
{
selected.Add(coarse.Symbol);
}
}
Alexandre Catarino
Hi Bright Yang ,
For historical data requests of tick-resolution data in Universe Selection, please use:
var history = History<Tick>(symbol, TimeSpan.FromDays(1), Resolution.Tick)
Mark Fernandes
Check if previous day(s) were trading day(s)
Bright Yang
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!