Generated by Cython 0.29.24

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_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_1 = __Pyx_Import(__pyx_n_s_bcolz, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_bcolz, __pyx_t_1) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
 016: cimport cython
 017: from cpython cimport bool
 018: 
+019: from numpy import (
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_numpy, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_array, __pyx_t_1) < 0) __PYX_ERR(0, 20, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_float64, __pyx_t_1) < 0) __PYX_ERR(0, 21, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_full); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_full, __pyx_t_1) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_intp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_intp, __pyx_t_1) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_uint32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_uint32, __pyx_t_1) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_zeros, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+020:     array,
  __pyx_t_1 = PyList_New(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_array);
  __Pyx_GIVEREF(__pyx_n_s_array);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_array);
  __Pyx_INCREF(__pyx_n_s_float64);
  __Pyx_GIVEREF(__pyx_n_s_float64);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_float64);
  __Pyx_INCREF(__pyx_n_s_full);
  __Pyx_GIVEREF(__pyx_n_s_full);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_full);
  __Pyx_INCREF(__pyx_n_s_intp);
  __Pyx_GIVEREF(__pyx_n_s_intp);
  PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_s_intp);
  __Pyx_INCREF(__pyx_n_s_uint32);
  __Pyx_GIVEREF(__pyx_n_s_uint32);
  PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_s_uint32);
  __Pyx_INCREF(__pyx_n_s_zeros);
  __Pyx_GIVEREF(__pyx_n_s_zeros);
  PyList_SET_ITEM(__pyx_t_1, 5, __pyx_n_s_zeros);
 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 numpy.math cimport NAN
 035: 
+036: ctypedef object carray_t
typedef PyObject *__pyx_t_7zipline_4data_9_equities_carray_t;
+037: ctypedef object ctable_t
typedef PyObject *__pyx_t_7zipline_4data_9_equities_ctable_t;
+038: ctypedef object Timestamp_t
typedef PyObject *__pyx_t_7zipline_4data_9_equities_Timestamp_t;
+039: ctypedef object DatetimeIndex_t
typedef PyObject *__pyx_t_7zipline_4data_9_equities_DatetimeIndex_t;
+040: ctypedef object Int64Index_t
typedef PyObject *__pyx_t_7zipline_4data_9_equities_Int64Index_t;
 041: 
 042: 
 043: @cython.boundscheck(False)
 044: @cython.wraparound(False)
