'The open field\'s aggregation returns the first value that occurs
for the day, if there has been no data on or before the `dt` the open
is `nan`.
Once the first non-nan open is seen, that value remains constant per
asset for the remainder of the day.
Returns
np.array with dtype=float64, in order of assets parameter.'

def opens(self, assets, dt):

    (market_open, prev_dt, dt_value, entries) = self._prelude(dt, 'open')
    opens = []
    session_label = self._trading_calendar.minute_to_session_label(dt)
    for asset in assets:
        if (not asset.is_alive_for_session(session_label)):
            opens.append(np.NaN)
            continue
        if (prev_dt is None):
            val = self._minute_reader.get_value(asset, dt, 'open')
            entries[asset] = (dt_value, val)
            opens.append(val)
            continue
        else:
            try:
                (last_visited_dt, first_open) = entries[asset]
                if (last_visited_dt == dt_value):
                    opens.append(first_open)
                    continue
                elif (not pd.isnull(first_open)):
                    opens.append(first_open)
                    entries[asset] = (dt_value, first_open)
                    continue
                else:
                    after_last = pd.Timestamp((last_visited_dt + self._one_min), tz='UTC')
                    window = self._minute_reader.load_raw_arrays(['open'], after_last, dt, [asset])[0]
                    nonnan = window[(~ pd.isnull(window))]
                    if len(nonnan):
                        val = nonnan[0]
                    else:
                        val = np.nan
                    entries[asset] = (dt_value, val)
                    opens.append(val)
                    continue
            except KeyError:
                window = self._minute_reader.load_raw_arrays(['open'], market_open, dt, [asset])[0]
                nonnan = window[(~ pd.isnull(window))]
                if len(nonnan):
                    val = nonnan[0]
                else:
                    val = np.nan
                entries[asset] = (dt_value, val)
                opens.append(val)
                continue
    return np.array(opens)
