Generated by Cython 3.0.12

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: _adjustments.c

+001: #
  __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_5) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 002: # Copyright 2015 Quantopian, Inc.
 003: #
 004: # Licensed under the Apache License, Version 2.0 (the "License");
 005: # you may not use this file except in compliance with the License.
 006: # You may obtain a copy of the License at
 007: #
 008: #     http://www.apache.org/licenses/LICENSE-2.0
 009: #
 010: # Unless required by applicable law or agreed to in writing, software
 011: # distributed under the License is distributed on an "AS IS" BASIS,
 012: # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 013: # See the License for the specific language governing permissions and
 014: # limitations under the License.
 015: from cpython cimport (
 016:     bool,
 017:     PyDict_Contains,
 018:     PySet_Add,
 019: )
 020: 
+021: from itertools import chain
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_chain);
  __Pyx_GIVEREF(__pyx_n_s_chain);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_chain)) __PYX_ERR(0, 21, __pyx_L1_error);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_itertools, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_chain); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_chain, __pyx_t_2) < 0) __PYX_ERR(0, 21, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+022: from numpy import (
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_numpy, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_int64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_int64, __pyx_t_3) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_uint32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_uint32, __pyx_t_3) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_zeros, __pyx_t_3) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+023:     int64,
  __pyx_t_3 = PyList_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_int64);
  __Pyx_GIVEREF(__pyx_n_s_int64);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_int64)) __PYX_ERR(0, 23, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_s_uint32);
  __Pyx_GIVEREF(__pyx_n_s_uint32);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_uint32)) __PYX_ERR(0, 23, __pyx_L1_error);
  __Pyx_INCREF(__pyx_n_s_zeros);
  __Pyx_GIVEREF(__pyx_n_s_zeros);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_s_zeros)) __PYX_ERR(0, 23, __pyx_L1_error);
 024:     uint32,
 025:     zeros,
 026: )
 027: from numpy cimport float64_t, int64_t, ndarray
+028: from pandas import Timestamp
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_Timestamp);
  __Pyx_GIVEREF(__pyx_n_s_Timestamp);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Timestamp)) __PYX_ERR(0, 28, __pyx_L1_error);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_pandas, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Timestamp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Timestamp, __pyx_t_2) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 029: 
+030: ctypedef object Timestamp_t
typedef PyObject *__pyx_t_7zipline_4data_12_adjustments_Timestamp_t;
+031: ctypedef object DatetimeIndex_t
typedef PyObject *__pyx_t_7zipline_4data_12_adjustments_DatetimeIndex_t;
 032: ctypedef object Index_t
 033: 
+034: from zipline.lib.adjustment import Float64Multiply
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_Float64Multiply);
  __Pyx_GIVEREF(__pyx_n_s_Float64Multiply);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_Float64Multiply)) __PYX_ERR(0, 34, __pyx_L1_error);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_zipline_lib_adjustment, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Float64Multiply); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Float64Multiply, __pyx_t_3) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+035: from zipline.assets.asset_writer import (
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_zipline_assets_asset_writer, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_SQLITE_MAX_VARIABLE_NUMBER); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SQLITE_MAX_IN_STATEMENT, __pyx_t_2) < 0) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+036:     SQLITE_MAX_VARIABLE_NUMBER as SQLITE_MAX_IN_STATEMENT,
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_SQLITE_MAX_VARIABLE_NUMBER);
  __Pyx_GIVEREF(__pyx_n_s_SQLITE_MAX_VARIABLE_NUMBER);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_SQLITE_MAX_VARIABLE_NUMBER)) __PYX_ERR(0, 36, __pyx_L1_error);
 037: )
+038: from zipline.utils.pandas_utils import timedelta_to_integral_seconds
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_s_timedelta_to_integral_seconds);
  __Pyx_GIVEREF(__pyx_n_s_timedelta_to_integral_seconds);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_timedelta_to_integral_seconds)) __PYX_ERR(0, 38, __pyx_L1_error);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_zipline_utils_pandas_utils, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_timedelta_to_integral_seconds); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_timedelta_to_integral_seconds, __pyx_t_3) < 0) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 039: 
 040: 
+041: _SID_QUERY_TEMPLATE = """
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SID_QUERY_TEMPLATE, __pyx_kp_u_SELECT_DISTINCT_sid_FROM_0_WHER) < 0) __PYX_ERR(0, 41, __pyx_L1_error)
 042: SELECT DISTINCT sid FROM {0}
 043: WHERE effective_date >= ? AND effective_date <= ?
 044: """
+045: cdef dict SID_QUERIES = {
  { /* enter inner scope */
    __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
+046:     tablename: _SID_QUERY_TEMPLATE.format(tablename)
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_SID_QUERY_TEMPLATE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 46, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 46, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      __pyx_t_8 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
          __pyx_t_8 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_7genexpr__pyx_v_7zipline_4data_12_adjustments_tablename};
        __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 46, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      if (unlikely(PyDict_SetItem(__pyx_t_2, (PyObject*)__pyx_7genexpr__pyx_v_7zipline_4data_12_adjustments_tablename, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 46, __pyx_L4_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+047:     for tablename in ('splits', 'dividends', 'mergers')
    __pyx_t_3 = __pyx_tuple__7; __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    for (;;) {
      if (__pyx_t_4 >= 3) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 47, __pyx_L4_error)
      #else
      __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 47, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_XGOTREF(__pyx_7genexpr__pyx_v_7zipline_4data_12_adjustments_tablename);
      __Pyx_DECREF_SET(__pyx_7genexpr__pyx_v_7zipline_4data_12_adjustments_tablename, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __pyx_t_5 = 0;
/* … */
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_7genexpr__pyx_v_7zipline_4data_12_adjustments_tablename);
    __Pyx_DECREF_SET(__pyx_7genexpr__pyx_v_7zipline_4data_12_adjustments_tablename, Py_None);
    goto __pyx_L8_exit_scope;
    __pyx_L4_error:;
    __Pyx_GOTREF(__pyx_7genexpr__pyx_v_7zipline_4data_12_adjustments_tablename);
    __Pyx_DECREF_SET(__pyx_7genexpr__pyx_v_7zipline_4data_12_adjustments_tablename, Py_None);
    goto __pyx_L1_error;
    __pyx_L8_exit_scope:;
  } /* exit inner scope */
  __Pyx_XGOTREF(__pyx_v_7zipline_4data_12_adjustments_SID_QUERIES);
  __Pyx_DECREF_SET(__pyx_v_7zipline_4data_12_adjustments_SID_QUERIES, ((PyObject*)__pyx_t_2));
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
/* … */
  __pyx_tuple__7 = PyTuple_Pack(3, __pyx_n_u_splits, __pyx_n_u_dividends, __pyx_n_u_mergers); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 47, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);
 048: }
 049: 
+050: ADJ_QUERY_TEMPLATE = """
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ADJ_QUERY_TEMPLATE, __pyx_kp_u_SELECT_sid_ratio_effective_date) < 0) __PYX_ERR(0, 50, __pyx_L1_error)
 051: SELECT sid, ratio, effective_date
 052: FROM {0}
 053: WHERE sid IN ({1}) AND effective_date >= {2} AND effective_date <= {3}
 054: """
 055: 
+056: EPOCH = Timestamp(0, tz='UTC')
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Timestamp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_tz, __pyx_n_u_UTC) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__8, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_EPOCH, __pyx_t_5) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* … */
  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);
 057: 
+058: cdef set _get_sids_from_table(object db,
static PyObject *__pyx_f_7zipline_4data_12_adjustments__get_sids_from_table(PyObject *__pyx_v_db, PyObject *__pyx_v_tablename, int __pyx_v_start_date, int __pyx_v_end_date) {
  PyObject *__pyx_v_cursor = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceCall("_get_sids_from_table", __pyx_f[0], 58, 0, __PYX_ERR(0, 58, __pyx_L1_error));
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("zipline.data._adjustments._get_sids_from_table", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cursor);
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 059:                               str tablename,
 060:                               int start_date,
 061:                               int end_date):
 062:     """
 063:     Get the unique sids for all adjustments between start_date and end_date
 064:     from table `tablename`.
 065: 
 066:     Parameters
 067:     ----------
 068:     db : sqlite3.connection
 069:     tablename : str
 070:     start_date : int (seconds since epoch)
 071:     end_date : int (seconds since epoch)
 072: 
 073:     Returns
 074:     -------
 075:     sids : set
 076:         Set of sets
 077:     """
 078: 
+079:     cdef object cursor = db.execute(
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_db, __pyx_n_s_execute); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
+080:         SID_QUERIES[tablename],
  if (unlikely(__pyx_v_7zipline_4data_12_adjustments_SID_QUERIES == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 80, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_7zipline_4data_12_adjustments_SID_QUERIES, __pyx_v_tablename); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
+081:         (start_date, end_date),
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_start_date); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_end_date); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5)) __PYX_ERR(0, 81, __pyx_L1_error);
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_7 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_7 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_6};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_v_cursor = __pyx_t_1;
  __pyx_t_1 = 0;
 082:     )
+083:     cdef set out = set()
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_out = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
 084:     cdef tuple result