+045: cpdef _compute_row_slices(dict asset_starts_absolute,
static PyObject *__pyx_pw_7zipline_4data_9_equities_1_compute_row_slices(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_compute_row_slices", 0);
  __Pyx_TraceCall("_compute_row_slices", __pyx_f[0], 45, 0, __PYX_ERR(0, 45, __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);
  { 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_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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7zipline_4data_9_equities_1_compute_row_slices(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __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 PyObject *__pyx_pw_7zipline_4data_9_equities_1_compute_row_slices(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  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;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_compute_row_slices (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_asset_starts_absolute,&__pyx_n_s_asset_ends_absolute,&__pyx_n_s_asset_starts_calendar,&__pyx_n_s_query_start,&__pyx_n_s_query_end,&__pyx_n_s_requested_assets,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_asset_starts_absolute)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_asset_ends_absolute)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_compute_row_slices", 1, 6, 6, 1); __PYX_ERR(0, 45, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_asset_starts_calendar)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_compute_row_slices", 1, 6, 6, 2); __PYX_ERR(0, 45, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_query_start)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_compute_row_slices", 1, 6, 6, 3); __PYX_ERR(0, 45, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_query_end)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_compute_row_slices", 1, 6, 6, 4); __PYX_ERR(0, 45, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_requested_assets)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_compute_row_slices", 1, 6, 6, 5); __PYX_ERR(0, 45, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_compute_row_slices") < 0)) __PYX_ERR(0, 45, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __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_PyInt_As_Py_intptr_t(values[3]); if (unlikely((__pyx_v_query_start == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 48, __pyx_L3_error)
    __pyx_v_query_end = __Pyx_PyInt_As_Py_intptr_t(values[4]); if (unlikely((__pyx_v_query_end == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 49, __pyx_L3_error)
    __pyx_v_requested_assets = ((__pyx_t_7zipline_4data_9_equities_Int64Index_t)values[5]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_compute_row_slices", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 45, __pyx_L3_error)
  __pyx_L3_error:;
  __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, 45, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_asset_ends_absolute), (&PyDict_Type), 1, "asset_ends_absolute", 1))) __PYX_ERR(0, 46, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_asset_starts_calendar), (&PyDict_Type), 1, "asset_starts_calendar", 1))) __PYX_ERR(0, 47, __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;
  __pyx_L0:;
  __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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_compute_row_slices", 0);
  __Pyx_TraceCall("_compute_row_slices (wrapper)", __pyx_f[0], 45, 0, __PYX_ERR(0, 45, __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, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __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_AddTraceback("zipline.data._equities._compute_row_slices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 046:                           dict asset_ends_absolute,
 047:                           dict asset_starts_calendar,
 048:                           intp_t query_start,
 049:                           intp_t query_end,
 050:                           Int64Index_t requested_assets):
 051:     """
 052:     Core indexing functionality for loading raw data from bcolz.
 053: 
 054:     For each asset in requested assets, computes three values:
 055: 
 056:     1.) The index in the raw bcolz data of first row to load.
 057:     2.) The index in the raw bcolz data of the last row to load.
 058:     3.) The index in the dates of our query corresponding to the first row for
 059:         each asset. This is non-zero iff the asset's lifetime begins partway
 060:         through the requested query dates.
 061: 
 062:     Values for unknown sids will be populated with a value of -1.
 063: 
 064:     Parameters
 065:     ----------
 066:     asset_starts_absolute : dict
 067:         Dictionary containing the index of the first row of each asset in the
 068:         bcolz file from which we will query.
 069:     asset_ends_absolute : dict
 070:         Dictionary containing the index of the last row of each asset in the
 071:         bcolz file from which we will query.
 072:     asset_starts_calendar : dict
 073:         Dictionary containing the index of in our calendar corresponding to the
 074:         start date of each asset
 075:     query_start : intp
 076:         Start index in our calendar of the dates for which we're querying.
 077:     query_end : intp
 078:         End index in our calendar of the dates for which we're querying.
 079:     requested_assets : pandas.Int64Index
 080:         The assets for which we want to load data.
 081: 
 082:     Returns
 083:     -------
 084:     first_rows, last_rows, offsets : 3-tuple of ndarrays
 085:     """
 086:     cdef:
+087:         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, 87, __pyx_L1_error)
  __pyx_v_nassets = __pyx_t_1;
 088: 
 089:         # For each sid, we need to compute the following:
+090:         ndarray[dtype=intp_t, ndim=1] first_row_a = full(nassets, -1, dtype=intp)
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_full); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_nassets); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_neg_1);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_intp); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__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 (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 90, __pyx_L1_error)
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_first_row_a.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__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, 90, __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_t_6 = 0;
  __pyx_v_first_row_a = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;
+091:         ndarray[dtype=intp_t, ndim=1] last_row_a = full(nassets, -1, dtype=intp)
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_full); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_nassets); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_neg_1);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_intp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 91, __pyx_L1_error)
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_last_row_a.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__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, 91, __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_t_7 = 0;
  __pyx_v_last_row_a = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
