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

    +001: #

      __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: # 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: import bcolz

      __pyx_t_5 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_bcolz, NULL); 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_bcolz, __pyx_t_5) < (0)) __PYX_ERR(0, 15, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

     016: cimport cython

     017: from cpython cimport bool

     018:

    +019: from numpy import (

      __pyx_t_4 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_numpy, __pyx_t_5, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 19, __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_array); 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_array, __pyx_t_5) < (0)) __PYX_ERR(0, 20, __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, 19, __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, 21, __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_full); 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_full, __pyx_t_5) < (0)) __PYX_ERR(0, 22, __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_intp); 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_intp, __pyx_t_5) < (0)) __PYX_ERR(0, 23, __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_uint32); 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_uint32, __pyx_t_5) < (0)) __PYX_ERR(0, 24, __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_zeros); 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_zeros, __pyx_t_5) < (0)) __PYX_ERR(0, 25, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +020:     array,

      __pyx_t_5 = __Pyx_PyList_Pack(6, __pyx_mstate_global->__pyx_n_u_array, __pyx_mstate_global->__pyx_n_u_float64, __pyx_mstate_global->__pyx_n_u_full, __pyx_mstate_global->__pyx_n_u_intp, __pyx_mstate_global->__pyx_n_u_uint32, __pyx_mstate_global->__pyx_n_u_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 20, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);

     021:     float64,

     022:     full,

     023:     intp,

     024:     uint32,

     025:     zeros,

     026: )

     027: from numpy cimport (

     028:     float64_t,

     029:     intp_t,

     030:     ndarray,

     031:     uint32_t,

     032:     uint8_t,

     033: )

     034: from libc.math cimport NAN

    +035: ctypedef object carray_t

    typedef PyObject *__pyx_t_7zipline_4data_9_equities_carray_t;

    +036: ctypedef object ctable_t

    typedef PyObject *__pyx_t_7zipline_4data_9_equities_ctable_t;

    +037: ctypedef object Timestamp_t

    typedef PyObject *__pyx_t_7zipline_4data_9_equities_Timestamp_t;

    +038: ctypedef object DatetimeIndex_t

    typedef PyObject *__pyx_t_7zipline_4data_9_equities_DatetimeIndex_t;

    +039: ctypedef object Int64Index_t

    typedef PyObject *__pyx_t_7zipline_4data_9_equities_Int64Index_t;

     040:

     041:

    +042: @cython.boundscheck(False)

    static PyObject *__pyx_pw_7zipline_4data_9_equities_1_compute_row_slices(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 PyObject *__pyx_f_7zipline_4data_9_equities__compute_row_slices(PyObject *__pyx_v_asset_starts_absolute, PyObject *__pyx_v_asset_ends_absolute, PyObject *__pyx_v_asset_starts_calendar, __pyx_t_5numpy_intp_t __pyx_v_query_start, __pyx_t_5numpy_intp_t __pyx_v_query_end, __pyx_t_7zipline_4data_9_equities_Int64Index_t __pyx_v_requested_assets, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __pyx_t_5numpy_intp_t __pyx_v_nassets;
      PyArrayObject *__pyx_v_first_row_a = 0;
      PyArrayObject *__pyx_v_last_row_a = 0;
      PyArrayObject *__pyx_v_offset_a = 0;
      __pyx_t_5numpy_intp_t __pyx_v_i;
      __pyx_t_5numpy_intp_t __pyx_v_asset;
      __pyx_t_5numpy_intp_t __pyx_v_asset_start_data;
      __pyx_t_5numpy_intp_t __pyx_v_asset_end_data;
      __pyx_t_5numpy_intp_t __pyx_v_asset_start_calendar;
      __pyx_t_5numpy_intp_t __pyx_v_asset_end_calendar;
      __pyx_t_5numpy_uint8_t __pyx_v_any_hits;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_first_row_a;
      __Pyx_Buffer __pyx_pybuffer_first_row_a;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_last_row_a;
      __Pyx_Buffer __pyx_pybuffer_last_row_a;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_offset_a;
      __Pyx_Buffer __pyx_pybuffer_offset_a;
      PyObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[39]))
      __Pyx_TraceStartFunc("_compute_row_slices", __pyx_f[0], 42, 0, 0, __pyx_skip_dispatch, __PYX_ERR(0, 42, __pyx_L1_error));
      __pyx_pybuffer_first_row_a.pybuffer.buf = NULL;
      __pyx_pybuffer_first_row_a.refcount = 0;
      __pyx_pybuffernd_first_row_a.data = NULL;
      __pyx_pybuffernd_first_row_a.rcbuffer = &__pyx_pybuffer_first_row_a;
      __pyx_pybuffer_last_row_a.pybuffer.buf = NULL;
      __pyx_pybuffer_last_row_a.refcount = 0;
      __pyx_pybuffernd_last_row_a.data = NULL;
      __pyx_pybuffernd_last_row_a.rcbuffer = &__pyx_pybuffer_last_row_a;
      __pyx_pybuffer_offset_a.pybuffer.buf = NULL;
      __pyx_pybuffer_offset_a.refcount = 0;
      __pyx_pybuffernd_offset_a.data = NULL;
      __pyx_pybuffernd_offset_a.rcbuffer = &__pyx_pybuffer_offset_a;
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_8);
      { 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_first_row_a.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_last_row_a.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_offset_a.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, 42, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline.data._equities._compute_row_slices", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_first_row_a.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_last_row_a.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_offset_a.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_first_row_a);
      __Pyx_XDECREF((PyObject *)__pyx_v_last_row_a);
      __Pyx_XDECREF((PyObject *)__pyx_v_offset_a);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_7zipline_4data_9_equities_1_compute_row_slices(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*/
    PyDoc_STRVAR(__pyx_doc_7zipline_4data_9_equities__compute_row_slices, "\n    Core indexing functionality for loading raw data from bcolz.\n\n    For each asset in requested assets, computes three values:\n\n    1.) The index in the raw bcolz data of first row to load.\n    2.) The index in the raw bcolz data of the last row to load.\n    3.) The index in the dates of our query corresponding to the first row for\n        each asset. This is non-zero iff the asset's lifetime begins partway\n        through the requested query dates.\n\n    Values for unknown sids will be populated with a value of -1.\n\n    Parameters\n    ----------\n    asset_starts_absolute : dict\n        Dictionary containing the index of the first row of each asset in the\n        bcolz file from which we will query.\n    asset_ends_absolute : dict\n        Dictionary containing the index of the last row of each asset in the\n        bcolz file from which we will query.\n    asset_starts_calendar : dict\n        Dictionary containing the index of in our calendar corresponding to the\n        start date of each asset\n    query_start : intp\n        Start index in our calendar of the dates for which we're querying.\n    query_end : intp\n        End index in our calendar of the dates for which we're querying.\n    requested_assets : pandas.Int64Index\n        The assets for which we want to load data.\n\n    Returns\n    -------\n    first_rows, last_rows, offsets : 3-tuple of ndarrays\n    ");
    static PyMethodDef __pyx_mdef_7zipline_4data_9_equities_1_compute_row_slices = {"_compute_row_slices", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_4data_9_equities_1_compute_row_slices, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7zipline_4data_9_equities__compute_row_slices};
    static PyObject *__pyx_pw_7zipline_4data_9_equities_1_compute_row_slices(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
    ) {
      PyObject *__pyx_v_asset_starts_absolute = 0;
      PyObject *__pyx_v_asset_ends_absolute = 0;
      PyObject *__pyx_v_asset_starts_calendar = 0;
      __pyx_t_5numpy_intp_t __pyx_v_query_start;
      __pyx_t_5numpy_intp_t __pyx_v_query_end;
      __pyx_t_7zipline_4data_9_equities_Int64Index_t __pyx_v_requested_assets = 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("_compute_row_slices (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_asset_starts_absolute,&__pyx_mstate_global->__pyx_n_u_asset_ends_absolute,&__pyx_mstate_global->__pyx_n_u_asset_starts_calendar,&__pyx_mstate_global->__pyx_n_u_query_start,&__pyx_mstate_global->__pyx_n_u_query_end,&__pyx_mstate_global->__pyx_n_u_requested_assets,0};
      PyObject* values[6] = {0,0,0,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, 42, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  6:
            values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 42, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  5:
            values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 42, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  4:
            values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 42, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 42, __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, 42, __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, 42, __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, "_compute_row_slices", 0) < (0)) __PYX_ERR(0, 42, __pyx_L3_error)
          for (Py_ssize_t i = __pyx_nargs; i < 6; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_compute_row_slices", 1, 6, 6, i); __PYX_ERR(0, 42, __pyx_L3_error) }
          }
        } else if (unlikely(__pyx_nargs != 6)) {
          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, 42, __pyx_L3_error)
          values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 42, __pyx_L3_error)
          values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 42, __pyx_L3_error)
          values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 42, __pyx_L3_error)
          values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 42, __pyx_L3_error)
          values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 42, __pyx_L3_error)
        }
        __pyx_v_asset_starts_absolute = ((PyObject*)values[0]);
        __pyx_v_asset_ends_absolute = ((PyObject*)values[1]);
        __pyx_v_asset_starts_calendar = ((PyObject*)values[2]);
        __pyx_v_query_start = __Pyx_PyLong_As_npy_intp(values[3]); if (unlikely((__pyx_v_query_start == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 47, __pyx_L3_error)
        __pyx_v_query_end = __Pyx_PyLong_As_npy_intp(values[4]); if (unlikely((__pyx_v_query_end == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 48, __pyx_L3_error)
        __pyx_v_requested_assets = ((__pyx_t_7zipline_4data_9_equities_Int64Index_t)values[5]);
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("_compute_row_slices", 1, 6, 6, __pyx_nargs); __PYX_ERR(0, 42, __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.data._equities._compute_row_slices", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_asset_starts_absolute), (&PyDict_Type), 1, "asset_starts_absolute", 1))) __PYX_ERR(0, 44, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_asset_ends_absolute), (&PyDict_Type), 1, "asset_ends_absolute", 1))) __PYX_ERR(0, 45, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_asset_starts_calendar), (&PyDict_Type), 1, "asset_starts_calendar", 1))) __PYX_ERR(0, 46, __pyx_L1_error)
      __pyx_r = __pyx_pf_7zipline_4data_9_equities__compute_row_slices(__pyx_self, __pyx_v_asset_starts_absolute, __pyx_v_asset_ends_absolute, __pyx_v_asset_starts_calendar, __pyx_v_query_start, __pyx_v_query_end, __pyx_v_requested_assets);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      goto __pyx_L7_cleaned_up;
      __pyx_L0:;
      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_L7_cleaned_up:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_7zipline_4data_9_equities__compute_row_slices(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_asset_starts_absolute, PyObject *__pyx_v_asset_ends_absolute, PyObject *__pyx_v_asset_starts_calendar, __pyx_t_5numpy_intp_t __pyx_v_query_start, __pyx_t_5numpy_intp_t __pyx_v_query_end, __pyx_t_7zipline_4data_9_equities_Int64Index_t __pyx_v_requested_assets) {
      PyObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[39]))
      __Pyx_TraceStartFunc("_compute_row_slices (wrapper)", __pyx_f[0], 42, 0, 0, 0, __PYX_ERR(0, 42, __pyx_L1_error));
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_7zipline_4data_9_equities__compute_row_slices(__pyx_v_asset_starts_absolute, __pyx_v_asset_ends_absolute, __pyx_v_asset_starts_calendar, __pyx_v_query_start, __pyx_v_query_end, __pyx_v_requested_assets, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __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, 42, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline.data._equities._compute_row_slices", __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_equities_1_compute_row_slices, 0, __pyx_mstate_global->__pyx_n_u_compute_row_slices, NULL, __pyx_mstate_global->__pyx_n_u_zipline_data__equities, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[39])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_compute_row_slices, __pyx_t_4) < (0)) __PYX_ERR(0, 42, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     043: @cython.wraparound(False)

     044: cpdef _compute_row_slices(dict asset_starts_absolute,

     045:                           dict asset_ends_absolute,

     046:                           dict asset_starts_calendar,

     047:                           intp_t query_start,

     048:                           intp_t query_end,

     049:                           Int64Index_t requested_assets):

     050:     """

     051:     Core indexing functionality for loading raw data from bcolz.

     052:

     053:     For each asset in requested assets, computes three values:

     054:

     055:     1.) The index in the raw bcolz data of first row to load.

     056:     2.) The index in the raw bcolz data of the last row to load.

     057:     3.) The index in the dates of our query corresponding to the first row for

     058:         each asset. This is non-zero iff the asset's lifetime begins partway

     059:         through the requested query dates.

     060:

     061:     Values for unknown sids will be populated with a value of -1.

     062:

     063:     Parameters

     064:     ----------

     065:     asset_starts_absolute : dict

     066:         Dictionary containing the index of the first row of each asset in the

     067:         bcolz file from which we will query.

     068:     asset_ends_absolute : dict

     069:         Dictionary containing the index of the last row of each asset in the

     070:         bcolz file from which we will query.

     071:     asset_starts_calendar : dict

     072:         Dictionary containing the index of in our calendar corresponding to the

     073:         start date of each asset

     074:     query_start : intp

     075:         Start index in our calendar of the dates for which we're querying.

     076:     query_end : intp

     077:         End index in our calendar of the dates for which we're querying.

     078:     requested_assets : pandas.Int64Index

     079:         The assets for which we want to load data.

     080:

     081:     Returns

     082:     -------

     083:     first_rows, last_rows, offsets : 3-tuple of ndarrays

     084:     """

     085:     cdef:

    +086:         intp_t nassets = len(requested_assets)

      __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_requested_assets)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 86, __pyx_L1_error)
      __pyx_v_nassets = __pyx_t_1;

     087:

     088:         # For each sid, we need to compute the following:

    +089:         ndarray[dtype=intp_t, ndim=1] first_row_a = full(nassets, -1, dtype=intp)

      __pyx_t_3 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_full); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 89, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyLong_From_npy_intp(__pyx_v_nassets); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_intp); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 89, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
        assert(__pyx_t_3);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
        __pyx_t_7 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, __pyx_t_5, __pyx_mstate_global->__pyx_int_neg_1};
        __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 89, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_6, __pyx_t_8, __pyx_callargs+3, 0) < (0)) __PYX_ERR(0, 89, __pyx_L1_error)
        __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_4, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 89, __pyx_L1_error)
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_first_row_a.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          __pyx_v_first_row_a = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_first_row_a.rcbuffer->pybuffer.buf = NULL;
          __PYX_ERR(0, 89, __pyx_L1_error)
        } else {__pyx_pybuffernd_first_row_a.diminfo[0].strides = __pyx_pybuffernd_first_row_a.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_first_row_a.diminfo[0].shape = __pyx_pybuffernd_first_row_a.rcbuffer->pybuffer.shape[0];
        }
      }
      __pyx_v_first_row_a = ((PyArrayObject *)__pyx_t_2);
      __pyx_t_2 = 0;

    +090:         ndarray[dtype=intp_t, ndim=1] last_row_a = full(nassets, -1, dtype=intp)

      __pyx_t_4 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_full); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 90, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = __Pyx_PyLong_From_npy_intp(__pyx_v_nassets); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 90, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_intp); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 90, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
        assert(__pyx_t_4);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
        __pyx_t_7 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_t_6, __pyx_mstate_global->__pyx_int_neg_1};
        __pyx_t_3 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_5, __pyx_t_3, __pyx_callargs+3, 0) < (0)) __PYX_ERR(0, 90, __pyx_L1_error)
        __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_8, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 90, __pyx_L1_error)
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_last_row_a.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          __pyx_v_last_row_a = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_last_row_a.rcbuffer->pybuffer.buf = NULL;
          __PYX_ERR(0, 90, __pyx_L1_error)
        } else {__pyx_pybuffernd_last_row_a.diminfo[0].strides = __pyx_pybuffernd_last_row_a.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_last_row_a.diminfo[0].shape = __pyx_pybuffernd_last_row_a.rcbuffer->pybuffer.shape[0];
        }
      }
      __pyx_v_last_row_a = ((PyArrayObject *)__pyx_t_2);
      __pyx_t_2 = 0;

    +091:         ndarray[dtype=intp_t, ndim=1] offset_a = full(nassets, -1, dtype=intp)

      __pyx_t_8 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_full); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyLong_From_npy_intp(__pyx_v_nassets); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 91, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_intp); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 91, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
        assert(__pyx_t_8);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
        __pyx_t_7 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[3 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_8, __pyx_t_5, __pyx_mstate_global->__pyx_int_neg_1};
        __pyx_t_4 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_6, __pyx_t_4, __pyx_callargs+3, 0) < (0)) __PYX_ERR(0, 91, __pyx_L1_error)
        __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_3, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_4);
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 91, __pyx_L1_error)
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_offset_a.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          __pyx_v_offset_a = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_offset_a.rcbuffer->pybuffer.buf = NULL;
          __PYX_ERR(0, 91, __pyx_L1_error)
        } else {__pyx_pybuffernd_offset_a.diminfo[0].strides = __pyx_pybuffernd_offset_a.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_offset_a.diminfo[0].shape = __pyx_pybuffernd_offset_a.rcbuffer->pybuffer.shape[0];
        }
      }
      __pyx_v_offset_a = ((PyArrayObject *)__pyx_t_2);
      __pyx_t_2 = 0;

     092:

     093:         # Loop variables.

     094:         intp_t i

     095:         intp_t asset

     096:         intp_t asset_start_data

     097:         intp_t asset_end_data

     098:         intp_t asset_start_calendar

     099:         intp_t asset_end_calendar

     100:

     101:         # Flag to check whether we should raise an error because we don't know

     102:         # about any of the requested sids.

    +103:         uint8_t any_hits = 0

      __pyx_v_any_hits = 0;

     104:

    +105:     for i, asset in enumerate(requested_assets):

      __pyx_t_9 = 0;
      if (likely(PyList_CheckExact(((PyObject *)__pyx_v_requested_assets))) || PyTuple_CheckExact(((PyObject *)__pyx_v_requested_assets))) {
        __pyx_t_2 = ((PyObject *)__pyx_v_requested_assets); __Pyx_INCREF(__pyx_t_2);
        __pyx_t_1 = 0;
        __pyx_t_10 = NULL;
      } else {
        __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_requested_assets)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 105, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_10)) {
          if (likely(PyList_CheckExact(__pyx_t_2))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 105, __pyx_L1_error)
              #endif
              if (__pyx_t_1 >= __pyx_temp) break;
            }
            __pyx_t_3 = __Pyx_PyList_GetItemRef(__pyx_t_2, __pyx_t_1);
            ++__pyx_t_1;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 105, __pyx_L1_error)
              #endif
              if (__pyx_t_1 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1));
            #else
            __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_1);
            #endif
            ++__pyx_t_1;
          }
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 105, __pyx_L1_error)
        } else {
          __pyx_t_3 = __pyx_t_10(__pyx_t_2);
          if (unlikely(!__pyx_t_3)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 105, __pyx_L1_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_11 = __Pyx_PyLong_As_npy_intp(__pyx_t_3); if (unlikely((__pyx_t_11 == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 105, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_v_asset = __pyx_t_11;
        __pyx_v_i = __pyx_t_9;
        __pyx_t_9 = (__pyx_t_9 + 1);
    /* … */
        __pyx_L3_continue:;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +106:         if asset not in asset_starts_absolute:

        __pyx_t_3 = __Pyx_PyLong_From_npy_intp(__pyx_v_asset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 106, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (unlikely(__pyx_v_asset_starts_absolute == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
          __PYX_ERR(0, 106, __pyx_L1_error)
        }
        __pyx_t_12 = (__Pyx_PyDict_ContainsTF(__pyx_t_3, __pyx_v_asset_starts_absolute, Py_NE)); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 106, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (__pyx_t_12) {
    /* … */
        }

     107:             # This is an unknown asset, leave its slot empty.

    +108:             continue

          goto __pyx_L3_continue;

     109:

    +110:         any_hits = 1

        __pyx_v_any_hits = 1;

     111:

    +112:         asset_start_data = asset_starts_absolute[asset]

        if (unlikely(__pyx_v_asset_starts_absolute == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 112, __pyx_L1_error)
        }
        __pyx_t_3 = __Pyx_PyLong_From_npy_intp(__pyx_v_asset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_asset_starts_absolute, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_11 = __Pyx_PyLong_As_npy_intp(__pyx_t_4); if (unlikely((__pyx_t_11 == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 112, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_v_asset_start_data = __pyx_t_11;

    +113:         asset_end_data = asset_ends_absolute[asset]

        if (unlikely(__pyx_v_asset_ends_absolute == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 113, __pyx_L1_error)
        }
        __pyx_t_4 = __Pyx_PyLong_From_npy_intp(__pyx_v_asset); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 113, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_asset_ends_absolute, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_11 = __Pyx_PyLong_As_npy_intp(__pyx_t_3); if (unlikely((__pyx_t_11 == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 113, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_v_asset_end_data = __pyx_t_11;

    +114:         asset_start_calendar = asset_starts_calendar[asset]

        if (unlikely(__pyx_v_asset_starts_calendar == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 114, __pyx_L1_error)
        }
        __pyx_t_3 = __Pyx_PyLong_From_npy_intp(__pyx_v_asset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 114, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_asset_starts_calendar, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 114, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_11 = __Pyx_PyLong_As_npy_intp(__pyx_t_4); if (unlikely((__pyx_t_11 == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 114, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_v_asset_start_calendar = __pyx_t_11;

     115:         asset_end_calendar = (

    +116:             asset_start_calendar + (asset_end_data - asset_start_data)

        __pyx_v_asset_end_calendar = (__pyx_v_asset_start_calendar + (__pyx_v_asset_end_data - __pyx_v_asset_start_data));

     117:         )

     118:

     119:         # If the asset started during the query, then start with the asset's

     120:         # first row.

     121:         # Otherwise start with the asset's first row + the number of rows

     122:         # before the query on which the asset existed.

    +123:         first_row_a[i] = (

        __pyx_t_15 = __pyx_v_i;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_first_row_a.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_first_row_a.diminfo[0].strides) = (__pyx_v_asset_start_data + __pyx_t_14);

    +124:             asset_start_data + max(0, (query_start - asset_start_calendar))

        __pyx_t_11 = (__pyx_v_query_start - __pyx_v_asset_start_calendar);
        __pyx_t_13 = 0;
        __pyx_t_12 = (__pyx_t_11 > __pyx_t_13);
        if (__pyx_t_12) {
          __pyx_t_14 = __pyx_t_11;
        } else {
          __pyx_t_14 = __pyx_t_13;
        }

     125:         )

     126:         # If the asset ended during the query, the end with the asset's last

     127:         # row.

     128:         # Otherwise, end with the asset's last row minus the number of rows

     129:         # after the query for which the asset

    +130:         last_row_a[i] = (

        __pyx_t_15 = __pyx_v_i;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_last_row_a.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_last_row_a.diminfo[0].strides) = (__pyx_v_asset_end_data - __pyx_t_11);

    +131:             asset_end_data - max(0, asset_end_calendar - query_end)

        __pyx_t_14 = (__pyx_v_asset_end_calendar - __pyx_v_query_end);
        __pyx_t_13 = 0;
        __pyx_t_12 = (__pyx_t_14 > __pyx_t_13);
        if (__pyx_t_12) {
          __pyx_t_11 = __pyx_t_14;
        } else {
          __pyx_t_11 = __pyx_t_13;
        }

     132:         )

     133:         # If the asset existed on or before the query, no offset.

     134:         # Otherwise, offset by the number of rows in the query in which the

     135:         # asset did not yet exist.

    +136:         offset_a[i] = max(0, asset_start_calendar - query_start)

        __pyx_t_11 = (__pyx_v_asset_start_calendar - __pyx_v_query_start);
        __pyx_t_13 = 0;
        __pyx_t_12 = (__pyx_t_11 > __pyx_t_13);
        if (__pyx_t_12) {
          __pyx_t_14 = __pyx_t_11;
        } else {
          __pyx_t_14 = __pyx_t_13;
        }
        __pyx_t_15 = __pyx_v_i;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_offset_a.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_offset_a.diminfo[0].strides) = __pyx_t_14;

     137:

    +138:     if not any_hits:

      __pyx_t_12 = (!(__pyx_v_any_hits != 0));
      if (unlikely(__pyx_t_12)) {
    /* … */
      }

    +139:         raise ValueError('At least one valid asset id is required.')

        __pyx_t_4 = NULL;
        __Pyx_INCREF(__pyx_builtin_ValueError);
        __pyx_t_3 = __pyx_builtin_ValueError;
        __pyx_t_7 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_At_least_one_valid_asset_id_is_r};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __Pyx_Raise(__pyx_t_2, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __PYX_ERR(0, 139, __pyx_L1_error)

     140:

    +141:     return first_row_a, last_row_a, offset_a

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 141, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF((PyObject *)__pyx_v_first_row_a);
      __Pyx_GIVEREF((PyObject *)__pyx_v_first_row_a);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_first_row_a)) != (0)) __PYX_ERR(0, 141, __pyx_L1_error);
      __Pyx_INCREF((PyObject *)__pyx_v_last_row_a);
      __Pyx_GIVEREF((PyObject *)__pyx_v_last_row_a);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_last_row_a)) != (0)) __PYX_ERR(0, 141, __pyx_L1_error);
      __Pyx_INCREF((PyObject *)__pyx_v_offset_a);
      __Pyx_GIVEREF((PyObject *)__pyx_v_offset_a);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_offset_a)) != (0)) __PYX_ERR(0, 141, __pyx_L1_error);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_TraceReturnValue(__pyx_r, 92, 0, __PYX_ERR(0, 141, __pyx_L1_error));
      goto __pyx_L0;

     142:

     143:

    +144: @cython.boundscheck(False)

    static PyObject *__pyx_pw_7zipline_4data_9_equities_3_read_bcolz_data(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 PyObject *__pyx_f_7zipline_4data_9_equities__read_bcolz_data(__pyx_t_7zipline_4data_9_equities_ctable_t __pyx_v_table, PyObject *__pyx_v_shape, PyObject *__pyx_v_columns, __Pyx_memviewslice __pyx_v_first_rows, __Pyx_memviewslice __pyx_v_last_rows, __Pyx_memviewslice __pyx_v_offsets, PyLongObject *__pyx_v_read_all, CYTHON_UNUSED int __pyx_skip_dispatch) {
      int __pyx_v_nassets;
      PyObject *__pyx_v_column_name = 0;
      __pyx_t_7zipline_4data_9_equities_carray_t __pyx_v_carray = 0;
      PyArrayObject *__pyx_v_raw_data = 0;
      PyArrayObject *__pyx_v_outbuf = 0;
      PyArrayObject *__pyx_v_where_nan = 0;
      PyArrayObject *__pyx_v_outbuf_as_float = 0;
      __pyx_t_5numpy_intp_t __pyx_v_asset;
      __pyx_t_5numpy_intp_t __pyx_v_first_row;
      __pyx_t_5numpy_intp_t __pyx_v_last_row;
      __pyx_t_5numpy_intp_t __pyx_v_offset;
      PyObject *__pyx_v_results = 0;
      CYTHON_UNUSED PyObject *__pyx_v_ndays = NULL;
      CYTHON_UNUSED __pyx_t_5numpy_intp_t __pyx_v_out_start;
      CYTHON_UNUSED __pyx_t_5numpy_intp_t __pyx_v_out_end;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_outbuf;
      __Pyx_Buffer __pyx_pybuffer_outbuf;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_outbuf_as_float;
      __Pyx_Buffer __pyx_pybuffer_outbuf_as_float;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_raw_data;
      __Pyx_Buffer __pyx_pybuffer_raw_data;
      __Pyx_LocalBuf_ND __pyx_pybuffernd_where_nan;
      __Pyx_Buffer __pyx_pybuffer_where_nan;
      PyObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[40]))
      __Pyx_TraceStartFunc("_read_bcolz_data", __pyx_f[0], 144, 0, 0, __pyx_skip_dispatch, __PYX_ERR(0, 144, __pyx_L1_error));
      __pyx_pybuffer_raw_data.pybuffer.buf = NULL;
      __pyx_pybuffer_raw_data.refcount = 0;
      __pyx_pybuffernd_raw_data.data = NULL;
      __pyx_pybuffernd_raw_data.rcbuffer = &__pyx_pybuffer_raw_data;
      __pyx_pybuffer_outbuf.pybuffer.buf = NULL;
      __pyx_pybuffer_outbuf.refcount = 0;
      __pyx_pybuffernd_outbuf.data = NULL;
      __pyx_pybuffernd_outbuf.rcbuffer = &__pyx_pybuffer_outbuf;
      __pyx_pybuffer_where_nan.pybuffer.buf = NULL;
      __pyx_pybuffer_where_nan.refcount = 0;
      __pyx_pybuffernd_where_nan.data = NULL;
      __pyx_pybuffernd_where_nan.rcbuffer = &__pyx_pybuffer_where_nan;
      __pyx_pybuffer_outbuf_as_float.pybuffer.buf = NULL;
      __pyx_pybuffer_outbuf_as_float.refcount = 0;
      __pyx_pybuffernd_outbuf_as_float.data = NULL;
      __pyx_pybuffernd_outbuf_as_float.rcbuffer = &__pyx_pybuffer_outbuf_as_float;
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_11);
      __Pyx_XDECREF(__pyx_t_12);
      __Pyx_XDECREF(__pyx_t_13);
      __Pyx_XDECREF(__pyx_t_20);
      { 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_outbuf.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf_as_float.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_raw_data.rcbuffer->pybuffer);
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_where_nan.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, 144, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline.data._equities._read_bcolz_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf_as_float.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_raw_data.rcbuffer->pybuffer);
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_where_nan.rcbuffer->pybuffer);
      __pyx_L2:;
      __Pyx_XDECREF(__pyx_v_column_name);
      __Pyx_XDECREF(__pyx_v_carray);
      __Pyx_XDECREF((PyObject *)__pyx_v_raw_data);
      __Pyx_XDECREF((PyObject *)__pyx_v_outbuf);
      __Pyx_XDECREF((PyObject *)__pyx_v_where_nan);
      __Pyx_XDECREF((PyObject *)__pyx_v_outbuf_as_float);
      __Pyx_XDECREF(__pyx_v_results);
      __Pyx_XDECREF(__pyx_v_ndays);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_7zipline_4data_9_equities_3_read_bcolz_data(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*/
    PyDoc_STRVAR(__pyx_doc_7zipline_4data_9_equities_2_read_bcolz_data, "Load raw bcolz data for the given columns and indices.\n\n    Parameters\n    ----------\n    table : bcolz.ctable\n        The table from which to read.\n    shape : tuple (length 2)\n        The shape of the expected output arrays.\n    columns : list[str]\n        List of column names to read.\n\n    first_rows : ndarray[intp]\n    last_rows : ndarray[intp]\n    offsets : ndarray[intp\n        Arrays in the format returned by _compute_row_slices.\n    read_all : bool\n        Whether to read_all sid data at once, or to read a silce from the\n        carray for each sid.\n\n    Returns\n    -------\n    results : list of ndarray\n        A 2D array of shape `shape` for each column in `columns`.\n    ");
    static PyMethodDef __pyx_mdef_7zipline_4data_9_equities_3_read_bcolz_data = {"_read_bcolz_data", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_4data_9_equities_3_read_bcolz_data, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7zipline_4data_9_equities_2_read_bcolz_data};
    static PyObject *__pyx_pw_7zipline_4data_9_equities_3_read_bcolz_data(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_t_7zipline_4data_9_equities_ctable_t __pyx_v_table = 0;
      PyObject *__pyx_v_shape = 0;
      PyObject *__pyx_v_columns = 0;
      __Pyx_memviewslice __pyx_v_first_rows = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_last_rows = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_offsets = { 0, 0, { 0 }, { 0 }, { 0 } };
      PyLongObject *__pyx_v_read_all = 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("_read_bcolz_data (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_table,&__pyx_mstate_global->__pyx_n_u_shape,&__pyx_mstate_global->__pyx_n_u_columns,&__pyx_mstate_global->__pyx_n_u_first_rows,&__pyx_mstate_global->__pyx_n_u_last_rows,&__pyx_mstate_global->__pyx_n_u_offsets,&__pyx_mstate_global->__pyx_n_u_read_all,0};
      PyObject* values[7] = {0,0,0,0,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, 144, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  7:
            values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 144, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  6:
            values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 144, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  5:
            values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 144, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  4:
            values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 144, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 144, __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, 144, __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, 144, __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, "_read_bcolz_data", 0) < (0)) __PYX_ERR(0, 144, __pyx_L3_error)
          for (Py_ssize_t i = __pyx_nargs; i < 7; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_read_bcolz_data", 1, 7, 7, i); __PYX_ERR(0, 144, __pyx_L3_error) }
          }
        } else if (unlikely(__pyx_nargs != 7)) {
          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, 144, __pyx_L3_error)
          values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 144, __pyx_L3_error)
          values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 144, __pyx_L3_error)
          values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 144, __pyx_L3_error)
          values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 144, __pyx_L3_error)
          values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 144, __pyx_L3_error)
          values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 144, __pyx_L3_error)
        }
        __pyx_v_table = ((__pyx_t_7zipline_4data_9_equities_ctable_t)values[0]);
        __pyx_v_shape = ((PyObject*)values[1]);
        __pyx_v_columns = ((PyObject*)values[2]);
        __pyx_v_first_rows = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_intp_t(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_first_rows.memview)) __PYX_ERR(0, 149, __pyx_L3_error)
        __pyx_v_last_rows = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_intp_t(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_last_rows.memview)) __PYX_ERR(0, 150, __pyx_L3_error)
        __pyx_v_offsets = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_intp_t(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_offsets.memview)) __PYX_ERR(0, 151, __pyx_L3_error)
        __pyx_v_read_all = ((PyLongObject *)values[6]);
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("_read_bcolz_data", 1, 7, 7, __pyx_nargs); __PYX_ERR(0, 144, __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_first_rows, 1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_last_rows, 1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_offsets, 1);
      __Pyx_AddTraceback("zipline.data._equities._read_bcolz_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(0, 147, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_columns), (&PyList_Type), 1, "columns", 1))) __PYX_ERR(0, 148, __pyx_L1_error)
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_read_all), __pyx_mstate_global->__pyx_ptype_7cpython_4bool_bool, 1, "read_all", 0))) __PYX_ERR(0, 152, __pyx_L1_error)
      __pyx_r = __pyx_pf_7zipline_4data_9_equities_2_read_bcolz_data(__pyx_self, __pyx_v_table, __pyx_v_shape, __pyx_v_columns, __pyx_v_first_rows, __pyx_v_last_rows, __pyx_v_offsets, __pyx_v_read_all);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      goto __pyx_L7_cleaned_up;
      __pyx_L0:;
      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_L7_cleaned_up:;
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_first_rows, 1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_last_rows, 1);
      __PYX_XCLEAR_MEMVIEW(&__pyx_v_offsets, 1);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_7zipline_4data_9_equities_2_read_bcolz_data(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_7zipline_4data_9_equities_ctable_t __pyx_v_table, PyObject *__pyx_v_shape, PyObject *__pyx_v_columns, __Pyx_memviewslice __pyx_v_first_rows, __Pyx_memviewslice __pyx_v_last_rows, __Pyx_memviewslice __pyx_v_offsets, PyLongObject *__pyx_v_read_all) {
      PyObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[40]))
      __Pyx_TraceStartFunc("_read_bcolz_data (wrapper)", __pyx_f[0], 144, 0, 0, 0, __PYX_ERR(0, 144, __pyx_L1_error));
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_v_first_rows.memview)) { __Pyx_RaiseUnboundLocalError("first_rows"); __PYX_ERR(0, 144, __pyx_L1_error) }
      if (unlikely(!__pyx_v_last_rows.memview)) { __Pyx_RaiseUnboundLocalError("last_rows"); __PYX_ERR(0, 144, __pyx_L1_error) }
      if (unlikely(!__pyx_v_offsets.memview)) { __Pyx_RaiseUnboundLocalError("offsets"); __PYX_ERR(0, 144, __pyx_L1_error) }
      __pyx_t_1 = __pyx_f_7zipline_4data_9_equities__read_bcolz_data(__pyx_v_table, __pyx_v_shape, __pyx_v_columns, __pyx_v_first_rows, __pyx_v_last_rows, __pyx_v_offsets, __pyx_v_read_all, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __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_equities_3_read_bcolz_data, 0, __pyx_mstate_global->__pyx_n_u_read_bcolz_data, NULL, __pyx_mstate_global->__pyx_n_u_zipline_data__equities, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[40])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 144, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_read_bcolz_data, __pyx_t_4) < (0)) __PYX_ERR(0, 144, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     145: @cython.wraparound(False)

     146: cpdef _read_bcolz_data(ctable_t table,

     147:                        tuple shape,

     148:                        list columns,

     149:                        intp_t[:] first_rows,

     150:                        intp_t[:] last_rows,

     151:                        intp_t[:] offsets,

     152:                        bool read_all):

     153:     """Load raw bcolz data for the given columns and indices.

     154:

     155:     Parameters

     156:     ----------

     157:     table : bcolz.ctable

     158:         The table from which to read.

     159:     shape : tuple (length 2)

     160:         The shape of the expected output arrays.

     161:     columns : list[str]

     162:         List of column names to read.

     163:

     164:     first_rows : ndarray[intp]

     165:     last_rows : ndarray[intp]

     166:     offsets : ndarray[intp

     167:         Arrays in the format returned by _compute_row_slices.

     168:     read_all : bool

     169:         Whether to read_all sid data at once, or to read a silce from the

     170:         carray for each sid.

     171:

     172:     Returns

     173:     -------

     174:     results : list of ndarray

     175:         A 2D array of shape `shape` for each column in `columns`.

     176:     """

     177:     cdef:

     178:         int nassets

     179:         str column_name

     180:         carray_t carray

     181:         ndarray[dtype=uint32_t, ndim=1] raw_data

     182:         ndarray[dtype=uint32_t, ndim=2] outbuf

     183:         ndarray[dtype=uint8_t, ndim=2, cast=True] where_nan

     184:         ndarray[dtype=float64_t, ndim=2] outbuf_as_float

     185:         intp_t asset

     186:         intp_t out_idx

     187:         intp_t raw_idx

     188:         intp_t first_row

     189:         intp_t last_row

     190:         intp_t offset

    +191:         list results = []

      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_results = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

     192:

    +193:     ndays = shape[0]

      if (unlikely(__pyx_v_shape == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 193, __pyx_L1_error)
      }
      __pyx_t_1 = __Pyx_PyTuple_GET_ITEM(__pyx_v_shape, 0);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_ndays = __pyx_t_1;
      __pyx_t_1 = 0;

    +194:     nassets = shape[1]

      if (unlikely(__pyx_v_shape == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 194, __pyx_L1_error)
      }
      __pyx_t_2 = __Pyx_PyLong_As_int(__Pyx_PyTuple_GET_ITEM(__pyx_v_shape, 1)); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L1_error)
      __pyx_v_nassets = __pyx_t_2;

    +195:     if not nassets== len(first_rows) == len(last_rows) == len(offsets):

      __pyx_t_3 = __Pyx_MemoryView_Len(__pyx_v_first_rows);
      __pyx_t_4 = (__pyx_v_nassets == __pyx_t_3);
      if (__pyx_t_4) {
        __pyx_t_5 = __Pyx_MemoryView_Len(__pyx_v_last_rows);
        __pyx_t_4 = (__pyx_t_3 == __pyx_t_5);
        if (__pyx_t_4) {
          __pyx_t_6 = __Pyx_MemoryView_Len(__pyx_v_offsets);
          __pyx_t_4 = (__pyx_t_5 == __pyx_t_6);
        }
      }
      __pyx_t_7 = (!__pyx_t_4);
      if (unlikely(__pyx_t_7)) {
    /* … */
      }

    +196:         raise ValueError("Incompatible index arrays.")

        __pyx_t_8 = NULL;
        __Pyx_INCREF(__pyx_builtin_ValueError);
        __pyx_t_9 = __pyx_builtin_ValueError;
        __pyx_t_10 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_Incompatible_index_arrays};
          __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_Raise(__pyx_t_1, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __PYX_ERR(0, 196, __pyx_L1_error)

     197:

    +198:     for column_name in columns:

      if (unlikely(__pyx_v_columns == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 198, __pyx_L1_error)
      }
      __pyx_t_1 = __pyx_v_columns; __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = 0;
      for (;;) {
        {
          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, 198, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        __pyx_t_9 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_3);
        ++__pyx_t_3;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 198, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (!(likely(PyUnicode_CheckExact(__pyx_t_9))||((__pyx_t_9) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_9))) __PYX_ERR(0, 198, __pyx_L1_error)
        __Pyx_XDECREF_SET(__pyx_v_column_name, ((PyObject*)__pyx_t_9));
        __pyx_t_9 = 0;
    /* … */
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +199:         outbuf = zeros(shape=shape, dtype=uint32)

        __pyx_t_8 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_zeros); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 199, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_uint32); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 199, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_10 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_11))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_11);
          assert(__pyx_t_8);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
          __pyx_t_10 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_8, NULL};
          __pyx_t_13 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 199, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_shape, __pyx_v_shape, __pyx_t_13, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 199, __pyx_L1_error)
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_t_12, __pyx_t_13, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 199, __pyx_L1_error)
          __pyx_t_9 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_11, __pyx_callargs+__pyx_t_10, (1-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_13);
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 199, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
        }
        if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 199, __pyx_L1_error)
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
          __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_9), &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
          if (unlikely(__pyx_t_2 < 0)) {
            PyErr_Fetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_16);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_14, __pyx_t_15, __pyx_t_16);
            }
            __pyx_t_14 = __pyx_t_15 = __pyx_t_16 = 0;
          }
          __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
          if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 199, __pyx_L1_error)
        }
        __Pyx_XDECREF_SET(__pyx_v_outbuf, ((PyArrayObject *)__pyx_t_9));
        __pyx_t_9 = 0;

    +200:         if read_all:

        __pyx_t_7 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_read_all)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 200, __pyx_L1_error)
        if (__pyx_t_7) {
    /* … */
          goto __pyx_L6;
        }

    +201:             raw_data = table[column_name][:]

          __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_table), __pyx_v_column_name); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 201, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_11 = __Pyx_PyObject_GetSlice(__pyx_t_9, 0, 0, NULL, NULL, &__pyx_mstate_global->__pyx_slice[0], 0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 201, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 201, __pyx_L1_error)
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_raw_data.rcbuffer->pybuffer);
            __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_raw_data.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_11), &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
            if (unlikely(__pyx_t_2 < 0)) {
              PyErr_Fetch(&__pyx_t_16, &__pyx_t_15, &__pyx_t_14);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_raw_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_raw_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_16, __pyx_t_15, __pyx_t_14);
              }
              __pyx_t_16 = __pyx_t_15 = __pyx_t_14 = 0;
            }
            __pyx_pybuffernd_raw_data.diminfo[0].strides = __pyx_pybuffernd_raw_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_raw_data.diminfo[0].shape = __pyx_pybuffernd_raw_data.rcbuffer->pybuffer.shape[0];
            if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 201, __pyx_L1_error)
          }
          __Pyx_XDECREF_SET(__pyx_v_raw_data, ((PyArrayObject *)__pyx_t_11));
          __pyx_t_11 = 0;

     202:

    +203:             for asset in range(nassets):

          __pyx_t_2 = __pyx_v_nassets;
          __pyx_t_17 = __pyx_t_2;
          for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
            __pyx_v_asset = __pyx_t_18;

    +204:                 first_row = first_rows[asset]

            __pyx_t_19 = __pyx_v_asset;
            __pyx_v_first_row = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ (__pyx_v_first_rows.data + __pyx_t_19 * __pyx_v_first_rows.strides[0]) )));

    +205:                 if first_row == -1:

            __pyx_t_7 = (__pyx_v_first_row == -1L);
            if (__pyx_t_7) {
    /* … */
            }

     206:                     # This is an unknown asset, leave its slot empty.

    +207:                     continue

              goto __pyx_L7_continue;

     208:

    +209:                 last_row = last_rows[asset]

            __pyx_t_19 = __pyx_v_asset;
            __pyx_v_last_row = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ (__pyx_v_last_rows.data + __pyx_t_19 * __pyx_v_last_rows.strides[0]) )));

    +210:                 offset = offsets[asset]

            __pyx_t_19 = __pyx_v_asset;
            __pyx_v_offset = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ (__pyx_v_offsets.data + __pyx_t_19 * __pyx_v_offsets.strides[0]) )));

     211:

    +212:                 if first_row <= last_row:

            __pyx_t_7 = (__pyx_v_first_row <= __pyx_v_last_row);
            if (__pyx_t_7) {
    /* … */
              goto __pyx_L10;
            }

    +213:                     outbuf[offset:offset + (last_row + 1 - first_row), asset] =\

              __pyx_t_13 = __Pyx_PyLong_From_npy_intp(__pyx_v_offset); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 213, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_13);
              __pyx_t_11 = __Pyx_PyLong_From_npy_intp((__pyx_v_offset + ((__pyx_v_last_row + 1) - __pyx_v_first_row))); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 213, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_11);
              __pyx_t_12 = PySlice_New(__pyx_t_13, __pyx_t_11, Py_None); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 213, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              __pyx_t_11 = __Pyx_PyLong_From_npy_intp(__pyx_v_asset); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 213, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_11);
              __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 213, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_13);
              __Pyx_GIVEREF(__pyx_t_12);
              if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12) != (0)) __PYX_ERR(0, 213, __pyx_L1_error);
              __Pyx_GIVEREF(__pyx_t_11);
              if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_11) != (0)) __PYX_ERR(0, 213, __pyx_L1_error);
              __pyx_t_12 = 0;
              __pyx_t_11 = 0;
              if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_outbuf), __pyx_t_13, __pyx_t_9) < 0))) __PYX_ERR(0, 213, __pyx_L1_error)
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    +214:                         raw_data[first_row:last_row + 1]

              __pyx_t_11 = __Pyx_PyLong_From_npy_intp(__pyx_v_first_row); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 214, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_11);
              __pyx_t_9 = __Pyx_PyLong_From_npy_intp((__pyx_v_last_row + 1)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 214, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_9);
              __pyx_t_13 = PySlice_New(__pyx_t_11, __pyx_t_9, Py_None); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 214, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_13);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
              __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_raw_data), __pyx_t_13); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 214, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_9);
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

     215:                 else:

    +216:                     continue

            /*else*/ {
              goto __pyx_L7_continue;
            }
            __pyx_L10:;
            __pyx_L7_continue:;
          }

     217:         else:

    +218:             carray = table[column_name]

        /*else*/ {
          __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_table), __pyx_v_column_name); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 218, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_XDECREF_SET(__pyx_v_carray, ((__pyx_t_7zipline_4data_9_equities_carray_t)__pyx_t_9));
          __pyx_t_9 = 0;

     219:

    +220:             for asset in range(nassets):

          __pyx_t_2 = __pyx_v_nassets;
          __pyx_t_17 = __pyx_t_2;
          for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
            __pyx_v_asset = __pyx_t_18;

    +221:                 first_row = first_rows[asset]

            __pyx_t_19 = __pyx_v_asset;
            __pyx_v_first_row = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ (__pyx_v_first_rows.data + __pyx_t_19 * __pyx_v_first_rows.strides[0]) )));

    +222:                 if first_row == -1:

            __pyx_t_7 = (__pyx_v_first_row == -1L);
            if (__pyx_t_7) {
    /* … */
            }

     223:                     # This is an unknown asset, leave its slot empty.

    +224:                     continue

              goto __pyx_L11_continue;

     225:

    +226:                 last_row = last_rows[asset]

            __pyx_t_19 = __pyx_v_asset;
            __pyx_v_last_row = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ (__pyx_v_last_rows.data + __pyx_t_19 * __pyx_v_last_rows.strides[0]) )));

    +227:                 offset = offsets[asset]

            __pyx_t_19 = __pyx_v_asset;
            __pyx_v_offset = (*((__pyx_t_5numpy_intp_t *) ( /* dim=0 */ (__pyx_v_offsets.data + __pyx_t_19 * __pyx_v_offsets.strides[0]) )));

    +228:                 out_start = offset

            __pyx_v_out_start = __pyx_v_offset;

    +229:                 out_end = (last_row - first_row) + offset + 1

            __pyx_v_out_end = (((__pyx_v_last_row - __pyx_v_first_row) + __pyx_v_offset) + 1);

    +230:                 if first_row <= last_row:

            __pyx_t_7 = (__pyx_v_first_row <= __pyx_v_last_row);
            if (__pyx_t_7) {
    /* … */
              goto __pyx_L14;
            }

    +231:                     outbuf[offset:offset + (last_row + 1 - first_row), asset] =\

              __pyx_t_13 = __Pyx_PyLong_From_npy_intp(__pyx_v_offset); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 231, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_13);
              __pyx_t_11 = __Pyx_PyLong_From_npy_intp((__pyx_v_offset + ((__pyx_v_last_row + 1) - __pyx_v_first_row))); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 231, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_11);
              __pyx_t_12 = PySlice_New(__pyx_t_13, __pyx_t_11, Py_None); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 231, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              __pyx_t_11 = __Pyx_PyLong_From_npy_intp(__pyx_v_asset); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 231, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_11);
              __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 231, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_13);
              __Pyx_GIVEREF(__pyx_t_12);
              if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12) != (0)) __PYX_ERR(0, 231, __pyx_L1_error);
              __Pyx_GIVEREF(__pyx_t_11);
              if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_11) != (0)) __PYX_ERR(0, 231, __pyx_L1_error);
              __pyx_t_12 = 0;
              __pyx_t_11 = 0;
              if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_outbuf), __pyx_t_13, __pyx_t_9) < 0))) __PYX_ERR(0, 231, __pyx_L1_error)
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    +232:                         carray[first_row:last_row + 1]

              __pyx_t_9 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_carray), __pyx_v_first_row, (__pyx_v_last_row + 1), NULL, NULL, NULL, 1, 1, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 232, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_9);

     233:                 else:

    +234:                     continue

            /*else*/ {
              goto __pyx_L11_continue;
            }
            __pyx_L14:;
            __pyx_L11_continue:;
          }
        }
        __pyx_L6:;

     235:

    +236:         if column_name in {'open', 'high', 'low', 'close'}:

        __Pyx_INCREF(__pyx_v_column_name);
        __pyx_t_20 = __pyx_v_column_name;
        __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_20, __pyx_mstate_global->__pyx_n_u_open, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 236, __pyx_L1_error)
        if (!__pyx_t_4) {
        } else {
          __pyx_t_7 = __pyx_t_4;
          goto __pyx_L16_bool_binop_done;
        }
        __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_20, __pyx_mstate_global->__pyx_n_u_high, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 236, __pyx_L1_error)
        if (!__pyx_t_4) {
        } else {
          __pyx_t_7 = __pyx_t_4;
          goto __pyx_L16_bool_binop_done;
        }
        __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_20, __pyx_mstate_global->__pyx_n_u_low, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 236, __pyx_L1_error)
        if (!__pyx_t_4) {
        } else {
          __pyx_t_7 = __pyx_t_4;
          goto __pyx_L16_bool_binop_done;
        }
        __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_20, __pyx_mstate_global->__pyx_n_u_close, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 236, __pyx_L1_error)
        __pyx_t_7 = __pyx_t_4;
        __pyx_L16_bool_binop_done:;
        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
        __pyx_t_4 = __pyx_t_7;
        if (__pyx_t_4) {
    /* … */
          goto __pyx_L15;
        }

    +237:             where_nan = (outbuf == 0)

          __pyx_t_9 = PyObject_RichCompare(((PyObject *)__pyx_v_outbuf), __pyx_mstate_global->__pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 237, __pyx_L1_error)
          if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 237, __pyx_L1_error)
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_where_nan.rcbuffer->pybuffer);
            __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_where_nan.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_9), &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 1, __pyx_stack);
            if (unlikely(__pyx_t_2 < 0)) {
              PyErr_Fetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_where_nan.rcbuffer->pybuffer, (PyObject*)__pyx_v_where_nan, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 1, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_16);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_14, __pyx_t_15, __pyx_t_16);
              }
              __pyx_t_14 = __pyx_t_15 = __pyx_t_16 = 0;
            }
            __pyx_pybuffernd_where_nan.diminfo[0].strides = __pyx_pybuffernd_where_nan.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_where_nan.diminfo[0].shape = __pyx_pybuffernd_where_nan.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_where_nan.diminfo[1].strides = __pyx_pybuffernd_where_nan.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_where_nan.diminfo[1].shape = __pyx_pybuffernd_where_nan.rcbuffer->pybuffer.shape[1];
            if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 237, __pyx_L1_error)
          }
          __Pyx_XDECREF_SET(__pyx_v_where_nan, ((PyArrayObject *)__pyx_t_9));
          __pyx_t_9 = 0;

    +238:             outbuf_as_float = outbuf.astype(float64) * .001

          __pyx_t_13 = ((PyObject *)__pyx_v_outbuf);
          __Pyx_INCREF(__pyx_t_13);
          __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_float64); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 238, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_10 = 0;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_t_11};
            __pyx_t_9 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_astype, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 238, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
          }
          __pyx_t_11 = PyNumber_Multiply(__pyx_t_9, __pyx_mstate_global->__pyx_float__001); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 238, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_mstate_global->__pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 238, __pyx_L1_error)
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf_as_float.rcbuffer->pybuffer);
            __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf_as_float.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_11), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_2 < 0)) {
              PyErr_Fetch(&__pyx_t_16, &__pyx_t_15, &__pyx_t_14);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf_as_float.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf_as_float, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_16, __pyx_t_15, __pyx_t_14);
              }
              __pyx_t_16 = __pyx_t_15 = __pyx_t_14 = 0;
            }
            __pyx_pybuffernd_outbuf_as_float.diminfo[0].strides = __pyx_pybuffernd_outbuf_as_float.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf_as_float.diminfo[0].shape = __pyx_pybuffernd_outbuf_as_float.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf_as_float.diminfo[1].strides = __pyx_pybuffernd_outbuf_as_float.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf_as_float.diminfo[1].shape = __pyx_pybuffernd_outbuf_as_float.rcbuffer->pybuffer.shape[1];
            if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 238, __pyx_L1_error)
          }
          __Pyx_XDECREF_SET(__pyx_v_outbuf_as_float, ((PyArrayObject *)__pyx_t_11));
          __pyx_t_11 = 0;

    +239:             outbuf_as_float[where_nan] = NAN

          __pyx_t_11 = PyFloat_FromDouble(NAN); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 239, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_outbuf_as_float), ((PyObject *)__pyx_v_where_nan), __pyx_t_11) < 0))) __PYX_ERR(0, 239, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

    +240:             results.append(outbuf_as_float)

          __pyx_t_21 = __Pyx_PyList_Append(__pyx_v_results, ((PyObject *)__pyx_v_outbuf_as_float)); if (unlikely(__pyx_t_21 == ((int)-1))) __PYX_ERR(0, 240, __pyx_L1_error)

     241:         else:

    +242:             results.append(outbuf)

        /*else*/ {
          __pyx_t_21 = __Pyx_PyList_Append(__pyx_v_results, ((PyObject *)__pyx_v_outbuf)); if (unlikely(__pyx_t_21 == ((int)-1))) __PYX_ERR(0, 242, __pyx_L1_error)
        }
        __pyx_L15:;

    +243:     return results

      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_results);
      __pyx_r = __pyx_v_results;
      __Pyx_TraceReturnValue(__pyx_r, 177, 0, __PYX_ERR(0, 243, __pyx_L1_error));
      goto __pyx_L0;