+085:     for result in cursor.fetchall():
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_cursor, __pyx_n_s_fetchall); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_7 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_8 = 0;
    __pyx_t_9 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 85, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_9)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 85, __pyx_L1_error)
          #endif
          if (__pyx_t_8 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(0, 85, __pyx_L1_error)
        #else
        __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 85, __pyx_L1_error)
          #endif
          if (__pyx_t_8 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely((0 < 0))) __PYX_ERR(0, 85, __pyx_L1_error)
        #else
        __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_9(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 85, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(0, 85, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_result, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;
/* … */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+086:         PySet_Add(out, result[0])
    if (unlikely(__pyx_v_result == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 86, __pyx_L1_error)
    }
    __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_10 = PySet_Add(__pyx_v_out, __pyx_t_1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 86, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+087:     return out
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_out);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;
 088: 
 089: 
+090: cdef set _get_split_sids(object db, int start_date, int end_date):
static PyObject *__pyx_f_7zipline_4data_12_adjustments__get_split_sids(PyObject *__pyx_v_db, int __pyx_v_start_date, int __pyx_v_end_date) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceCall("_get_split_sids", __pyx_f[0], 90, 0, __PYX_ERR(0, 90, __pyx_L1_error));
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("zipline.data._adjustments._get_split_sids", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+091:     return _get_sids_from_table(db, 'splits', start_date, end_date)
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7zipline_4data_12_adjustments__get_sids_from_table(__pyx_v_db, __pyx_n_u_splits, __pyx_v_start_date, __pyx_v_end_date); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;
 092: 
 093: 
+094: cdef set _get_merger_sids(object db, int start_date, int end_date):
static PyObject *__pyx_f_7zipline_4data_12_adjustments__get_merger_sids(PyObject *__pyx_v_db, int __pyx_v_start_date, int __pyx_v_end_date) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceCall("_get_merger_sids", __pyx_f[0], 94, 0, __PYX_ERR(0, 94, __pyx_L1_error));
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("zipline.data._adjustments._get_merger_sids", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+095:     return _get_sids_from_table(db, 'mergers', start_date, end_date)
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7zipline_4data_12_adjustments__get_sids_from_table(__pyx_v_db, __pyx_n_u_mergers, __pyx_v_start_date, __pyx_v_end_date); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;
 096: 
 097: 
+098: cdef set _get_dividend_sids(object db, int start_date, int end_date):
static PyObject *__pyx_f_7zipline_4data_12_adjustments__get_dividend_sids(PyObject *__pyx_v_db, int __pyx_v_start_date, int __pyx_v_end_date) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceCall("_get_dividend_sids", __pyx_f[0], 98, 0, __PYX_ERR(0, 98, __pyx_L1_error));
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("zipline.data._adjustments._get_dividend_sids", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
+099:     return _get_sids_from_table(db, 'dividends', start_date, end_date)
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7zipline_4data_12_adjustments__get_sids_from_table(__pyx_v_db, __pyx_n_u_dividends, __pyx_v_start_date, __pyx_v_end_date); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;
 100: 
 101: 
+102: cdef _adjustments(object adjustments_db,
static PyObject *__pyx_f_7zipline_4data_12_adjustments__adjustments(PyObject *__pyx_v_adjustments_db, PyObject *__pyx_v_split_sids, PyObject *__pyx_v_merger_sids, PyObject *__pyx_v_dividends_sids, int __pyx_v_start_date, int __pyx_v_end_date, __pyx_t_7zipline_4data_12_adjustments_Index_t __pyx_v_assets) {
  PyObject *__pyx_v_c = NULL;
  PyObject *__pyx_v_splits_to_query = NULL;
  PyObject *__pyx_v_splits_results = NULL;
  PyObject *__pyx_v_query_len = NULL;
  PyObject *__pyx_v_query_assets = NULL;
  PyObject *__pyx_v_t = NULL;
  PyObject *__pyx_v_statement = NULL;
  PyObject *__pyx_v_mergers_to_query = NULL;
  PyObject *__pyx_v_mergers_results = NULL;
  PyObject *__pyx_v_dividends_to_query = NULL;
  PyObject *__pyx_v_dividends_results = NULL;
  PyObject *__pyx_8genexpr1__pyx_v_a = NULL;
  PyObject *__pyx_8genexpr2__pyx_v_a = NULL;
  CYTHON_UNUSED PyObject *__pyx_8genexpr3__pyx_v__ = NULL;
  PyObject *__pyx_8genexpr4__pyx_v_a = NULL;
  PyObject *__pyx_8genexpr5__pyx_v_a = NULL;
  CYTHON_UNUSED PyObject *__pyx_8genexpr6__pyx_v__ = NULL;
  PyObject *__pyx_8genexpr7__pyx_v_a = NULL;
  PyObject *__pyx_8genexpr8__pyx_v_a = NULL;
  CYTHON_UNUSED PyObject *__pyx_8genexpr9__pyx_v__ = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceCall("_adjustments", __pyx_f[0], 102, 0, __PYX_ERR(0, 102, __pyx_L1_error));
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("zipline.data._adjustments._adjustments", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_c);
  __Pyx_XDECREF(__pyx_v_splits_to_query);
  __Pyx_XDECREF(__pyx_v_splits_results);
  __Pyx_XDECREF(__pyx_v_query_len);
  __Pyx_XDECREF(__pyx_v_query_assets);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XDECREF(__pyx_v_statement);
  __Pyx_XDECREF(__pyx_v_mergers_to_query);
  __Pyx_XDECREF(__pyx_v_mergers_results);
  __Pyx_XDECREF(__pyx_v_dividends_to_query);
  __Pyx_XDECREF(__pyx_v_dividends_results);
  __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_a);
  __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_a);
  __Pyx_XDECREF(__pyx_8genexpr3__pyx_v__);
  __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_a);
  __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_a);
  __Pyx_XDECREF(__pyx_8genexpr6__pyx_v__);
  __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_a);
  __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_a);
  __Pyx_XDECREF(__pyx_8genexpr9__pyx_v__);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 103:                   set split_sids,
 104:                   set merger_sids,
 105:                   set dividends_sids,
 106:                   int start_date,
 107:                   int end_date,
 108:                   Index_t assets):
 109: 
+110:     c = adjustments_db.cursor()
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_adjustments_db, __pyx_n_s_cursor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_v_c = __pyx_t_1;
  __pyx_t_1 = 0;
 111: 
+112:     splits_to_query = [str(a) for a in assets if a in split_sids]
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (likely(PyList_CheckExact(((PyObject *)__pyx_v_assets))) || PyTuple_CheckExact(((PyObject *)__pyx_v_assets))) {
      __pyx_t_2 = ((PyObject *)__pyx_v_assets); __Pyx_INCREF(__pyx_t_2);
      __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_assets)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 112, __pyx_L5_error)
    }
    for (;;) {
      if (likely(!__pyx_t_6)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 112, __pyx_L5_error)
            #endif
            if (__pyx_t_5 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 112, __pyx_L5_error)
          #else
          __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 112, __pyx_L5_error)
            #endif
            if (__pyx_t_5 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 112, __pyx_L5_error)
          #else
          __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        }
      } else {
        __pyx_t_3 = __pyx_t_6(__pyx_t_2);
        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, 112, __pyx_L5_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_a, __pyx_t_3);
      __pyx_t_3 = 0;
      if (unlikely(__pyx_v_split_sids == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 112, __pyx_L5_error)
      }
      __pyx_t_7 = (__Pyx_PySet_ContainsTF(__pyx_8genexpr1__pyx_v_a, __pyx_v_split_sids, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 112, __pyx_L5_error)
      if (__pyx_t_7) {
        __pyx_t_3 = __Pyx_PyObject_Unicode(__pyx_8genexpr1__pyx_v_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 112, __pyx_L5_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_a); __pyx_8genexpr1__pyx_v_a = 0;
    goto __pyx_L10_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_a); __pyx_8genexpr1__pyx_v_a = 0;
    goto __pyx_L1_error;
    __pyx_L10_exit_scope:;
  } /* exit inner scope */
  __pyx_v_splits_to_query = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
+113:     splits_results = []
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_splits_results = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
+114:     while splits_to_query:
  while (1) {
    __pyx_t_7 = (PyList_GET_SIZE(__pyx_v_splits_to_query) != 0);
    if (!__pyx_t_7) break;
+115:         query_len = min(len(splits_to_query), SQLITE_MAX_IN_STATEMENT)
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_SQLITE_MAX_IN_STATEMENT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyList_GET_SIZE(__pyx_v_splits_to_query); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 115, __pyx_L1_error)
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 115, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 115, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (__pyx_t_7) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_2 = __pyx_t_1;
    } else {
      __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 115, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = __pyx_t_8;
      __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __pyx_t_2;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_query_len, __pyx_t_1);
    __pyx_t_1 = 0;