+092:         ndarray[dtype=intp_t, ndim=1] offset_a = full(nassets, -1, dtype=intp)
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_full); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_nassets); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_neg_1);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_intp); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__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 (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 92, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_offset_a.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__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, 92, __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_t_8 = 0;
  __pyx_v_offset_a = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;
 093: 
 094:         # Loop variables.
 095:         intp_t i
 096:         intp_t asset
 097:         intp_t asset_start_data
 098:         intp_t asset_end_data
 099:         intp_t asset_start_calendar
 100:         intp_t asset_end_calendar
 101: 
 102:         # Flag to check whether we should raise an error because we don't know
 103:         # about any of the requested sids.
+104:         uint8_t any_hits = 0
  __pyx_v_any_hits = 0;
 105: 
+106:     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_5 = ((PyObject *)__pyx_v_requested_assets); __Pyx_INCREF(__pyx_t_5); __pyx_t_1 = 0;
    __pyx_t_10 = NULL;
  } else {
    __pyx_t_1 = -1; __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_requested_assets)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 106, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_10 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 106, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_10)) {
      if (likely(PyList_CheckExact(__pyx_t_5))) {
        if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 106, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 106, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 106, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 106, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_10(__pyx_t_5);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 106, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_11 = __Pyx_PyInt_As_Py_intptr_t(__pyx_t_3); if (unlikely((__pyx_t_11 == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 106, __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_5); __pyx_t_5 = 0;
+107:         if asset not in asset_starts_absolute:
    __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_asset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 107, __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, 107, __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, 107, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_13 = (__pyx_t_12 != 0);
    if (__pyx_t_13) {
/* … */
    }
 108:             # This is an unknown asset, leave its slot empty.
+109:             continue
      goto __pyx_L3_continue;
 110: 
+111:         any_hits = 1
    __pyx_v_any_hits = 1;
 112: 
+113:         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, 113, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_asset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __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, 113, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_11 = __Pyx_PyInt_As_Py_intptr_t(__pyx_t_4); if (unlikely((__pyx_t_11 == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 113, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_asset_start_data = __pyx_t_11;
+114:         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, 114, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_asset); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 114, __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, 114, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_11 = __Pyx_PyInt_As_Py_intptr_t(__pyx_t_3); if (unlikely((__pyx_t_11 == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 114, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_asset_end_data = __pyx_t_11;
+115:         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, 115, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_asset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 115, __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, 115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_11 = __Pyx_PyInt_As_Py_intptr_t(__pyx_t_4); if (unlikely((__pyx_t_11 == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_asset_start_calendar = __pyx_t_11;
 116:         asset_end_calendar = (
+117:             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));
 118:         )
 119: 
 120:         # If the asset started during the query, then start with the asset's
 121:         # first row.
 122:         # Otherwise start with the asset's first row + the number of rows
 123:         # before the query on which the asset existed.
+124:         first_row_a[i] = (
    __pyx_t_16 = __pyx_v_i;
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_first_row_a.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_first_row_a.diminfo[0].strides) = (__pyx_v_asset_start_data + __pyx_t_15);
+125:             asset_start_data + max(0, (query_start - asset_start_calendar))
    __pyx_t_11 = (__pyx_v_query_start - __pyx_v_asset_start_calendar);
    __pyx_t_14 = 0;
    if (((__pyx_t_11 > __pyx_t_14) != 0)) {
      __pyx_t_15 = __pyx_t_11;
    } else {
      __pyx_t_15 = __pyx_t_14;
    }
 126:         )
 127:         # If the asset ended during the query, the end with the asset's last
 128:         # row.
 129:         # Otherwise, end with the asset's last row minus the number of rows
 130:         # after the query for which the asset
+131:         last_row_a[i] = (
    __pyx_t_16 = __pyx_v_i;
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_last_row_a.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_last_row_a.diminfo[0].strides) = (__pyx_v_asset_end_data - __pyx_t_14);
+132:             asset_end_data - max(0, asset_end_calendar - query_end)
    __pyx_t_11 = (__pyx_v_asset_end_calendar - __pyx_v_query_end);
    __pyx_t_15 = 0;
    if (((__pyx_t_11 > __pyx_t_15) != 0)) {
      __pyx_t_14 = __pyx_t_11;
    } else {
      __pyx_t_14 = __pyx_t_15;
    }
 133:         )
 134:         # If the asset existed on or before the query, no offset.
 135:         # Otherwise, offset by the number of rows in the query in which the
 136:         # asset did not yet exist.
+137:         offset_a[i] = max(0, asset_start_calendar - query_start)
    __pyx_t_11 = (__pyx_v_asset_start_calendar - __pyx_v_query_start);
    __pyx_t_14 = 0;
    if (((__pyx_t_11 > __pyx_t_14) != 0)) {
      __pyx_t_15 = __pyx_t_11;
    } else {
      __pyx_t_15 = __pyx_t_14;
    }
    __pyx_t_16 = __pyx_v_i;
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_offset_a.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_offset_a.diminfo[0].strides) = __pyx_t_15;
 138: 
+139:     if not any_hits:
  __pyx_t_13 = ((!(__pyx_v_any_hits != 0)) != 0);
  if (unlikely(__pyx_t_13)) {
/* … */
  }
+140:         raise ValueError('At least one valid asset id is required.')
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(0, 140, __pyx_L1_error)
/* … */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_At_least_one_valid_asset_id_is_r); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);
 141: 
+142:     return first_row_a, last_row_a, offset_a
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_first_row_a));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_first_row_a));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_first_row_a));
  __Pyx_INCREF(((PyObject *)__pyx_v_last_row_a));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_last_row_a));
  PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_last_row_a));
  __Pyx_INCREF(((PyObject *)__pyx_v_offset_a));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_offset_a));
  PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)__pyx_v_offset_a));
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;
 143: 
 144: 
 145: @cython.boundscheck(False)
 146: @cython.wraparound(False)
