Open DerekMelchin opened 8 months ago
The OpenInterestFutureUniverseSelectionModel constructor also doesn't accept a UniverseSettings object like all the other universe selection models do
After debugging the C# version of this algo in the cloud, I found it fails when the current time is February 27th of 2023.
When the OpenInterestFutureUniverseSelectionModel.GetOpenInterest()
is executed, the date 2023/2/27 is assigned to the variable current
as well as endTime
. To compute the value of the variable previousDay
, the method Time.GetStartTimeForTradeBars()
is called. This method "rounds down" the value of the variable endTime
by first converting it to the UTC timezone (adding 5 hours), then rounding down that date (removes the five hours added) and finally converting it again to the New York Timezone (removes 5 hours). Therefore, since the initial value of endTime
was 2023/2/27 00:00:00, the extension method RoundDownInTimeZone()
returns 2023/2/26 19:00:00. Then, this date is subtracted by barSize
(1 day) so the final date returned by the Time.GetStartTimeForTradeBars()
method is 2023/2/25 19:00:00.
Thus, the history request for open interest data is from the 25th to the 27th and since we are missing open interest data for the 26th, we obtain no open interest data and the algo fails.
I've run both versions (Python and C#) of the algo attached in this issue and seen them fail (throw the error mentioned in this algo).
Expected Behavior
OpenInterestFutureUniverseSelectionModel works w/o error
Actual Behavior
works in Python https://www.quantconnect.com/terminal/processCache?request=embedded_backtest_be173aeb8eab0ab765cd6c13b5e6ebb8.html
But the C# equivalent
throws
Potential Solution
N/A
Reproducing the Problem
System Information
QC Cloud
Checklist
master
branch