microsoft/qlib · error · IndexError
`start_time` uses a future date, if you want to get future t
Error message
`start_time` uses a future date, if you want to get future trading days, you can use: `future=True`
What it means
Error "`start_time` uses a future date, if you want to get future trading days, you can use: `future=True`" thrown in microsoft/qlib.
Source
Thrown at qlib/data/data.py:145
Returns
-------
pd.Timestamp
the real start time.
pd.Timestamp
the real end time.
int
the index of start time.
int
the index of end time.
"""
start_time = pd.Timestamp(start_time)
end_time = pd.Timestamp(end_time)
calendar, calendar_index = self._get_calendar(freq=freq, future=future)
if start_time not in calendar_index:
try:
start_time = calendar[bisect.bisect_left(calendar, start_time)]
except IndexError as index_e:
raise IndexError(
"`start_time` uses a future date, if you want to get future trading days, you can use: `future=True`"
) from index_e
start_index = calendar_index[start_time]
if end_time not in calendar_index:
end_time = calendar[bisect.bisect_right(calendar, end_time) - 1]
end_index = calendar_index[end_time]
return start_time, end_time, start_index, end_index
def _get_calendar(self, freq, future):
"""Load calendar using memcache.
Parameters
----------
freq : str
frequency of read calendar file.
future : bool
whether including future trading day.
View on GitHub (pinned to 79633dd950)
Solutions
- Pass `future=True` if you intentionally want future trading days.
- Use a `start_time` that is not in the future relative to the calendar.
When it happens
Trigger: This error is raised at qlib/data/data.py:145 when the guard condition fails: "`start_time` uses a future date". It triggers when the code path receives input or a state that violates the precondition checked at this point — e.g. an unimplemented abstract method being called, an unsupported argument type/value, or an invalid configuration. To avoid it, satisfy the documented precondition before this call: implement the required method in your subclass, or pass a supported value of the expected type as described by the message.
Common situations: See trigger scenarios.
AI-assisted analysis of microsoft/qlib@79633dd950 (2026-08-15).
Data as JSON: /api/errors/1c4ac98f31cb7a64.
Report an issue: GitHub.