+147: cpdef _read_bcolz_data(ctable_t table,
static PyObject *__pyx_pw_7zipline_4data_9_equities_3_read_bcolz_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*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, PyBoolObject *__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 long __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_TraceDeclarations
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_read_bcolz_data", 0);
  __Pyx_TraceCall("_read_bcolz_data", __pyx_f[0], 147, 0, __PYX_ERR(0, 147, __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_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_20);
  __Pyx_XDECREF(__pyx_t_21);
  { 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_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_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7zipline_4data_9_equities_3_read_bcolz_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __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 PyObject *__pyx_pw_7zipline_4data_9_equities_3_read_bcolz_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  __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 } };
  PyBoolObject *__pyx_v_read_all = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_read_bcolz_data (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_table,&__pyx_n_s_shape,&__pyx_n_s_columns,&__pyx_n_s_first_rows,&__pyx_n_s_last_rows,&__pyx_n_s_offsets,&__pyx_n_s_read_all,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_table)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_read_bcolz_data", 1, 7, 7, 1); __PYX_ERR(0, 147, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_columns)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_read_bcolz_data", 1, 7, 7, 2); __PYX_ERR(0, 147, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_first_rows)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_read_bcolz_data", 1, 7, 7, 3); __PYX_ERR(0, 147, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_last_rows)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_read_bcolz_data", 1, 7, 7, 4); __PYX_ERR(0, 147, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_offsets)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_read_bcolz_data", 1, 7, 7, 5); __PYX_ERR(0, 147, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_read_all)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_read_bcolz_data", 1, 7, 7, 6); __PYX_ERR(0, 147, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_read_bcolz_data") < 0)) __PYX_ERR(0, 147, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
    }
    __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, 150, __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, 151, __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, 152, __pyx_L3_error)
    __pyx_v_read_all = ((PyBoolObject *)values[6]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_read_bcolz_data", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 147, __pyx_L3_error)
  __pyx_L3_error:;
  __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, 148, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_columns), (&PyList_Type), 1, "columns", 1))) __PYX_ERR(0, 149, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_read_all), __pyx_ptype_7cpython_4bool_bool, 1, "read_all", 0))) __PYX_ERR(0, 153, __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;
  __pyx_L0:;
  __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, PyBoolObject *__pyx_v_read_all) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_read_bcolz_data", 0);
  __Pyx_TraceCall("_read_bcolz_data (wrapper)", __pyx_f[0], 147, 0, __PYX_ERR(0, 147, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_v_first_rows.memview)) { __Pyx_RaiseUnboundLocalError("first_rows"); __PYX_ERR(0, 147, __pyx_L1_error) }
  if (unlikely(!__pyx_v_last_rows.memview)) { __Pyx_RaiseUnboundLocalError("last_rows"); __PYX_ERR(0, 147, __pyx_L1_error) }
  if (unlikely(!__pyx_v_offsets.memview)) { __Pyx_RaiseUnboundLocalError("offsets"); __PYX_ERR(0, 147, __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, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __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_AddTraceback("zipline.data._equities._read_bcolz_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_first_rows, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_last_rows, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_offsets, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 148:                        tuple shape,
 149:                        list columns,
 150:                        intp_t[:] first_rows,
 151:                        intp_t[:] last_rows,
 152:                        intp_t[:] offsets,
 153:                        bool read_all):
 154:     """Load raw bcolz data for the given columns and indices.
 155: 
 156:     Parameters
 157:     ----------
 158:     table : bcolz.ctable
 159:         The table from which to read.
 160:     shape : tuple (length 2)
 161:         The shape of the expected output arrays.
 162:     columns : list[str]
 163:         List of column names to read.
 164: 
 165:     first_rows : ndarray[intp]
 166:     last_rows : ndarray[intp]
 167:     offsets : ndarray[intp
 168:         Arrays in the format returned by _compute_row_slices.
 169:     read_all : bool
 170:         Whether to read_all sid data at once, or to read a silce from the
 171:         carray for each sid.
 172: 
 173:     Returns
 174:     -------
 175:     results : list of ndarray
 176:         A 2D array of shape `shape` for each column in `columns`.
 177:     """
 178:     cdef:
 179:         int nassets
 180:         str column_name
 181:         carray_t carray
 182:         ndarray[dtype=uint32_t, ndim=1] raw_data
 183:         ndarray[dtype=uint32_t, ndim=2] outbuf
 184:         ndarray[dtype=uint8_t, ndim=2, cast=True] where_nan
 185:         ndarray[dtype=float64_t, ndim=2] outbuf_as_float
 186:         intp_t asset
 187:         intp_t out_idx
 188:         intp_t raw_idx
 189:         intp_t first_row
 190:         intp_t last_row
 191:         intp_t offset
+192:         list results = []
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_results = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
 193: 
+194:     ndays = shape[0]
  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_1 = PyTuple_GET_ITEM(__pyx_v_shape, 0);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_ndays = __pyx_t_1;
  __pyx_t_1 = 0;
+195:     nassets = shape[1]
  if (unlikely(__pyx_v_shape == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 195, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyInt_As_int(PyTuple_GET_ITEM(__pyx_v_shape, 1)); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L1_error)
  __pyx_v_nassets = __pyx_t_2;
+196:     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 != 0)) != 0);
  if (unlikely(__pyx_t_7)) {
/* … */
  }
