def locate_index(self, start_time, end_time, freq, future):
    'Locate the start time index and end time index in a calendar under certain frequency.\n\n        Parameters\n        ----------\n        start_time : str\n            start of the time range\n        end_time : str\n            end of the time range\n        freq : str\n            time frequency, available: year/quarter/month/week/day\n        future : bool\n            whether including future trading day\n\n        Returns\n        -------\n        pd.Timestamp\n            the real start time\n        pd.Timestamp\n            the real end time\n        int\n            the index of start time\n        int\n            the index of end time\n        '
    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:
            raise IndexError('`start_time` uses a future date, if you want to get future trading days, you can use: `future=True`')
    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)
Locate the start time index and end time index in a calendar under certain frequency.

Parameters
----------
start_time : str
    start of the time range
end_time : str
    end of the time range
freq : str
    time frequency, available: year/quarter/month/week/day
future : bool
    whether including future trading day

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
def locate_index(self, start_time, end_time, freq, future):
    'Locate the start time index and end time index in a calendar under certain frequency.\n\n        Parameters\n        ----------\n        start_time : str\n            start of the time range\n        end_time : str\n            end of the time range\n        freq : str\n            time frequency, available: year/quarter/month/week/day\n        future : bool\n            whether including future trading day\n\n        Returns\n        -------\n        pd.Timestamp\n            the real start time\n        pd.Timestamp\n            the real end time\n        int\n            the index of start time\n        int\n            the index of end time\n        '
    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:
            raise IndexError('`start_time` uses a future date, if you want to get future trading days, you can use: `future=True`')
    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)