'Get the Float64Multiply objects to pass to an AdjustedArrayWindow.
For the use of AdjustedArrayWindow in the loader, which looks back
from current simulation time back to a window of data the dictionary is
structured with:
- the key into the dictionary for adjustments is the location of the
day from which the window is being viewed.
- the start of all multiply objects is always 0 (in each window all
adjustments are overlapping)
- the end of the multiply object is the location before the calendar
location of the adjustment action, making all days before the event
adjusted.
Parameters
asset : Asset
The assets for which to get adjustments.
dts : iterable of datetime64-like
The dts for which adjustment data is needed.
field : str
OHLCV field for which to get the adjustments.
Returns
out : dict[loc -> Float64Multiply]
The adjustments as a dict of loc -> Float64Multiply'

def _get_adjustments_in_range(self, asset, dts, field):

    sid = int(asset)
    start = normalize_date(dts[0])
    end = normalize_date(dts[(-1)])
    adjs = {}
    if (field != 'volume'):
        mergers = self._adjustments_reader.get_adjustments_for_sid('mergers', sid)
        for m in mergers:
            dt = m[0]
            if (start < dt <= end):
                end_loc = dts.searchsorted(dt)
                adj_loc = end_loc
                mult = Float64Multiply(0, (end_loc - 1), 0, 0, m[1])
                try:
                    adjs[adj_loc].append(mult)
                except KeyError:
                    adjs[adj_loc] = [mult]
        divs = self._adjustments_reader.get_adjustments_for_sid('dividends', sid)
        for d in divs:
            dt = d[0]
            if (start < dt <= end):
                end_loc = dts.searchsorted(dt)
                adj_loc = end_loc
                mult = Float64Multiply(0, (end_loc - 1), 0, 0, d[1])
                try:
                    adjs[adj_loc].append(mult)
                except KeyError:
                    adjs[adj_loc] = [mult]
    splits = self._adjustments_reader.get_adjustments_for_sid('splits', sid)
    for s in splits:
        dt = s[0]
        if (start < dt <= end):
            if (field == 'volume'):
                ratio = (1.0 / s[1])
            else:
                ratio = s[1]
            end_loc = dts.searchsorted(dt)
            adj_loc = end_loc
            mult = Float64Multiply(0, (end_loc - 1), 0, 0, ratio)
            try:
                adjs[adj_loc].append(mult)
            except KeyError:
                adjs[adj_loc] = [mult]
    return adjs