+116:         query_assets = splits_to_query[:query_len]
    __Pyx_INCREF(__pyx_v_query_len);
    __pyx_t_1 = __pyx_v_query_len;
    __pyx_t_7 = (__pyx_t_1 == Py_None);
    if (__pyx_t_7) {
      __pyx_t_5 = PY_SSIZE_T_MAX;
    } else {
      __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L1_error)
      __pyx_t_5 = __pyx_t_9;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyList_GetSlice(__pyx_v_splits_to_query, 0, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_query_assets, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;
+117:         t = [str(a) for a in query_assets]
    { /* enter inner scope */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L15_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __pyx_v_query_assets; __Pyx_INCREF(__pyx_t_2);
      __pyx_t_5 = 0;
      for (;;) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 117, __pyx_L15_error)
          #endif
          if (__pyx_t_5 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_8); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 117, __pyx_L15_error)
        #else
        __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 117, __pyx_L15_error)
        __Pyx_GOTREF(__pyx_t_8);
        #endif
        __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_a, __pyx_t_8);
        __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_PyObject_Unicode(__pyx_8genexpr2__pyx_v_a); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 117, __pyx_L15_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 117, __pyx_L15_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_a); __pyx_8genexpr2__pyx_v_a = 0;
      goto __pyx_L19_exit_scope;
      __pyx_L15_error:;
      __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_a); __pyx_8genexpr2__pyx_v_a = 0;
      goto __pyx_L1_error;
      __pyx_L19_exit_scope:;
    } /* exit inner scope */
    __Pyx_XDECREF_SET(__pyx_v_t, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;
+118:         statement = ADJ_QUERY_TEMPLATE.format(
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ADJ_QUERY_TEMPLATE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 118, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 119:             'splits',
+120:             ",".join(['?' for _ in query_assets]),
    { /* enter inner scope */
      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L22_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __pyx_v_query_assets; __Pyx_INCREF(__pyx_t_3);
      __pyx_t_5 = 0;
      for (;;) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 120, __pyx_L22_error)
          #endif
          if (__pyx_t_5 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_10 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_10); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 120, __pyx_L22_error)
        #else
        __pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 120, __pyx_L22_error)
        __Pyx_GOTREF(__pyx_t_10);
        #endif
        __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v__, __pyx_t_10);
        __pyx_t_10 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_kp_u__4))) __PYX_ERR(0, 120, __pyx_L22_error)
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_8genexpr3__pyx_v__); __pyx_8genexpr3__pyx_v__ = 0;
      goto __pyx_L26_exit_scope;
      __pyx_L22_error:;
      __Pyx_XDECREF(__pyx_8genexpr3__pyx_v__); __pyx_8genexpr3__pyx_v__ = 0;
      goto __pyx_L1_error;
      __pyx_L26_exit_scope:;
    } /* exit inner scope */
    __pyx_t_3 = PyUnicode_Join(__pyx_kp_u__3, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+121:             start_date,
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_start_date); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
+122:             end_date,
    __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_end_date); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = NULL;
    __pyx_t_4 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_4 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[5] = {__pyx_t_11, __pyx_n_u_splits, __pyx_t_3, __pyx_t_2, __pyx_t_10};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_4, 4+__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_XDECREF_SET(__pyx_v_statement, __pyx_t_1);
    __pyx_t_1 = 0;
 123:         )
+124:         c.execute(statement, t)
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_c, __pyx_n_s_execute); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = NULL;
    __pyx_t_4 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_4 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_10, __pyx_v_statement, __pyx_v_t};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+125:         splits_to_query = splits_to_query[query_len:]
    __Pyx_INCREF(__pyx_v_query_len);
    __pyx_t_1 = __pyx_v_query_len;
    __pyx_t_7 = (__pyx_t_1 == Py_None);
    if (__pyx_t_7) {
      __pyx_t_5 = 0;
    } else {
      __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L1_error)
      __pyx_t_5 = __pyx_t_9;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyList_GetSlice(__pyx_v_splits_to_query, __pyx_t_5, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_splits_to_query, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;
+126:         splits_results.extend(c.fetchall())
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_c, __pyx_n_s_fetchall); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = NULL;
    __pyx_t_4 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_4 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __pyx_t_12 = __Pyx_PyList_Extend(__pyx_v_splits_results, __pyx_t_1); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 126, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
 127: 
+128:     mergers_to_query = [str(a) for a in assets if a in merger_sids]
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L29_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (likely(PyList_CheckExact(((PyObject *)__pyx_v_assets))) || PyTuple_CheckExact(((PyObject *)__pyx_v_assets))) {
      __pyx_t_8 = ((PyObject *)__pyx_v_assets); __Pyx_INCREF(__pyx_t_8);
      __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_8 = PyObject_GetIter(((PyObject *)__pyx_v_assets)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 128, __pyx_L29_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 128, __pyx_L29_error)
    }
    for (;;) {
      if (likely(!__pyx_t_6)) {
        if (likely(PyList_CheckExact(__pyx_t_8))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_8);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 128, __pyx_L29_error)
            #endif
            if (__pyx_t_5 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_10 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_5); __Pyx_INCREF(__pyx_t_10); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 128, __pyx_L29_error)
          #else
          __pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_8, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 128, __pyx_L29_error)
          __Pyx_GOTREF(__pyx_t_10);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_8);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 128, __pyx_L29_error)
            #endif
            if (__pyx_t_5 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_5); __Pyx_INCREF(__pyx_t_10); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 128, __pyx_L29_error)
          #else
          __pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_8, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 128, __pyx_L29_error)
          __Pyx_GOTREF(__pyx_t_10);
          #endif
        }
      } else {
        __pyx_t_10 = __pyx_t_6(__pyx_t_8);
        if (unlikely(!__pyx_t_10)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 128, __pyx_L29_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_10);
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr4__pyx_v_a, __pyx_t_10);
      __pyx_t_10 = 0;
      if (unlikely(__pyx_v_merger_sids == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 128, __pyx_L29_error)
      }
      __pyx_t_7 = (__Pyx_PySet_ContainsTF(__pyx_8genexpr4__pyx_v_a, __pyx_v_merger_sids, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 128, __pyx_L29_error)
      if (__pyx_t_7) {
        __pyx_t_10 = __Pyx_PyObject_Unicode(__pyx_8genexpr4__pyx_v_a); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 128, __pyx_L29_error)
        __Pyx_GOTREF(__pyx_t_10);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 128, __pyx_L29_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_a); __pyx_8genexpr4__pyx_v_a = 0;
    goto __pyx_L34_exit_scope;
    __pyx_L29_error:;
    __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_a); __pyx_8genexpr4__pyx_v_a = 0;
    goto __pyx_L1_error;
    __pyx_L34_exit_scope:;
  } /* exit inner scope */
  __pyx_v_mergers_to_query = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
+129:     mergers_results = []
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_mergers_results = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
+130:     while mergers_to_query:
  while (1) {
    __pyx_t_7 = (PyList_GET_SIZE(__pyx_v_mergers_to_query) != 0);
    if (!__pyx_t_7) break;
+131:         query_len = min(len(mergers_to_query), SQLITE_MAX_IN_STATEMENT)
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_SQLITE_MAX_IN_STATEMENT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyList_GET_SIZE(__pyx_v_mergers_to_query); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 131, __pyx_L1_error)
    __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 131, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_10, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 131, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 131, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_7) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_8 = __pyx_t_1;
    } else {
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 131, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = __pyx_t_2;
      __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __pyx_t_8;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_query_len, __pyx_t_1);
    __pyx_t_1 = 0;
+132:         query_assets = mergers_to_query[:query_len]
    __Pyx_INCREF(__pyx_v_query_len);
    __pyx_t_1 = __pyx_v_query_len;
    __pyx_t_7 = (__pyx_t_1 == Py_None);
    if (__pyx_t_7) {
      __pyx_t_5 = PY_SSIZE_T_MAX;
    } else {
      __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L1_error)
      __pyx_t_5 = __pyx_t_9;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyList_GetSlice(__pyx_v_mergers_to_query, 0, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_query_assets, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;
+133:         t = [str(a) for a in query_assets]
    { /* enter inner scope */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L39_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = __pyx_v_query_assets; __Pyx_INCREF(__pyx_t_8);
      __pyx_t_5 = 0;
      for (;;) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_8);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 133, __pyx_L39_error)
          #endif
          if (__pyx_t_5 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 133, __pyx_L39_error)
        #else
        __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_8, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L39_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
        __Pyx_XDECREF_SET(__pyx_8genexpr5__pyx_v_a, __pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_Unicode(__pyx_8genexpr5__pyx_v_a); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L39_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 133, __pyx_L39_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_a); __pyx_8genexpr5__pyx_v_a = 0;
      goto __pyx_L43_exit_scope;
      __pyx_L39_error:;
      __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_a); __pyx_8genexpr5__pyx_v_a = 0;
      goto __pyx_L1_error;
      __pyx_L43_exit_scope:;
    } /* exit inner scope */
    __Pyx_XDECREF_SET(__pyx_v_t, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;
+134:         statement = ADJ_QUERY_TEMPLATE.format(
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_ADJ_QUERY_TEMPLATE); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 134, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
 135:             'mergers',
+136:             ",".join(['?' for _ in query_assets]),
    { /* enter inner scope */
      __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 136, __pyx_L46_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_10 = __pyx_v_query_assets; __Pyx_INCREF(__pyx_t_10);
      __pyx_t_5 = 0;
      for (;;) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_10);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 136, __pyx_L46_error)
          #endif
          if (__pyx_t_5 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 136, __pyx_L46_error)
        #else
        __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_10, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 136, __pyx_L46_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
        __Pyx_XDECREF_SET(__pyx_8genexpr6__pyx_v__, __pyx_t_3);
        __pyx_t_3 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_8, (PyObject*)__pyx_kp_u__4))) __PYX_ERR(0, 136, __pyx_L46_error)
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_8genexpr6__pyx_v__); __pyx_8genexpr6__pyx_v__ = 0;
      goto __pyx_L50_exit_scope;
      __pyx_L46_error:;
      __Pyx_XDECREF(__pyx_8genexpr6__pyx_v__); __pyx_8genexpr6__pyx_v__ = 0;
      goto __pyx_L1_error;
      __pyx_L50_exit_scope:;
    } /* exit inner scope */
    __pyx_t_10 = PyUnicode_Join(__pyx_kp_u__3, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+137:             start_date,
    __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_start_date); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 137, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
+138:             end_date,
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_end_date); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_11 = NULL;
    __pyx_t_4 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_4 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[5] = {__pyx_t_11, __pyx_n_u_mergers, __pyx_t_10, __pyx_t_8, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 4+__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_XDECREF_SET(__pyx_v_statement, __pyx_t_1);
    __pyx_t_1 = 0;
 139:         )
