Cython: sim_engine.pyx

Generated by Cython 3.1.8

Yellow lines hint at Python interaction.
Click on a line that starts with a "`+`" to see the C code that Cython generated for it.

Raw output: sim_engine.c

    +001: #

      __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_5) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

     002: # Copyright 2015 Quantopian, Inc.

     003: #

     004: # Licensed under the Apache License, Version 2.0 (the "License");

     005: # you may not use this file except in compliance with the License.

     006: # You may obtain a copy of the License at

     007: #

     008: #     http://www.apache.org/licenses/LICENSE-2.0

     009: #

     010: # Unless required by applicable law or agreed to in writing, software

     011: # distributed under the License is distributed on an "AS IS" BASIS,

     012: # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

     013: # See the License for the specific language governing permissions and

     014: # limitations under the License.

     015:

     016: cimport cython

     017: cimport numpy as np

    +018: import numpy as np

      __pyx_t_5 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_numpy, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 18, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_np, __pyx_t_5) < (0)) __PYX_ERR(0, 18, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    +019: import pandas as pd

      __pyx_t_5 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_pandas, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 19, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pd, __pyx_t_5) < (0)) __PYX_ERR(0, 19, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

     020: from cpython cimport bool

     021:

    +022: cdef np.int64_t _nanos_in_minute = 60000000000

      __pyx_v_7zipline_4gens_10sim_engine__nanos_in_minute = 0xDF8475800;

    +023: NANOS_IN_MINUTE = _nanos_in_minute

      __pyx_t_5 = __Pyx_PyLong_From_npy_int64(__pyx_v_7zipline_4gens_10sim_engine__nanos_in_minute); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_NANOS_IN_MINUTE, __pyx_t_5) < (0)) __PYX_ERR(0, 23, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

     024:

    +025: cpdef enum:

    enum  {
      __pyx_e_7zipline_4gens_10sim_engine_BAR = 0,
      __pyx_e_7zipline_4gens_10sim_engine_SESSION_START = 1,
      __pyx_e_7zipline_4gens_10sim_engine_SESSION_END = 2,
      __pyx_e_7zipline_4gens_10sim_engine_MINUTE_END = 3,
      __pyx_e_7zipline_4gens_10sim_engine_BEFORE_TRADING_START_BAR = 4
    };

     026:     BAR = 0

     027:     SESSION_START = 1

     028:     SESSION_END = 2

     029:     MINUTE_END = 3

     030:     BEFORE_TRADING_START_BAR = 4

     031:

    +032: cdef class MinuteSimulationClock:

    struct __pyx_obj_7zipline_4gens_10sim_engine_MinuteSimulationClock {
      PyObject_HEAD
      struct __pyx_vtabstruct_7zipline_4gens_10sim_engine_MinuteSimulationClock *__pyx_vtab;
      PyLongObject *minute_emission;
      __Pyx_memviewslice market_opens_nanos;
      __Pyx_memviewslice market_closes_nanos;
      __Pyx_memviewslice bts_nanos;
      __Pyx_memviewslice sessions_nanos;
      PyObject *minutes_by_session;
    };
    /* … */
    struct __pyx_vtabstruct_7zipline_4gens_10sim_engine_MinuteSimulationClock {
      PyObject *(*calc_minutes_by_session)(struct __pyx_obj_7zipline_4gens_10sim_engine_MinuteSimulationClock *);
    };
    static struct __pyx_vtabstruct_7zipline_4gens_10sim_engine_MinuteSimulationClock *__pyx_vtabptr_7zipline_4gens_10sim_engine_MinuteSimulationClock;

     033:     cdef bool minute_emission

     034:     cdef np.int64_t[:] market_opens_nanos, market_closes_nanos, bts_nanos, \

     035:         sessions_nanos

     036:     cdef dict minutes_by_session

     037:

    +038:     def __init__(self,

    /* Python wrapper */
    static int __pyx_pw_7zipline_4gens_10sim_engine_21MinuteSimulationClock_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static int __pyx_pw_7zipline_4gens_10sim_engine_21MinuteSimulationClock_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_sessions = 0;
      PyObject *__pyx_v_market_opens = 0;
      PyObject *__pyx_v_market_closes = 0;
      PyObject *__pyx_v_before_trading_start_minutes = 0;
      PyObject *__pyx_v_minute_emission = 0;
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
      #endif
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_sessions,&__pyx_mstate_global->__pyx_n_u_market_opens,&__pyx_mstate_global->__pyx_n_u_market_closes,&__pyx_mstate_global->__pyx_n_u_before_trading_start_minutes,&__pyx_mstate_global->__pyx_n_u_minute_emission,0};
      PyObject* values[5] = {0,0,0,0,0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 38, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  5:
            values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 38, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  4:
            values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 38, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  3:
            values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 38, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 38, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 38, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 38, __pyx_L3_error)
    /* … */
      /* function exit code */
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static int __pyx_pf_7zipline_4gens_10sim_engine_21MinuteSimulationClock___init__(struct __pyx_obj_7zipline_4gens_10sim_engine_MinuteSimulationClock *__pyx_v_self, PyObject *__pyx_v_sessions, PyObject *__pyx_v_market_opens, PyObject *__pyx_v_market_closes, PyObject *__pyx_v_before_trading_start_minutes, PyObject *__pyx_v_minute_emission) {
      int __pyx_r;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[39]))
      __Pyx_TraceStartFunc("__init__", __pyx_f[0], 38, 0, 0, 0, __PYX_ERR(0, 38, __pyx_L1_error));
    /* … */
      /* function exit code */
      __pyx_r = 0;
      __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 38, __pyx_L1_error));
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
      __Pyx_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 38, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline.gens.sim_engine.MinuteSimulationClock.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     039:                  sessions,

     040:                  market_opens,

     041:                  market_closes,

     042:                  before_trading_start_minutes,

    +043:                  minute_emission=False):

          if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_False));
          for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 5, i); __PYX_ERR(0, 38, __pyx_L3_error) }
          }
        } else {
          switch (__pyx_nargs) {
            case  5:
            values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 38, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  4:
            values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 38, __pyx_L3_error)
            values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 38, __pyx_L3_error)
            values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 38, __pyx_L3_error)
            values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 38, __pyx_L3_error)
            break;
            default: goto __pyx_L5_argtuple_error;
          }
          if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_False));
        }
        __pyx_v_sessions = values[0];
        __pyx_v_market_opens = values[1];
        __pyx_v_market_closes = values[2];
        __pyx_v_before_trading_start_minutes = values[3];
        __pyx_v_minute_emission = values[4];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("__init__", 0, 4, 5, __pyx_nargs); __PYX_ERR(0, 38, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("zipline.gens.sim_engine.MinuteSimulationClock.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return -1;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_7zipline_4gens_10sim_engine_21MinuteSimulationClock___init__(((struct __pyx_obj_7zipline_4gens_10sim_engine_MinuteSimulationClock *)__pyx_v_self), __pyx_v_sessions, __pyx_v_market_opens, __pyx_v_market_closes, __pyx_v_before_trading_start_minutes, __pyx_v_minute_emission);

    +044:         self.minute_emission = minute_emission

      __pyx_t_1 = __pyx_v_minute_emission;
      __Pyx_INCREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_7cpython_4bool_bool))))) __PYX_ERR(0, 44, __pyx_L1_error)
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF((PyObject *)__pyx_v_self->minute_emission);
      __Pyx_DECREF((PyObject *)__pyx_v_self->minute_emission);
      __pyx_v_self->minute_emission = ((PyLongObject *)__pyx_t_1);
      __pyx_t_1 = 0;

     045:

    +046:         self.market_opens_nanos = market_opens.values.astype(np.int64)

      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_market_opens, __pyx_mstate_global->__pyx_n_u_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __pyx_t_3;
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 46, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_int64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 46, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int64_t(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 46, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_self->market_opens_nanos, 0);
      __pyx_v_self->market_opens_nanos = __pyx_t_7;
      __pyx_t_7.memview = NULL;
      __pyx_t_7.data = NULL;

    +047:         self.market_closes_nanos = market_closes.values.astype(np.int64)

      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_market_closes, __pyx_mstate_global->__pyx_n_u_values); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 47, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_int64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 47, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int64_t(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 47, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_self->market_closes_nanos, 0);
      __pyx_v_self->market_closes_nanos = __pyx_t_7;
      __pyx_t_7.memview = NULL;
      __pyx_t_7.data = NULL;

    +048:         self.sessions_nanos = sessions.values.astype(np.int64)

      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sessions, __pyx_mstate_global->__pyx_n_u_values); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 48, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __pyx_t_4;
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_int64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_2};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int64_t(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 48, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_self->sessions_nanos, 0);
      __pyx_v_self->sessions_nanos = __pyx_t_7;
      __pyx_t_7.memview = NULL;
      __pyx_t_7.data = NULL;

    +049:         self.bts_nanos = before_trading_start_minutes.values.astype(np.int64)

      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_before_trading_start_minutes, __pyx_mstate_global->__pyx_n_u_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __pyx_t_2;
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 49, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_int64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int64_t(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 49, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_self->bts_nanos, 0);
      __pyx_v_self->bts_nanos = __pyx_t_7;
      __pyx_t_7.memview = NULL;
      __pyx_t_7.data = NULL;

     050:

    +051:         self.minutes_by_session = self.calc_minutes_by_session()

      __pyx_t_1 = ((struct __pyx_vtabstruct_7zipline_4gens_10sim_engine_MinuteSimulationClock *)__pyx_v_self->__pyx_vtab)->calc_minutes_by_session(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->minutes_by_session);
      __Pyx_DECREF(__pyx_v_self->minutes_by_session);
      __pyx_v_self->minutes_by_session = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

     052:

    +053:     @cython.boundscheck(False)

    static PyObject *__pyx_f_7zipline_4gens_10sim_engine_21MinuteSimulationClock_calc_minutes_by_session(struct __pyx_obj_7zipline_4gens_10sim_engine_MinuteSimulationClock *__pyx_v_self) {
      PyObject *__pyx_v_minutes_by_session = 0;
      int __pyx_v_session_idx;
      __pyx_t_5numpy_int64_t __pyx_v_session_nano;
      PyArrayObject *__pyx_v_minutes_nanos = 0;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_minutes_nanos;
      __Pyx_Buffer __pyx_pybuffer_minutes_nanos;
      PyObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[40]))
      __Pyx_TraceStartFunc("calc_minutes_by_session", __pyx_f[0], 53, 0, 0, 0, __PYX_ERR(0, 53, __pyx_L1_error));
      __pyx_pybuffer_minutes_nanos.pybuffer.buf = NULL;
      __pyx_pybuffer_minutes_nanos.refcount = 0;
      __pyx_pybuffernd_minutes_nanos.data = NULL;
      __pyx_pybuffernd_minutes_nanos.rcbuffer = &__pyx_pybuffer_minutes_nanos;
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_t_3, 1);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_11);
      __Pyx_XDECREF(__pyx_t_12);
      __Pyx_XDECREF(__pyx_t_13);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_minutes_nanos.rcbuffer->pybuffer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 53, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline.gens.sim_engine.MinuteSimulationClock.calc_minutes_by_session", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_minutes_nanos.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF(__pyx_v_minutes_by_session);
      __Pyx_XDECREF((PyObject *)__pyx_v_minutes_nanos);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    static PyObject *__pyx_gb_7zipline_4gens_10sim_engine_21MinuteSimulationClock_4generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

     054:     @cython.wraparound(False)

     055:     cdef dict calc_minutes_by_session(self):

     056:         cdef dict minutes_by_session

     057:         cdef int session_idx

     058:         cdef np.int64_t session_nano

     059:         cdef np.ndarray[np.int64_t, ndim=1] minutes_nanos

     060:

    +061:         minutes_by_session = {}

      __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_minutes_by_session = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

    +062:         for session_idx, session_nano in enumerate(self.sessions_nanos):

      __pyx_t_2 = 0;
      if (unlikely(!__pyx_v_self->sessions_nanos.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 62, __pyx_L1_error)}
      if (unlikely(((PyObject *) __pyx_v_self->sessions_nanos.memview) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
        __PYX_ERR(0, 62, __pyx_L1_error)
      }
      __PYX_INC_MEMVIEW(&__pyx_v_self->sessions_nanos, 1);
      __pyx_t_3 = __pyx_v_self->sessions_nanos;
      __pyx_t_4 = __Pyx_MemoryView_Len(__pyx_t_3);
      for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_4; __pyx_t_6++) {
        __pyx_t_5 = __pyx_t_6;
        __pyx_t_7 = __pyx_t_5;
        __pyx_v_session_nano = (*((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ (__pyx_t_3.data + __pyx_t_7 * __pyx_t_3.strides[0]) )));
    /* … */
        __pyx_v_session_idx = __pyx_t_2;
    /* … */
        __pyx_t_2 = (__pyx_t_2 + 1);

    +063:             minutes_nanos = np.arange(

        __pyx_t_8 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 63, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_arange); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 63, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    /* … */
        if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 63, __pyx_L1_error)
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_minutes_nanos.rcbuffer->pybuffer);
          __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_minutes_nanos.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
          if (unlikely(__pyx_t_15 < 0)) {
            PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_minutes_nanos.rcbuffer->pybuffer, (PyObject*)__pyx_v_minutes_nanos, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
            }
            __pyx_t_16 = __pyx_t_17 = __pyx_t_18 = 0;
          }
          __pyx_pybuffernd_minutes_nanos.diminfo[0].strides = __pyx_pybuffernd_minutes_nanos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_minutes_nanos.diminfo[0].shape = __pyx_pybuffernd_minutes_nanos.rcbuffer->pybuffer.shape[0];
          if (unlikely((__pyx_t_15 < 0))) __PYX_ERR(0, 63, __pyx_L1_error)
        }
        __Pyx_XDECREF_SET(__pyx_v_minutes_nanos, ((PyArrayObject *)__pyx_t_1));
        __pyx_t_1 = 0;

    +064:                 self.market_opens_nanos[session_idx],

        if (unlikely(!__pyx_v_self->market_opens_nanos.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 64, __pyx_L1_error)}
        __pyx_t_7 = __pyx_v_session_idx;
        __pyx_t_9 = __Pyx_PyLong_From_npy_int64((*((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ (__pyx_v_self->market_opens_nanos.data + __pyx_t_7 * __pyx_v_self->market_opens_nanos.strides[0]) )))); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 64, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);

    +065:                 self.market_closes_nanos[session_idx] + NANOS_IN_MINUTE,

        if (unlikely(!__pyx_v_self->market_closes_nanos.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 65, __pyx_L1_error)}
        __pyx_t_7 = __pyx_v_session_idx;
        __pyx_t_11 = __Pyx_PyLong_From_npy_int64((*((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ (__pyx_v_self->market_closes_nanos.data + __pyx_t_7 * __pyx_v_self->market_closes_nanos.strides[0]) )))); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 65, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_NANOS_IN_MINUTE); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 65, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_13 = PyNumber_Add(__pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 65, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

    +066:                 NANOS_IN_MINUTE

        __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_NANOS_IN_MINUTE); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 66, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_14 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10);
          assert(__pyx_t_8);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_10, __pyx__function);
          __pyx_t_14 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[4] = {__pyx_t_8, __pyx_t_9, __pyx_t_13, __pyx_t_12};
          __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+__pyx_t_14, (4-__pyx_t_14) | (__pyx_t_14*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }

     067:             )

    +068:             minutes_by_session[session_nano] = pd.to_datetime(

        __pyx_t_10 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 68, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_to_datetime); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 68, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    /* … */
        __pyx_t_13 = __Pyx_PyLong_From_npy_int64(__pyx_v_session_nano); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 68, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        if (unlikely((PyDict_SetItem(__pyx_v_minutes_by_session, __pyx_t_13, __pyx_t_1) < 0))) __PYX_ERR(0, 68, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __PYX_XCLEAR_MEMVIEW(&__pyx_t_3, 1);
      __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;

    +069:                 minutes_nanos, utc=True

        __pyx_t_14 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_13))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_13);
          assert(__pyx_t_10);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_13);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_13, __pyx__function);
          __pyx_t_14 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_10, ((PyObject *)__pyx_v_minutes_nanos)};
          __pyx_t_12 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 68, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_utc, Py_True, __pyx_t_12, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 68, __pyx_L1_error)
          __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_13, __pyx_callargs+__pyx_t_14, (2-__pyx_t_14) | (__pyx_t_14*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_12);
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }

     070:             )

    +071:         return minutes_by_session

      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_minutes_by_session);
      __pyx_r = __pyx_v_minutes_by_session;
      __Pyx_TraceReturnValue(__pyx_r, 34, 0, __PYX_ERR(0, 71, __pyx_L1_error));
      goto __pyx_L0;

     072:

    +073:     def __iter__(self):

    /* Python wrapper */
    static PyObject *__pyx_pw_7zipline_4gens_10sim_engine_21MinuteSimulationClock_3__iter__(PyObject *__pyx_v_self); /*proto*/
    static PyObject *__pyx_pw_7zipline_4gens_10sim_engine_21MinuteSimulationClock_3__iter__(PyObject *__pyx_v_self) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      __pyx_r = __pyx_pf_7zipline_4gens_10sim_engine_21MinuteSimulationClock_2__iter__(((struct __pyx_obj_7zipline_4gens_10sim_engine_MinuteSimulationClock *)__pyx_v_self));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_7zipline_4gens_10sim_engine_21MinuteSimulationClock_2__iter__(struct __pyx_obj_7zipline_4gens_10sim_engine_MinuteSimulationClock *__pyx_v_self) {
      struct __pyx_obj_7zipline_4gens_10sim_engine___pyx_scope_struct____iter__ *__pyx_cur_scope;
      PyObject *__pyx_r = NULL;
      __pyx_cur_scope = (struct __pyx_obj_7zipline_4gens_10sim_engine___pyx_scope_struct____iter__ *)__pyx_tp_new_7zipline_4gens_10sim_engine___pyx_scope_struct____iter__(__pyx_mstate_global->__pyx_ptype_7zipline_4gens_10sim_engine___pyx_scope_struct____iter__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
      if (unlikely(!__pyx_cur_scope)) {
        __pyx_cur_scope = ((struct __pyx_obj_7zipline_4gens_10sim_engine___pyx_scope_struct____iter__ *)Py_None);
        __Pyx_INCREF(Py_None);
        __PYX_ERR(0, 73, __pyx_L1_error)
      } else {
        __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
      }
      __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
      __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
      __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
      {
        __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7zipline_4gens_10sim_engine_21MinuteSimulationClock_4generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[41]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iter, __pyx_mstate_global->__pyx_n_u_MinuteSimulationClock___iter, __pyx_mstate_global->__pyx_n_u_zipline_gens_sim_engine); if (unlikely(!gen)) __PYX_ERR(0, 73, __pyx_L1_error)
        __Pyx_DECREF(__pyx_cur_scope);
        __Pyx_RefNannyFinishContext();
        return (PyObject *) gen;
      }

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_AddTraceback("zipline.gens.sim_engine.MinuteSimulationClock.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __Pyx_DECREF((PyObject *)__pyx_cur_scope);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_gb_7zipline_4gens_10sim_engine_21MinuteSimulationClock_4generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
    {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__iter__", 0);
      __Pyx_TraceDeclarationsGen
      __pyx_L3_first_run:;
      __Pyx_TraceStartGen("__iter__", __pyx_f[0], 73, 0, 0, 0, __PYX_ERR(0, 73, __pyx_L1_error));
      if (unlikely(__pyx_sent_value != Py_None)) {
        if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
        __PYX_ERR(0, 73, __pyx_L1_error)
      }
    /* … */
      /* function exit code */
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_t_3, 1);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_13);
      if (__Pyx_PyErr_Occurred()) {
        __Pyx_TraceException(__pyx_lineno, 0, 0);
        __Pyx_Generator_Replace_StopIteration(0);
        __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
        __Pyx_TraceExceptionUnwind(0, 0);
      }
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      #if !CYTHON_USE_EXC_INFO_STACK
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      #endif
      __pyx_generator->resume_label = -1;
      __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    static PyObject *__pyx_gb_7zipline_4gens_10sim_engine_21MinuteSimulationClock_7generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
    /* … */
    struct __pyx_obj_7zipline_4gens_10sim_engine___pyx_scope_struct____iter__ {
      PyObject_HEAD
      PyObject *__pyx_v_bts_idx;
      PyObject *__pyx_v_bts_minute;
      PyObject *__pyx_v_evt;
      Py_ssize_t __pyx_v_idx;
      PyObject *__pyx_v_minute;
      PyLongObject *__pyx_v_minute_emission;
      PyObject *__pyx_v_regular_minutes;
      struct __pyx_obj_7zipline_4gens_10sim_engine_MinuteSimulationClock *__pyx_v_self;
      PyObject *__pyx_v_session_nano;
      Py_ssize_t __pyx_t_0;
      __Pyx_memviewslice __pyx_t_1;
      Py_ssize_t __pyx_t_2;
      Py_ssize_t __pyx_t_3;
      Py_ssize_t __pyx_t_4;
      PyObject *__pyx_t_5;
      Py_ssize_t __pyx_t_6;
      PyObject *(*__pyx_t_7)(PyObject *);
    };

    +074:         minute_emission = self.minute_emission

      __pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->minute_emission);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_cur_scope->__pyx_v_minute_emission = ((PyLongObject *)__pyx_t_1);
      __pyx_t_1 = 0;

     075:

     076:         cdef Py_ssize_t idx

     077:

    +078:         for idx, session_nano in enumerate(self.sessions_nanos):

      __pyx_t_2 = 0;
      if (unlikely(!__pyx_cur_scope->__pyx_v_self->sessions_nanos.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 78, __pyx_L1_error)}
      if (unlikely(((PyObject *) __pyx_cur_scope->__pyx_v_self->sessions_nanos.memview) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
        __PYX_ERR(0, 78, __pyx_L1_error)
      }
      __PYX_INC_MEMVIEW(&__pyx_cur_scope->__pyx_v_self->sessions_nanos, 1);
      __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->sessions_nanos;
      __pyx_t_4 = __Pyx_MemoryView_Len(__pyx_t_3);
      for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_4; __pyx_t_6++) {
        __pyx_t_5 = __pyx_t_6;
        __pyx_t_7 = __pyx_t_5;
        __pyx_t_1 = __Pyx_PyLong_From_npy_int64((*((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ (__pyx_t_3.data + __pyx_t_7 * __pyx_t_3.strides[0]) )))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_session_nano);
        __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_session_nano, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __pyx_t_1 = 0;
    /* … */
        __pyx_cur_scope->__pyx_v_idx = __pyx_t_2;
    /* … */
        __pyx_t_2 = (__pyx_t_2 + 1);

    +079:             yield pd.Timestamp(session_nano, tz='UTC'), SESSION_START

        __pyx_t_8 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 79, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_Timestamp); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 79, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_11 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10);
          assert(__pyx_t_8);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_10, __pyx__function);
          __pyx_t_11 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_8, __pyx_cur_scope->__pyx_v_session_nano};
          __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 79, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_tz, __pyx_mstate_global->__pyx_n_u_UTC, __pyx_t_9, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 79, __pyx_L1_error)
          __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_10, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9);
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __pyx_t_10 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_7zipline_4gens_10sim_engine_SESSION_START); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 79, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 79, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_1);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 79, __pyx_L1_error);
        __Pyx_GIVEREF(__pyx_t_10);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10) != (0)) __PYX_ERR(0, 79, __pyx_L1_error);
        __pyx_t_1 = 0;
        __pyx_t_10 = 0;
        __pyx_r = __pyx_t_9;
        __pyx_t_9 = 0;
        __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
        __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
        __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
        __pyx_cur_scope->__pyx_t_3 = __pyx_t_5;
        __pyx_cur_scope->__pyx_t_4 = __pyx_t_6;
        __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 79, __pyx_L1_error));
        __Pyx_XGIVEREF(__pyx_r);
        __Pyx_RefNannyFinishContext();
        __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
        /* return from generator, yielding value */
        __pyx_generator->resume_label = 1;
        return __pyx_r;
        __pyx_L6_resume_from_yield:;
        __Pyx_TraceResumeGen("__iter__", __pyx_f[0], 73, 0, __PYX_ERR(0, 79, __pyx_L1_error));
        __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
        __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
        __pyx_cur_scope->__pyx_t_1.memview = NULL; __pyx_cur_scope->__pyx_t_1.data = NULL;
        __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
        __pyx_t_5 = __pyx_cur_scope->__pyx_t_3;
        __pyx_t_6 = __pyx_cur_scope->__pyx_t_4;
        if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 79, __pyx_L1_error)

     080:

    +081:             bts_minute = pd.Timestamp(self.bts_nanos[idx], tz='UTC')

        __pyx_t_10 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Timestamp); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 81, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_cur_scope->__pyx_v_self->bts_nanos.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 81, __pyx_L1_error)}
        __pyx_t_7 = __pyx_cur_scope->__pyx_v_idx;
        __pyx_t_12 = -1;
        if (__pyx_t_7 < 0) {
          __pyx_t_7 += __pyx_cur_scope->__pyx_v_self->bts_nanos.shape[0];
          if (unlikely(__pyx_t_7 < 0)) __pyx_t_12 = 0;
        } else if (unlikely(__pyx_t_7 >= __pyx_cur_scope->__pyx_v_self->bts_nanos.shape[0])) __pyx_t_12 = 0;
        if (unlikely(__pyx_t_12 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_12);
          __PYX_ERR(0, 81, __pyx_L1_error)
        }
        __pyx_t_1 = __Pyx_PyLong_From_npy_int64((*((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ (__pyx_cur_scope->__pyx_v_self->bts_nanos.data + __pyx_t_7 * __pyx_cur_scope->__pyx_v_self->bts_nanos.strides[0]) )))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_11 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
          assert(__pyx_t_10);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
          __pyx_t_11 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_10, __pyx_t_1};
          __pyx_t_13 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 81, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_tz, __pyx_mstate_global->__pyx_n_u_UTC, __pyx_t_13, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 81, __pyx_L1_error)
          __pyx_t_9 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_8, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_13);
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 81, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
        }
        __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_bts_minute);
        __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_bts_minute, __pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_9);
        __pyx_t_9 = 0;

    +082:             regular_minutes = self.minutes_by_session[session_nano]

        if (unlikely(__pyx_cur_scope->__pyx_v_self->minutes_by_session == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 82, __pyx_L1_error)
        }
        __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_self->minutes_by_session, __pyx_cur_scope->__pyx_v_session_nano); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 82, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_regular_minutes);
        __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_regular_minutes, __pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_9);
        __pyx_t_9 = 0;

     083:

    +084:             if bts_minute > regular_minutes[-1]:

        __pyx_t_9 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_regular_minutes, -1L, long, 1, __Pyx_PyLong_From_long, 0, 1, 1, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 84, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_8 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_bts_minute, __pyx_t_9, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 84, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 84, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (__pyx_t_14) {
    /* … */
          goto __pyx_L7;
        }

     085:                 # before_trading_start is after the last close,

     086:                 # so don't emit it

    +087:                 for minute, evt in self._get_minutes_for_list(

          __pyx_t_9 = ((PyObject *)__pyx_cur_scope->__pyx_v_self);
          __Pyx_INCREF(__pyx_t_9);
    /* … */
          if (likely(PyList_CheckExact(__pyx_t_8)) || PyTuple_CheckExact(__pyx_t_8)) {
            __pyx_t_9 = __pyx_t_8; __Pyx_INCREF(__pyx_t_9);
            __pyx_t_15 = 0;
            __pyx_t_16 = NULL;
          } else {
            __pyx_t_15 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 87, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __pyx_t_16 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 87, __pyx_L1_error)
          }
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          for (;;) {
            if (likely(!__pyx_t_16)) {
              if (likely(PyList_CheckExact(__pyx_t_9))) {
                {
                  Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_9);
                  #if !CYTHON_ASSUME_SAFE_SIZE
                  if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 87, __pyx_L1_error)
                  #endif
                  if (__pyx_t_15 >= __pyx_temp) break;
                }
                __pyx_t_8 = __Pyx_PyList_GetItemRef(__pyx_t_9, __pyx_t_15);
                ++__pyx_t_15;
              } else {
                {
                  Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_9);
                  #if !CYTHON_ASSUME_SAFE_SIZE
                  if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 87, __pyx_L1_error)
                  #endif
                  if (__pyx_t_15 >= __pyx_temp) break;
                }
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_15));
                #else
                __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_9, __pyx_t_15);
                #endif
                ++__pyx_t_15;
              }
              if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 87, __pyx_L1_error)
            } else {
              __pyx_t_8 = __pyx_t_16(__pyx_t_9);
              if (unlikely(!__pyx_t_8)) {
                PyObject* exc_type = PyErr_Occurred();
                if (exc_type) {
                  if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 87, __pyx_L1_error)
                  PyErr_Clear();
                }
                break;
              }
            }
            __Pyx_GOTREF(__pyx_t_8);
            if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) {
              PyObject* sequence = __pyx_t_8;
              Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
              if (unlikely(size != 2)) {
                if (size > 2) __Pyx_RaiseTooManyValuesError(2);
                else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
                __PYX_ERR(0, 87, __pyx_L1_error)
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              if (likely(PyTuple_CheckExact(sequence))) {
                __pyx_t_13 = PyTuple_GET_ITEM(sequence, 0);
                __Pyx_INCREF(__pyx_t_13);
                __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
                __Pyx_INCREF(__pyx_t_1);
              } else {
                __pyx_t_13 = __Pyx_PyList_GetItemRef(sequence, 0);
                if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 87, __pyx_L1_error)
                __Pyx_XGOTREF(__pyx_t_13);
                __pyx_t_1 = __Pyx_PyList_GetItemRef(sequence, 1);
                if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error)
                __Pyx_XGOTREF(__pyx_t_1);
              }
              #else
              __pyx_t_13 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 87, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_13);
              __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_1);
              #endif
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            } else {
              Py_ssize_t index = -1;
              __pyx_t_10 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 87, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              __pyx_t_17 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
              index = 0; __pyx_t_13 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_13)) goto __pyx_L10_unpacking_failed;
              __Pyx_GOTREF(__pyx_t_13);
              index = 1; __pyx_t_1 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_1)) goto __pyx_L10_unpacking_failed;
              __Pyx_GOTREF(__pyx_t_1);
              if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < (0)) __PYX_ERR(0, 87, __pyx_L1_error)
              __pyx_t_17 = NULL;
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              goto __pyx_L11_unpacking_done;
              __pyx_L10_unpacking_failed:;
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              __pyx_t_17 = NULL;
              if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
              __PYX_ERR(0, 87, __pyx_L1_error)
              __pyx_L11_unpacking_done:;
            }
            __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_minute);
            __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_minute, __pyx_t_13);
            __Pyx_GIVEREF(__pyx_t_13);
            __pyx_t_13 = 0;
            __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_evt);
            __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_evt, __pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_1);
            __pyx_t_1 = 0;
    /* … */
          }
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

     088:                     regular_minutes,

    +089:                     minute_emission

          __pyx_t_11 = 0;
          {
            PyObject *__pyx_callargs[3] = {__pyx_t_9, __pyx_cur_scope->__pyx_v_regular_minutes, ((PyObject *)__pyx_cur_scope->__pyx_v_minute_emission)};
            __pyx_t_8 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_minutes_for_list, __pyx_callargs+__pyx_t_11, (3-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 87, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
          }

     090:                 ):

    +091:                     yield minute, evt

            __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 91, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_INCREF(__pyx_cur_scope->__pyx_v_minute);
            __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_minute);
            if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_cur_scope->__pyx_v_minute) != (0)) __PYX_ERR(0, 91, __pyx_L1_error);
            __Pyx_INCREF(__pyx_cur_scope->__pyx_v_evt);
            __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_evt);
            if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_cur_scope->__pyx_v_evt) != (0)) __PYX_ERR(0, 91, __pyx_L1_error);
            __pyx_r = __pyx_t_8;
            __pyx_t_8 = 0;
            __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
            __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
            __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
            __pyx_cur_scope->__pyx_t_3 = __pyx_t_5;
            __pyx_cur_scope->__pyx_t_4 = __pyx_t_6;
            __Pyx_XGIVEREF(__pyx_t_9);
            __pyx_cur_scope->__pyx_t_5 = __pyx_t_9;
            __pyx_cur_scope->__pyx_t_6 = __pyx_t_15;
            __pyx_cur_scope->__pyx_t_7 = __pyx_t_16;
            __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 91, __pyx_L1_error));
            __Pyx_XGIVEREF(__pyx_r);
            __Pyx_RefNannyFinishContext();
            __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
            /* return from generator, yielding value */
            __pyx_generator->resume_label = 2;
            return __pyx_r;
            __pyx_L12_resume_from_yield:;
            __Pyx_TraceResumeGen("__iter__", __pyx_f[0], 73, 0, __PYX_ERR(0, 91, __pyx_L1_error));
            __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
            __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
            __pyx_cur_scope->__pyx_t_1.memview = NULL; __pyx_cur_scope->__pyx_t_1.data = NULL;
            __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
            __pyx_t_5 = __pyx_cur_scope->__pyx_t_3;
            __pyx_t_6 = __pyx_cur_scope->__pyx_t_4;
            __pyx_t_9 = __pyx_cur_scope->__pyx_t_5;
            __pyx_cur_scope->__pyx_t_5 = 0;
            __Pyx_XGOTREF(__pyx_t_9);
            __pyx_t_15 = __pyx_cur_scope->__pyx_t_6;
            __pyx_t_16 = __pyx_cur_scope->__pyx_t_7;
            if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 91, __pyx_L1_error)

     092:             else:

     093:                 # we have to search anew every session, because there is no

     094:                 # guarantee that any two session start on the same minute

    +095:                 bts_idx = regular_minutes.searchsorted(bts_minute)

        /*else*/ {
          __pyx_t_8 = __pyx_cur_scope->__pyx_v_regular_minutes;
          __Pyx_INCREF(__pyx_t_8);
          __pyx_t_11 = 0;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_cur_scope->__pyx_v_bts_minute};
            __pyx_t_9 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_searchsorted, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 95, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
          }
          __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_bts_idx);
          __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_bts_idx, __pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_9);
          __pyx_t_9 = 0;

     096:

     097:                 # emit all the minutes before bts_minute

    +098:                 for minute, evt in self._get_minutes_for_list(

          __pyx_t_8 = ((PyObject *)__pyx_cur_scope->__pyx_v_self);
          __Pyx_INCREF(__pyx_t_8);
    /* … */
          if (likely(PyList_CheckExact(__pyx_t_9)) || PyTuple_CheckExact(__pyx_t_9)) {
            __pyx_t_1 = __pyx_t_9; __Pyx_INCREF(__pyx_t_1);
            __pyx_t_15 = 0;
            __pyx_t_16 = NULL;
          } else {
            __pyx_t_15 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_16 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 98, __pyx_L1_error)
          }
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          for (;;) {
            if (likely(!__pyx_t_16)) {
              if (likely(PyList_CheckExact(__pyx_t_1))) {
                {
                  Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
                  #if !CYTHON_ASSUME_SAFE_SIZE
                  if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 98, __pyx_L1_error)
                  #endif
                  if (__pyx_t_15 >= __pyx_temp) break;
                }
                __pyx_t_9 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_15);
                ++__pyx_t_15;
              } else {
                {
                  Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
                  #if !CYTHON_ASSUME_SAFE_SIZE
                  if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 98, __pyx_L1_error)
                  #endif
                  if (__pyx_t_15 >= __pyx_temp) break;
                }
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                __pyx_t_9 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_15));
                #else
                __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_15);
                #endif
                ++__pyx_t_15;
              }
              if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 98, __pyx_L1_error)
            } else {
              __pyx_t_9 = __pyx_t_16(__pyx_t_1);
              if (unlikely(!__pyx_t_9)) {
                PyObject* exc_type = PyErr_Occurred();
                if (exc_type) {
                  if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 98, __pyx_L1_error)
                  PyErr_Clear();
                }
                break;
              }
            }
            __Pyx_GOTREF(__pyx_t_9);
            if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
              PyObject* sequence = __pyx_t_9;
              Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
              if (unlikely(size != 2)) {
                if (size > 2) __Pyx_RaiseTooManyValuesError(2);
                else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
                __PYX_ERR(0, 98, __pyx_L1_error)
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              if (likely(PyTuple_CheckExact(sequence))) {
                __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0);
                __Pyx_INCREF(__pyx_t_8);
                __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1);
                __Pyx_INCREF(__pyx_t_13);
              } else {
                __pyx_t_8 = __Pyx_PyList_GetItemRef(sequence, 0);
                if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 98, __pyx_L1_error)
                __Pyx_XGOTREF(__pyx_t_8);
                __pyx_t_13 = __Pyx_PyList_GetItemRef(sequence, 1);
                if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 98, __pyx_L1_error)
                __Pyx_XGOTREF(__pyx_t_13);
              }
              #else
              __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 98, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              __pyx_t_13 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 98, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_13);
              #endif
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            } else {
              Py_ssize_t index = -1;
              __pyx_t_10 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 98, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
              __pyx_t_17 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
              index = 0; __pyx_t_8 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L16_unpacking_failed;
              __Pyx_GOTREF(__pyx_t_8);
              index = 1; __pyx_t_13 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_13)) goto __pyx_L16_unpacking_failed;
              __Pyx_GOTREF(__pyx_t_13);
              if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < (0)) __PYX_ERR(0, 98, __pyx_L1_error)
              __pyx_t_17 = NULL;
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              goto __pyx_L17_unpacking_done;
              __pyx_L16_unpacking_failed:;
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              __pyx_t_17 = NULL;
              if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
              __PYX_ERR(0, 98, __pyx_L1_error)
              __pyx_L17_unpacking_done:;
            }
            __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_minute);
            __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_minute, __pyx_t_8);
            __Pyx_GIVEREF(__pyx_t_8);
            __pyx_t_8 = 0;
            __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_evt);
            __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_evt, __pyx_t_13);
            __Pyx_GIVEREF(__pyx_t_13);
            __pyx_t_13 = 0;
    /* … */
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +099:                     regular_minutes[0:bts_idx],

          __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_regular_minutes, 0, 0, NULL, &__pyx_cur_scope->__pyx_v_bts_idx, NULL, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);

    +100:                     minute_emission

          __pyx_t_11 = 0;
          {
            PyObject *__pyx_callargs[3] = {__pyx_t_8, __pyx_t_1, ((PyObject *)__pyx_cur_scope->__pyx_v_minute_emission)};
            __pyx_t_9 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_minutes_for_list, __pyx_callargs+__pyx_t_11, (3-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 98, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
          }

     101:                 ):

    +102:                     yield minute, evt

            __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 102, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_INCREF(__pyx_cur_scope->__pyx_v_minute);
            __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_minute);
            if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_cur_scope->__pyx_v_minute) != (0)) __PYX_ERR(0, 102, __pyx_L1_error);
            __Pyx_INCREF(__pyx_cur_scope->__pyx_v_evt);
            __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_evt);
            if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_cur_scope->__pyx_v_evt) != (0)) __PYX_ERR(0, 102, __pyx_L1_error);
            __pyx_r = __pyx_t_9;
            __pyx_t_9 = 0;
            __Pyx_XGIVEREF(__pyx_t_1);
            __pyx_cur_scope->__pyx_t_5 = __pyx_t_1;
            __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
            __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
            __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
            __pyx_cur_scope->__pyx_t_3 = __pyx_t_5;
            __pyx_cur_scope->__pyx_t_4 = __pyx_t_6;
            __pyx_cur_scope->__pyx_t_6 = __pyx_t_15;
            __pyx_cur_scope->__pyx_t_7 = __pyx_t_16;
            __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 102, __pyx_L1_error));
            __Pyx_XGIVEREF(__pyx_r);
            __Pyx_RefNannyFinishContext();
            __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
            /* return from generator, yielding value */
            __pyx_generator->resume_label = 3;
            return __pyx_r;
            __pyx_L18_resume_from_yield:;
            __Pyx_TraceResumeGen("__iter__", __pyx_f[0], 73, 0, __PYX_ERR(0, 102, __pyx_L1_error));
            __pyx_t_1 = __pyx_cur_scope->__pyx_t_5;
            __pyx_cur_scope->__pyx_t_5 = 0;
            __Pyx_XGOTREF(__pyx_t_1);
            __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
            __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
            __pyx_cur_scope->__pyx_t_1.memview = NULL; __pyx_cur_scope->__pyx_t_1.data = NULL;
            __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
            __pyx_t_5 = __pyx_cur_scope->__pyx_t_3;
            __pyx_t_6 = __pyx_cur_scope->__pyx_t_4;
            __pyx_t_15 = __pyx_cur_scope->__pyx_t_6;
            __pyx_t_16 = __pyx_cur_scope->__pyx_t_7;
            if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 102, __pyx_L1_error)

     103:

    +104:                 yield bts_minute, BEFORE_TRADING_START_BAR

          __pyx_t_1 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_7zipline_4gens_10sim_engine_BEFORE_TRADING_START_BAR); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 104, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_INCREF(__pyx_cur_scope->__pyx_v_bts_minute);
          __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_bts_minute);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_cur_scope->__pyx_v_bts_minute) != (0)) __PYX_ERR(0, 104, __pyx_L1_error);
          __Pyx_GIVEREF(__pyx_t_1);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 104, __pyx_L1_error);
          __pyx_t_1 = 0;
          __pyx_r = __pyx_t_9;
          __pyx_t_9 = 0;
          __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
          __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
          __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
          __pyx_cur_scope->__pyx_t_3 = __pyx_t_5;
          __pyx_cur_scope->__pyx_t_4 = __pyx_t_6;
          __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 104, __pyx_L1_error));
          __Pyx_XGIVEREF(__pyx_r);
          __Pyx_RefNannyFinishContext();
          __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
          /* return from generator, yielding value */
          __pyx_generator->resume_label = 4;
          return __pyx_r;
          __pyx_L20_resume_from_yield:;
          __Pyx_TraceResumeGen("__iter__", __pyx_f[0], 73, 0, __PYX_ERR(0, 104, __pyx_L1_error));
          __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
          __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
          __pyx_cur_scope->__pyx_t_1.memview = NULL; __pyx_cur_scope->__pyx_t_1.data = NULL;
          __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
          __pyx_t_5 = __pyx_cur_scope->__pyx_t_3;
          __pyx_t_6 = __pyx_cur_scope->__pyx_t_4;
          if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 104, __pyx_L1_error)

     105:

     106:                 # emit all the minutes after bts_minute

    +107:                 for minute, evt in self._get_minutes_for_list(

          __pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_v_self);
          __Pyx_INCREF(__pyx_t_1);
    /* … */
          if (likely(PyList_CheckExact(__pyx_t_9)) || PyTuple_CheckExact(__pyx_t_9)) {
            __pyx_t_13 = __pyx_t_9; __Pyx_INCREF(__pyx_t_13);
            __pyx_t_15 = 0;
            __pyx_t_16 = NULL;
          } else {
            __pyx_t_15 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 107, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_13);
            __pyx_t_16 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_13); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 107, __pyx_L1_error)
          }
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          for (;;) {
            if (likely(!__pyx_t_16)) {
              if (likely(PyList_CheckExact(__pyx_t_13))) {
                {
                  Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_13);
                  #if !CYTHON_ASSUME_SAFE_SIZE
                  if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 107, __pyx_L1_error)
                  #endif
                  if (__pyx_t_15 >= __pyx_temp) break;
                }
                __pyx_t_9 = __Pyx_PyList_GetItemRef(__pyx_t_13, __pyx_t_15);
                ++__pyx_t_15;
              } else {
                {
                  Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_13);
                  #if !CYTHON_ASSUME_SAFE_SIZE
                  if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 107, __pyx_L1_error)
                  #endif
                  if (__pyx_t_15 >= __pyx_temp) break;
                }
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                __pyx_t_9 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_15));
                #else
                __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_13, __pyx_t_15);
                #endif
                ++__pyx_t_15;
              }
              if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
            } else {
              __pyx_t_9 = __pyx_t_16(__pyx_t_13);
              if (unlikely(!__pyx_t_9)) {
                PyObject* exc_type = PyErr_Occurred();
                if (exc_type) {
                  if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 107, __pyx_L1_error)
                  PyErr_Clear();
                }
                break;
              }
            }
            __Pyx_GOTREF(__pyx_t_9);
            if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
              PyObject* sequence = __pyx_t_9;
              Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
              if (unlikely(size != 2)) {
                if (size > 2) __Pyx_RaiseTooManyValuesError(2);
                else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
                __PYX_ERR(0, 107, __pyx_L1_error)
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              if (likely(PyTuple_CheckExact(sequence))) {
                __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
                __Pyx_INCREF(__pyx_t_1);
                __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
                __Pyx_INCREF(__pyx_t_8);
              } else {
                __pyx_t_1 = __Pyx_PyList_GetItemRef(sequence, 0);
                if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error)
                __Pyx_XGOTREF(__pyx_t_1);
                __pyx_t_8 = __Pyx_PyList_GetItemRef(sequence, 1);
                if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 107, __pyx_L1_error)
                __Pyx_XGOTREF(__pyx_t_8);
              }
              #else
              __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_1);
              __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 107, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              #endif
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            } else {
              Py_ssize_t index = -1;
              __pyx_t_10 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 107, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
              __pyx_t_17 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
              index = 0; __pyx_t_1 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_1)) goto __pyx_L23_unpacking_failed;
              __Pyx_GOTREF(__pyx_t_1);
              index = 1; __pyx_t_8 = __pyx_t_17(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L23_unpacking_failed;
              __Pyx_GOTREF(__pyx_t_8);
              if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 2) < (0)) __PYX_ERR(0, 107, __pyx_L1_error)
              __pyx_t_17 = NULL;
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              goto __pyx_L24_unpacking_done;
              __pyx_L23_unpacking_failed:;
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              __pyx_t_17 = NULL;
              if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
              __PYX_ERR(0, 107, __pyx_L1_error)
              __pyx_L24_unpacking_done:;
            }
            __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_minute);
            __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_minute, __pyx_t_1);
            __Pyx_GIVEREF(__pyx_t_1);
            __pyx_t_1 = 0;
            __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_evt);
            __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_evt, __pyx_t_8);
            __Pyx_GIVEREF(__pyx_t_8);
            __pyx_t_8 = 0;
    /* … */
          }
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        }
        __pyx_L7:;

    +108:                     regular_minutes[bts_idx:],

          __pyx_t_13 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_regular_minutes, 0, 0, &__pyx_cur_scope->__pyx_v_bts_idx, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 108, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);

    +109:                     minute_emission

          __pyx_t_11 = 0;
          {
            PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_t_13, ((PyObject *)__pyx_cur_scope->__pyx_v_minute_emission)};
            __pyx_t_9 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_minutes_for_list, __pyx_callargs+__pyx_t_11, (3-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 107, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
          }

     110:                 ):

    +111:                     yield minute, evt

            __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 111, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_INCREF(__pyx_cur_scope->__pyx_v_minute);
            __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_minute);
            if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_cur_scope->__pyx_v_minute) != (0)) __PYX_ERR(0, 111, __pyx_L1_error);
            __Pyx_INCREF(__pyx_cur_scope->__pyx_v_evt);
            __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_evt);
            if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_cur_scope->__pyx_v_evt) != (0)) __PYX_ERR(0, 111, __pyx_L1_error);
            __pyx_r = __pyx_t_9;
            __pyx_t_9 = 0;
            __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
            __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
            __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
            __pyx_cur_scope->__pyx_t_3 = __pyx_t_5;
            __pyx_cur_scope->__pyx_t_4 = __pyx_t_6;
            __Pyx_XGIVEREF(__pyx_t_13);
            __pyx_cur_scope->__pyx_t_5 = __pyx_t_13;
            __pyx_cur_scope->__pyx_t_6 = __pyx_t_15;
            __pyx_cur_scope->__pyx_t_7 = __pyx_t_16;
            __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 111, __pyx_L1_error));
            __Pyx_XGIVEREF(__pyx_r);
            __Pyx_RefNannyFinishContext();
            __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
            /* return from generator, yielding value */
            __pyx_generator->resume_label = 5;
            return __pyx_r;
            __pyx_L25_resume_from_yield:;
            __Pyx_TraceResumeGen("__iter__", __pyx_f[0], 73, 0, __PYX_ERR(0, 111, __pyx_L1_error));
            __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
            __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
            __pyx_cur_scope->__pyx_t_1.memview = NULL; __pyx_cur_scope->__pyx_t_1.data = NULL;
            __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
            __pyx_t_5 = __pyx_cur_scope->__pyx_t_3;
            __pyx_t_6 = __pyx_cur_scope->__pyx_t_4;
            __pyx_t_13 = __pyx_cur_scope->__pyx_t_5;
            __pyx_cur_scope->__pyx_t_5 = 0;
            __Pyx_XGOTREF(__pyx_t_13);
            __pyx_t_15 = __pyx_cur_scope->__pyx_t_6;
            __pyx_t_16 = __pyx_cur_scope->__pyx_t_7;
            if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 111, __pyx_L1_error)

     112:

    +113:             yield regular_minutes[-1], SESSION_END

        __pyx_t_13 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_regular_minutes, -1L, long, 1, __Pyx_PyLong_From_long, 0, 1, 1, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 113, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_9 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_7zipline_4gens_10sim_engine_SESSION_END); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 113, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 113, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_13);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_13) != (0)) __PYX_ERR(0, 113, __pyx_L1_error);
        __Pyx_GIVEREF(__pyx_t_9);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_9) != (0)) __PYX_ERR(0, 113, __pyx_L1_error);
        __pyx_t_13 = 0;
        __pyx_t_9 = 0;
        __pyx_r = __pyx_t_8;
        __pyx_t_8 = 0;
        __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
        __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
        __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
        __pyx_cur_scope->__pyx_t_3 = __pyx_t_5;
        __pyx_cur_scope->__pyx_t_4 = __pyx_t_6;
        __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 113, __pyx_L1_error));
        __Pyx_XGIVEREF(__pyx_r);
        __Pyx_RefNannyFinishContext();
        __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
        /* return from generator, yielding value */
        __pyx_generator->resume_label = 6;
        return __pyx_r;
        __pyx_L27_resume_from_yield:;
        __Pyx_TraceResumeGen("__iter__", __pyx_f[0], 73, 0, __PYX_ERR(0, 113, __pyx_L1_error));
        __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
        __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
        __pyx_cur_scope->__pyx_t_1.memview = NULL; __pyx_cur_scope->__pyx_t_1.data = NULL;
        __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
        __pyx_t_5 = __pyx_cur_scope->__pyx_t_3;
        __pyx_t_6 = __pyx_cur_scope->__pyx_t_4;
        if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 113, __pyx_L1_error)
      }
      __PYX_XCLEAR_MEMVIEW(&__pyx_t_3, 1);
      __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
      CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
      __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 73, __pyx_L1_error));

     114:

    +115:     def _get_minutes_for_list(self, minutes, minute_emission):

    /* Python wrapper */
    static PyObject *__pyx_pw_7zipline_4gens_10sim_engine_21MinuteSimulationClock_6_get_minutes_for_list(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    static PyMethodDef __pyx_mdef_7zipline_4gens_10sim_engine_21MinuteSimulationClock_6_get_minutes_for_list = {"_get_minutes_for_list", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_4gens_10sim_engine_21MinuteSimulationClock_6_get_minutes_for_list, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
    static PyObject *__pyx_pw_7zipline_4gens_10sim_engine_21MinuteSimulationClock_6_get_minutes_for_list(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ) {
      PyObject *__pyx_v_minutes = 0;
      PyObject *__pyx_v_minute_emission = 0;
      #if !CYTHON_METH_FASTCALL
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      #endif
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_get_minutes_for_list (wrapper)", 0);
      #if !CYTHON_METH_FASTCALL
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
      #endif
      #endif
      __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_minutes,&__pyx_mstate_global->__pyx_n_u_minute_emission,0};
      PyObject* values[2] = {0,0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 115, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 115, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 115, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "_get_minutes_for_list", 0) < (0)) __PYX_ERR(0, 115, __pyx_L3_error)
          for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_get_minutes_for_list", 1, 2, 2, i); __PYX_ERR(0, 115, __pyx_L3_error) }
          }
        } else if (unlikely(__pyx_nargs != 2)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 115, __pyx_L3_error)
          values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 115, __pyx_L3_error)
        }
        __pyx_v_minutes = values[0];
        __pyx_v_minute_emission = values[1];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("_get_minutes_for_list", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 115, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("zipline.gens.sim_engine.MinuteSimulationClock._get_minutes_for_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_7zipline_4gens_10sim_engine_21MinuteSimulationClock_5_get_minutes_for_list(((struct __pyx_obj_7zipline_4gens_10sim_engine_MinuteSimulationClock *)__pyx_v_self), __pyx_v_minutes, __pyx_v_minute_emission);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_7zipline_4gens_10sim_engine_21MinuteSimulationClock_5_get_minutes_for_list(CYTHON_UNUSED struct __pyx_obj_7zipline_4gens_10sim_engine_MinuteSimulationClock *__pyx_v_self, PyObject *__pyx_v_minutes, PyObject *__pyx_v_minute_emission) {
      struct __pyx_obj_7zipline_4gens_10sim_engine___pyx_scope_struct_1__get_minutes_for_list *__pyx_cur_scope;
      PyObject *__pyx_r = NULL;
      __pyx_cur_scope = (struct __pyx_obj_7zipline_4gens_10sim_engine___pyx_scope_struct_1__get_minutes_for_list *)__pyx_tp_new_7zipline_4gens_10sim_engine___pyx_scope_struct_1__get_minutes_for_list(__pyx_mstate_global->__pyx_ptype_7zipline_4gens_10sim_engine___pyx_scope_struct_1__get_minutes_for_list, __pyx_mstate_global->__pyx_empty_tuple, NULL);
      if (unlikely(!__pyx_cur_scope)) {
        __pyx_cur_scope = ((struct __pyx_obj_7zipline_4gens_10sim_engine___pyx_scope_struct_1__get_minutes_for_list *)Py_None);
        __Pyx_INCREF(Py_None);
        __PYX_ERR(0, 115, __pyx_L1_error)
      } else {
        __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
      }
      __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
      __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
      __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
      __pyx_cur_scope->__pyx_v_minutes = __pyx_v_minutes;
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_minutes);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_minutes);
      __pyx_cur_scope->__pyx_v_minute_emission = __pyx_v_minute_emission;
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_minute_emission);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_minute_emission);
      {
        __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7zipline_4gens_10sim_engine_21MinuteSimulationClock_7generator1, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[42]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_get_minutes_for_list, __pyx_mstate_global->__pyx_n_u_MinuteSimulationClock__get_minut, __pyx_mstate_global->__pyx_n_u_zipline_gens_sim_engine); if (unlikely(!gen)) __PYX_ERR(0, 115, __pyx_L1_error)
        __Pyx_DECREF(__pyx_cur_scope);
        __Pyx_RefNannyFinishContext();
        return (PyObject *) gen;
      }

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_AddTraceback("zipline.gens.sim_engine.MinuteSimulationClock._get_minutes_for_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __Pyx_DECREF((PyObject *)__pyx_cur_scope);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_gb_7zipline_4gens_10sim_engine_21MinuteSimulationClock_7generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
    {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("_get_minutes_for_list", 0);
      __Pyx_TraceDeclarationsGen
      __pyx_L3_first_run:;
      __Pyx_TraceStartGen("_get_minutes_for_list", __pyx_f[0], 115, 0, 0, 0, __PYX_ERR(0, 115, __pyx_L1_error));
      if (unlikely(__pyx_sent_value != Py_None)) {
        if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
        __PYX_ERR(0, 115, __pyx_L1_error)
      }
    /* … */
      /* function exit code */
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      if (__Pyx_PyErr_Occurred()) {
        __Pyx_TraceException(__pyx_lineno, 0, 0);
        __Pyx_Generator_Replace_StopIteration(0);
        __Pyx_AddTraceback("_get_minutes_for_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
        __Pyx_TraceExceptionUnwind(0, 0);
      }
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      #if !CYTHON_USE_EXC_INFO_STACK
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      #endif
      __pyx_generator->resume_label = -1;
      __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7zipline_4gens_10sim_engine_21MinuteSimulationClock_6_get_minutes_for_list, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_MinuteSimulationClock__get_minut, NULL, __pyx_mstate_global->__pyx_n_u_zipline_gens_sim_engine, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[42])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 115, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7zipline_4gens_10sim_engine_MinuteSimulationClock, __pyx_mstate_global->__pyx_n_u_get_minutes_for_list, __pyx_t_5) < (0)) __PYX_ERR(0, 115, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    /* … */
    struct __pyx_obj_7zipline_4gens_10sim_engine___pyx_scope_struct_1__get_minutes_for_list {
      PyObject_HEAD
      PyObject *__pyx_v_minute;
      PyObject *__pyx_v_minute_emission;
      PyObject *__pyx_v_minutes;
      struct __pyx_obj_7zipline_4gens_10sim_engine_MinuteSimulationClock *__pyx_v_self;
      PyObject *__pyx_t_0;
      Py_ssize_t __pyx_t_1;
      PyObject *(*__pyx_t_2)(PyObject *);
    };

    +116:         for minute in minutes:

      if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_minutes)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_minutes)) {
        __pyx_t_1 = __pyx_cur_scope->__pyx_v_minutes; __Pyx_INCREF(__pyx_t_1);
        __pyx_t_2 = 0;
        __pyx_t_3 = NULL;
      } else {
        __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_minutes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_3)) {
          if (likely(PyList_CheckExact(__pyx_t_1))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 116, __pyx_L1_error)
              #endif
              if (__pyx_t_2 >= __pyx_temp) break;
            }
            __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
            ++__pyx_t_2;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 116, __pyx_L1_error)
              #endif
              if (__pyx_t_2 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
            #else
            __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
            #endif
            ++__pyx_t_2;
          }
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L1_error)
        } else {
          __pyx_t_4 = __pyx_t_3(__pyx_t_1);
          if (unlikely(!__pyx_t_4)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 116, __pyx_L1_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_minute);
        __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_minute, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_4);
        __pyx_t_4 = 0;
    /* … */
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
      __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 115, __pyx_L1_error));

    +117:             yield minute, BAR

        __pyx_t_4 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_7zipline_4gens_10sim_engine_BAR); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 117, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_minute);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_minute);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_minute) != (0)) __PYX_ERR(0, 117, __pyx_L1_error);
        __Pyx_GIVEREF(__pyx_t_4);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 117, __pyx_L1_error);
        __pyx_t_4 = 0;
        __pyx_r = __pyx_t_5;
        __pyx_t_5 = 0;
        __Pyx_XGIVEREF(__pyx_t_1);
        __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
        __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
        __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
        __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 117, __pyx_L1_error));
        __Pyx_XGIVEREF(__pyx_r);
        __Pyx_RefNannyFinishContext();
        __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
        /* return from generator, yielding value */
        __pyx_generator->resume_label = 1;
        return __pyx_r;
        __pyx_L6_resume_from_yield:;
        __Pyx_TraceResumeGen("_get_minutes_for_list", __pyx_f[0], 115, 0, __PYX_ERR(0, 117, __pyx_L1_error));
        __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
        __pyx_cur_scope->__pyx_t_0 = 0;
        __Pyx_XGOTREF(__pyx_t_1);
        __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
        __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
        if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 117, __pyx_L1_error)

    +118:             if minute_emission:

        __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_minute_emission); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 118, __pyx_L1_error)
        if (__pyx_t_6) {
    /* … */
        }

    +119:                 yield minute, MINUTE_END

          __pyx_t_5 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_7zipline_4gens_10sim_engine_MINUTE_END); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 119, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_INCREF(__pyx_cur_scope->__pyx_v_minute);
          __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_minute);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_minute) != (0)) __PYX_ERR(0, 119, __pyx_L1_error);
          __Pyx_GIVEREF(__pyx_t_5);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5) != (0)) __PYX_ERR(0, 119, __pyx_L1_error);
          __pyx_t_5 = 0;
          __pyx_r = __pyx_t_4;
          __pyx_t_4 = 0;
          __Pyx_XGIVEREF(__pyx_t_1);
          __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
          __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
          __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
          __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 119, __pyx_L1_error));
          __Pyx_XGIVEREF(__pyx_r);
          __Pyx_RefNannyFinishContext();
          __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
          /* return from generator, yielding value */
          __pyx_generator->resume_label = 2;
          return __pyx_r;
          __pyx_L8_resume_from_yield:;
          __Pyx_TraceResumeGen("_get_minutes_for_list", __pyx_f[0], 115, 0, __PYX_ERR(0, 119, __pyx_L1_error));
          __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
          __pyx_cur_scope->__pyx_t_0 = 0;
          __Pyx_XGOTREF(__pyx_t_1);
          __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
          __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
          if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 119, __pyx_L1_error)