+197:         raise ValueError("Incompatible index arrays.")
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __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, 197, __pyx_L1_error)
/* … */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Incompatible_index_arrays); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);
 198: 
+199:     for column_name in columns:
  if (unlikely(__pyx_v_columns == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 199, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_columns; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
  for (;;) {
    if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_9 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_9); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 199, __pyx_L1_error)
    #else
    __pyx_t_9 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 199, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    #endif
    if (!(likely(PyUnicode_CheckExact(__pyx_t_9))||((__pyx_t_9) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_9)->tp_name), 0))) __PYX_ERR(0, 199, __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;
+200:         outbuf = zeros(shape=shape, dtype=uint32)
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 200, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 200, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_shape, __pyx_v_shape) < 0) __PYX_ERR(0, 200, __pyx_L1_error)
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_uint32); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 200, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_11) < 0) __PYX_ERR(0, 200, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_empty_tuple, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 200, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 200, __pyx_L1_error)
    __pyx_t_12 = ((PyArrayObject *)__pyx_t_11);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__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_13, &__pyx_t_14, &__pyx_t_15);
        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_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
        }
        __pyx_t_13 = __pyx_t_14 = __pyx_t_15 = 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, 200, __pyx_L1_error)
    }
    __pyx_t_12 = 0;
    __Pyx_XDECREF_SET(__pyx_v_outbuf, ((PyArrayObject *)__pyx_t_11));
    __pyx_t_11 = 0;
+201:         if read_all:
    __pyx_t_7 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_read_all)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 201, __pyx_L1_error)
    if (__pyx_t_7) {
/* … */
      goto __pyx_L6;
    }
+202:             raw_data = table[column_name][:]
      __pyx_t_11 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_table), __pyx_v_column_name); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 202, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_10 = __Pyx_PyObject_GetSlice(__pyx_t_11, 0, 0, NULL, NULL, &__pyx_slice__3, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 202, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 202, __pyx_L1_error)
      __pyx_t_16 = ((PyArrayObject *)__pyx_t_10);
      {
        __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*)__pyx_t_16, &__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_15, &__pyx_t_14, &__pyx_t_13);
          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_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
          }
          __pyx_t_15 = __pyx_t_14 = __pyx_t_13 = 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, 202, __pyx_L1_error)
      }
      __pyx_t_16 = 0;
      __Pyx_XDECREF_SET(__pyx_v_raw_data, ((PyArrayObject *)__pyx_t_10));
      __pyx_t_10 = 0;
/* … */
  __pyx_slice__3 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__3)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__3);
  __Pyx_GIVEREF(__pyx_slice__3);
 203: 