+140:         c.execute(statement, t)
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_c, __pyx_n_s_execute); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    __pyx_t_4 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_4 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_statement, __pyx_v_t};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+141:         mergers_to_query = mergers_to_query[query_len:]
    __Pyx_INCREF(__pyx_v_query_len);
    __pyx_t_1 = __pyx_v_query_len;
    __pyx_t_7 = (__pyx_t_1 == Py_None);
    if (__pyx_t_7) {
      __pyx_t_5 = 0;
    } else {
      __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L1_error)
      __pyx_t_5 = __pyx_t_9;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyList_GetSlice(__pyx_v_mergers_to_query, __pyx_t_5, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_mergers_to_query, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;
+142:         mergers_results.extend(c.fetchall())
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_c, __pyx_n_s_fetchall); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    __pyx_t_4 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_4 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_t_12 = __Pyx_PyList_Extend(__pyx_v_mergers_results, __pyx_t_1); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 142, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
 143: 
+144:     dividends_to_query = [str(a) for a in assets if a in dividends_sids]
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L53_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (likely(PyList_CheckExact(((PyObject *)__pyx_v_assets))) || PyTuple_CheckExact(((PyObject *)__pyx_v_assets))) {
      __pyx_t_2 = ((PyObject *)__pyx_v_assets); __Pyx_INCREF(__pyx_t_2);
      __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_assets)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L53_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 144, __pyx_L53_error)
    }
    for (;;) {
      if (likely(!__pyx_t_6)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 144, __pyx_L53_error)
            #endif
            if (__pyx_t_5 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 144, __pyx_L53_error)
          #else
          __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 144, __pyx_L53_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
            #if !CYTHON_ASSUME_SAFE_MACROS
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 144, __pyx_L53_error)
            #endif
            if (__pyx_t_5 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 144, __pyx_L53_error)
          #else
          __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 144, __pyx_L53_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        }
      } else {
        __pyx_t_3 = __pyx_t_6(__pyx_t_2);
        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, 144, __pyx_L53_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr7__pyx_v_a, __pyx_t_3);
      __pyx_t_3 = 0;
      if (unlikely(__pyx_v_dividends_sids == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 144, __pyx_L53_error)
      }
      __pyx_t_7 = (__Pyx_PySet_ContainsTF(__pyx_8genexpr7__pyx_v_a, __pyx_v_dividends_sids, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 144, __pyx_L53_error)
      if (__pyx_t_7) {
        __pyx_t_3 = __Pyx_PyObject_Unicode(__pyx_8genexpr7__pyx_v_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 144, __pyx_L53_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 144, __pyx_L53_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_a); __pyx_8genexpr7__pyx_v_a = 0;
    goto __pyx_L58_exit_scope;
    __pyx_L53_error:;
    __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_a); __pyx_8genexpr7__pyx_v_a = 0;
    goto __pyx_L1_error;
    __pyx_L58_exit_scope:;
  } /* exit inner scope */
  __pyx_v_dividends_to_query = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
+145:     dividends_results = []
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_dividends_results = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
+146:     while dividends_to_query:
  while (1) {
    __pyx_t_7 = (PyList_GET_SIZE(__pyx_v_dividends_to_query) != 0);
    if (!__pyx_t_7) break;
+147:         query_len = min(len(dividends_to_query), SQLITE_MAX_IN_STATEMENT)
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_SQLITE_MAX_IN_STATEMENT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyList_GET_SIZE(__pyx_v_dividends_to_query); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 147, __pyx_L1_error)
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 147, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 147, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (__pyx_t_7) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_2 = __pyx_t_1;
    } else {
      __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 147, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = __pyx_t_8;
      __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __pyx_t_2;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_query_len, __pyx_t_1);
    __pyx_t_1 = 0;
+148:         query_assets = dividends_to_query[:query_len]
    __Pyx_INCREF(__pyx_v_query_len);
    __pyx_t_1 = __pyx_v_query_len;
    __pyx_t_7 = (__pyx_t_1 == Py_None);
    if (__pyx_t_7) {
      __pyx_t_5 = PY_SSIZE_T_MAX;
    } else {
      __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 148, __pyx_L1_error)
      __pyx_t_5 = __pyx_t_9;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyList_GetSlice(__pyx_v_dividends_to_query, 0, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_query_assets, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;
+149:         t = [str(a) for a in query_assets]
    { /* enter inner scope */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L63_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __pyx_v_query_assets; __Pyx_INCREF(__pyx_t_2);
      __pyx_t_5 = 0;
      for (;;) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 149, __pyx_L63_error)
          #endif
          if (__pyx_t_5 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_8); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 149, __pyx_L63_error)
        #else
        __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 149, __pyx_L63_error)
        __Pyx_GOTREF(__pyx_t_8);
        #endif
        __Pyx_XDECREF_SET(__pyx_8genexpr8__pyx_v_a, __pyx_t_8);
        __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_PyObject_Unicode(__pyx_8genexpr8__pyx_v_a); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 149, __pyx_L63_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 149, __pyx_L63_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_a); __pyx_8genexpr8__pyx_v_a = 0;
      goto __pyx_L67_exit_scope;
      __pyx_L63_error:;
      __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_a); __pyx_8genexpr8__pyx_v_a = 0;
      goto __pyx_L1_error;
      __pyx_L67_exit_scope:;
    } /* exit inner scope */
    __Pyx_XDECREF_SET(__pyx_v_t, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;
+150:         statement = ADJ_QUERY_TEMPLATE.format(
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ADJ_QUERY_TEMPLATE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 150, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 151:             'dividends',
+152:             ",".join(['?' for _ in query_assets]),
    { /* enter inner scope */
      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 152, __pyx_L70_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __pyx_v_query_assets; __Pyx_INCREF(__pyx_t_3);
      __pyx_t_5 = 0;
      for (;;) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 152, __pyx_L70_error)
          #endif
          if (__pyx_t_5 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_10 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_10); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 152, __pyx_L70_error)
        #else
        __pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 152, __pyx_L70_error)
        __Pyx_GOTREF(__pyx_t_10);
        #endif
        __Pyx_XDECREF_SET(__pyx_8genexpr9__pyx_v__, __pyx_t_10);
        __pyx_t_10 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_kp_u__4))) __PYX_ERR(0, 152, __pyx_L70_error)
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_8genexpr9__pyx_v__); __pyx_8genexpr9__pyx_v__ = 0;
      goto __pyx_L74_exit_scope;
      __pyx_L70_error:;
      __Pyx_XDECREF(__pyx_8genexpr9__pyx_v__); __pyx_8genexpr9__pyx_v__ = 0;
      goto __pyx_L1_error;
      __pyx_L74_exit_scope:;
    } /* exit inner scope */
    __pyx_t_3 = PyUnicode_Join(__pyx_kp_u__3, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 152, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+153:             start_date,
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_start_date); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
+154:             end_date,
    __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_end_date); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 154, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = NULL;
    __pyx_t_4 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_4 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[5] = {__pyx_t_11, __pyx_n_u_dividends, __pyx_t_3, __pyx_t_2, __pyx_t_10};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_4, 4+__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_XDECREF_SET(__pyx_v_statement, __pyx_t_1);
    __pyx_t_1 = 0;
 155:         )
+156:         c.execute(statement, t)
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_c, __pyx_n_s_execute); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 156, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = NULL;
    __pyx_t_4 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_4 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_10, __pyx_v_statement, __pyx_v_t};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+157:         dividends_to_query = dividends_to_query[query_len:]
    __Pyx_INCREF(__pyx_v_query_len);
    __pyx_t_1 = __pyx_v_query_len;
    __pyx_t_7 = (__pyx_t_1 == Py_None);
    if (__pyx_t_7) {
      __pyx_t_5 = 0;
    } else {
      __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 157, __pyx_L1_error)
      __pyx_t_5 = __pyx_t_9;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyList_GetSlice(__pyx_v_dividends_to_query, __pyx_t_5, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_dividends_to_query, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;
+158:         dividends_results.extend(c.fetchall())
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_c, __pyx_n_s_fetchall); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 158, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_10 = NULL;
    __pyx_t_4 = 0;
    #if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_4 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, NULL};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __pyx_t_12 = __Pyx_PyList_Extend(__pyx_v_dividends_results, __pyx_t_1); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 158, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
 159: 
+160:     return splits_results, mergers_results, dividends_results
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_splits_results);
  __Pyx_GIVEREF(__pyx_v_splits_results);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_splits_results)) __PYX_ERR(0, 160, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_mergers_results);
  __Pyx_GIVEREF(__pyx_v_mergers_results);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_mergers_results)) __PYX_ERR(0, 160, __pyx_L1_error);
  __Pyx_INCREF(__pyx_v_dividends_results);
  __Pyx_GIVEREF(__pyx_v_dividends_results);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_dividends_results)) __PYX_ERR(0, 160, __pyx_L1_error);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;
 161: 
 162: 
