The stock period in the stock market as described in the map files must be respected independently of the resolution.
Actual Behavior
The starting date for stocks whose ticker contains previous data is not respected. If the resolution is hourly or daily the price data will be pumped since the first observation available. However, if there is a last date, it is respected and the equity is delisted.
Potential Solution
Investigate why the SubscriptionDataReader is failing at this lines with lower resolutions:
// if factor file has minimum date, update start period if before minimum date
if (!_isLiveMode && _factorFile != null && _factorFile.FactorFileMinimumDate.HasValue)
{
if (_periodStart < _factorFile.FactorFileMinimumDate.Value)
{
_periodStart = _factorFile.FactorFileMinimumDate.Value;
_resultHandler.DebugMessage(
string.Format("Data for symbol {0} has been limited due to numerical precision issues in the factor file. The starting date has been set to {1}.",
config.Symbol.Value,
_factorFile.FactorFileMinimumDate.Value.ToShortDateString()));
}
}
Reproducing the Problem
GM went into bankruptcy in January 1st, 2009 and was out of the stock markets until November 1st, 2010 when it came back under the same symbol
The algorithm attached below will work perfectly for higher resolutions:
If the ticker is GM.1 the security will be held until January 1st, 2009.
If the ticker is GM the algorithm will start to receive the security data since November 1st, 2010.
Now, if we set lower resolutions:
If the ticker is GM.1 it’ll work fine.
If the ticker is GM the algorithm will start to receive the security data since January 2nd, 1998.
public class BasicTemplateAlgorithm : QCAlgorithm
{
string _ticker = "GM";
private Symbol _security;
public override void Initialize()
{
SetStartDate(1998, 01, 01); //Set Start Date
SetEndDate(DateTime.Today); //Set End Date
SetCash(100000); //Set Strategy Cash
_security = AddEquity(_ticker, Resolution.Hour).Symbol;
}
public override void OnData(Slice data)
{
if (!Portfolio.Invested)
{
MarketOrder(_security, 1);
Log($"Purchased Security {_security}");
}
}
}
System Information
QC Cloud.
Checklist
[x] I have completely filled out this template
[x] I have confirmed that this issue exists on the current master branch
[x] I have confirmed that this is not a duplicate issue by searching issues
[x] I have provided detailed steps to reproduce the issue
Expected Behavior
The stock period in the stock market as described in the map files must be respected independently of the resolution.
Actual Behavior
The starting date for stocks whose ticker contains previous data is not respected. If the resolution is hourly or daily the price data will be pumped since the first observation available. However, if there is a last date, it is respected and the equity is delisted.
Potential Solution
Investigate why the
SubscriptionDataReader
is failing at this lines with lower resolutions:Reproducing the Problem
GM went into bankruptcy in January 1st, 2009 and was out of the stock markets until November 1st, 2010 when it came back under the same symbol
The algorithm attached below will work perfectly for higher resolutions:
GM.1
the security will be held until January 1st, 2009.GM
the algorithm will start to receive the security data since November 1st, 2010.Now, if we set lower resolutions:
GM.1
it’ll work fine.GM
the algorithm will start to receive the security data since January 2nd, 1998.System Information
QC Cloud.
Checklist
master
branch