+204:             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;
+205:                 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]) )));
+206:                 if first_row == -1:
        __pyx_t_7 = ((__pyx_v_first_row == -1L) != 0);
        if (__pyx_t_7) {
/* … */
        }
 207:                     # This is an unknown asset, leave its slot empty.
+208:                     continue
          goto __pyx_L7_continue;
 209: 
+210:                 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]) )));
+211:                 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]) )));
 212: 
+213:                 if first_row <= last_row:
        __pyx_t_7 = ((__pyx_v_first_row <= __pyx_v_last_row) != 0);
        if (__pyx_t_7) {
/* … */
          goto __pyx_L10;
        }
+214:                     outbuf[offset:offset + (last_row + 1 - first_row), asset] =\
          __pyx_t_9 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_offset); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 214, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = __Pyx_PyInt_From_long((__pyx_v_offset + ((__pyx_v_last_row + 1) - __pyx_v_first_row))); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 214, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_20 = PySlice_New(__pyx_t_9, __pyx_t_10, Py_None); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 214, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_20);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_10 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_asset); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 214, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 214, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_20);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_20);
          __Pyx_GIVEREF(__pyx_t_10);
          PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
          __pyx_t_20 = 0;
          __pyx_t_10 = 0;
          if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_outbuf), __pyx_t_9, __pyx_t_11) < 0)) __PYX_ERR(0, 214, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+215:                         raw_data[first_row:last_row + 1]
          __pyx_t_10 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_first_row); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 215, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_11 = __Pyx_PyInt_From_long((__pyx_v_last_row + 1)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 215, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_9 = PySlice_New(__pyx_t_10, __pyx_t_11, Py_None); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 215, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_11 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_raw_data), __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 215, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
 216:                 else:
+217:                     continue
        /*else*/ {
          goto __pyx_L7_continue;
        }
        __pyx_L10:;
        __pyx_L7_continue:;
      }
 218:         else:
+219:             carray = table[column_name]
    /*else*/ {
      __pyx_t_11 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_table), __pyx_v_column_name); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 219, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_XDECREF_SET(__pyx_v_carray, ((__pyx_t_7zipline_4data_9_equities_carray_t)__pyx_t_11));
      __pyx_t_11 = 0;
 220: 
+221:             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;
+222:                 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]) )));
+223:                 if first_row == -1:
        __pyx_t_7 = ((__pyx_v_first_row == -1L) != 0);
        if (__pyx_t_7) {
/* … */
        }
 224:                     # This is an unknown asset, leave its slot empty.
+225:                     continue
          goto __pyx_L11_continue;
 226: 
+227:                 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]) )));
+228:                 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]) )));
+229:                 out_start = offset
        __pyx_v_out_start = __pyx_v_offset;
+230:                 out_end = (last_row - first_row) + offset + 1
        __pyx_v_out_end = (((__pyx_v_last_row - __pyx_v_first_row) + __pyx_v_offset) + 1);
+231:                 if first_row <= last_row:
        __pyx_t_7 = ((__pyx_v_first_row <= __pyx_v_last_row) != 0);
        if (__pyx_t_7) {
/* … */
          goto __pyx_L14;
        }
+232:                     outbuf[offset:offset + (last_row + 1 - first_row), asset] =\
          __pyx_t_9 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_offset); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 232, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = __Pyx_PyInt_From_long((__pyx_v_offset + ((__pyx_v_last_row + 1) - __pyx_v_first_row))); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 232, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_20 = PySlice_New(__pyx_t_9, __pyx_t_10, Py_None); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 232, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_20);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_10 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_asset); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 232, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 232, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_20);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_20);
          __Pyx_GIVEREF(__pyx_t_10);
          PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10);
          __pyx_t_20 = 0;
          __pyx_t_10 = 0;
          if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_outbuf), __pyx_t_9, __pyx_t_11) < 0)) __PYX_ERR(0, 232, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+233:                         carray[first_row:last_row + 1]
          __pyx_t_11 = __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_11)) __PYX_ERR(0, 233, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
 234:                 else:
+235:                     continue
        /*else*/ {
          goto __pyx_L11_continue;
        }
        __pyx_L14:;
        __pyx_L11_continue:;
      }
    }
    __pyx_L6:;
 236: 