+163: cpdef load_adjustments_from_sqlite(object adjustments_db,
static PyObject *__pyx_pw_7zipline_4data_12_adjustments_1load_adjustments_from_sqlite(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_12_adjustments_load_adjustments_from_sqlite(PyObject *__pyx_v_adjustments_db, __pyx_t_7zipline_4data_12_adjustments_DatetimeIndex_t __pyx_v_dates, __pyx_t_7zipline_4data_12_adjustments_Index_t __pyx_v_assets, PyBoolObject *__pyx_v_should_include_splits, PyBoolObject *__pyx_v_should_include_mergers, PyBoolObject *__pyx_v_should_include_dividends, PyObject *__pyx_v_adjustment_type, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyBoolObject *__pyx_v_should_include_price_adjustments = 0;
  PyBoolObject *__pyx_v_should_include_volume_adjustments = 0;
  int __pyx_v_start_date;
  int __pyx_v_end_date;
  PyObject *__pyx_v_split_sids = 0;
  PyObject *__pyx_v_merger_sids = 0;
  PyObject *__pyx_v_dividend_sids = 0;
  PyObject *__pyx_v_splits = 0;
  PyObject *__pyx_v_mergers = 0;
  PyObject *__pyx_v_dividends = 0;
  PyObject *__pyx_v_price_adjustments = 0;
  PyObject *__pyx_v_volume_adjustments = 0;
  PyObject *__pyx_v_result = 0;
  PyObject *__pyx_v_asset_ixs = 0;
  PyObject *__pyx_v_date_ixs = 0;
  int __pyx_v_i;
  int __pyx_v_dt;
  __pyx_t_5numpy_int64_t __pyx_v_sid;
  __pyx_t_5numpy_float64_t __pyx_v_ratio;
  int __pyx_v_eff_date;
  int __pyx_v_date_loc;
  Py_ssize_t __pyx_v_asset_ix;
  PyArrayObject *__pyx_v__dates_seconds = 0;
  PyObject *__pyx_v_price_adj = NULL;
  PyObject *__pyx_v_volume_adj = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd__dates_seconds;
  __Pyx_Buffer __pyx_pybuffer__dates_seconds;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__5)
  __Pyx_TraceCall("load_adjustments_from_sqlite", __pyx_f[0], 163, 0, __PYX_ERR(0, 163, __pyx_L1_error));
  __Pyx_INCREF((PyObject *)__pyx_v_should_include_mergers);
  __Pyx_INCREF((PyObject *)__pyx_v_should_include_dividends);
  __pyx_pybuffer__dates_seconds.pybuffer.buf = NULL;
  __pyx_pybuffer__dates_seconds.refcount = 0;
  __pyx_pybuffernd__dates_seconds.data = NULL;
  __pyx_pybuffernd__dates_seconds.rcbuffer = &__pyx_pybuffer__dates_seconds;
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_19);
  __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__dates_seconds.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("zipline.data._adjustments.load_adjustments_from_sqlite", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd__dates_seconds.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_should_include_price_adjustments);
  __Pyx_XDECREF((PyObject *)__pyx_v_should_include_volume_adjustments);
  __Pyx_XDECREF(__pyx_v_split_sids);
  __Pyx_XDECREF(__pyx_v_merger_sids);
  __Pyx_XDECREF(__pyx_v_dividend_sids);
  __Pyx_XDECREF(__pyx_v_splits);
  __Pyx_XDECREF(__pyx_v_mergers);
  __Pyx_XDECREF(__pyx_v_dividends);
  __Pyx_XDECREF(__pyx_v_price_adjustments);
  __Pyx_XDECREF(__pyx_v_volume_adjustments);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_asset_ixs);
  __Pyx_XDECREF(__pyx_v_date_ixs);
  __Pyx_XDECREF((PyObject *)__pyx_v__dates_seconds);
  __Pyx_XDECREF(__pyx_v_price_adj);
  __Pyx_XDECREF(__pyx_v_volume_adj);
  __Pyx_XDECREF((PyObject *)__pyx_v_should_include_mergers);
  __Pyx_XDECREF((PyObject *)__pyx_v_should_include_dividends);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7zipline_4data_12_adjustments_1load_adjustments_from_sqlite(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_12_adjustments_load_adjustments_from_sqlite, "\n    Load a dictionary of Adjustment objects from adjustments_db.\n\n    Parameters\n    ----------\n    adjustments_db : sqlite3.Connection\n        Connection to a sqlite3 table in the format written by\n        SQLiteAdjustmentWriter.\n    dates : pd.DatetimeIndex\n        Dates for which adjustments are needed.\n    assets : pd.Index\n        Assets for which adjustments are needed.\n    should_include_splits : bool\n        Whether split adjustments should be included.\n    should_include_mergers : bool\n        Whether merger adjustments should be included.\n    should_include_dividends : bool\n        Whether dividend adjustments should be included.\n    adjustment_type : str\n        Whether price adjustments, volume adjustments, or both, should be\n        included in the output.\n\n    Returns\n    -------\n    adjustments : dict[str -> dict[int -> Adjustment]]\n        A dictionary containing price and/or volume adjustment mappings from\n        index to adjustment objects to apply at that index.\n    ");
static PyMethodDef __pyx_mdef_7zipline_4data_12_adjustments_1load_adjustments_from_sqlite = {"load_adjustments_from_sqlite", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_4data_12_adjustments_1load_adjustments_from_sqlite, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7zipline_4data_12_adjustments_load_adjustments_from_sqlite};
static PyObject *__pyx_pw_7zipline_4data_12_adjustments_1load_adjustments_from_sqlite(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_adjustments_db = 0;
  __pyx_t_7zipline_4data_12_adjustments_DatetimeIndex_t __pyx_v_dates = 0;
  __pyx_t_7zipline_4data_12_adjustments_Index_t __pyx_v_assets = 0;
  PyBoolObject *__pyx_v_should_include_splits = 0;
  PyBoolObject *__pyx_v_should_include_mergers = 0;
  PyBoolObject *__pyx_v_should_include_dividends = 0;
  PyObject *__pyx_v_adjustment_type = 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("load_adjustments_from_sqlite (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_MACROS
  __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 **__pyx_pyargnames[] = {&__pyx_n_s_adjustments_db,&__pyx_n_s_dates,&__pyx_n_s_assets,&__pyx_n_s_should_include_splits,&__pyx_n_s_should_include_mergers,&__pyx_n_s_should_include_dividends,&__pyx_n_s_adjustment_type,0};
  PyObject* values[7] = {0,0,0,0,0,0,0};
    if (__pyx_kwds) {
      Py_ssize_t kw_args;
      switch (__pyx_nargs) {
        case  7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
      switch (__pyx_nargs) {
        case  0:
        if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_adjustments_db)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 163, __pyx_L3_error)
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dates)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 163, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("load_adjustments_from_sqlite", 1, 7, 7, 1); __PYX_ERR(0, 163, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_assets)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 163, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("load_adjustments_from_sqlite", 1, 7, 7, 2); __PYX_ERR(0, 163, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_should_include_splits)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[3]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 163, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("load_adjustments_from_sqlite", 1, 7, 7, 3); __PYX_ERR(0, 163, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_should_include_mergers)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[4]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 163, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("load_adjustments_from_sqlite", 1, 7, 7, 4); __PYX_ERR(0, 163, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_should_include_dividends)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[5]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 163, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("load_adjustments_from_sqlite", 1, 7, 7, 5); __PYX_ERR(0, 163, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_adjustment_type)) != 0)) {
          (void)__Pyx_Arg_NewRef_FASTCALL(values[6]);
          kw_args--;
        }
        else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 163, __pyx_L3_error)
        else {
          __Pyx_RaiseArgtupleInvalid("load_adjustments_from_sqlite", 1, 7, 7, 6); __PYX_ERR(0, 163, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t kwd_pos_args = __pyx_nargs;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "load_adjustments_from_sqlite") < 0)) __PYX_ERR(0, 163, __pyx_L3_error)
      }
    } else if (unlikely(__pyx_nargs != 7)) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
      values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
      values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
      values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
      values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
      values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
      values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
    }
    __pyx_v_adjustments_db = values[0];
    __pyx_v_dates = ((__pyx_t_7zipline_4data_12_adjustments_DatetimeIndex_t)values[1]);
    __pyx_v_assets = ((__pyx_t_7zipline_4data_12_adjustments_Index_t)values[2]);
    __pyx_v_should_include_splits = ((PyBoolObject *)values[3]);
    __pyx_v_should_include_mergers = ((PyBoolObject *)values[4]);
    __pyx_v_should_include_dividends = ((PyBoolObject *)values[5]);
    __pyx_v_adjustment_type = ((PyObject*)values[6]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("load_adjustments_from_sqlite", 1, 7, 7, __pyx_nargs); __PYX_ERR(0, 163, __pyx_L3_error)
  __pyx_L6_skip:;
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_AddTraceback("zipline.data._adjustments.load_adjustments_from_sqlite", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_should_include_splits), __pyx_ptype_7cpython_4bool_bool, 1, "should_include_splits", 0))) __PYX_ERR(0, 166, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_should_include_mergers), __pyx_ptype_7cpython_4bool_bool, 1, "should_include_mergers", 0))) __PYX_ERR(0, 167, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_should_include_dividends), __pyx_ptype_7cpython_4bool_bool, 1, "should_include_dividends", 0))) __PYX_ERR(0, 168, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_adjustment_type), (&PyUnicode_Type), 1, "adjustment_type", 1))) __PYX_ERR(0, 169, __pyx_L1_error)
  __pyx_r = __pyx_pf_7zipline_4data_12_adjustments_load_adjustments_from_sqlite(__pyx_self, __pyx_v_adjustments_db, __pyx_v_dates, __pyx_v_assets, __pyx_v_should_include_splits, __pyx_v_should_include_mergers, __pyx_v_should_include_dividends, __pyx_v_adjustment_type);
  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:;
  {
    Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
      __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
    }
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7zipline_4data_12_adjustments_load_adjustments_from_sqlite(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_adjustments_db, __pyx_t_7zipline_4data_12_adjustments_DatetimeIndex_t __pyx_v_dates, __pyx_t_7zipline_4data_12_adjustments_Index_t __pyx_v_assets, PyBoolObject *__pyx_v_should_include_splits, PyBoolObject *__pyx_v_should_include_mergers, PyBoolObject *__pyx_v_should_include_dividends, PyObject *__pyx_v_adjustment_type) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceFrameInit(__pyx_codeobj__5)
  __Pyx_TraceCall("load_adjustments_from_sqlite (wrapper)", __pyx_f[0], 163, 0, __PYX_ERR(0, 163, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7zipline_4data_12_adjustments_load_adjustments_from_sqlite(__pyx_v_adjustments_db, __pyx_v_dates, __pyx_v_assets, __pyx_v_should_include_splits, __pyx_v_should_include_mergers, __pyx_v_should_include_dividends, __pyx_v_adjustment_type, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __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._adjustments.load_adjustments_from_sqlite", __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;
}
/* … */
  __pyx_tuple__9 = PyTuple_Pack(7, __pyx_n_s_adjustments_db, __pyx_n_s_dates, __pyx_n_s_assets, __pyx_n_s_should_include_splits, __pyx_n_s_should_include_mergers, __pyx_n_s_should_include_dividends, __pyx_n_s_adjustment_type); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);
/* … */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7zipline_4data_12_adjustments_1load_adjustments_from_sqlite, 0, __pyx_n_s_load_adjustments_from_sqlite, NULL, __pyx_n_s_zipline_data__adjustments, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_load_adjustments_from_sqlite, __pyx_t_5) < 0) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 164:                                    DatetimeIndex_t dates,
 165:                                    Index_t assets,
 166:                                    bool should_include_splits,
 167:                                    bool should_include_mergers,
 168:                                    bool should_include_dividends,
 169:                                    str adjustment_type):
 170:     """
 171:     Load a dictionary of Adjustment objects from adjustments_db.
 172: 
 173:     Parameters
 174:     ----------
 175:     adjustments_db : sqlite3.Connection
 176:         Connection to a sqlite3 table in the format written by
 177:         SQLiteAdjustmentWriter.
 178:     dates : pd.DatetimeIndex
 179:         Dates for which adjustments are needed.
 180:     assets : pd.Index
 181:         Assets for which adjustments are needed.
 182:     should_include_splits : bool
 183:         Whether split adjustments should be included.
 184:     should_include_mergers : bool
 185:         Whether merger adjustments should be included.
 186:     should_include_dividends : bool
 187:         Whether dividend adjustments should be included.
 188:     adjustment_type : str
 189:         Whether price adjustments, volume adjustments, or both, should be
 190:         included in the output.
 191: 
 192:     Returns
 193:     -------
 194:     adjustments : dict[str -> dict[int -> Adjustment]]
 195:         A dictionary containing price and/or volume adjustment mappings from
 196:         index to adjustment objects to apply at that index.
 197:     """
 198: 
