def get_values_for_date_ranges(zip_date_index_with_vals,
                               vals_for_date_intervals,
                               starts,
                               ends,
                               date_index):
    # Fill in given values for given date ranges.
    end_indexes = date_index.values.searchsorted(ends)
    start_indexes = date_index.values.searchsorted(starts)
    num_days = (end_indexes - start_indexes) + 1

    # In case any of the end dates falls on days missing from the date_index,
    # searchsorted will have placed their index within `date_index` to the
    # index of the next start date, so we will have added 1 extra day for
    # each of these. Subtract those extra days, but ignore any cases where the
    # start and end dates are equal. Note: if any of the start dates is
    # missing, it won't affect calculations because searchsorted will advance
    # the index to the next date within the same range.
    num_days[np.where(~np.in1d(ends, date_index) & (num_days != 0))] -= 1
    return zip_date_index_with_vals(
        date_index,
        np.repeat(
            vals_for_date_intervals,
            num_days,
        )
    )
Returns a Series of values indexed by date based on the intervals defined
dataset/ETHPy150Open quantopian/zipline/zipline/pipeline/loaders/utils.py/get_values_for_date_ranges