Lean
Lean copied to clipboard
Universe Selection of Custom/Alternative Data Not Triggered on the Weekends
Expected Behavior
If there is Universe Selection data on the weekend, e.g. QuiverTwitterFollowersUniverse, the universe selector is triggered.
Actual Behavior
Universe Selection of Custom/Alternative data is not triggered during the weekends.
Potential Solution
One potential solution is to add the market hours to the custom data class via BaseData.cs:
public virtual MarketHoursDatabase MarketHours()
{
return MarketHoursDatabase.AlwaysOpen;
}
but it might be better to consider that custom data is data-driven, meaning it doesn't default to Equity market hours, but to MarketHoursDatabase.AlwaysOpen.
Reproducing the Problem
using System.Collections.Generic;
using QuantConnect.Securities;
using QuantConnect.DataSource;
using QuantConnect.Data;
namespace QuantConnect.Algorithm.CSharp
{
public class BasicTemplateFrameworkAlgorithm : QCAlgorithm
{
private Symbol _symbol;
private QuiverTwitterFollowersUniverse _datum;
private Security _quiverTwitterFollowers;
public override void Initialize()
{
SetStartDate(2022, 2, 2); //Set Start Date
SetEndDate(2022, 3, 22); //Set End Date
_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_quiverTwitterFollowers = AddData<QuiverTwitterFollowers>(_symbol);
AddUniverse<QuiverTwitterFollowersUniverse>("QuiverQuantTwitterFollowersUniverse", Resolution.Daily, UniverseSelectionMethod);
}
private IEnumerable<Symbol> UniverseSelectionMethod(IEnumerable<QuiverTwitterFollowersUniverse> data)
{
Log($"Universe: {Time}-{Time.DayOfWeek}");
return Universe.Unchanged;
}
public override void OnData(Slice slice) =>
Log($"OnData: {Time}-{Time.DayOfWeek}");
}
}
Checklist
- [x] I have completely filled out this template
- [x] I have confirmed that this issue exists on the current
masterbranch - [x] I have confirmed that this is not a duplicate issue by searching issues
- [x] I have provided detailed steps to reproduce the issue