+199:     if not (adjustment_type == 'price' or
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_adjustment_type, __pyx_n_u_price, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 199, __pyx_L1_error)
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
/* … */
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {
/* … */
  }
+200:             adjustment_type == 'volume' or
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_adjustment_type, __pyx_n_u_volume, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 200, __pyx_L1_error)
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
+201:             adjustment_type == 'all'):
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_adjustment_type, __pyx_n_u_all, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 201, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
+202:         raise ValueError(
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 202, __pyx_L1_error)
+203:             "%s is not a valid adjustment type.\n"
    __pyx_t_4 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_3, __pyx_kp_u_is_not_a_valid_adjustment_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
 204:             "Valid adjustment types are 'price', 'volume', and 'all'.\n" % (
+205:                 adjustment_type,
    __pyx_t_3 = __Pyx_PyUnicode_Unicode(__pyx_v_adjustment_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
 206:             )
 207:         )
 208: 
 209:     cdef bool should_include_price_adjustments = (
+210:         adjustment_type == 'all' or adjustment_type == 'price'
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_adjustment_type, __pyx_n_u_all, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 210, __pyx_L1_error)
  if (!__pyx_t_2) {
  } else {
    __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 210, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7cpython_4bool_bool)))) __PYX_ERR(0, 210, __pyx_L1_error)
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_adjustment_type, __pyx_n_u_price, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 210, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7cpython_4bool_bool)))) __PYX_ERR(0, 210, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_L7_bool_binop_done:;
  __pyx_v_should_include_price_adjustments = ((PyBoolObject *)__pyx_t_3);
  __pyx_t_3 = 0;
 211:     )
 212:     cdef bool should_include_volume_adjustments = (
+213:         adjustment_type == 'all' or adjustment_type == 'volume'
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_adjustment_type, __pyx_n_u_all, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 213, __pyx_L1_error)
  if (!__pyx_t_2) {
  } else {
    __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 213, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7cpython_4bool_bool)))) __PYX_ERR(0, 213, __pyx_L1_error)
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_adjustment_type, __pyx_n_u_volume, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 213, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7cpython_4bool_bool)))) __PYX_ERR(0, 213, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_L9_bool_binop_done:;
  __pyx_v_should_include_volume_adjustments = ((PyBoolObject *)__pyx_t_3);
  __pyx_t_3 = 0;
 214:     )
 215: 
+216:     if not should_include_price_adjustments:
  __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_should_include_price_adjustments)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 216, __pyx_L1_error)
  __pyx_t_1 = (!__pyx_t_2);
  if (__pyx_t_1) {
/* … */
  }
+217:         should_include_mergers = False
    __Pyx_INCREF(Py_False);
    __Pyx_DECREF_SET(__pyx_v_should_include_mergers, ((PyBoolObject *)Py_False));
+218:         should_include_dividends = False
    __Pyx_INCREF(Py_False);
    __Pyx_DECREF_SET(__pyx_v_should_include_dividends, ((PyBoolObject *)Py_False));
 219: 
+220:     cdef int start_date = timedelta_to_integral_seconds(dates[0] - EPOCH)
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_timedelta_to_integral_seconds); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_dates), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_EPOCH); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyNumber_Subtract(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  __pyx_t_8 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_8 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_7};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_start_date = __pyx_t_9;
+221:     cdef int end_date = timedelta_to_integral_seconds(dates[-1] - EPOCH)
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_timedelta_to_integral_seconds); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = __Pyx_GetItemInt(((PyObject *)__pyx_v_dates), -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_EPOCH); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyNumber_Subtract(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  __pyx_t_8 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_8 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_5};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 221, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_end_date = __pyx_t_9;
 222:     cdef:
 223:         set split_sids
 224:         set merger_sids
 225:         set dividend_sids
 226: 
+227:     if should_include_splits:
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_should_include_splits)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 227, __pyx_L1_error)
  if (__pyx_t_1) {
/* … */
    goto __pyx_L12;
  }
+228:         split_sids = _get_split_sids(
    __pyx_t_3 = __pyx_f_7zipline_4data_12_adjustments__get_split_sids(__pyx_v_adjustments_db, __pyx_v_start_date, __pyx_v_end_date); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 228, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_split_sids = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
 229:             adjustments_db,
 230:             start_date,
 231:             end_date,
 232:         )
 233:     else:
+234:         split_sids = set()
  /*else*/ {
    __pyx_t_3 = PySet_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_split_sids = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L12:;
 235: 
+236:     if should_include_mergers:
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_should_include_mergers)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 236, __pyx_L1_error)
  if (__pyx_t_1) {
/* … */
    goto __pyx_L13;
  }
+237:         merger_sids = _get_merger_sids(
    __pyx_t_3 = __pyx_f_7zipline_4data_12_adjustments__get_merger_sids(__pyx_v_adjustments_db, __pyx_v_start_date, __pyx_v_end_date); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_merger_sids = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
 238:             adjustments_db,
 239:             start_date,
 240:             end_date,
 241:         )
 242:     else:
+243:         merger_sids = set()
  /*else*/ {
    __pyx_t_3 = PySet_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 243, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_merger_sids = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L13:;
 244: 
+245:     if should_include_dividends:
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_should_include_dividends)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 245, __pyx_L1_error)
  if (__pyx_t_1) {
/* … */
    goto __pyx_L14;
  }
+246:         dividend_sids = _get_dividend_sids(
    __pyx_t_3 = __pyx_f_7zipline_4data_12_adjustments__get_dividend_sids(__pyx_v_adjustments_db, __pyx_v_start_date, __pyx_v_end_date); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 246, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_dividend_sids = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
 247:             adjustments_db,
 248:             start_date,
 249:             end_date,
 250:         )
 251:     else:
+252:         dividend_sids = set()
  /*else*/ {
    __pyx_t_3 = PySet_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_dividend_sids = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L14:;
 253: 
 254:     cdef:
 255:         list splits, mergers, dividends
+256:     splits, mergers, dividends = _adjustments(
  __pyx_t_3 = __pyx_f_7zipline_4data_12_adjustments__adjustments(__pyx_v_adjustments_db, __pyx_v_split_sids, __pyx_v_merger_sids, __pyx_v_dividend_sids, __pyx_v_start_date, __pyx_v_end_date, __pyx_v_assets); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 256, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 256, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 256, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 256, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 256, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
    index = 0; __pyx_t_4 = __pyx_t_10(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L15_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    index = 1; __pyx_t_5 = __pyx_t_10(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L15_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 2; __pyx_t_6 = __pyx_t_10(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L15_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_7), 3) < 0) __PYX_ERR(0, 256, __pyx_L1_error)
    __pyx_t_10 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L16_unpacking_done;
    __pyx_L15_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_10 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 256, __pyx_L1_error)
    __pyx_L16_unpacking_done:;
  }
  if (!(likely(PyList_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_4))) __PYX_ERR(0, 256, __pyx_L1_error)
  if (!(likely(PyList_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_5))) __PYX_ERR(0, 256, __pyx_L1_error)
  if (!(likely(PyList_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_6))) __PYX_ERR(0, 256, __pyx_L1_error)
  __pyx_v_splits = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_v_mergers = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_v_dividends = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;
 257:         adjustments_db,
 258:         split_sids,
 259:         merger_sids,
 260:         dividend_sids,
 261:         start_date,
 262:         end_date,
 263:         assets,
 264:     )
 265: 
