Cython: _resample.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: _resample.c

    +001: # Copyright 2016 Quantopian, Inc.

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

     002: #

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

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

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

     006: #

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

     008: #

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

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

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

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

     013: # limitations under the License.

     014: from cython cimport boundscheck, wraparound

    +015: from numpy import finfo, float64, nan, isnan

      __pyx_t_5 = __Pyx_PyList_Pack(4, __pyx_mstate_global->__pyx_n_u_finfo, __pyx_mstate_global->__pyx_n_u_float64, __pyx_mstate_global->__pyx_n_u_nan, __pyx_mstate_global->__pyx_n_u_isnan); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 15, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_numpy, __pyx_t_5, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 15, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_finfo); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 15, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_finfo, __pyx_t_5) < (0)) __PYX_ERR(0, 15, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_float64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 15, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_float64, __pyx_t_5) < (0)) __PYX_ERR(0, 15, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_nan); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 15, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_nan, __pyx_t_5) < (0)) __PYX_ERR(0, 15, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_isnan); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 15, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_isnan, __pyx_t_5) < (0)) __PYX_ERR(0, 15, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     016: from numpy cimport intp_t, float64_t

     017:

     018:

    +019: @boundscheck(False)

    static PyObject *__pyx_pw_7zipline_4data_9_resample_1_minute_to_session_open(PyObject *__pyx_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 void __pyx_f_7zipline_4data_9_resample__minute_to_session_open(__Pyx_memviewslice __pyx_v_close_locs, __Pyx_memviewslice __pyx_v_data, __Pyx_memviewslice __pyx_v_out, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __pyx_t_5numpy_intp_t __pyx_v_i;
      __pyx_t_5numpy_intp_t __pyx_v_close_loc;
      __pyx_t_5numpy_intp_t __pyx_v_loc;
      __pyx_t_5numpy_float64_t __pyx_v_val;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[35]))
      __Pyx_TraceStartFunc("_minute_to_session_open", __pyx_f[0], 19, 0, 0, __pyx_skip_dispatch, __PYX_ERR(0, 19, __pyx_L1_error));
    /* … */
      /* function exit code */
      __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 19, __pyx_L1_error));
      goto __pyx_L0;
      __pyx_L1_error:;
      __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_11);
      __Pyx_XDECREF(__pyx_t_12);
      __Pyx_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 19, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline.data._resample._minute_to_session_open", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_L0:;
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_7zipline_4data_9_resample_1_minute_to_session_open(PyObject *__pyx_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_4data_9_resample_1_minute_to_session_open = {"_minute_to_session_open", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_4data_9_resample_1_minute_to_session_open, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
    static PyObject *__pyx_pw_7zipline_4data_9_resample_1_minute_to_session_open(PyObject *__pyx_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
    ) {
      __Pyx_memviewslice __pyx_v_close_locs = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_data = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 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("_minute_to_session_open (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_close_locs,&__pyx_mstate_global->__pyx_n_u_data,&__pyx_mstate_global->__pyx_n_u_out,0};
      PyObject* values[3] = {0,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, 19, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 19, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 19, __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, 19, __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, "_minute_to_session_open", 0) < (0)) __PYX_ERR(0, 19, __pyx_L3_error)
          for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_minute_to_session_open", 1, 3, 3, i); __PYX_ERR(0, 19, __pyx_L3_error) }
          }
        } else if (unlikely(__pyx_nargs != 3)) {
          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, 19, __pyx_L3_error)
          values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 19, __pyx_L3_error)
          values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 19, __pyx_L3_error)
        }
        __pyx_v_close_locs = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_intp_t(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_close_locs.memview)) __PYX_ERR(0, 21, __pyx_L3_error)
        __pyx_v_data = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_data.memview)) __PYX_ERR(0, 22, __pyx_L3_error)
        __pyx_v_out = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_out.memview)) __PYX_ERR(0, 23, __pyx_L3_error)
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("_minute_to_session_open", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 19, __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_XCLEAR_MEMVIEW(&__pyx_v_close_locs, 1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_data, 1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_out, 1);
      __Pyx_AddTraceback("zipline.data._resample._minute_to_session_open", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_7zipline_4data_9_resample__minute_to_session_open(__pyx_self, __pyx_v_close_locs, __pyx_v_data, __pyx_v_out);
      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_XCLEAR_MEMVIEW(&__pyx_v_close_locs, 1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_data, 1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_out, 1);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_7zipline_4data_9_resample__minute_to_session_open(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_close_locs, __Pyx_memviewslice __pyx_v_data, __Pyx_memviewslice __pyx_v_out) {
      PyObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[35]))
      __Pyx_TraceStartFunc("_minute_to_session_open (wrapper)", __pyx_f[0], 19, 0, 0, 0, __PYX_ERR(0, 19, __pyx_L1_error));
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_v_close_locs.memview)) { __Pyx_RaiseUnboundLocalError("close_locs"); __PYX_ERR(0, 19, __pyx_L1_error) }
      if (unlikely(!__pyx_v_data.memview)) { __Pyx_RaiseUnboundLocalError("data"); __PYX_ERR(0, 19, __pyx_L1_error) }
      if (unlikely(!__pyx_v_out.memview)) { __Pyx_RaiseUnboundLocalError("out"); __PYX_ERR(0, 19, __pyx_L1_error) }
      __pyx_f_7zipline_4data_9_resample__minute_to_session_open(__pyx_v_close_locs, __pyx_v_data, __pyx_v_out, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 19, __pyx_L1_error)
      __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_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, 19, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline.data._resample._minute_to_session_open", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7zipline_4data_9_resample_1_minute_to_session_open, 0, __pyx_mstate_global->__pyx_n_u_minute_to_session_open, NULL, __pyx_mstate_global->__pyx_n_u_zipline_data__resample, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[35])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 19, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_minute_to_session_open, __pyx_t_4) < (0)) __PYX_ERR(0, 19, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     020: @wraparound(False)

     021: cpdef void _minute_to_session_open(intp_t[:] close_locs,

     022:                                    float64_t[:] data,

     023:                                    float64_t[:] out):

    +024:     cdef intp_t i, close_loc, loc = 0

      __pyx_v_loc = 0;

     025:     cdef float64_t val

    +026:     for i, close_loc in enumerate(close_locs):

      __pyx_t_1 = 0;
      if (unlikely(((PyObject *) __pyx_v_close_locs.memview) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
        __PYX_ERR(0, 26, __pyx_L1_error)
      }
      __PYX_INC_MEMVIEW(&__pyx_v_close_locs, 1);
      __pyx_t_2 = __pyx_v_close_locs;
      __pyx_t_3 = __Pyx_MemoryView_Len(__pyx_t_2);
      for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5++) {
        __pyx_t_4 = __pyx_t_5;
        __pyx_t_6 = __pyx_t_4;
        __pyx_v_close_loc = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ (__pyx_t_2.data + __pyx_t_6 * __pyx_t_2.strides[0]) )));
    /* … */
        __pyx_v_i = __pyx_t_1;
    /* … */
        __pyx_t_1 = (__pyx_t_1 + 1);

    +027:         val = nan

        __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_nan); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 27, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = __Pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_8 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 27, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_v_val = __pyx_t_8;

     028:         # Start by getting the price value at the opening minute of each day.

     029:         # If the value is NaN, continue looking forward until we either find a

     030:         # valid value or reach the closing minute, at which point the value is

     031:         # just kept as a NaN. We increment 'loc' after obtaining the value to

     032:         # ensure we do not reach an out of bounds index.

    +033:         while isnan(val) and loc <= close_loc:

        while (1) {
          __pyx_t_10 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_isnan); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 33, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_12 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 33, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_13 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_11))) {
            __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_11);
            assert(__pyx_t_10);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
            __pyx_t_13 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_12};
            __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+__pyx_t_13, (2-__pyx_t_13) | (__pyx_t_13*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 33, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
          }
          __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 33, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (__pyx_t_14) {
          } else {
            __pyx_t_9 = __pyx_t_14;
            goto __pyx_L7_bool_binop_done;
          }
          __pyx_t_14 = (__pyx_v_loc <= __pyx_v_close_loc);
          __pyx_t_9 = __pyx_t_14;
          __pyx_L7_bool_binop_done:;
          if (!__pyx_t_9) break;

    +034:             val = data[loc]

          __pyx_t_6 = __pyx_v_loc;
          __pyx_v_val = (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_data.data + __pyx_t_6 * __pyx_v_data.strides[0]) )));

    +035:             loc += 1

          __pyx_v_loc = (__pyx_v_loc + 1);
        }

    +036:         out[i] = val

        __pyx_t_6 = __pyx_v_i;
        *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_6 * __pyx_v_out.strides[0]) )) = __pyx_v_val;

    +037:         loc = close_loc + 1

        __pyx_v_loc = (__pyx_v_close_loc + 1);
      }
      __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1);
      __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;

     038:

     039:

    +040: @boundscheck(False)

    static PyObject *__pyx_pw_7zipline_4data_9_resample_3_minute_to_session_high(PyObject *__pyx_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 void __pyx_f_7zipline_4data_9_resample__minute_to_session_high(__Pyx_memviewslice __pyx_v_close_locs, __Pyx_memviewslice __pyx_v_data, __Pyx_memviewslice __pyx_v_out, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __pyx_t_5numpy_intp_t __pyx_v_i;
      __pyx_t_5numpy_intp_t __pyx_v_close_loc;
      __pyx_t_5numpy_intp_t __pyx_v_loc;
      __pyx_t_5numpy_float64_t __pyx_v_val;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[36]))
      __Pyx_TraceStartFunc("_minute_to_session_high", __pyx_f[0], 40, 0, 0, __pyx_skip_dispatch, __PYX_ERR(0, 40, __pyx_L1_error));
    /* … */
      /* function exit code */
      __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 40, __pyx_L1_error));
      goto __pyx_L0;
      __pyx_L1_error:;
      __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1);
      __Pyx_XDECREF(__pyx_t_11);
      __Pyx_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 40, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline.data._resample._minute_to_session_high", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_L0:;
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_7zipline_4data_9_resample_3_minute_to_session_high(PyObject *__pyx_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_4data_9_resample_3_minute_to_session_high = {"_minute_to_session_high", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_4data_9_resample_3_minute_to_session_high, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
    static PyObject *__pyx_pw_7zipline_4data_9_resample_3_minute_to_session_high(PyObject *__pyx_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
    ) {
      __Pyx_memviewslice __pyx_v_close_locs = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_data = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 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("_minute_to_session_high (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_close_locs,&__pyx_mstate_global->__pyx_n_u_data,&__pyx_mstate_global->__pyx_n_u_out,0};
      PyObject* values[3] = {0,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, 40, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 40, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 40, __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, 40, __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, "_minute_to_session_high", 0) < (0)) __PYX_ERR(0, 40, __pyx_L3_error)
          for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_minute_to_session_high", 1, 3, 3, i); __PYX_ERR(0, 40, __pyx_L3_error) }
          }
        } else if (unlikely(__pyx_nargs != 3)) {
          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, 40, __pyx_L3_error)
          values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 40, __pyx_L3_error)
          values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 40, __pyx_L3_error)
        }
        __pyx_v_close_locs = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_intp_t(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_close_locs.memview)) __PYX_ERR(0, 42, __pyx_L3_error)
        __pyx_v_data = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_data.memview)) __PYX_ERR(0, 43, __pyx_L3_error)
        __pyx_v_out = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_out.memview)) __PYX_ERR(0, 44, __pyx_L3_error)
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("_minute_to_session_high", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 40, __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_XCLEAR_MEMVIEW(&__pyx_v_close_locs, 1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_data, 1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_out, 1);
      __Pyx_AddTraceback("zipline.data._resample._minute_to_session_high", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_7zipline_4data_9_resample_2_minute_to_session_high(__pyx_self, __pyx_v_close_locs, __pyx_v_data, __pyx_v_out);
      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_XCLEAR_MEMVIEW(&__pyx_v_close_locs, 1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_data, 1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_out, 1);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_7zipline_4data_9_resample_2_minute_to_session_high(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_close_locs, __Pyx_memviewslice __pyx_v_data, __Pyx_memviewslice __pyx_v_out) {
      PyObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[36]))
      __Pyx_TraceStartFunc("_minute_to_session_high (wrapper)", __pyx_f[0], 40, 0, 0, 0, __PYX_ERR(0, 40, __pyx_L1_error));
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_v_close_locs.memview)) { __Pyx_RaiseUnboundLocalError("close_locs"); __PYX_ERR(0, 40, __pyx_L1_error) }
      if (unlikely(!__pyx_v_data.memview)) { __Pyx_RaiseUnboundLocalError("data"); __PYX_ERR(0, 40, __pyx_L1_error) }
      if (unlikely(!__pyx_v_out.memview)) { __Pyx_RaiseUnboundLocalError("out"); __PYX_ERR(0, 40, __pyx_L1_error) }
      __pyx_f_7zipline_4data_9_resample__minute_to_session_high(__pyx_v_close_locs, __pyx_v_data, __pyx_v_out, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 40, __pyx_L1_error)
      __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_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, 40, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline.data._resample._minute_to_session_high", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7zipline_4data_9_resample_3_minute_to_session_high, 0, __pyx_mstate_global->__pyx_n_u_minute_to_session_high, NULL, __pyx_mstate_global->__pyx_n_u_zipline_data__resample, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[36])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 40, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_minute_to_session_high, __pyx_t_4) < (0)) __PYX_ERR(0, 40, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     041: @wraparound(False)

     042: cpdef void _minute_to_session_high(intp_t[:] close_locs,

     043:                                    float64_t[:] data,

     044:                                    float64_t[:] out):

    +045:     cdef intp_t i, close_loc, loc = 0

      __pyx_v_loc = 0;

     046:     cdef float64_t val

    +047:     for i, close_loc in enumerate(close_locs):

      __pyx_t_1 = 0;
      if (unlikely(((PyObject *) __pyx_v_close_locs.memview) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
        __PYX_ERR(0, 47, __pyx_L1_error)
      }
      __PYX_INC_MEMVIEW(&__pyx_v_close_locs, 1);
      __pyx_t_2 = __pyx_v_close_locs;
      __pyx_t_3 = __Pyx_MemoryView_Len(__pyx_t_2);
      for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5++) {
        __pyx_t_4 = __pyx_t_5;
        __pyx_t_6 = __pyx_t_4;
        __pyx_v_close_loc = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ (__pyx_t_2.data + __pyx_t_6 * __pyx_t_2.strides[0]) )));
    /* … */
        __pyx_v_i = __pyx_t_1;
    /* … */
        __pyx_t_1 = (__pyx_t_1 + 1);

    +048:         val = -1

        __pyx_v_val = -1.0;

    +049:         while loc <= close_loc:

        while (1) {
          __pyx_t_7 = (__pyx_v_loc <= __pyx_v_close_loc);
          if (!__pyx_t_7) break;

    +050:             val = max(val, data[loc])

          __pyx_t_6 = __pyx_v_loc;
          __pyx_t_8 = (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_data.data + __pyx_t_6 * __pyx_v_data.strides[0]) )));
          __pyx_t_9 = __pyx_v_val;
          __pyx_t_7 = (__pyx_t_8 > __pyx_t_9);
          if (__pyx_t_7) {
            __pyx_t_10 = __pyx_t_8;
          } else {
            __pyx_t_10 = __pyx_t_9;
          }
          __pyx_v_val = __pyx_t_10;

    +051:             loc += 1

          __pyx_v_loc = (__pyx_v_loc + 1);
        }

    +052:         if val == -1:

        __pyx_t_7 = (__pyx_v_val == -1.0);
        if (__pyx_t_7) {
    /* … */
        }

    +053:             val = nan

          __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_nan); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 53, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_10 = __Pyx_PyFloat_AsDouble(__pyx_t_11); if (unlikely((__pyx_t_10 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 53, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_v_val = __pyx_t_10;

    +054:         out[i] = val

        __pyx_t_6 = __pyx_v_i;
        *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_6 * __pyx_v_out.strides[0]) )) = __pyx_v_val;

    +055:         loc = close_loc + 1

        __pyx_v_loc = (__pyx_v_close_loc + 1);
      }
      __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1);
      __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;

     056:

     057:

    +058: @boundscheck(False)

    static PyObject *__pyx_pw_7zipline_4data_9_resample_5_minute_to_session_low(PyObject *__pyx_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 void __pyx_f_7zipline_4data_9_resample__minute_to_session_low(__Pyx_memviewslice __pyx_v_close_locs, __Pyx_memviewslice __pyx_v_data, __Pyx_memviewslice __pyx_v_out, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __pyx_t_5numpy_intp_t __pyx_v_i;
      __pyx_t_5numpy_intp_t __pyx_v_close_loc;
      __pyx_t_5numpy_intp_t __pyx_v_loc;
      __pyx_t_5numpy_float64_t __pyx_v_val;
      __pyx_t_5numpy_float64_t __pyx_v_max_float;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[37]))
      __Pyx_TraceStartFunc("_minute_to_session_low", __pyx_f[0], 58, 0, 0, __pyx_skip_dispatch, __PYX_ERR(0, 58, __pyx_L1_error));
    /* … */
      /* function exit code */
      __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 58, __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_XCLEAR_MEMVIEW(&__pyx_t_8, 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, 58, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline.data._resample._minute_to_session_low", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_L0:;
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_7zipline_4data_9_resample_5_minute_to_session_low(PyObject *__pyx_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_4data_9_resample_5_minute_to_session_low = {"_minute_to_session_low", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_4data_9_resample_5_minute_to_session_low, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
    static PyObject *__pyx_pw_7zipline_4data_9_resample_5_minute_to_session_low(PyObject *__pyx_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
    ) {
      __Pyx_memviewslice __pyx_v_close_locs = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_data = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 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("_minute_to_session_low (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_close_locs,&__pyx_mstate_global->__pyx_n_u_data,&__pyx_mstate_global->__pyx_n_u_out,0};
      PyObject* values[3] = {0,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, 58, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 58, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 58, __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, 58, __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, "_minute_to_session_low", 0) < (0)) __PYX_ERR(0, 58, __pyx_L3_error)
          for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_minute_to_session_low", 1, 3, 3, i); __PYX_ERR(0, 58, __pyx_L3_error) }
          }
        } else if (unlikely(__pyx_nargs != 3)) {
          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, 58, __pyx_L3_error)
          values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 58, __pyx_L3_error)
          values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 58, __pyx_L3_error)
        }
        __pyx_v_close_locs = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_intp_t(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_close_locs.memview)) __PYX_ERR(0, 60, __pyx_L3_error)
        __pyx_v_data = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_data.memview)) __PYX_ERR(0, 61, __pyx_L3_error)
        __pyx_v_out = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_out.memview)) __PYX_ERR(0, 62, __pyx_L3_error)
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("_minute_to_session_low", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 58, __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_XCLEAR_MEMVIEW(&__pyx_v_close_locs, 1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_data, 1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_out, 1);
      __Pyx_AddTraceback("zipline.data._resample._minute_to_session_low", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_7zipline_4data_9_resample_4_minute_to_session_low(__pyx_self, __pyx_v_close_locs, __pyx_v_data, __pyx_v_out);
      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_XCLEAR_MEMVIEW(&__pyx_v_close_locs, 1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_data, 1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_out, 1);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_7zipline_4data_9_resample_4_minute_to_session_low(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_close_locs, __Pyx_memviewslice __pyx_v_data, __Pyx_memviewslice __pyx_v_out) {
      PyObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[37]))
      __Pyx_TraceStartFunc("_minute_to_session_low (wrapper)", __pyx_f[0], 58, 0, 0, 0, __PYX_ERR(0, 58, __pyx_L1_error));
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_v_close_locs.memview)) { __Pyx_RaiseUnboundLocalError("close_locs"); __PYX_ERR(0, 58, __pyx_L1_error) }
      if (unlikely(!__pyx_v_data.memview)) { __Pyx_RaiseUnboundLocalError("data"); __PYX_ERR(0, 58, __pyx_L1_error) }
      if (unlikely(!__pyx_v_out.memview)) { __Pyx_RaiseUnboundLocalError("out"); __PYX_ERR(0, 58, __pyx_L1_error) }
      __pyx_f_7zipline_4data_9_resample__minute_to_session_low(__pyx_v_close_locs, __pyx_v_data, __pyx_v_out, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 58, __pyx_L1_error)
      __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_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, 58, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline.data._resample._minute_to_session_low", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7zipline_4data_9_resample_5_minute_to_session_low, 0, __pyx_mstate_global->__pyx_n_u_minute_to_session_low, NULL, __pyx_mstate_global->__pyx_n_u_zipline_data__resample, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[37])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_minute_to_session_low, __pyx_t_4) < (0)) __PYX_ERR(0, 58, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     059: @wraparound(False)

     060: cpdef void _minute_to_session_low(intp_t[:] close_locs,

     061:                                    float64_t[:] data,

     062:                                    float64_t[:] out):

    +063:     cdef intp_t i, close_loc, loc = 0

      __pyx_v_loc = 0;

     064:     cdef float64_t val

    +065:     cdef float64_t max_float = finfo(float64).max

      __pyx_t_2 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_finfo); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_float64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        assert(__pyx_t_2);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
        __pyx_t_5 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_max); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = __Pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 65, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_max_float = __pyx_t_6;

    +066:     for i, close_loc in enumerate(close_locs):

      __pyx_t_7 = 0;
      if (unlikely(((PyObject *) __pyx_v_close_locs.memview) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
        __PYX_ERR(0, 66, __pyx_L1_error)
      }
      __PYX_INC_MEMVIEW(&__pyx_v_close_locs, 1);
      __pyx_t_8 = __pyx_v_close_locs;
      __pyx_t_9 = __Pyx_MemoryView_Len(__pyx_t_8);
      for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11++) {
        __pyx_t_10 = __pyx_t_11;
        __pyx_t_12 = __pyx_t_10;
        __pyx_v_close_loc = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ (__pyx_t_8.data + __pyx_t_12 * __pyx_t_8.strides[0]) )));
    /* … */
        __pyx_v_i = __pyx_t_7;
    /* … */
        __pyx_t_7 = (__pyx_t_7 + 1);

    +067:         val = max_float

        __pyx_v_val = __pyx_v_max_float;

    +068:         while loc <= close_loc:

        while (1) {
          __pyx_t_13 = (__pyx_v_loc <= __pyx_v_close_loc);
          if (!__pyx_t_13) break;

    +069:             val = min(val, data[loc])

          __pyx_t_12 = __pyx_v_loc;
          __pyx_t_6 = (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_data.data + __pyx_t_12 * __pyx_v_data.strides[0]) )));
          __pyx_t_14 = __pyx_v_val;
          __pyx_t_13 = (__pyx_t_6 < __pyx_t_14);
          if (__pyx_t_13) {
            __pyx_t_15 = __pyx_t_6;
          } else {
            __pyx_t_15 = __pyx_t_14;
          }
          __pyx_v_val = __pyx_t_15;

    +070:             loc += 1

          __pyx_v_loc = (__pyx_v_loc + 1);
        }

    +071:         if val == max_float:

        __pyx_t_13 = (__pyx_v_val == __pyx_v_max_float);
        if (__pyx_t_13) {
    /* … */
        }

    +072:             val = nan

          __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_nan); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_15 = __Pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_15 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_v_val = __pyx_t_15;

    +073:         out[i] = val

        __pyx_t_12 = __pyx_v_i;
        *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_12 * __pyx_v_out.strides[0]) )) = __pyx_v_val;

    +074:         loc = close_loc + 1

        __pyx_v_loc = (__pyx_v_close_loc + 1);
      }
      __PYX_XCLEAR_MEMVIEW(&__pyx_t_8, 1);
      __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL;

     075:

     076:

    +077: @boundscheck(False)

    static PyObject *__pyx_pw_7zipline_4data_9_resample_7_minute_to_session_close(PyObject *__pyx_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 void __pyx_f_7zipline_4data_9_resample__minute_to_session_close(__Pyx_memviewslice __pyx_v_close_locs, __Pyx_memviewslice __pyx_v_data, __Pyx_memviewslice __pyx_v_out, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __pyx_t_5numpy_intp_t __pyx_v_i;
      __pyx_t_5numpy_intp_t __pyx_v_prev_close_loc;
      __pyx_t_5numpy_intp_t __pyx_v_loc;
      __pyx_t_5numpy_float64_t __pyx_v_val;
      PyObject *__pyx_v_num_out = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[38]))
      __Pyx_TraceStartFunc("_minute_to_session_close", __pyx_f[0], 77, 0, 0, __pyx_skip_dispatch, __PYX_ERR(0, 77, __pyx_L1_error));
    /* … */
      /* function exit code */
      __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 77, __pyx_L1_error));
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 77, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline.data._resample._minute_to_session_close", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_num_out);
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_7zipline_4data_9_resample_7_minute_to_session_close(PyObject *__pyx_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_4data_9_resample_7_minute_to_session_close = {"_minute_to_session_close", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_4data_9_resample_7_minute_to_session_close, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
    static PyObject *__pyx_pw_7zipline_4data_9_resample_7_minute_to_session_close(PyObject *__pyx_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
    ) {
      __Pyx_memviewslice __pyx_v_close_locs = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_data = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 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("_minute_to_session_close (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_close_locs,&__pyx_mstate_global->__pyx_n_u_data,&__pyx_mstate_global->__pyx_n_u_out,0};
      PyObject* values[3] = {0,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, 77, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 77, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 77, __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, 77, __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, "_minute_to_session_close", 0) < (0)) __PYX_ERR(0, 77, __pyx_L3_error)
          for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_minute_to_session_close", 1, 3, 3, i); __PYX_ERR(0, 77, __pyx_L3_error) }
          }
        } else if (unlikely(__pyx_nargs != 3)) {
          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, 77, __pyx_L3_error)
          values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 77, __pyx_L3_error)
          values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 77, __pyx_L3_error)
        }
        __pyx_v_close_locs = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_intp_t(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_close_locs.memview)) __PYX_ERR(0, 79, __pyx_L3_error)
        __pyx_v_data = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_data.memview)) __PYX_ERR(0, 80, __pyx_L3_error)
        __pyx_v_out = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_out.memview)) __PYX_ERR(0, 81, __pyx_L3_error)
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("_minute_to_session_close", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 77, __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_XCLEAR_MEMVIEW(&__pyx_v_close_locs, 1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_data, 1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_out, 1);
      __Pyx_AddTraceback("zipline.data._resample._minute_to_session_close", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_7zipline_4data_9_resample_6_minute_to_session_close(__pyx_self, __pyx_v_close_locs, __pyx_v_data, __pyx_v_out);
      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_XCLEAR_MEMVIEW(&__pyx_v_close_locs, 1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_data, 1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_out, 1);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_7zipline_4data_9_resample_6_minute_to_session_close(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_close_locs, __Pyx_memviewslice __pyx_v_data, __Pyx_memviewslice __pyx_v_out) {
      PyObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[38]))
      __Pyx_TraceStartFunc("_minute_to_session_close (wrapper)", __pyx_f[0], 77, 0, 0, 0, __PYX_ERR(0, 77, __pyx_L1_error));
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_v_close_locs.memview)) { __Pyx_RaiseUnboundLocalError("close_locs"); __PYX_ERR(0, 77, __pyx_L1_error) }
      if (unlikely(!__pyx_v_data.memview)) { __Pyx_RaiseUnboundLocalError("data"); __PYX_ERR(0, 77, __pyx_L1_error) }
      if (unlikely(!__pyx_v_out.memview)) { __Pyx_RaiseUnboundLocalError("out"); __PYX_ERR(0, 77, __pyx_L1_error) }
      __pyx_f_7zipline_4data_9_resample__minute_to_session_close(__pyx_v_close_locs, __pyx_v_data, __pyx_v_out, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 77, __pyx_L1_error)
      __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_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, 77, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline.data._resample._minute_to_session_close", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7zipline_4data_9_resample_7_minute_to_session_close, 0, __pyx_mstate_global->__pyx_n_u_minute_to_session_close, NULL, __pyx_mstate_global->__pyx_n_u_zipline_data__resample, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[38])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 77, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_minute_to_session_close, __pyx_t_4) < (0)) __PYX_ERR(0, 77, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     078: @wraparound(False)

     079: cpdef void _minute_to_session_close(intp_t[:] close_locs,

     080:                                     float64_t[:] data,

     081:                                     float64_t[:] out):

    +082:     cdef intp_t i, prev_close_loc, loc = 0

      __pyx_v_loc = 0;

     083:     cdef float64_t val

    +084:     num_out = len(out)

      __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_out);
      __pyx_t_2 = PyLong_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_num_out = __pyx_t_2;
      __pyx_t_2 = 0;

    +085:     for i in range(num_out - 1, -1, -1):

      __pyx_t_2 = __Pyx_PyLong_SubtractObjC(__pyx_v_num_out, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      for (__pyx_t_3 = __pyx_t_1; __pyx_t_3 > -1L; __pyx_t_3-=1) {
        __pyx_v_i = __pyx_t_3;

    +086:         if i > 0:

        __pyx_t_4 = (__pyx_v_i > 0);
        if (__pyx_t_4) {
    /* … */
          goto __pyx_L5;
        }

    +087:             prev_close_loc = close_locs[i - 1]

          __pyx_t_5 = (__pyx_v_i - 1);
          __pyx_v_prev_close_loc = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ (__pyx_v_close_locs.data + __pyx_t_5 * __pyx_v_close_locs.strides[0]) )));

     088:         else:

    +089:             prev_close_loc = -1

        /*else*/ {
          __pyx_v_prev_close_loc = -1L;
        }
        __pyx_L5:;

    +090:         loc = close_locs[i]

        __pyx_t_5 = __pyx_v_i;
        __pyx_v_loc = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ (__pyx_v_close_locs.data + __pyx_t_5 * __pyx_v_close_locs.strides[0]) )));

    +091:         val = nan

        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_nan); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_6 = __Pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_v_val = __pyx_t_6;

     092:         # Start by getting the price value at the closing minute of each day.

     093:         # If the value is NaN, continue looking back until we either find a

     094:         # valid value or reach the closing minute of the previous day, at which

     095:         # point the value is just kept as a NaN. We decrement 'loc' after

     096:         # obtaining the value to ensure we do not reach a negative index.

    +097:         while isnan(val) and loc > prev_close_loc:

        while (1) {
          __pyx_t_7 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_isnan); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 97, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_9 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 97, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_8))) {
            __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
            assert(__pyx_t_7);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
            __pyx_t_10 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_9};
            __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
          }
          __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 97, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (__pyx_t_11) {
          } else {
            __pyx_t_4 = __pyx_t_11;
            goto __pyx_L8_bool_binop_done;
          }
          __pyx_t_11 = (__pyx_v_loc > __pyx_v_prev_close_loc);
          __pyx_t_4 = __pyx_t_11;
          __pyx_L8_bool_binop_done:;
          if (!__pyx_t_4) break;

    +098:             val = data[loc]

          __pyx_t_5 = __pyx_v_loc;
          __pyx_v_val = (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_data.data + __pyx_t_5 * __pyx_v_data.strides[0]) )));

    +099:             loc -= 1

          __pyx_v_loc = (__pyx_v_loc - 1);
        }

    +100:         out[i] = val

        __pyx_t_5 = __pyx_v_i;
        *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_5 * __pyx_v_out.strides[0]) )) = __pyx_v_val;
      }

     101:

     102:

    +103: @boundscheck(False)

    static PyObject *__pyx_pw_7zipline_4data_9_resample_9_minute_to_session_volume(PyObject *__pyx_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 void __pyx_f_7zipline_4data_9_resample__minute_to_session_volume(__Pyx_memviewslice __pyx_v_close_locs, __Pyx_memviewslice __pyx_v_data, __Pyx_memviewslice __pyx_v_out, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __pyx_t_5numpy_intp_t __pyx_v_i;
      __pyx_t_5numpy_intp_t __pyx_v_close_loc;
      __pyx_t_5numpy_intp_t __pyx_v_loc;
      __pyx_t_5numpy_float64_t __pyx_v_val;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[39]))
      __Pyx_TraceStartFunc("_minute_to_session_volume", __pyx_f[0], 103, 0, 0, __pyx_skip_dispatch, __PYX_ERR(0, 103, __pyx_L1_error));
    /* … */
      /* function exit code */
      __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 103, __pyx_L1_error));
      goto __pyx_L0;
      __pyx_L1_error:;
      __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 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, 103, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline.data._resample._minute_to_session_volume", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_L0:;
      __Pyx_PyMonitoring_ExitScope(0);
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_7zipline_4data_9_resample_9_minute_to_session_volume(PyObject *__pyx_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_4data_9_resample_9_minute_to_session_volume = {"_minute_to_session_volume", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_4data_9_resample_9_minute_to_session_volume, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
    static PyObject *__pyx_pw_7zipline_4data_9_resample_9_minute_to_session_volume(PyObject *__pyx_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
    ) {
      __Pyx_memviewslice __pyx_v_close_locs = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_data = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 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("_minute_to_session_volume (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_close_locs,&__pyx_mstate_global->__pyx_n_u_data,&__pyx_mstate_global->__pyx_n_u_out,0};
      PyObject* values[3] = {0,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, 103, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 103, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 103, __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, 103, __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, "_minute_to_session_volume", 0) < (0)) __PYX_ERR(0, 103, __pyx_L3_error)
          for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_minute_to_session_volume", 1, 3, 3, i); __PYX_ERR(0, 103, __pyx_L3_error) }
          }
        } else if (unlikely(__pyx_nargs != 3)) {
          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, 103, __pyx_L3_error)
          values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 103, __pyx_L3_error)
          values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 103, __pyx_L3_error)
        }
        __pyx_v_close_locs = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_intp_t(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_close_locs.memview)) __PYX_ERR(0, 105, __pyx_L3_error)
        __pyx_v_data = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_data.memview)) __PYX_ERR(0, 106, __pyx_L3_error)
        __pyx_v_out = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_out.memview)) __PYX_ERR(0, 107, __pyx_L3_error)
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("_minute_to_session_volume", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 103, __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_XCLEAR_MEMVIEW(&__pyx_v_close_locs, 1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_data, 1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_out, 1);
      __Pyx_AddTraceback("zipline.data._resample._minute_to_session_volume", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_7zipline_4data_9_resample_8_minute_to_session_volume(__pyx_self, __pyx_v_close_locs, __pyx_v_data, __pyx_v_out);
      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_XCLEAR_MEMVIEW(&__pyx_v_close_locs, 1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_data, 1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_out, 1);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_7zipline_4data_9_resample_8_minute_to_session_volume(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_close_locs, __Pyx_memviewslice __pyx_v_data, __Pyx_memviewslice __pyx_v_out) {
      PyObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[39]))
      __Pyx_TraceStartFunc("_minute_to_session_volume (wrapper)", __pyx_f[0], 103, 0, 0, 0, __PYX_ERR(0, 103, __pyx_L1_error));
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_v_close_locs.memview)) { __Pyx_RaiseUnboundLocalError("close_locs"); __PYX_ERR(0, 103, __pyx_L1_error) }
      if (unlikely(!__pyx_v_data.memview)) { __Pyx_RaiseUnboundLocalError("data"); __PYX_ERR(0, 103, __pyx_L1_error) }
      if (unlikely(!__pyx_v_out.memview)) { __Pyx_RaiseUnboundLocalError("out"); __PYX_ERR(0, 103, __pyx_L1_error) }
      __pyx_f_7zipline_4data_9_resample__minute_to_session_volume(__pyx_v_close_locs, __pyx_v_data, __pyx_v_out, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 103, __pyx_L1_error)
      __pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;
    /* … */
      __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7zipline_4data_9_resample_9_minute_to_session_volume, 0, __pyx_mstate_global->__pyx_n_u_minute_to_session_volume, NULL, __pyx_mstate_global->__pyx_n_u_zipline_data__resample, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[39])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_minute_to_session_volume, __pyx_t_4) < (0)) __PYX_ERR(0, 103, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     104: @wraparound(False)

     105: cpdef void _minute_to_session_volume(intp_t[:] close_locs,

     106:                                      float64_t[:] data,

     107:                                      float64_t[:] out):

    +108:     cdef intp_t i, close_loc, loc = 0

      __pyx_v_loc = 0;

     109:     cdef float64_t val

    +110:     loc = 0

      __pyx_v_loc = 0;

    +111:     for i, close_loc in enumerate(close_locs):

      __pyx_t_1 = 0;
      if (unlikely(((PyObject *) __pyx_v_close_locs.memview) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
        __PYX_ERR(0, 111, __pyx_L1_error)
      }
      __PYX_INC_MEMVIEW(&__pyx_v_close_locs, 1);
      __pyx_t_2 = __pyx_v_close_locs;
      __pyx_t_3 = __Pyx_MemoryView_Len(__pyx_t_2);
      for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5++) {
        __pyx_t_4 = __pyx_t_5;
        __pyx_t_6 = __pyx_t_4;
        __pyx_v_close_loc = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ (__pyx_t_2.data + __pyx_t_6 * __pyx_t_2.strides[0]) )));
    /* … */
        __pyx_v_i = __pyx_t_1;
    /* … */
        __pyx_t_1 = (__pyx_t_1 + 1);

    +112:         val = 0

        __pyx_v_val = 0.0;

    +113:         while loc <= close_loc:

        while (1) {
          __pyx_t_7 = (__pyx_v_loc <= __pyx_v_close_loc);
          if (!__pyx_t_7) break;

    +114:             val += data[loc]

          __pyx_t_6 = __pyx_v_loc;
          __pyx_v_val = (__pyx_v_val + (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_data.data + __pyx_t_6 * __pyx_v_data.strides[0]) ))));

    +115:             loc += 1

          __pyx_v_loc = (__pyx_v_loc + 1);
        }

    +116:         out[i] = val

        __pyx_t_6 = __pyx_v_i;
        *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_out.data + __pyx_t_6 * __pyx_v_out.strides[0]) )) = __pyx_v_val;

    +117:         loc = close_loc + 1

        __pyx_v_loc = (__pyx_v_close_loc + 1);
      }
      __PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1);
      __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;