+237:         if column_name in {'open', 'high', 'low', 'close'}:
    __Pyx_INCREF(__pyx_v_column_name);
    __pyx_t_21 = __pyx_v_column_name;
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_21, __pyx_n_u_open, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 237, __pyx_L1_error)
    __pyx_t_22 = (__pyx_t_4 != 0);
    if (!__pyx_t_22) {
    } else {
      __pyx_t_7 = __pyx_t_22;
      goto __pyx_L16_bool_binop_done;
    }
    __pyx_t_22 = (__Pyx_PyUnicode_Equals(__pyx_t_21, __pyx_n_u_high, Py_EQ)); if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 237, __pyx_L1_error)
    __pyx_t_4 = (__pyx_t_22 != 0);
    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_21, __pyx_n_u_low, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 237, __pyx_L1_error)
    __pyx_t_22 = (__pyx_t_4 != 0);
    if (!__pyx_t_22) {
    } else {
      __pyx_t_7 = __pyx_t_22;
      goto __pyx_L16_bool_binop_done;
    }
    __pyx_t_22 = (__Pyx_PyUnicode_Equals(__pyx_t_21, __pyx_n_u_close, Py_EQ)); if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 237, __pyx_L1_error)
    __pyx_t_4 = (__pyx_t_22 != 0);
    __pyx_t_7 = __pyx_t_4;
    __pyx_L16_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    __pyx_t_4 = (__pyx_t_7 != 0);
    if (__pyx_t_4) {
/* … */
      goto __pyx_L15;
    }
+238:             where_nan = (outbuf == 0)
      __pyx_t_11 = PyObject_RichCompare(((PyObject *)__pyx_v_outbuf), __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 238, __pyx_L1_error)
      if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 238, __pyx_L1_error)
      __pyx_t_23 = ((PyArrayObject *)__pyx_t_11);
      {
        __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*)__pyx_t_23, &__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_13, &__pyx_t_14, &__pyx_t_15);
          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_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
          }
          __pyx_t_13 = __pyx_t_14 = __pyx_t_15 = 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, 238, __pyx_L1_error)
      }
      __pyx_t_23 = 0;
      __Pyx_XDECREF_SET(__pyx_v_where_nan, ((PyArrayObject *)__pyx_t_11));
      __pyx_t_11 = 0;
+239:             outbuf_as_float = outbuf.astype(float64) * .001
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_outbuf), __pyx_n_s_astype); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 239, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_float64); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 239, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_20 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_20)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_20);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      __pyx_t_11 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_20, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10);
      __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 239, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyNumber_Multiply(__pyx_t_11, __pyx_float__001); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 239, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 239, __pyx_L1_error)
      __pyx_t_24 = ((PyArrayObject *)__pyx_t_9);
      {
        __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*)__pyx_t_24, &__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_15, &__pyx_t_14, &__pyx_t_13);
          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_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
          }
          __pyx_t_15 = __pyx_t_14 = __pyx_t_13 = 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, 239, __pyx_L1_error)
      }
      __pyx_t_24 = 0;
      __Pyx_XDECREF_SET(__pyx_v_outbuf_as_float, ((PyArrayObject *)__pyx_t_9));
      __pyx_t_9 = 0;
+240:             outbuf_as_float[where_nan] = NAN
      __pyx_t_9 = PyFloat_FromDouble(NPY_NAN); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 240, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_outbuf_as_float), ((PyObject *)__pyx_v_where_nan), __pyx_t_9) < 0)) __PYX_ERR(0, 240, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+241:             results.append(outbuf_as_float)
      __pyx_t_25 = __Pyx_PyList_Append(__pyx_v_results, ((PyObject *)__pyx_v_outbuf_as_float)); if (unlikely(__pyx_t_25 == ((int)-1))) __PYX_ERR(0, 241, __pyx_L1_error)
 242:         else:
+243:             results.append(outbuf)
    /*else*/ {
      __pyx_t_25 = __Pyx_PyList_Append(__pyx_v_results, ((PyObject *)__pyx_v_outbuf)); if (unlikely(__pyx_t_25 == ((int)-1))) __PYX_ERR(0, 243, __pyx_L1_error)
    }
    __pyx_L15:;
+244:     return results
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_results);
  __pyx_r = __pyx_v_results;
  goto __pyx_L0;