+266:     cdef dict price_adjustments = {}
  __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_price_adjustments = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
+267:     cdef dict volume_adjustments = {}
  __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_volume_adjustments = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
+268:     cdef dict result = {}
  __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_result = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
+269:     cdef dict asset_ixs = {}  # Cache sid lookups here.
  __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_asset_ixs = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
+270:     cdef dict date_ixs = {}
  __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_date_ixs = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
 271:     cdef:
 272:         int i
 273:         int dt
 274:         int64_t sid
 275:         float64_t ratio
 276:         int eff_date
 277:         int date_loc
 278:         Py_ssize_t asset_ix
 279:         dict col_adjustments
 280: 
 281:     cdef ndarray[int64_t, ndim=1] _dates_seconds = \
+282:         dates.values.astype('datetime64[s]').view(int64)
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_dates), __pyx_n_s_values); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_astype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_8 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_8 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_kp_u_datetime64_s};
    __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_view); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_int64); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = NULL;
  __pyx_t_8 = 0;
  #if CYTHON_UNPACK_METHODS
  if (likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_8 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_6};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 282, __pyx_L1_error)
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd__dates_seconds.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v__dates_seconds = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd__dates_seconds.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 281, __pyx_L1_error)
    } else {__pyx_pybuffernd__dates_seconds.diminfo[0].strides = __pyx_pybuffernd__dates_seconds.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd__dates_seconds.diminfo[0].shape = __pyx_pybuffernd__dates_seconds.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_11 = 0;
  __pyx_v__dates_seconds = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;
 283: 
 284:     # Pre-populate date index cache.
+285:     for i, dt in enumerate(_dates_seconds):
  __pyx_t_9 = 0;
  if (likely(PyList_CheckExact(((PyObject *)__pyx_v__dates_seconds))) || PyTuple_CheckExact(((PyObject *)__pyx_v__dates_seconds))) {
    __pyx_t_3 = ((PyObject *)__pyx_v__dates_seconds); __Pyx_INCREF(__pyx_t_3);
    __pyx_t_12 = 0;
    __pyx_t_13 = NULL;
  } else {
    __pyx_t_12 = -1; __pyx_t_3 = PyObject_GetIter(((PyObject *)__pyx_v__dates_seconds)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_13 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 285, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_13)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 285, __pyx_L1_error)
          #endif
          if (__pyx_t_12 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely((0 < 0))) __PYX_ERR(0, 285, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 285, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 285, __pyx_L1_error)
          #endif
          if (__pyx_t_12 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely((0 < 0))) __PYX_ERR(0, 285, __pyx_L1_error)
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 285, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_13(__pyx_t_3);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 285, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 285, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_dt = __pyx_t_14;
    __pyx_v_i = __pyx_t_9;
    __pyx_t_9 = (__pyx_t_9 + 1);
/* … */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+286:         date_ixs[dt] = i
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_dt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely((PyDict_SetItem(__pyx_v_date_ixs, __pyx_t_6, __pyx_t_4) < 0))) __PYX_ERR(0, 286, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 287: 
 288:     # splits affect prices and volumes, volumes is the inverse
+289:     for sid, ratio, eff_date in splits:
  if (unlikely(__pyx_v_splits == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 289, __pyx_L1_error)
  }
  __pyx_t_3 = __pyx_v_splits; __Pyx_INCREF(__pyx_t_3);
  __pyx_t_12 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
      #if !CYTHON_ASSUME_SAFE_MACROS
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 289, __pyx_L1_error)
      #endif
      if (__pyx_t_12 >= __pyx_temp) break;
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely((0 < 0))) __PYX_ERR(0, 289, __pyx_L1_error)
    #else
    __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 289, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 289, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 289, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 289, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_15 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 289, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_15);
      index = 0; __pyx_t_6 = __pyx_t_10(__pyx_t_15); if (unlikely(!__pyx_t_6)) goto __pyx_L22_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 1; __pyx_t_5 = __pyx_t_10(__pyx_t_15); if (unlikely(!__pyx_t_5)) goto __pyx_L22_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 2; __pyx_t_7 = __pyx_t_10(__pyx_t_15); if (unlikely(!__pyx_t_7)) goto __pyx_L22_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_15), 3) < 0) __PYX_ERR(0, 289, __pyx_L1_error)
      __pyx_t_10 = NULL;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      goto __pyx_L23_unpacking_done;
      __pyx_L22_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_10 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 289, __pyx_L1_error)
      __pyx_L23_unpacking_done:;
    }
    __pyx_t_16 = __Pyx_PyInt_As_npy_int64(__pyx_t_6); if (unlikely((__pyx_t_16 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_17 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 289, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_sid = __pyx_t_16;
    __pyx_v_ratio = __pyx_t_17;
    __pyx_v_eff_date = __pyx_t_9;
/* … */
    __pyx_L20_continue:;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+290:         if eff_date < start_date:
    __pyx_t_1 = (__pyx_v_eff_date < __pyx_v_start_date);
    if (__pyx_t_1) {
/* … */
    }
+291:             continue
      goto __pyx_L20_continue;
 292: 
+293:         date_loc = _lookup_dt(date_ixs, eff_date, _dates_seconds)
    __pyx_t_4 = __pyx_f_7zipline_4data_12_adjustments__lookup_dt(__pyx_v_date_ixs, __pyx_v_eff_date, ((PyArrayObject *)__pyx_v__dates_seconds)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 293, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 293, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_date_loc = __pyx_t_9;
 294: 
+295:         if not PyDict_Contains(asset_ixs, sid):
    __pyx_t_4 = __Pyx_PyInt_From_npy_int64(__pyx_v_sid); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 295, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = PyDict_Contains(__pyx_v_asset_ixs, __pyx_t_4); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 295, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = (!(__pyx_t_9 != 0));
    if (__pyx_t_1) {
/* … */
    }
+296:             asset_ixs[sid] = assets.get_loc(sid)
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_assets), __pyx_n_s_get_loc); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 296, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = __Pyx_PyInt_From_npy_int64(__pyx_v_sid); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 296, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      __pyx_t_8 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
          __pyx_t_8 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_5};
        __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 296, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __pyx_t_7 = __Pyx_PyInt_From_npy_int64(__pyx_v_sid); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 296, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (unlikely((PyDict_SetItem(__pyx_v_asset_ixs, __pyx_t_7, __pyx_t_4) < 0))) __PYX_ERR(0, 296, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+297:         asset_ix = asset_ixs[sid]
    __pyx_t_4 = __Pyx_PyInt_From_npy_int64(__pyx_v_sid); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 297, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyDict_GetItem(__pyx_v_asset_ixs, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 297, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_18 = __Pyx_PyIndex_AsSsize_t(__pyx_t_7); if (unlikely((__pyx_t_18 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 297, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_asset_ix = __pyx_t_18;
 298: 
+299:         if should_include_price_adjustments:
    __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_should_include_price_adjustments)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 299, __pyx_L1_error)
    if (__pyx_t_1) {
/* … */
    }
+300:             price_adj = Float64Multiply(0, date_loc, asset_ix, asset_ix, ratio)
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Float64Multiply); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 300, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_date_loc); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 300, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_asset_ix); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 300, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_15 = PyInt_FromSsize_t(__pyx_v_asset_ix); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 300, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_19 = PyFloat_FromDouble(__pyx_v_ratio); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 300, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_19);
      __pyx_t_20 = NULL;
      __pyx_t_8 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_20)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_20);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_8 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[6] = {__pyx_t_20, __pyx_int_0, __pyx_t_5, __pyx_t_6, __pyx_t_15, __pyx_t_19};
        __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 5+__pyx_t_8);
        __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 300, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_XDECREF_SET(__pyx_v_price_adj, __pyx_t_7);
      __pyx_t_7 = 0;
+301:             price_adjustments.setdefault(date_loc, []).append(price_adj)
      __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_date_loc); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 301, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 301, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_19 = __Pyx_PyDict_SetDefault(__pyx_v_price_adjustments, __pyx_t_7, __pyx_t_4, -1L); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 301, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_19);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_21 = __Pyx_PyObject_Append(__pyx_t_19, __pyx_v_price_adj); if (unlikely(__pyx_t_21 == ((int)-1))) __PYX_ERR(0, 301, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
 302: 
+303:         if should_include_volume_adjustments:
    __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_should_include_volume_adjustments)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 303, __pyx_L1_error)
    if (__pyx_t_1) {
/* … */
    }
+304:             volume_adj = Float64Multiply(
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Float64Multiply); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 304, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
+305:                 0, date_loc, asset_ix, asset_ix, 1.0 / ratio
      __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_date_loc); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 305, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_15 = PyInt_FromSsize_t(__pyx_v_asset_ix); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 305, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_asset_ix); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 305, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (unlikely(__pyx_v_ratio == 0)) {
        PyErr_SetString(PyExc_ZeroDivisionError, "float division");
        __PYX_ERR(0, 305, __pyx_L1_error)
      }
      __pyx_t_5 = PyFloat_FromDouble((((__pyx_t_5numpy_float64_t)1.0) / __pyx_v_ratio)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 305, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_20 = NULL;
      __pyx_t_8 = 0;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_20)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_20);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_8 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[6] = {__pyx_t_20, __pyx_int_0, __pyx_t_7, __pyx_t_15, __pyx_t_6, __pyx_t_5};
        __pyx_t_19 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 5+__pyx_t_8);
        __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 304, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_19);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_XDECREF_SET(__pyx_v_volume_adj, __pyx_t_19);
      __pyx_t_19 = 0;
 306:             )
