Example #1
0
def minute_to_session(column, close_locs, data, out):
    """
    Resample an array with minute data into an array with session data.

    This function assumes that the minute data is the exact length of all
    minutes in the sessions in the output.

    Parameters
    ----------
    column : str
        The `open`, `high`, `low`, `close`, or `volume` column.
    close_locs : array[intp]
        The locations in `data` which are the market close minutes.
    data : array[float64|uint32]
        The minute data to be sampled into session data.
        The first value should align with the market open of the first session,
        containing values for all minutes for all sessions. With the last value
        being the market close of the last session.
    out : array[float64|uint32]
        The output array into which to write the sampled sessions.
    """
    if column == 'open':
        _minute_to_session_open(close_locs, data, out)
    elif column == 'high':
        _minute_to_session_high(close_locs, data, out)
    elif column == 'low':
        _minute_to_session_low(close_locs, data, out)
    elif column == 'close':
        _minute_to_session_close(close_locs, data, out)
    elif column == 'volume':
        _minute_to_session_volume(close_locs, data, out)
    return out
def minute_to_session(column, close_locs, data, out):
    """
    Resample an array with minute data into an array with session data.

    This function assumes that the minute data is the exact length of all
    minutes in the sessions in the output.

    Parameters
    ----------
    column : str
        The `open`, `high`, `low`, `close`, or `volume` column.
    close_locs : array[intp]
        The locations in `data` which are the market close minutes.
    data : array[float64|uint32]
        The minute data to be sampled into session data.
        The first value should align with the market open of the first session,
        containing values for all minutes for all sessions. With the last value
        being the market close of the last session.
    out : array[float64|uint32]
        The output array into which to write the sampled sessions.
    """
    if column == 'open':
        _minute_to_session_open(close_locs, data, out)
    elif column == 'high':
        _minute_to_session_high(close_locs, data, out)
    elif column == 'low':
        _minute_to_session_low(close_locs, data, out)
    elif column == 'close':
        _minute_to_session_close(close_locs, data, out)
    elif column == 'volume':
        _minute_to_session_volume(close_locs, data, out)
    return out