+307:             volume_adjustments.setdefault(date_loc, []).append(volume_adj)
      __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_date_loc); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 307, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_19);
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 307, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyDict_SetDefault(__pyx_v_volume_adjustments, __pyx_t_19, __pyx_t_4, -1L); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 307, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_21 = __Pyx_PyObject_Append(__pyx_t_5, __pyx_v_volume_adj); if (unlikely(__pyx_t_21 == ((int)-1))) __PYX_ERR(0, 307, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 308: 
 309:     # mergers and dividends affect prices only
+310:     for sid, ratio, eff_date in chain(mergers, dividends):
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_chain); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = NULL;
  __pyx_t_8 = 0;
  #if CYTHON_UNPACK_METHODS
  if (unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_8 = 1;
    }
  }
  #endif
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_mergers, __pyx_v_dividends};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 310, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_5 = __pyx_t_3; __Pyx_INCREF(__pyx_t_5);
    __pyx_t_12 = 0;
    __pyx_t_13 = NULL;
  } else {
    __pyx_t_12 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 310, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_13 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 310, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(!__pyx_t_13)) {
      if (likely(PyList_CheckExact(__pyx_t_5))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 310, __pyx_L1_error)
          #endif
          if (__pyx_t_12 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_12); __Pyx_INCREF(__pyx_t_3); __pyx_t_12++; if (unlikely((0 < 0))) __PYX_ERR(0, 310, __pyx_L1_error)
        #else
        __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 310, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
          #if !CYTHON_ASSUME_SAFE_MACROS
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 310, __pyx_L1_error)
          #endif
          if (__pyx_t_12 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_12); __Pyx_INCREF(__pyx_t_3); __pyx_t_12++; if (unlikely((0 < 0))) __PYX_ERR(0, 310, __pyx_L1_error)
        #else
        __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 310, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_13(__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, 310, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 310, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_19 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_19 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_19);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_19 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_19);
      __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_15 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 310, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_15);
      index = 0; __pyx_t_4 = __pyx_t_10(__pyx_t_15); if (unlikely(!__pyx_t_4)) goto __pyx_L31_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_19 = __pyx_t_10(__pyx_t_15); if (unlikely(!__pyx_t_19)) goto __pyx_L31_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_19);
      index = 2; __pyx_t_6 = __pyx_t_10(__pyx_t_15); if (unlikely(!__pyx_t_6)) goto __pyx_L31_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_15), 3) < 0) __PYX_ERR(0, 310, __pyx_L1_error)
      __pyx_t_10 = NULL;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      goto __pyx_L32_unpacking_done;
      __pyx_L31_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_10 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 310, __pyx_L1_error)
      __pyx_L32_unpacking_done:;
    }
    __pyx_t_16 = __Pyx_PyInt_As_npy_int64(__pyx_t_4); if (unlikely((__pyx_t_16 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 310, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_19); if (unlikely((__pyx_t_17 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 310, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
    __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 310, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_sid = __pyx_t_16;
    __pyx_v_ratio = __pyx_t_17;
    __pyx_v_eff_date = __pyx_t_9;
/* … */
    __pyx_L29_continue:;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+311:         if eff_date < start_date:
    __pyx_t_1 = (__pyx_v_eff_date < __pyx_v_start_date);
    if (__pyx_t_1) {
/* … */
    }
+312:             continue
      goto __pyx_L29_continue;
 313: 
+314:         date_loc = _lookup_dt(date_ixs, eff_date, _dates_seconds)
    __pyx_t_3 = __pyx_f_7zipline_4data_12_adjustments__lookup_dt(__pyx_v_date_ixs, __pyx_v_eff_date, ((PyArrayObject *)__pyx_v__dates_seconds)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 314, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 314, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_date_loc = __pyx_t_9;
 315: 
+316:         if not PyDict_Contains(asset_ixs, sid):
    __pyx_t_3 = __Pyx_PyInt_From_npy_int64(__pyx_v_sid); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 316, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = PyDict_Contains(__pyx_v_asset_ixs, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 316, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = (!(__pyx_t_9 != 0));
    if (__pyx_t_1) {
/* … */
    }
+317:             asset_ixs[sid] = assets.get_loc(sid)
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_assets), __pyx_n_s_get_loc); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_19 = __Pyx_PyInt_From_npy_int64(__pyx_v_sid); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_19);
      __pyx_t_4 = NULL;
      __pyx_t_8 = 0;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_8 = 1;
        }
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_19};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 317, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __pyx_t_6 = __Pyx_PyInt_From_npy_int64(__pyx_v_sid); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (unlikely((PyDict_SetItem(__pyx_v_asset_ixs, __pyx_t_6, __pyx_t_3) < 0))) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+318:         asset_ix = asset_ixs[sid]
    __pyx_t_3 = __Pyx_PyInt_From_npy_int64(__pyx_v_sid); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_v_asset_ixs, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_18 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_18 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 318, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_asset_ix = __pyx_t_18;
 319: 
+320:         price_adj = Float64Multiply(0, date_loc, asset_ix, asset_ix, ratio)
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Float64Multiply); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_date_loc); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_19);
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_asset_ix); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_15 = PyInt_FromSsize_t(__pyx_v_asset_ix); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_ratio); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_20 = NULL;
    __pyx_t_8 = 0;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_20)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_20);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_8 = 1;
      }
    }
    #endif
    {
      PyObject *__pyx_callargs[6] = {__pyx_t_20, __pyx_int_0, __pyx_t_19, __pyx_t_4, __pyx_t_15, __pyx_t_7};
      __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_8, 5+__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
      __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 320, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_XDECREF_SET(__pyx_v_price_adj, __pyx_t_6);
    __pyx_t_6 = 0;
+321:         price_adjustments.setdefault(date_loc, []).append(price_adj)
    __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_date_loc); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 321, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 321, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __Pyx_PyDict_SetDefault(__pyx_v_price_adjustments, __pyx_t_6, __pyx_t_3, -1L); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 321, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_21 = __Pyx_PyObject_Append(__pyx_t_7, __pyx_v_price_adj); if (unlikely(__pyx_t_21 == ((int)-1))) __PYX_ERR(0, 321, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
 322: 
+323:     if should_include_price_adjustments:
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_should_include_price_adjustments)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 323, __pyx_L1_error)
  if (__pyx_t_1) {
/* … */
  }
+324:         result['price'] = price_adjustments
    if (unlikely((PyDict_SetItem(__pyx_v_result, __pyx_n_u_price, __pyx_v_price_adjustments) < 0))) __PYX_ERR(0, 324, __pyx_L1_error)
+325:     if should_include_volume_adjustments:
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_should_include_volume_adjustments)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 325, __pyx_L1_error)
  if (__pyx_t_1) {
/* … */
  }
+326:         result['volume'] = volume_adjustments
    if (unlikely((PyDict_SetItem(__pyx_v_result, __pyx_n_u_volume, __pyx_v_volume_adjustments) < 0))) __PYX_ERR(0, 326, __pyx_L1_error)
 327: 
+328:     return result
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;
 329: 
 330: 
+331: cdef _lookup_dt(dict dt_cache,
static PyObject *__pyx_f_7zipline_4data_12_adjustments__lookup_dt(PyObject *__pyx_v_dt_cache, int __pyx_v_dt, PyArrayObject *__pyx_v_fallback) {
  __Pyx_LocalBuf_ND __pyx_pybuffernd_fallback;
  __Pyx_Buffer __pyx_pybuffer_fallback;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_TraceCall("_lookup_dt", __pyx_f[0], 331, 0, __PYX_ERR(0, 331, __pyx_L1_error));
  __pyx_pybuffer_fallback.pybuffer.buf = NULL;
  __pyx_pybuffer_fallback.refcount = 0;
  __pyx_pybuffernd_fallback.data = NULL;
  __pyx_pybuffernd_fallback.rcbuffer = &__pyx_pybuffer_fallback;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fallback.rcbuffer->pybuffer, (PyObject*)__pyx_v_fallback, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 331, __pyx_L1_error)
  }
  __pyx_pybuffernd_fallback.diminfo[0].strides = __pyx_pybuffernd_fallback.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fallback.diminfo[0].shape = __pyx_pybuffernd_fallback.rcbuffer->pybuffer.shape[0];
/* … */
  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { 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_fallback.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("zipline.data._adjustments._lookup_dt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fallback.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r, 0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
 332:                 int dt,
 333:                 ndarray[int64_t, ndim=1] fallback):
 334: 
+335:     if not PyDict_Contains(dt_cache, dt):
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_dt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyDict_Contains(__pyx_v_dt_cache, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 335, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!(__pyx_t_2 != 0));
  if (__pyx_t_3) {
/* … */
  }
+336:         dt_cache[dt] = fallback.searchsorted(dt, side='right')
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_fallback), __pyx_n_s_searchsorted); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 336, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_dt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 336, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 336, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4)) __PYX_ERR(0, 336, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 336, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_side, __pyx_n_u_right) < 0) __PYX_ERR(0, 336, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 336, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(__pyx_v_dt_cache == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 336, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_dt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 336, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely((PyDict_SetItem(__pyx_v_dt_cache, __pyx_t_4, __pyx_t_6) < 0))) __PYX_ERR(0, 336, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+337:     return dt_cache[dt]
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_dt_cache == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 337, __pyx_L1_error)
  }
  __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_dt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_dt_cache, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;