Cython: _protocol.pyx

Generated by Cython 3.1.8

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

Raw output: _protocol.c

    +001: #

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

     002: # Copyright 2016 Quantopian, Inc.

     003: #

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

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

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

     007: #

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

     009: #

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

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

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

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

     014: # limitations under the License.

    +015: import warnings

      __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_warnings, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_warnings, __pyx_t_2) < (0)) __PYX_ERR(0, 15, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +016: from contextlib import contextmanager

      __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_contextmanager); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_contextlib, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 16, __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_mstate_global->__pyx_n_u_contextmanager); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_contextmanager, __pyx_t_2) < (0)) __PYX_ERR(0, 16, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +017: from functools import wraps

      __pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_wraps); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_functools, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __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_mstate_global->__pyx_n_u_wraps); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_wraps, __pyx_t_3) < (0)) __PYX_ERR(0, 17, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +018: import pandas as pd

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

    +019: import numpy as np

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

     020:

     021: from cpython cimport bool

    +022: from collections.abc import Iterable

      __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_Iterable); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_collections_abc, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 22, __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_mstate_global->__pyx_n_u_Iterable); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Iterable, __pyx_t_2) < (0)) __PYX_ERR(0, 22, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

     023:

    +024: from zipline.assets import (

      __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_zipline_assets, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __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_mstate_global->__pyx_n_u_PricingDataAssociable); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 24, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_PricingDataAssociable, __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;

    +025:     PricingDataAssociable,

      __pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_PricingDataAssociable); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 25, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);

     026: )

     027: from zipline.assets._assets cimport Asset

    +028: from zipline.assets.continuous_futures import ContinuousFuture

      __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_ContinuousFuture); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_zipline_assets_continuous_future, __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_mstate_global->__pyx_n_u_ContinuousFuture); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_ContinuousFuture, __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: from zipline.zipline_warnings import ZiplineDeprecationWarning

      __pyx_t_3 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_ZiplineDeprecationWarning); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_zipline_zipline_warnings, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __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_mstate_global->__pyx_n_u_ZiplineDeprecationWarning); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_ZiplineDeprecationWarning, __pyx_t_3) < (0)) __PYX_ERR(0, 29, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     030:

    +031: cdef bool _is_iterable(obj):

    static PyLongObject *__pyx_f_7zipline_9_protocol__is_iterable(PyObject *__pyx_v_obj) {
      PyLongObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[39]))
      __Pyx_TraceStartFunc("_is_iterable", __pyx_f[0], 31, 0, 0, 0, __PYX_ERR(0, 31, __pyx_L1_error));
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 31, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline._protocol._is_iterable", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF((PyObject *)__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +032:     return isinstance(obj, Iterable) and not isinstance(obj, str)

      __Pyx_XDECREF((PyObject *)__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Iterable); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_IsInstance(__pyx_v_obj, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 32, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_3) {
      } else {
        __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_7cpython_4bool_bool)))) __PYX_ERR(0, 32, __pyx_L1_error)
        __pyx_t_1 = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L3_bool_binop_done;
      }
      __pyx_t_3 = PyUnicode_Check(__pyx_v_obj);
      __pyx_t_4 = (!__pyx_t_3);
      __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_7cpython_4bool_bool)))) __PYX_ERR(0, 32, __pyx_L1_error)
      __pyx_t_1 = __pyx_t_2;
      __pyx_t_2 = 0;
      __pyx_L3_bool_binop_done:;
      __pyx_r = ((PyLongObject *)__pyx_t_1);
      __pyx_t_1 = 0;
      __Pyx_TraceReturnValue((PyObject *)__pyx_r, 1, 0, __PYX_ERR(0, 32, __pyx_L1_error));
      goto __pyx_L0;

     033:

    +034: cdef class check_parameters:

    struct __pyx_obj_7zipline_9_protocol_check_parameters {
      PyObject_HEAD
      PyObject *keyword_names;
      PyObject *types;
      PyObject *keys_to_types;
    };

     035:     """

     036:     Asserts that the keywords passed into the wrapped function are included

     037:     in those passed into this decorator. If not, raise a TypeError with a

     038:     meaningful message, unlike the one Cython returns by default.

     039:

     040:     Also asserts that the arguments passed into the wrapped function are

     041:     consistent with the types passed into this decorator. If not, raise a

     042:     TypeError with a meaningful message.

     043:     """

     044:     cdef tuple keyword_names

     045:     cdef tuple types

     046:     cdef dict keys_to_types

     047:

    +048:     def __init__(self, keyword_names, types):

    /* Python wrapper */
    static int __pyx_pw_7zipline_9_protocol_16check_parameters_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static int __pyx_pw_7zipline_9_protocol_16check_parameters_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_keyword_names = 0;
      PyObject *__pyx_v_types = 0;
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
      #endif
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_keyword_names,&__pyx_mstate_global->__pyx_n_u_types,0};
      PyObject* values[2] = {0,0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 48, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  2:
            values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 48, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 48, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 48, __pyx_L3_error)
          for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, i); __PYX_ERR(0, 48, __pyx_L3_error) }
          }
        } else if (unlikely(__pyx_nargs != 2)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 48, __pyx_L3_error)
          values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 48, __pyx_L3_error)
        }
        __pyx_v_keyword_names = values[0];
        __pyx_v_types = values[1];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 48, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("zipline._protocol.check_parameters.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return -1;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_7zipline_9_protocol_16check_parameters___init__(((struct __pyx_obj_7zipline_9_protocol_check_parameters *)__pyx_v_self), __pyx_v_keyword_names, __pyx_v_types);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

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

    static int __pyx_pf_7zipline_9_protocol_16check_parameters___init__(struct __pyx_obj_7zipline_9_protocol_check_parameters *__pyx_v_self, PyObject *__pyx_v_keyword_names, PyObject *__pyx_v_types) {
      int __pyx_r;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[40]))
      __Pyx_TraceStartFunc("__init__", __pyx_f[0], 48, 0, 0, 0, __PYX_ERR(0, 48, __pyx_L1_error));
    /* … */
      /* function exit code */
      __pyx_r = 0;
      __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 48, __pyx_L1_error));
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 48, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline._protocol.check_parameters.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +049:         self.keyword_names = keyword_names

      __pyx_t_1 = __pyx_v_keyword_names;
      __Pyx_INCREF(__pyx_t_1);
      if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(0, 49, __pyx_L1_error)
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->keyword_names);
      __Pyx_DECREF(__pyx_v_self->keyword_names);
      __pyx_v_self->keyword_names = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

    +050:         self.types = types

      __pyx_t_1 = __pyx_v_types;
      __Pyx_INCREF(__pyx_t_1);
      if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(0, 50, __pyx_L1_error)
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->types);
      __Pyx_DECREF(__pyx_v_self->types);
      __pyx_v_self->types = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

     051:

    +052:         self.keys_to_types = dict(zip(keyword_names, types))

      __pyx_t_2 = NULL;
      __Pyx_INCREF((PyObject *)(&PyDict_Type));
      __pyx_t_3 = ((PyObject *)(&PyDict_Type));
      __pyx_t_5 = NULL;
      __Pyx_INCREF(__pyx_builtin_zip);
      __pyx_t_6 = __pyx_builtin_zip;
      __pyx_t_7 = 1;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_v_keyword_names, __pyx_v_types};
        __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_7 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->keys_to_types);
      __Pyx_DECREF(__pyx_v_self->keys_to_types);
      __pyx_v_self->keys_to_types = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

     053:

    +054:     def __call__(self, func):

    /* Python wrapper */
    static PyObject *__pyx_pw_7zipline_9_protocol_16check_parameters_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyObject *__pyx_pw_7zipline_9_protocol_16check_parameters_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_func = 0;
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
      #endif
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_func,0};
      PyObject* values[1] = {0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 54, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  1:
            values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 54, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__call__", 0) < (0)) __PYX_ERR(0, 54, __pyx_L3_error)
          for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, i); __PYX_ERR(0, 54, __pyx_L3_error) }
          }
        } else if (unlikely(__pyx_nargs != 1)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 54, __pyx_L3_error)
        }
        __pyx_v_func = values[0];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 54, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("zipline._protocol.check_parameters.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_7zipline_9_protocol_16check_parameters_2__call__(((struct __pyx_obj_7zipline_9_protocol_check_parameters *)__pyx_v_self), __pyx_v_func);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
    static PyObject *__pyx_pf_7zipline_9_protocol_16check_parameters_2__call__(struct __pyx_obj_7zipline_9_protocol_check_parameters *__pyx_v_self, PyObject *__pyx_v_func) {
      struct __pyx_obj_7zipline_9_protocol___pyx_scope_struct____call__ *__pyx_cur_scope;
      PyObject *__pyx_v_assert_keywords_and_call = 0;
      PyObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[42]))
      __pyx_cur_scope = (struct __pyx_obj_7zipline_9_protocol___pyx_scope_struct____call__ *)__pyx_tp_new_7zipline_9_protocol___pyx_scope_struct____call__(__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol___pyx_scope_struct____call__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
      if (unlikely(!__pyx_cur_scope)) {
        __pyx_cur_scope = ((struct __pyx_obj_7zipline_9_protocol___pyx_scope_struct____call__ *)Py_None);
        __Pyx_INCREF(Py_None);
        __PYX_ERR(0, 54, __pyx_L1_error)
      } else {
        __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
      }
      __Pyx_TraceStartFunc("__call__", __pyx_f[0], 54, 0, 0, 0, __PYX_ERR(0, 54, __pyx_L1_error));
      __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
      __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
      __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
      __pyx_cur_scope->__pyx_v_func = __pyx_v_func;
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_func);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_func);
    /* … */
      /* 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_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 54, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline._protocol.check_parameters.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_assert_keywords_and_call);
      __Pyx_DECREF((PyObject *)__pyx_cur_scope);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
    struct __pyx_obj_7zipline_9_protocol___pyx_scope_struct____call__ {
      PyObject_HEAD
      PyObject *__pyx_v_func;
      struct __pyx_obj_7zipline_9_protocol_check_parameters *__pyx_v_self;
    };

    +055:         @wraps(func)

    /* Python wrapper */
    static PyObject *__pyx_pw_7zipline_9_protocol_16check_parameters_8__call___1assert_keywords_and_call(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_7zipline_9_protocol_16check_parameters_8__call___1assert_keywords_and_call = {"assert_keywords_and_call", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_7zipline_9_protocol_16check_parameters_8__call___1assert_keywords_and_call, METH_VARARGS|METH_KEYWORDS, 0};
    static PyObject *__pyx_pw_7zipline_9_protocol_16check_parameters_8__call___1assert_keywords_and_call(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_args = 0;
      PyObject *__pyx_v_kwargs = 0;
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("assert_keywords_and_call (wrapper)", 0);
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
      #endif
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
      if (unlikely(__pyx_kwds_len < 0)) return NULL;
      if (__pyx_kwds_len > 0) {
        if (unlikely(__Pyx_CheckKeywordStrings("assert_keywords_and_call", __pyx_kwds) == -1)) return NULL;
        __pyx_v_kwargs = __Pyx_KwargsAsDict_VARARGS(__pyx_kwds, __pyx_kwvalues);
        if (unlikely(!__pyx_v_kwargs)) return NULL;
        __Pyx_GOTREF(__pyx_v_kwargs);
      } else {
        __pyx_v_kwargs = PyDict_New();
        if (unlikely(!__pyx_v_kwargs)) return NULL;
        __Pyx_GOTREF(__pyx_v_kwargs);
      }
      __Pyx_INCREF(__pyx_args);
      __pyx_v_args = __pyx_args;
      __pyx_r = __pyx_pf_7zipline_9_protocol_16check_parameters_8__call___assert_keywords_and_call(__pyx_self, __pyx_v_args, __pyx_v_kwargs);

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

    static PyObject *__pyx_pf_7zipline_9_protocol_16check_parameters_8__call___assert_keywords_and_call(PyObject *__pyx_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
      struct __pyx_obj_7zipline_9_protocol___pyx_scope_struct____call__ *__pyx_cur_scope;
      struct __pyx_obj_7zipline_9_protocol___pyx_scope_struct____call__ *__pyx_outer_scope;
      short __pyx_v_i;
      PyObject *__pyx_v_field = NULL;
      PyObject *__pyx_v_arg = NULL;
      PyObject *__pyx_v_expected_type = NULL;
      PyObject *__pyx_v_expected_type_name = NULL;
      PyObject *__pyx_v_keyword = NULL;
      PyObject *__pyx_7genexpr__pyx_v_type_ = NULL;
      PyObject *__pyx_8genexpr1__pyx_v_type_ = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[41]))
      __pyx_outer_scope = (struct __pyx_obj_7zipline_9_protocol___pyx_scope_struct____call__ *) __Pyx_CyFunction_GetClosure(__pyx_self);
      __pyx_cur_scope = __pyx_outer_scope;
      __Pyx_TraceStartFunc("assert_keywords_and_call", __pyx_f[0], 55, 0, 0, 0, __PYX_ERR(0, 55, __pyx_L1_error));
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_11);
      __Pyx_XDECREF(__pyx_t_13);
      __Pyx_XDECREF(__pyx_t_19);
      __Pyx_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 55, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline._protocol.check_parameters.__call__.assert_keywords_and_call", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_field);
      __Pyx_XDECREF(__pyx_v_arg);
      __Pyx_XDECREF(__pyx_v_expected_type);
      __Pyx_XDECREF(__pyx_v_expected_type_name);
      __Pyx_XDECREF(__pyx_v_keyword);
      __Pyx_XDECREF(__pyx_7genexpr__pyx_v_type_);
      __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_type_);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_2 = NULL;
      __pyx_t_4 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_wraps); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
        assert(__pyx_t_4);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_func};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7zipline_9_protocol_16check_parameters_8__call___1assert_keywords_and_call, 0, __pyx_mstate_global->__pyx_n_u_call___locals_assert_keywords, ((PyObject*)__pyx_cur_scope), __pyx_mstate_global->__pyx_n_u_zipline__protocol, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[41])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        assert(__pyx_t_2);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_5};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_v_assert_keywords_and_call = __pyx_t_1;
      __pyx_t_1 = 0;

     056:         def assert_keywords_and_call(*args, **kwargs):

     057:             cdef short i

     058:

     059:             # verify all the keyword arguments

    +060:             for field in kwargs:

      __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_kwargs, 1, ((PyObject *)NULL), (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 60, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_1);
      __pyx_t_1 = __pyx_t_5;
      __pyx_t_5 = 0;
      while (1) {
        __pyx_t_6 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, NULL, NULL, __pyx_t_4);
        if (unlikely(__pyx_t_6 == 0)) break;
        if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 60, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_5);
        __pyx_t_5 = 0;

    +061:                 if field not in self.keyword_names:

        if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 61, __pyx_L1_error) }
        __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_v_field, __pyx_cur_scope->__pyx_v_self->keyword_names, Py_NE)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 61, __pyx_L1_error)
        if (unlikely(__pyx_t_7)) {
    /* … */
        }
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +062:                     raise TypeError("%s() got an unexpected keyword argument"

          __pyx_t_8 = NULL;
          __Pyx_INCREF(__pyx_builtin_TypeError);
          __pyx_t_9 = __pyx_builtin_TypeError;
    /* … */
          __pyx_t_13 = __Pyx_PyUnicode_Join(__pyx_t_12, 4, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_11) + 39 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10));
          if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 62, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_14 = 1;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_13};
            __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_14, (2-__pyx_t_14) | (__pyx_t_14*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 62, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
          }
          __Pyx_Raise(__pyx_t_5, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __PYX_ERR(0, 62, __pyx_L1_error)

    +063:                                     " '%s'" % (func.__name__, field))

          if (unlikely(!__pyx_cur_scope->__pyx_v_func)) { __Pyx_RaiseClosureNameError("func"); __PYX_ERR(0, 63, __pyx_L1_error) }
          __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_func, __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 63, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_11 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_10), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 63, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_10 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_v_field), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 63, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_12[0] = __pyx_t_11;
          __pyx_t_12[1] = __pyx_mstate_global->__pyx_kp_u_got_an_unexpected_keyword_argum;
          __pyx_t_12[2] = __pyx_t_10;
          __pyx_t_12[3] = __pyx_mstate_global->__pyx_kp_u_;

     064:

     065:             # verify type of each argument

    +066:             for i, arg in enumerate(args[1:]):

      __pyx_t_15 = 0;
      __pyx_t_1 = __Pyx_PyTuple_GetSlice(__pyx_v_args, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5);
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      for (;;) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 66, __pyx_L1_error)
          #endif
          if (__pyx_t_3 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_3));
        #else
        __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_3);
        #endif
        ++__pyx_t_3;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_v_i = __pyx_t_15;
        __pyx_t_15 = (__pyx_t_15 + 1);
    /* … */
        __pyx_L6_continue:;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    +067:                 expected_type = self.types[i]

        if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 67, __pyx_L1_error) }
        if (unlikely(__pyx_cur_scope->__pyx_v_self->types == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 67, __pyx_L1_error)
        }
        __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_cur_scope->__pyx_v_self->types, __pyx_v_i, short, 1, __Pyx_PyLong_From_short, 0, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_XDECREF_SET(__pyx_v_expected_type, __pyx_t_1);
        __pyx_t_1 = 0;

     068:

    +069:                 if (i == 0 or i == 1) and _is_iterable(arg):

        switch (__pyx_v_i) {
          case 0:
          case 1:
          __pyx_t_16 = 1;
          break;
          default:
          __pyx_t_16 = 0;
          break;
        }
        if (__pyx_t_16) {
        } else {
          __pyx_t_7 = __pyx_t_16;
          goto __pyx_L9_bool_binop_done;
        }
        __pyx_t_1 = ((PyObject *)__pyx_f_7zipline_9_protocol__is_iterable(__pyx_v_arg)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 69, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_7 = __pyx_t_16;
        __pyx_L9_bool_binop_done:;
        if (__pyx_t_7) {
    /* … */
        }

    +070:                     if len(arg) == 0:

          __pyx_t_2 = PyObject_Length(__pyx_v_arg); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 70, __pyx_L1_error)
          __pyx_t_7 = (__pyx_t_2 == 0);
          if (__pyx_t_7) {
    /* … */
          }

    +071:                         continue

            goto __pyx_L6_continue;

    +072:                     arg = arg[0]

          __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_arg, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF_SET(__pyx_v_arg, __pyx_t_1);
          __pyx_t_1 = 0;

     073:

    +074:                 if not isinstance(arg, expected_type):

        __pyx_t_7 = PyObject_IsInstance(__pyx_v_arg, __pyx_v_expected_type); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 74, __pyx_L1_error)
        __pyx_t_16 = (!__pyx_t_7);
        if (unlikely(__pyx_t_16)) {
    /* … */
        }

    +075:                     expected_type_name = expected_type.__name__ \

            __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_expected_type, __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 75, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __pyx_t_1 = __pyx_t_9;
            __pyx_t_9 = 0;
          } else {

    +076:                         if not _is_iterable(expected_type) \

          __pyx_t_9 = ((PyObject *)__pyx_f_7zipline_9_protocol__is_iterable(__pyx_v_expected_type)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 76, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_16 < 0))) __PYX_ERR(0, 76, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_7 = (!__pyx_t_16);
          if (__pyx_t_7) {

    +077:                         else ', '.join([type_.__name__ for type_ in expected_type])

            { /* enter inner scope */
              __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 77, __pyx_L15_error)
              __Pyx_GOTREF(__pyx_t_9);
              if (likely(PyList_CheckExact(__pyx_v_expected_type)) || PyTuple_CheckExact(__pyx_v_expected_type)) {
                __pyx_t_13 = __pyx_v_expected_type; __Pyx_INCREF(__pyx_t_13);
                __pyx_t_2 = 0;
                __pyx_t_17 = NULL;
              } else {
                __pyx_t_2 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_v_expected_type); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 77, __pyx_L15_error)
                __Pyx_GOTREF(__pyx_t_13);
                __pyx_t_17 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_13); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 77, __pyx_L15_error)
              }
              for (;;) {
                if (likely(!__pyx_t_17)) {
                  if (likely(PyList_CheckExact(__pyx_t_13))) {
                    {
                      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_13);
                      #if !CYTHON_ASSUME_SAFE_SIZE
                      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 77, __pyx_L15_error)
                      #endif
                      if (__pyx_t_2 >= __pyx_temp) break;
                    }
                    __pyx_t_8 = __Pyx_PyList_GetItemRef(__pyx_t_13, __pyx_t_2);
                    ++__pyx_t_2;
                  } else {
                    {
                      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_13);
                      #if !CYTHON_ASSUME_SAFE_SIZE
                      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 77, __pyx_L15_error)
                      #endif
                      if (__pyx_t_2 >= __pyx_temp) break;
                    }
                    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                    __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_2));
                    #else
                    __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_13, __pyx_t_2);
                    #endif
                    ++__pyx_t_2;
                  }
                  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 77, __pyx_L15_error)
                } else {
                  __pyx_t_8 = __pyx_t_17(__pyx_t_13);
                  if (unlikely(!__pyx_t_8)) {
                    PyObject* exc_type = PyErr_Occurred();
                    if (exc_type) {
                      if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 77, __pyx_L15_error)
                      PyErr_Clear();
                    }
                    break;
                  }
                }
                __Pyx_GOTREF(__pyx_t_8);
                __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_type_, __pyx_t_8);
                __pyx_t_8 = 0;
                __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_7genexpr__pyx_v_type_, __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 77, __pyx_L15_error)
                __Pyx_GOTREF(__pyx_t_8);
                if (unlikely(__Pyx_ListComp_Append(__pyx_t_9, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 77, __pyx_L15_error)
                __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              }
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
              __Pyx_XDECREF(__pyx_7genexpr__pyx_v_type_); __pyx_7genexpr__pyx_v_type_ = 0;
              goto __pyx_L19_exit_scope;
              __pyx_L15_error:;
              __Pyx_XDECREF(__pyx_7genexpr__pyx_v_type_); __pyx_7genexpr__pyx_v_type_ = 0;
              goto __pyx_L1_error;
              __pyx_L19_exit_scope:;
            } /* exit inner scope */
            __pyx_t_13 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__2, __pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 77, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_13);
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            __pyx_t_1 = __pyx_t_13;
            __pyx_t_13 = 0;
          }
          __pyx_v_expected_type_name = __pyx_t_1;
          __pyx_t_1 = 0;

     078:

    +079:                     raise TypeError("Expected %s argument to be of type %s%s" %

          __pyx_t_13 = NULL;
          __Pyx_INCREF(__pyx_builtin_TypeError);
          __pyx_t_9 = __pyx_builtin_TypeError;
    /* … */
          __pyx_t_19 = __Pyx_PyUnicode_Join(__pyx_t_18, 5, 9 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 24 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_11) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8));
          if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 79, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_19);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_14 = 1;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_t_19};
            __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_14, (2-__pyx_t_14) | (__pyx_t_14*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
          }
          __Pyx_Raise(__pyx_t_1, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __PYX_ERR(0, 79, __pyx_L1_error)

    +080:                                     (self.keyword_names[i],

          if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 80, __pyx_L1_error) }
          if (unlikely(__pyx_cur_scope->__pyx_v_self->keyword_names == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            __PYX_ERR(0, 80, __pyx_L1_error)
          }
          __pyx_t_8 = __Pyx_GetItemInt_Tuple(__pyx_cur_scope->__pyx_v_self->keyword_names, __pyx_v_i, short, 1, __Pyx_PyLong_From_short, 0, 1, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 80, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_10 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_8), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 80, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    +081:                                      'or iterable of type ' if i in (0, 1) else '',

          switch (__pyx_v_i) {
            case 0:
            case 1:
            __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_or_iterable_of_type);
            __Pyx_DECREF(__pyx_t_8);
            __pyx_t_8 = __pyx_mstate_global->__pyx_kp_u_or_iterable_of_type;
            break;
            default:
            __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__3);
            __Pyx_DECREF(__pyx_t_8);
            __pyx_t_8 = __pyx_mstate_global->__pyx_kp_u__3;
            break;
          }
          __pyx_t_11 = __Pyx_PyUnicode_Unicode(__pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 81, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    +082:                                      expected_type_name)

          __pyx_t_8 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_v_expected_type_name), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 82, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_18[0] = __pyx_mstate_global->__pyx_kp_u_Expected;
          __pyx_t_18[1] = __pyx_t_10;
          __pyx_t_18[2] = __pyx_mstate_global->__pyx_kp_u_argument_to_be_of_type;
          __pyx_t_18[3] = __pyx_t_11;
          __pyx_t_18[4] = __pyx_t_8;

     083:                                     )

     084:

     085:             # verify type of each kwarg

    +086:             for keyword, arg in kwargs.items():

      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_dict_iterator(__pyx_v_kwargs, 1, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_2), (&__pyx_t_4)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_5);
      __pyx_t_5 = __pyx_t_1;
      __pyx_t_1 = 0;
      while (1) {
        __pyx_t_6 = __Pyx_dict_iter_next(__pyx_t_5, __pyx_t_2, &__pyx_t_3, &__pyx_t_1, &__pyx_t_9, NULL, __pyx_t_4);
        if (unlikely(__pyx_t_6 == 0)) break;
        if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 86, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_XDECREF_SET(__pyx_v_keyword, __pyx_t_1);
        __pyx_t_1 = 0;
        __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_9);
        __pyx_t_9 = 0;

    +087:                 if keyword in ('assets', 'fields') and _is_iterable(arg):

        __Pyx_INCREF(__pyx_v_keyword);
        __pyx_t_9 = __pyx_v_keyword;
        __pyx_t_20 = (__Pyx_PyUnicode_Equals(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_assets, Py_EQ)); if (unlikely((__pyx_t_20 < 0))) __PYX_ERR(0, 87, __pyx_L1_error)
        if (!__pyx_t_20) {
        } else {
          __pyx_t_16 = __pyx_t_20;
          goto __pyx_L26_bool_binop_done;
        }
        __pyx_t_20 = (__Pyx_PyUnicode_Equals(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_fields, Py_EQ)); if (unlikely((__pyx_t_20 < 0))) __PYX_ERR(0, 87, __pyx_L1_error)
        __pyx_t_16 = __pyx_t_20;
        __pyx_L26_bool_binop_done:;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_20 = __pyx_t_16;
        if (__pyx_t_20) {
        } else {
          __pyx_t_7 = __pyx_t_20;
          goto __pyx_L24_bool_binop_done;
        }
        __pyx_t_9 = ((PyObject *)__pyx_f_7zipline_9_protocol__is_iterable(__pyx_v_arg)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 87, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_20 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_20 < 0))) __PYX_ERR(0, 87, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_7 = __pyx_t_20;
        __pyx_L24_bool_binop_done:;
        if (__pyx_t_7) {
    /* … */
        }

    +088:                     if len(arg) == 0:

          __pyx_t_21 = PyObject_Length(__pyx_v_arg); if (unlikely(__pyx_t_21 == ((Py_ssize_t)-1))) __PYX_ERR(0, 88, __pyx_L1_error)
          __pyx_t_7 = (__pyx_t_21 == 0);
          if (__pyx_t_7) {
    /* … */
          }

    +089:                         continue

            goto __pyx_L21_continue;

    +090:                     arg = arg[0]

          __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_arg, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 90, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF_SET(__pyx_v_arg, __pyx_t_9);
          __pyx_t_9 = 0;

    +091:                 if not isinstance(arg, self.keys_to_types[keyword]):

        if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 91, __pyx_L1_error) }
        if (unlikely(__pyx_cur_scope->__pyx_v_self->keys_to_types == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 91, __pyx_L1_error)
        }
        __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_self->keys_to_types, __pyx_v_keyword); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 91, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_7 = PyObject_IsInstance(__pyx_v_arg, __pyx_t_9); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 91, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_20 = (!__pyx_t_7);
        if (unlikely(__pyx_t_20)) {
    /* … */
        }
        __pyx_L21_continue:;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    +092:                     expected_type = self.keys_to_types[keyword].__name__ \

            if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 92, __pyx_L1_error) }
            if (unlikely(__pyx_cur_scope->__pyx_v_self->keys_to_types == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
              __PYX_ERR(0, 92, __pyx_L1_error)
            }
            __pyx_t_19 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_self->keys_to_types, __pyx_v_keyword); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 92, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_19);
            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_19, __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
            __pyx_t_9 = __pyx_t_1;
            __pyx_t_1 = 0;
          } else {

    +093:                         if not _is_iterable(self.keys_to_types[keyword]) \

          if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 93, __pyx_L1_error) }
          if (unlikely(__pyx_cur_scope->__pyx_v_self->keys_to_types == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
            __PYX_ERR(0, 93, __pyx_L1_error)
          }
          __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_self->keys_to_types, __pyx_v_keyword); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_19 = ((PyObject *)__pyx_f_7zipline_9_protocol__is_iterable(__pyx_t_1)); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 93, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_19);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_20 = __Pyx_PyObject_IsTrue(__pyx_t_19); if (unlikely((__pyx_t_20 < 0))) __PYX_ERR(0, 93, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
          __pyx_t_7 = (!__pyx_t_20);
          if (__pyx_t_7) {

    +094:                         else ', '.join([type_.__name__ for type_ in

            { /* enter inner scope */
              __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L32_error)
              __Pyx_GOTREF(__pyx_t_1);
    /* … */
                __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr1__pyx_v_type_, __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 94, __pyx_L32_error)
                __Pyx_GOTREF(__pyx_t_19);
                if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_19))) __PYX_ERR(0, 94, __pyx_L32_error)
                __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
              }
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
              __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_type_); __pyx_8genexpr1__pyx_v_type_ = 0;
              goto __pyx_L36_exit_scope;
              __pyx_L32_error:;
              __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_type_); __pyx_8genexpr1__pyx_v_type_ = 0;
              goto __pyx_L1_error;
              __pyx_L36_exit_scope:;
            } /* exit inner scope */
            __pyx_t_13 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__2, __pyx_t_1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 94, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_13);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __pyx_t_9 = __pyx_t_13;
            __pyx_t_13 = 0;
          }
          __Pyx_XDECREF_SET(__pyx_v_expected_type, __pyx_t_9);
          __pyx_t_9 = 0;

    +095:                                         self.keys_to_types[keyword]])

              if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 95, __pyx_L32_error) }
              if (unlikely(__pyx_cur_scope->__pyx_v_self->keys_to_types == Py_None)) {
                PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
                __PYX_ERR(0, 95, __pyx_L32_error)
              }
              __pyx_t_19 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_self->keys_to_types, __pyx_v_keyword); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 95, __pyx_L32_error)
              __Pyx_GOTREF(__pyx_t_19);
              if (likely(PyList_CheckExact(__pyx_t_19)) || PyTuple_CheckExact(__pyx_t_19)) {
                __pyx_t_13 = __pyx_t_19; __Pyx_INCREF(__pyx_t_13);
                __pyx_t_21 = 0;
                __pyx_t_17 = NULL;
              } else {
                __pyx_t_21 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_t_19); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 95, __pyx_L32_error)
                __Pyx_GOTREF(__pyx_t_13);
                __pyx_t_17 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_13); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 95, __pyx_L32_error)
              }
              __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
              for (;;) {
                if (likely(!__pyx_t_17)) {
                  if (likely(PyList_CheckExact(__pyx_t_13))) {
                    {
                      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_13);
                      #if !CYTHON_ASSUME_SAFE_SIZE
                      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 95, __pyx_L32_error)
                      #endif
                      if (__pyx_t_21 >= __pyx_temp) break;
                    }
                    __pyx_t_19 = __Pyx_PyList_GetItemRef(__pyx_t_13, __pyx_t_21);
                    ++__pyx_t_21;
                  } else {
                    {
                      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_13);
                      #if !CYTHON_ASSUME_SAFE_SIZE
                      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 95, __pyx_L32_error)
                      #endif
                      if (__pyx_t_21 >= __pyx_temp) break;
                    }
                    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                    __pyx_t_19 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_21));
                    #else
                    __pyx_t_19 = __Pyx_PySequence_ITEM(__pyx_t_13, __pyx_t_21);
                    #endif
                    ++__pyx_t_21;
                  }
                  if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 95, __pyx_L32_error)
                } else {
                  __pyx_t_19 = __pyx_t_17(__pyx_t_13);
                  if (unlikely(!__pyx_t_19)) {
                    PyObject* exc_type = PyErr_Occurred();
                    if (exc_type) {
                      if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 95, __pyx_L32_error)
                      PyErr_Clear();
                    }
                    break;
                  }
                }
                __Pyx_GOTREF(__pyx_t_19);
                __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_type_, __pyx_t_19);
                __pyx_t_19 = 0;

     096:

    +097:                     raise TypeError("Expected %s argument to be of type %s%s" %

          __pyx_t_13 = NULL;
          __Pyx_INCREF(__pyx_builtin_TypeError);
          __pyx_t_1 = __pyx_builtin_TypeError;
    /* … */
          __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_18, 5, 9 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_19) + 24 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_11) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_19) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8));
          if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 97, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_14 = 1;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_t_10};
            __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+__pyx_t_14, (2-__pyx_t_14) | (__pyx_t_14*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 97, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
          }
          __Pyx_Raise(__pyx_t_9, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __PYX_ERR(0, 97, __pyx_L1_error)

    +098:                                     (keyword,

          __pyx_t_19 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_v_keyword), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 98, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_19);

    +099:                                      'or iterable of type ' if keyword in

          __Pyx_INCREF(__pyx_v_keyword);
          __pyx_t_11 = __pyx_v_keyword;
          __pyx_t_20 = (__Pyx_PyUnicode_Equals(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_assets, Py_EQ)); if (unlikely((__pyx_t_20 < 0))) __PYX_ERR(0, 99, __pyx_L1_error)
          if (!__pyx_t_20) {
          } else {
            __pyx_t_7 = __pyx_t_20;
            goto __pyx_L37_bool_binop_done;
          }
          __pyx_t_20 = (__Pyx_PyUnicode_Equals(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_fields, Py_EQ)); if (unlikely((__pyx_t_20 < 0))) __PYX_ERR(0, 99, __pyx_L1_error)
          __pyx_t_7 = __pyx_t_20;
          __pyx_L37_bool_binop_done:;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_20 = __pyx_t_7;
          if (__pyx_t_20) {
            __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_or_iterable_of_type);
            __pyx_t_8 = __pyx_mstate_global->__pyx_kp_u_or_iterable_of_type;
          } else {
            __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__3);
            __pyx_t_8 = __pyx_mstate_global->__pyx_kp_u__3;
          }
          __pyx_t_11 = __Pyx_PyUnicode_Unicode(__pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 99, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

     100:                                                                ('assets', 'fields') else '',

    +101:                                      expected_type)

          __pyx_t_8 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_v_expected_type), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 101, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_18[0] = __pyx_mstate_global->__pyx_kp_u_Expected;
          __pyx_t_18[1] = __pyx_t_19;
          __pyx_t_18[2] = __pyx_mstate_global->__pyx_kp_u_argument_to_be_of_type;
          __pyx_t_18[3] = __pyx_t_11;
          __pyx_t_18[4] = __pyx_t_8;

     102:                                     )

     103:

    +104:             return func(*args, **kwargs)

      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_cur_scope->__pyx_v_func)) { __Pyx_RaiseClosureNameError("func"); __PYX_ERR(0, 104, __pyx_L1_error) }
      __pyx_t_5 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_func, __pyx_v_args, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_9;
      __pyx_t_9 = 0;
      __Pyx_TraceReturnValue(__pyx_r, 161, 0, __PYX_ERR(0, 104, __pyx_L1_error));
      goto __pyx_L0;

     105:

    +106:         return assert_keywords_and_call

      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_assert_keywords_and_call);
      __pyx_r = __pyx_v_assert_keywords_and_call;
      __Pyx_TraceReturnValue(__pyx_r, 5, 0, __PYX_ERR(0, 106, __pyx_L1_error));
      goto __pyx_L0;

     107:

    +108: @contextmanager

    /* Python wrapper */
    static PyObject *__pyx_pw_7zipline_9_protocol_1handle_non_market_minutes(PyObject *__pyx_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    static PyMethodDef __pyx_mdef_7zipline_9_protocol_1handle_non_market_minutes = {"handle_non_market_minutes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_9_protocol_1handle_non_market_minutes, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
    static PyObject *__pyx_pw_7zipline_9_protocol_1handle_non_market_minutes(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_bar_data = 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("handle_non_market_minutes (wrapper)", 0);
      #if !CYTHON_METH_FASTCALL
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
      #endif
      #endif
      __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_bar_data,0};
      PyObject* values[1] = {0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 108, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 108, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "handle_non_market_minutes", 0) < (0)) __PYX_ERR(0, 108, __pyx_L3_error)
          for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("handle_non_market_minutes", 1, 1, 1, i); __PYX_ERR(0, 108, __pyx_L3_error) }
          }
        } else if (unlikely(__pyx_nargs != 1)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 108, __pyx_L3_error)
        }
        __pyx_v_bar_data = values[0];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("handle_non_market_minutes", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 108, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("zipline._protocol.handle_non_market_minutes", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_7zipline_9_protocol_handle_non_market_minutes(__pyx_self, __pyx_v_bar_data);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

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

    static PyObject *__pyx_pf_7zipline_9_protocol_handle_non_market_minutes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_bar_data) {
      struct __pyx_obj_7zipline_9_protocol___pyx_scope_struct_1_handle_non_market_minutes *__pyx_cur_scope;
      PyObject *__pyx_r = NULL;
      __pyx_cur_scope = (struct __pyx_obj_7zipline_9_protocol___pyx_scope_struct_1_handle_non_market_minutes *)__pyx_tp_new_7zipline_9_protocol___pyx_scope_struct_1_handle_non_market_minutes(__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol___pyx_scope_struct_1_handle_non_market_minutes, __pyx_mstate_global->__pyx_empty_tuple, NULL);
      if (unlikely(!__pyx_cur_scope)) {
        __pyx_cur_scope = ((struct __pyx_obj_7zipline_9_protocol___pyx_scope_struct_1_handle_non_market_minutes *)Py_None);
        __Pyx_INCREF(Py_None);
        __PYX_ERR(0, 108, __pyx_L1_error)
      } else {
        __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
      }
      __pyx_cur_scope->__pyx_v_bar_data = __pyx_v_bar_data;
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_bar_data);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_bar_data);
      {
        __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7zipline_9_protocol_2generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[45]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_handle_non_market_minutes, __pyx_mstate_global->__pyx_n_u_handle_non_market_minutes, __pyx_mstate_global->__pyx_n_u_zipline__protocol); if (unlikely(!gen)) __PYX_ERR(0, 108, __pyx_L1_error)
        __Pyx_DECREF(__pyx_cur_scope);
        __Pyx_RefNannyFinishContext();
        return (PyObject *) gen;
      }

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

    static PyObject *__pyx_gb_7zipline_9_protocol_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
    {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("handle_non_market_minutes", 0);
      __Pyx_TraceDeclarationsGen
      __pyx_L3_first_run:;
      __Pyx_TraceStartGen("handle_non_market_minutes", __pyx_f[0], 108, 0, 0, 0, __PYX_ERR(0, 108, __pyx_L1_error));
      if (unlikely(__pyx_sent_value != Py_None)) {
        if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
        __PYX_ERR(0, 108, __pyx_L1_error)
      }
    /* … */
      /* function exit code */
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      if (__Pyx_PyErr_Occurred()) {
        __Pyx_TraceException(__pyx_lineno, 0, 0);
        __Pyx_Generator_Replace_StopIteration(0);
        __Pyx_AddTraceback("handle_non_market_minutes", __pyx_clineno, __pyx_lineno, __pyx_filename);
        __Pyx_TraceExceptionUnwind(0, 0);
      }
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      #if !CYTHON_USE_EXC_INFO_STACK
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      #endif
      __pyx_generator->resume_label = -1;
      __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_3 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_contextmanager); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 108, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7zipline_9_protocol_1handle_non_market_minutes, 0, __pyx_mstate_global->__pyx_n_u_handle_non_market_minutes, NULL, __pyx_mstate_global->__pyx_n_u_zipline__protocol, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[45])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 108, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_handle_non_market_minutes, __pyx_t_2) < (0)) __PYX_ERR(0, 108, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    /* … */
    struct __pyx_obj_7zipline_9_protocol___pyx_scope_struct_1_handle_non_market_minutes {
      PyObject_HEAD
      PyObject *__pyx_v_bar_data;
    };

     109: def handle_non_market_minutes(bar_data):

    +110:     try:

      /*try:*/ {

    +111:         bar_data._handle_non_market_minutes = True

        if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_bar_data, __pyx_mstate_global->__pyx_n_u_handle_non_market_minutes_2, Py_True) < (0)) __PYX_ERR(0, 111, __pyx_L5_error)

    +112:         yield

        __pyx_r = Py_None; __Pyx_INCREF(Py_None);
        __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 112, __pyx_L5_error));
        __Pyx_XGIVEREF(__pyx_r);
        __Pyx_RefNannyFinishContext();
        __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
        /* return from generator, yielding value */
        __pyx_generator->resume_label = 1;
        return __pyx_r;
        __pyx_L7_resume_from_yield:;
        __Pyx_TraceResumeGen("handle_non_market_minutes", __pyx_f[0], 108, 0, __PYX_ERR(0, 112, __pyx_L5_error));
        if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 112, __pyx_L5_error)
      }

     113:     finally:

    +114:         bar_data._handle_non_market_minutes = False

      /*finally:*/ {
        /*normal exit:*/{
          if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_bar_data, __pyx_mstate_global->__pyx_n_u_handle_non_market_minutes_2, Py_False) < (0)) __PYX_ERR(0, 114, __pyx_L1_error)
          goto __pyx_L6;
        }
        __pyx_L5_error:;
        /*exception exit:*/{
          __Pyx_TraceException(__pyx_lineno, 0, 0);
          __Pyx_TraceExceptionHandled(0);
          __Pyx_PyThreadState_assign
          __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0;
           __Pyx_ExceptionSwap(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
          if ( unlikely(__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0)) __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
          __Pyx_XGOTREF(__pyx_t_4);
          __Pyx_XGOTREF(__pyx_t_5);
          __Pyx_XGOTREF(__pyx_t_6);
          __Pyx_XGOTREF(__pyx_t_7);
          __Pyx_XGOTREF(__pyx_t_8);
          __Pyx_XGOTREF(__pyx_t_9);
          __pyx_t_1 = __pyx_lineno; __pyx_t_2 = __pyx_clineno; __pyx_t_3 = __pyx_filename;
          {
            if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_bar_data, __pyx_mstate_global->__pyx_n_u_handle_non_market_minutes_2, Py_False) < (0)) __PYX_ERR(0, 114, __pyx_L9_error)
          }
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
          __Pyx_XGIVEREF(__pyx_t_4);
          __Pyx_XGIVEREF(__pyx_t_5);
          __Pyx_XGIVEREF(__pyx_t_6);
          __Pyx_ErrRestore(__pyx_t_4, __pyx_t_5, __pyx_t_6);
          __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0;
          __pyx_lineno = __pyx_t_1; __pyx_clineno = __pyx_t_2; __pyx_filename = __pyx_t_3;
          __Pyx_TraceException(0, 1, 0);
          goto __pyx_L1_error;
          __pyx_L9_error:;
          __Pyx_XGIVEREF(__pyx_t_7);
          __Pyx_XGIVEREF(__pyx_t_8);
          __Pyx_XGIVEREF(__pyx_t_9);
          __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0;
          goto __pyx_L1_error;
        }
        __pyx_L6:;
      }
      CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
      __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 108, __pyx_L1_error));

     115:

    +116: cdef class BarData:

    struct __pyx_obj_7zipline_9_protocol_BarData {
      PyObject_HEAD
      struct __pyx_vtabstruct_7zipline_9_protocol_BarData *__pyx_vtab;
      PyObject *data_portal;
      PyObject *simulation_dt_func;
      PyObject *data_frequency;
      PyObject *restrictions;
      PyObject *_views;
      PyLongObject *_daily_mode;
      PyObject *_trading_calendar;
      PyObject *_is_restricted;
      PyLongObject *_adjust_minutes;
    };
    /* … */
    struct __pyx_vtabstruct_7zipline_9_protocol_BarData {
      PyObject *(*_get_current_minute)(struct __pyx_obj_7zipline_9_protocol_BarData *);
      PyLongObject *(*_can_trade_for_asset)(struct __pyx_obj_7zipline_9_protocol_BarData *, PyObject *, PyObject *, PyObject *, PyObject *);
      PyLongObject *(*_is_stale_for_asset)(struct __pyx_obj_7zipline_9_protocol_BarData *, PyObject *, PyObject *, PyObject *, PyObject *);
    };
    static struct __pyx_vtabstruct_7zipline_9_protocol_BarData *__pyx_vtabptr_7zipline_9_protocol_BarData;

     117:     """Provides methods for accessing minutely and daily price/volume data from

     118:     Algorithm API functions.

     119:

     120:     Also provides utility methods to determine if an asset is alive, and if it

     121:     has recent trade data.

     122:

     123:     An instance of this object is passed as ``data`` to

     124:     :func:`~zipline.api.handle_data` and

     125:     :func:`~zipline.api.before_trading_start`.

     126:

     127:     Parameters

     128:     ----------

     129:     data_portal : DataPortal

     130:         Provider for bar pricing data.

     131:     simulation_dt_func : callable

     132:         Function which returns the current simulation time.

     133:         This is usually bound to a method of TradingSimulation.

     134:     data_frequency : {'minute', 'daily'}

     135:         The frequency of the bar data; i.e. whether the data is

     136:         daily or minute bars

     137:     restrictions : zipline.finance.asset_restrictions.Restrictions

     138:         Object that combines and returns restricted list information from

     139:         multiple sources

     140:     """

     141:     cdef object data_portal

     142:     cdef object simulation_dt_func

     143:     cdef object data_frequency

     144:     cdef object restrictions

     145:     cdef dict _views

     146:     cdef bool _daily_mode

     147:     cdef object _trading_calendar

     148:     cdef object _is_restricted

     149:

     150:     cdef bool _adjust_minutes

     151:

    +152:     def __init__(self, data_portal, simulation_dt_func, data_frequency,

    /* Python wrapper */
    static int __pyx_pw_7zipline_9_protocol_7BarData_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static int __pyx_pw_7zipline_9_protocol_7BarData_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_data_portal = 0;
      PyObject *__pyx_v_simulation_dt_func = 0;
      PyObject *__pyx_v_data_frequency = 0;
      PyObject *__pyx_v_trading_calendar = 0;
      PyObject *__pyx_v_restrictions = 0;
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
      #endif
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_data_portal,&__pyx_mstate_global->__pyx_n_u_simulation_dt_func,&__pyx_mstate_global->__pyx_n_u_data_frequency,&__pyx_mstate_global->__pyx_n_u_trading_calendar,&__pyx_mstate_global->__pyx_n_u_restrictions,0};
      PyObject* values[5] = {0,0,0,0,0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 152, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  5:
            values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 152, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  4:
            values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 152, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  3:
            values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 152, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 152, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 152, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 152, __pyx_L3_error)
          for (Py_ssize_t i = __pyx_nargs; i < 5; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, i); __PYX_ERR(0, 152, __pyx_L3_error) }
          }
        } else if (unlikely(__pyx_nargs != 5)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 152, __pyx_L3_error)
          values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 152, __pyx_L3_error)
          values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 152, __pyx_L3_error)
          values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 152, __pyx_L3_error)
          values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 152, __pyx_L3_error)
        }
        __pyx_v_data_portal = values[0];
        __pyx_v_simulation_dt_func = values[1];
        __pyx_v_data_frequency = values[2];
        __pyx_v_trading_calendar = values[3];
        __pyx_v_restrictions = values[4];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 152, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("zipline._protocol.BarData.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return -1;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_7zipline_9_protocol_7BarData___init__(((struct __pyx_obj_7zipline_9_protocol_BarData *)__pyx_v_self), __pyx_v_data_portal, __pyx_v_simulation_dt_func, __pyx_v_data_frequency, __pyx_v_trading_calendar, __pyx_v_restrictions);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

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

    static int __pyx_pf_7zipline_9_protocol_7BarData___init__(struct __pyx_obj_7zipline_9_protocol_BarData *__pyx_v_self, PyObject *__pyx_v_data_portal, PyObject *__pyx_v_simulation_dt_func, PyObject *__pyx_v_data_frequency, PyObject *__pyx_v_trading_calendar, PyObject *__pyx_v_restrictions) {
      int __pyx_r;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[46]))
      __Pyx_TraceStartFunc("__init__", __pyx_f[0], 152, 0, 0, 0, __PYX_ERR(0, 152, __pyx_L1_error));
    /* … */
      /* function exit code */
      __pyx_r = 0;
      __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 152, __pyx_L1_error));
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 152, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline._protocol.BarData.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     153:                  trading_calendar, restrictions):

    +154:         self.data_portal = data_portal

      __Pyx_INCREF(__pyx_v_data_portal);
      __Pyx_GIVEREF(__pyx_v_data_portal);
      __Pyx_GOTREF(__pyx_v_self->data_portal);
      __Pyx_DECREF(__pyx_v_self->data_portal);
      __pyx_v_self->data_portal = __pyx_v_data_portal;

    +155:         self.simulation_dt_func = simulation_dt_func

      __Pyx_INCREF(__pyx_v_simulation_dt_func);
      __Pyx_GIVEREF(__pyx_v_simulation_dt_func);
      __Pyx_GOTREF(__pyx_v_self->simulation_dt_func);
      __Pyx_DECREF(__pyx_v_self->simulation_dt_func);
      __pyx_v_self->simulation_dt_func = __pyx_v_simulation_dt_func;

    +156:         self.data_frequency = data_frequency

      __Pyx_INCREF(__pyx_v_data_frequency);
      __Pyx_GIVEREF(__pyx_v_data_frequency);
      __Pyx_GOTREF(__pyx_v_self->data_frequency);
      __Pyx_DECREF(__pyx_v_self->data_frequency);
      __pyx_v_self->data_frequency = __pyx_v_data_frequency;

    +157:         self._views = {}

      __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->_views);
      __Pyx_DECREF(__pyx_v_self->_views);
      __pyx_v_self->_views = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

     158:

    +159:         self._daily_mode = (self.data_frequency == "daily")

      __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->data_frequency, __pyx_mstate_global->__pyx_n_u_daily, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error)
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_7cpython_4bool_bool))))) __PYX_ERR(0, 159, __pyx_L1_error)
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF((PyObject *)__pyx_v_self->_daily_mode);
      __Pyx_DECREF((PyObject *)__pyx_v_self->_daily_mode);
      __pyx_v_self->_daily_mode = ((PyLongObject *)__pyx_t_1);
      __pyx_t_1 = 0;

     160:

    +161:         self._adjust_minutes = False

      __Pyx_INCREF(Py_False);
      __Pyx_GIVEREF(Py_False);
      __Pyx_GOTREF((PyObject *)__pyx_v_self->_adjust_minutes);
      __Pyx_DECREF((PyObject *)__pyx_v_self->_adjust_minutes);
      __pyx_v_self->_adjust_minutes = ((PyLongObject *)Py_False);

     162:

    +163:         self._trading_calendar = trading_calendar

      __Pyx_INCREF(__pyx_v_trading_calendar);
      __Pyx_GIVEREF(__pyx_v_trading_calendar);
      __Pyx_GOTREF(__pyx_v_self->_trading_calendar);
      __Pyx_DECREF(__pyx_v_self->_trading_calendar);
      __pyx_v_self->_trading_calendar = __pyx_v_trading_calendar;

    +164:         self._is_restricted = restrictions.is_restricted

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_restrictions, __pyx_mstate_global->__pyx_n_u_is_restricted); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 164, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->_is_restricted);
      __Pyx_DECREF(__pyx_v_self->_is_restricted);
      __pyx_v_self->_is_restricted = __pyx_t_1;
      __pyx_t_1 = 0;

     165:

    +166:     cdef _get_current_minute(self):

    static PyObject *__pyx_f_7zipline_9_protocol_7BarData__get_current_minute(struct __pyx_obj_7zipline_9_protocol_BarData *__pyx_v_self) {
      PyObject *__pyx_v_dt = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[47]))
      __Pyx_TraceStartFunc("_get_current_minute", __pyx_f[0], 166, 0, 0, 0, __PYX_ERR(0, 166, __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_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 166, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline._protocol.BarData._get_current_minute", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_dt);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     167:         """Internal utility method to get the current simulation time.

     168:

     169:         Possible answers are:

     170:         - whatever the algorithm's get_datetime() method returns (this is what

     171:             `self.simulation_dt_func()` points to)

     172:         - sometimes we're knowingly not in a market minute, like if we're in

     173:             before_trading_start.  In that case, `self._adjust_minutes` is

     174:             True, and we get the previous market minute.

     175:         - if we're in daily mode, get the session label for this minute.

     176:         """

    +177:         dt = self.simulation_dt_func()

      __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_v_self->simulation_dt_func);
      __pyx_t_3 = __pyx_v_self->simulation_dt_func;
      __pyx_t_4 = 1;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        assert(__pyx_t_2);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
        __pyx_t_4 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_v_dt = __pyx_t_1;
      __pyx_t_1 = 0;

     178:

    +179:         if self._adjust_minutes:

      __pyx_t_5 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->_adjust_minutes)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 179, __pyx_L1_error)
      if (__pyx_t_5) {
    /* … */
      }

    +180:             dt = self.data_portal.trading_calendar.previous_minute(dt)

        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->data_portal, __pyx_mstate_global->__pyx_n_u_trading_calendar); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = __pyx_t_2;
        __Pyx_INCREF(__pyx_t_3);
        __pyx_t_4 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_dt};
          __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_previous_minute, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_DECREF_SET(__pyx_v_dt, __pyx_t_1);
        __pyx_t_1 = 0;

     181:

    +182:         if self._daily_mode:

      __pyx_t_5 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->_daily_mode)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 182, __pyx_L1_error)
      if (__pyx_t_5) {
    /* … */
      }

     183:             # if we're in daily mode, take the given dt (which is the last

     184:             # minute of the session) and get the session label for it.

    +185:             dt = self.data_portal.trading_calendar.minute_to_session(dt)

        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->data_portal, __pyx_mstate_global->__pyx_n_u_trading_calendar); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 185, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __pyx_t_3;
        __Pyx_INCREF(__pyx_t_2);
        __pyx_t_4 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_dt};
          __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_minute_to_session, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 185, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_DECREF_SET(__pyx_v_dt, __pyx_t_1);
        __pyx_t_1 = 0;

     186:

    +187:         return dt

      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_dt);
      __pyx_r = __pyx_v_dt;
      __Pyx_TraceReturnValue(__pyx_r, 25, 0, __PYX_ERR(0, 187, __pyx_L1_error));
      goto __pyx_L0;

     188:

    +189:     @check_parameters(('assets', 'fields'),

    /* Python wrapper */
    static PyObject *__pyx_pw_7zipline_9_protocol_7BarData_3current(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    PyDoc_STRVAR(__pyx_doc_7zipline_9_protocol_7BarData_2current, "Returns the \"current\" value of the given fields for the given assets\n        at the current simulation time.\n\n        Parameters\n        ----------\n        assets : zipline.assets.Asset or iterable of zipline.assets.Asset\n            The asset(s) for which data is requested.\n        fields : str or iterable[str].\n            Requested data field(s). Valid field names are: \"price\",\n            \"last_traded\", \"open\", \"high\", \"low\", \"close\", and \"volume\".\n\n        Returns\n        -------\n        current_value : Scalar, pandas Series, or pandas DataFrame.\n            See notes below.\n\n        Notes\n        -----\n        The return type of this function depends on the types of its inputs:\n\n        - If a single asset and a single field are requested, the returned\n          value is a scalar (either a float or a ``pd.Timestamp`` depending on\n          the field).\n\n        - If a single asset and a list of fields are requested, the returned\n          value is a :class:`pd.Series` whose indices are the requested fields.\n\n        - If a list of assets and a single field are requested, the returned\n          value is a :class:`pd.Series` whose indices are the assets.\n\n        - If a list of assets and a list of fields are requested, the returned\n          value is a :class:`pd.DataFrame`.  The columns of the returned frame\n          will be the requested fields, and the index of the frame will be the\n          requested assets.\n\n        The values produced for ``fields`` are as follows:\n\n        - Requesting \"price\" produces the last known close price for the asset,\n          forward-filled from an earlier minute if there is no trade this\n          minute. If there is no last known value (either because the asset\n          has never traded, or because it has delisted) NaN is returned. If a\n          value is found, and we had to cross an adjustment boundary (split,\n          dividend, etc) to get it, the value is adj""usted to the current\n          simulation time before being returned.\n\n        - Requesting \"open\", \"high\", \"low\", or \"close\" produces the open, high,\n          low, or close for the current minute. If no trades occurred this\n          minute, ``NaN`` is returned.\n\n        - Requesting \"volume\" produces the trade volume for the current\n          minute. If no trades occurred this minute, 0 is returned.\n\n        - Requesting \"last_traded\" produces the datetime of the last minute in\n          which the asset traded, even if the asset has stopped trading. If\n          there is no last known value, ``pd.NaT`` is returned.\n\n        If the current simulation time is not a valid market time for an asset,\n        we use the most recent market close instead.\n        ");
    static PyMethodDef __pyx_mdef_7zipline_9_protocol_7BarData_3current = {"current", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_9_protocol_7BarData_3current, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7zipline_9_protocol_7BarData_2current};
    static PyObject *__pyx_pw_7zipline_9_protocol_7BarData_3current(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ) {
      PyObject *__pyx_v_assets = 0;
      PyObject *__pyx_v_fields = 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("current (wrapper)", 0);
      #if !CYTHON_METH_FASTCALL
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
      #endif
      #endif
      __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_assets,&__pyx_mstate_global->__pyx_n_u_fields,0};
      PyObject* values[2] = {0,0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 189, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 189, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 189, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "current", 0) < (0)) __PYX_ERR(0, 189, __pyx_L3_error)
          for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("current", 1, 2, 2, i); __PYX_ERR(0, 189, __pyx_L3_error) }
          }
        } else if (unlikely(__pyx_nargs != 2)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 189, __pyx_L3_error)
          values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 189, __pyx_L3_error)
        }
        __pyx_v_assets = values[0];
        __pyx_v_fields = values[1];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("current", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 189, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("zipline._protocol.BarData.current", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_7zipline_9_protocol_7BarData_2current(((struct __pyx_obj_7zipline_9_protocol_BarData *)__pyx_v_self), __pyx_v_assets, __pyx_v_fields);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

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

    static PyObject *__pyx_pf_7zipline_9_protocol_7BarData_2current(struct __pyx_obj_7zipline_9_protocol_BarData *__pyx_v_self, PyObject *__pyx_v_assets, PyObject *__pyx_v_fields) {
      PyLongObject *__pyx_v_multiple_assets = NULL;
      PyLongObject *__pyx_v_multiple_fields = NULL;
      PyObject *__pyx_v_asset = NULL;
      PyObject *__pyx_v_field = NULL;
      PyObject *__pyx_v_data = NULL;
      PyObject *__pyx_v_series = NULL;
      PyObject *__pyx_8genexpr2__pyx_v_field = NULL;
      PyObject *__pyx_8genexpr3__pyx_v_field = NULL;
      PyObject *__pyx_8genexpr4__pyx_v_asset = NULL;
      PyObject *__pyx_8genexpr5__pyx_v_asset = NULL;
      PyObject *__pyx_8genexpr6__pyx_v_asset = NULL;
      PyObject *__pyx_8genexpr7__pyx_v_asset = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[48]))
      __Pyx_TraceStartFunc("current", __pyx_f[0], 189, 0, 0, 0, __PYX_ERR(0, 189, __pyx_L1_error));
    /* … */
      /* 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_7);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_12);
      __Pyx_XDECREF(__pyx_t_13);
      __Pyx_XDECREF(__pyx_t_14);
      __Pyx_XDECREF(__pyx_t_15);
      __Pyx_XDECREF(__pyx_t_16);
      __Pyx_XDECREF(__pyx_t_19);
      __Pyx_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 189, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline._protocol.BarData.current", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XDECREF((PyObject *)__pyx_v_multiple_assets);
      __Pyx_XDECREF((PyObject *)__pyx_v_multiple_fields);
      __Pyx_XDECREF(__pyx_v_asset);
      __Pyx_XDECREF(__pyx_v_field);
      __Pyx_XDECREF(__pyx_v_data);
      __Pyx_XDECREF(__pyx_v_series);
      __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_field);
      __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_field);
      __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_asset);
      __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_asset);
      __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_asset);
      __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_asset);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7zipline_9_protocol_7BarData_3current, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BarData_current, NULL, __pyx_mstate_global->__pyx_n_u_zipline__protocol, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[48])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 189, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_BarData, __pyx_mstate_global->__pyx_n_u_current, __pyx_t_2) < (0)) __PYX_ERR(0, 189, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = NULL;
      __pyx_t_3 = NULL;
      __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_check_parameters);
      __pyx_t_7 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_check_parameters);
    /* … */
      __Pyx_GetNameInClass(__pyx_t_7, (PyObject*)__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_BarData, __pyx_mstate_global->__pyx_n_u_current); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 189, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF((PyObject *)__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 189, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_BarData, __pyx_mstate_global->__pyx_n_u_current, __pyx_t_2) < (0)) __PYX_ERR(0, 189, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    /* … */
      __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(2, __pyx_mstate_global->__pyx_n_u_assets, __pyx_mstate_global->__pyx_n_u_fields); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(0, 189, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]);

    +190:                       ((Asset, ContinuousFuture, str), (str,)))

      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_ContinuousFuture); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 190, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PyTuple_Pack(3, ((PyObject *)__pyx_mstate_global->__pyx_ptype_7zipline_6assets_7_assets_Asset), __pyx_t_8, ((PyObject *)(&PyUnicode_Type))); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 190, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyTuple_Pack(1, ((PyObject *)(&PyUnicode_Type))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 190, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_10 = PyTuple_Pack(2, __pyx_t_9, __pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 190, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_mstate_global->__pyx_tuple[3], __pyx_t_10};
        __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 189, __pyx_L1_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_5);
      }

     191:     def current(self, assets, fields):

     192:         """Returns the "current" value of the given fields for the given assets

     193:         at the current simulation time.

     194:

     195:         Parameters

     196:         ----------

     197:         assets : zipline.assets.Asset or iterable of zipline.assets.Asset

     198:             The asset(s) for which data is requested.

     199:         fields : str or iterable[str].

     200:             Requested data field(s). Valid field names are: "price",

     201:             "last_traded", "open", "high", "low", "close", and "volume".

     202:

     203:         Returns

     204:         -------

     205:         current_value : Scalar, pandas Series, or pandas DataFrame.

     206:             See notes below.

     207:

     208:         Notes

     209:         -----

     210:         The return type of this function depends on the types of its inputs:

     211:

     212:         - If a single asset and a single field are requested, the returned

     213:           value is a scalar (either a float or a ``pd.Timestamp`` depending on

     214:           the field).

     215:

     216:         - If a single asset and a list of fields are requested, the returned

     217:           value is a :class:`pd.Series` whose indices are the requested fields.

     218:

     219:         - If a list of assets and a single field are requested, the returned

     220:           value is a :class:`pd.Series` whose indices are the assets.

     221:

     222:         - If a list of assets and a list of fields are requested, the returned

     223:           value is a :class:`pd.DataFrame`.  The columns of the returned frame

     224:           will be the requested fields, and the index of the frame will be the

     225:           requested assets.

     226:

     227:         The values produced for ``fields`` are as follows:

     228:

     229:         - Requesting "price" produces the last known close price for the asset,

     230:           forward-filled from an earlier minute if there is no trade this

     231:           minute. If there is no last known value (either because the asset

     232:           has never traded, or because it has delisted) NaN is returned. If a

     233:           value is found, and we had to cross an adjustment boundary (split,

     234:           dividend, etc) to get it, the value is adjusted to the current

     235:           simulation time before being returned.

     236:

     237:         - Requesting "open", "high", "low", or "close" produces the open, high,

     238:           low, or close for the current minute. If no trades occurred this

     239:           minute, ``NaN`` is returned.

     240:

     241:         - Requesting "volume" produces the trade volume for the current

     242:           minute. If no trades occurred this minute, 0 is returned.

     243:

     244:         - Requesting "last_traded" produces the datetime of the last minute in

     245:           which the asset traded, even if the asset has stopped trading. If

     246:           there is no last known value, ``pd.NaT`` is returned.

     247:

     248:         If the current simulation time is not a valid market time for an asset,

     249:         we use the most recent market close instead.

     250:         """

    +251:         multiple_assets = _is_iterable(assets)

      __pyx_t_1 = ((PyObject *)__pyx_f_7zipline_9_protocol__is_iterable(__pyx_v_assets)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_multiple_assets = ((PyLongObject *)__pyx_t_1);
      __pyx_t_1 = 0;

    +252:         multiple_fields = _is_iterable(fields)

      __pyx_t_1 = ((PyObject *)__pyx_f_7zipline_9_protocol__is_iterable(__pyx_v_fields)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 252, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_multiple_fields = ((PyLongObject *)__pyx_t_1);
      __pyx_t_1 = 0;

     253:

     254:         # There's some overly verbose code in here, particularly around

     255:         # 'do something if self._adjust_minutes is False, otherwise do

     256:         # something else'. This could be less verbose, but the 99% case is that

     257:         # `self._adjust_minutes` is False, so it's important to keep that code

     258:         # path as fast as possible.

     259:

     260:         # There's probably a way to make this method (and `history`) less

     261:         # verbose, but this is OK for now.

     262:

    +263:         if not multiple_assets:

      __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_multiple_assets)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 263, __pyx_L1_error)
      __pyx_t_3 = (!__pyx_t_2);
      if (__pyx_t_3) {
    /* … */
      }

    +264:             asset = assets

        __Pyx_INCREF(__pyx_v_assets);
        __pyx_v_asset = __pyx_v_assets;

     265:

    +266:             if not multiple_fields:

        __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_multiple_fields)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 266, __pyx_L1_error)
        __pyx_t_2 = (!__pyx_t_3);
        if (__pyx_t_2) {
    /* … */
        }

    +267:                 field = fields

          __Pyx_INCREF(__pyx_v_fields);
          __pyx_v_field = __pyx_v_fields;

     268:

     269:                 # return scalar value

    +270:                 if not self._adjust_minutes:

          __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->_adjust_minutes)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 270, __pyx_L1_error)
          __pyx_t_3 = (!__pyx_t_2);
          if (__pyx_t_3) {
    /* … */
          }

    +271:                     return self.data_portal.get_spot_value(

            __Pyx_XDECREF(__pyx_r);
            __pyx_t_4 = __pyx_v_self->data_portal;
            __Pyx_INCREF(__pyx_t_4);

     272:                         asset,

     273:                         field,

    +274:                         self._get_current_minute(),

            __pyx_t_5 = ((struct __pyx_vtabstruct_7zipline_9_protocol_BarData *)__pyx_v_self->__pyx_vtab)->_get_current_minute(__pyx_v_self); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 274, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);

    +275:                         self.data_frequency

            __pyx_t_6 = 0;
            {
              PyObject *__pyx_callargs[5] = {__pyx_t_4, __pyx_v_asset, __pyx_v_field, __pyx_t_5, __pyx_v_self->data_frequency};
              __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_spot_value, __pyx_callargs+__pyx_t_6, (5-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
              if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_1);
            }
            __pyx_r = __pyx_t_1;
            __pyx_t_1 = 0;
            __Pyx_TraceReturnValue(__pyx_r, 23, 0, __PYX_ERR(0, 271, __pyx_L1_error));
            goto __pyx_L0;

     276:                     )

     277:                 else:

    +278:                     return self.data_portal.get_adjusted_value(

          /*else*/ {
            __Pyx_XDECREF(__pyx_r);
            __pyx_t_5 = __pyx_v_self->data_portal;
            __Pyx_INCREF(__pyx_t_5);

     279:                         asset,

     280:                         field,

    +281:                         self._get_current_minute(),

            __pyx_t_4 = ((struct __pyx_vtabstruct_7zipline_9_protocol_BarData *)__pyx_v_self->__pyx_vtab)->_get_current_minute(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 281, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);

    +282:                         self.simulation_dt_func(),

            __pyx_t_8 = NULL;
            __Pyx_INCREF(__pyx_v_self->simulation_dt_func);
            __pyx_t_9 = __pyx_v_self->simulation_dt_func;
            __pyx_t_6 = 1;
            #if CYTHON_UNPACK_METHODS
            if (likely(PyMethod_Check(__pyx_t_9))) {
              __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
              assert(__pyx_t_8);
              PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9);
              __Pyx_INCREF(__pyx_t_8);
              __Pyx_INCREF(__pyx__function);
              __Pyx_DECREF_SET(__pyx_t_9, __pyx__function);
              __pyx_t_6 = 0;
            }
            #endif
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
              __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
              if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 282, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_7);
            }

    +283:                         self.data_frequency

            __pyx_t_6 = 0;
            {
              PyObject *__pyx_callargs[6] = {__pyx_t_5, __pyx_v_asset, __pyx_v_field, __pyx_t_4, __pyx_t_7, __pyx_v_self->data_frequency};
              __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_adjusted_value, __pyx_callargs+__pyx_t_6, (6-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
              if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 278, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_1);
            }
            __pyx_r = __pyx_t_1;
            __pyx_t_1 = 0;
            __Pyx_TraceReturnValue(__pyx_r, 35, 0, __PYX_ERR(0, 278, __pyx_L1_error));
            goto __pyx_L0;
          }

     284:                     )

     285:             else:

     286:                 # assume fields is iterable

     287:                 # return a Series indexed by field

    +288:                 if not self._adjust_minutes:

        /*else*/ {
          __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->_adjust_minutes)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 288, __pyx_L1_error)
          __pyx_t_2 = (!__pyx_t_3);
          if (__pyx_t_2) {
    /* … */
          }

    +289:                     return pd.Series(data={

            __Pyx_XDECREF(__pyx_r);
            __pyx_t_7 = NULL;
            __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 289, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Series); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 289, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            { /* enter inner scope */
              __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 289, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_4);

    +290:                         field: self.data_portal.get_spot_value(

                __pyx_t_12 = __pyx_v_self->data_portal;
                __Pyx_INCREF(__pyx_t_12);

     291:                             asset,

     292:                             field,

    +293:                             self._get_current_minute(),

                __pyx_t_13 = ((struct __pyx_vtabstruct_7zipline_9_protocol_BarData *)__pyx_v_self->__pyx_vtab)->_get_current_minute(__pyx_v_self); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 293, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_13);

    +294:                             self.data_frequency

                __pyx_t_6 = 0;
                {
                  PyObject *__pyx_callargs[5] = {__pyx_t_12, __pyx_v_asset, __pyx_8genexpr2__pyx_v_field, __pyx_t_13, __pyx_v_self->data_frequency};
                  __pyx_t_8 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_spot_value, __pyx_callargs+__pyx_t_6, (5-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                  __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
                  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
                  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 290, __pyx_L9_error)
                  __Pyx_GOTREF(__pyx_t_8);
                }
                if (unlikely(PyDict_SetItem(__pyx_t_4, (PyObject*)__pyx_8genexpr2__pyx_v_field, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 290, __pyx_L9_error)
                __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

     295:                         )

    +296:                         for field in fields

              if (likely(PyList_CheckExact(__pyx_v_fields)) || PyTuple_CheckExact(__pyx_v_fields)) {
                __pyx_t_9 = __pyx_v_fields; __Pyx_INCREF(__pyx_t_9);
                __pyx_t_10 = 0;
                __pyx_t_11 = NULL;
              } else {
                __pyx_t_10 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_fields); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 296, __pyx_L9_error)
                __Pyx_GOTREF(__pyx_t_9);
                __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 296, __pyx_L9_error)
              }
              for (;;) {
                if (likely(!__pyx_t_11)) {
                  if (likely(PyList_CheckExact(__pyx_t_9))) {
                    {
                      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_9);
                      #if !CYTHON_ASSUME_SAFE_SIZE
                      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 296, __pyx_L9_error)
                      #endif
                      if (__pyx_t_10 >= __pyx_temp) break;
                    }
                    __pyx_t_8 = __Pyx_PyList_GetItemRef(__pyx_t_9, __pyx_t_10);
                    ++__pyx_t_10;
                  } else {
                    {
                      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_9);
                      #if !CYTHON_ASSUME_SAFE_SIZE
                      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 296, __pyx_L9_error)
                      #endif
                      if (__pyx_t_10 >= __pyx_temp) break;
                    }
                    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                    __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_10));
                    #else
                    __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_9, __pyx_t_10);
                    #endif
                    ++__pyx_t_10;
                  }
                  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 296, __pyx_L9_error)
                } else {
                  __pyx_t_8 = __pyx_t_11(__pyx_t_9);
                  if (unlikely(!__pyx_t_8)) {
                    PyObject* exc_type = PyErr_Occurred();
                    if (exc_type) {
                      if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 296, __pyx_L9_error)
                      PyErr_Clear();
                    }
                    break;
                  }
                }
                __Pyx_GOTREF(__pyx_t_8);
                __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_field, __pyx_t_8);
                __pyx_t_8 = 0;
    /* … */
              }
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
              __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_field); __pyx_8genexpr2__pyx_v_field = 0;
              goto __pyx_L13_exit_scope;
              __pyx_L9_error:;
              __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_field); __pyx_8genexpr2__pyx_v_field = 0;
              goto __pyx_L1_error;
              __pyx_L13_exit_scope:;
            } /* exit inner scope */

    +297:                     }, index=fields, name=assets.symbol)

            __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_assets, __pyx_mstate_global->__pyx_n_u_symbol); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 297, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __pyx_t_6 = 1;
            #if CYTHON_UNPACK_METHODS
            if (unlikely(PyMethod_Check(__pyx_t_5))) {
              __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
              assert(__pyx_t_7);
              PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
              __Pyx_INCREF(__pyx_t_7);
              __Pyx_INCREF(__pyx__function);
              __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
              __pyx_t_6 = 0;
            }
            #endif
            {
              PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_7, NULL};
              __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 289, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_data, __pyx_t_4, __pyx_t_8, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 289, __pyx_L1_error)
              if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_index, __pyx_v_fields, __pyx_t_8, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 289, __pyx_L1_error)
              if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_name_2, __pyx_t_9, __pyx_t_8, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 289, __pyx_L1_error)
              __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_5, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8);
              __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
              if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_1);
            }
            __pyx_r = __pyx_t_1;
            __pyx_t_1 = 0;
            __Pyx_TraceReturnValue(__pyx_r, 54, 0, __PYX_ERR(0, 289, __pyx_L1_error));
            goto __pyx_L0;

     298:                 else:

    +299:                     return pd.Series(data={

          /*else*/ {
            __Pyx_XDECREF(__pyx_r);
            __pyx_t_5 = NULL;
            __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 299, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Series); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 299, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            { /* enter inner scope */
              __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 299, __pyx_L16_error)
              __Pyx_GOTREF(__pyx_t_8);

    +300:                         field: self.data_portal.get_adjusted_value(

                __pyx_t_13 = __pyx_v_self->data_portal;
                __Pyx_INCREF(__pyx_t_13);

     301:                             asset,

     302:                             field,

    +303:                             self._get_current_minute(),

                __pyx_t_12 = ((struct __pyx_vtabstruct_7zipline_9_protocol_BarData *)__pyx_v_self->__pyx_vtab)->_get_current_minute(__pyx_v_self); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 303, __pyx_L16_error)
                __Pyx_GOTREF(__pyx_t_12);

    +304:                             self.simulation_dt_func(),

                __pyx_t_15 = NULL;
                __Pyx_INCREF(__pyx_v_self->simulation_dt_func);
                __pyx_t_16 = __pyx_v_self->simulation_dt_func;
                __pyx_t_6 = 1;
                #if CYTHON_UNPACK_METHODS
                if (likely(PyMethod_Check(__pyx_t_16))) {
                  __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_16);
                  assert(__pyx_t_15);
                  PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_16);
                  __Pyx_INCREF(__pyx_t_15);
                  __Pyx_INCREF(__pyx__function);
                  __Pyx_DECREF_SET(__pyx_t_16, __pyx__function);
                  __pyx_t_6 = 0;
                }
                #endif
                {
                  PyObject *__pyx_callargs[2] = {__pyx_t_15, NULL};
                  __pyx_t_14 = __Pyx_PyObject_FastCall(__pyx_t_16, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
                  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
                  if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 304, __pyx_L16_error)
                  __Pyx_GOTREF(__pyx_t_14);
                }

    +305:                             self.data_frequency

                __pyx_t_6 = 0;
                {
                  PyObject *__pyx_callargs[6] = {__pyx_t_13, __pyx_v_asset, __pyx_8genexpr3__pyx_v_field, __pyx_t_12, __pyx_t_14, __pyx_v_self->data_frequency};
                  __pyx_t_7 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_adjusted_value, __pyx_callargs+__pyx_t_6, (6-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                  __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
                  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
                  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 300, __pyx_L16_error)
                  __Pyx_GOTREF(__pyx_t_7);
                }
                if (unlikely(PyDict_SetItem(__pyx_t_8, (PyObject*)__pyx_8genexpr3__pyx_v_field, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 300, __pyx_L16_error)
                __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

     306:                         )

    +307:                         for field in fields

              if (likely(PyList_CheckExact(__pyx_v_fields)) || PyTuple_CheckExact(__pyx_v_fields)) {
                __pyx_t_4 = __pyx_v_fields; __Pyx_INCREF(__pyx_t_4);
                __pyx_t_10 = 0;
                __pyx_t_11 = NULL;
              } else {
                __pyx_t_10 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_fields); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 307, __pyx_L16_error)
                __Pyx_GOTREF(__pyx_t_4);
                __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 307, __pyx_L16_error)
              }
              for (;;) {
                if (likely(!__pyx_t_11)) {
                  if (likely(PyList_CheckExact(__pyx_t_4))) {
                    {
                      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
                      #if !CYTHON_ASSUME_SAFE_SIZE
                      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 307, __pyx_L16_error)
                      #endif
                      if (__pyx_t_10 >= __pyx_temp) break;
                    }
                    __pyx_t_7 = __Pyx_PyList_GetItemRef(__pyx_t_4, __pyx_t_10);
                    ++__pyx_t_10;
                  } else {
                    {
                      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
                      #if !CYTHON_ASSUME_SAFE_SIZE
                      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 307, __pyx_L16_error)
                      #endif
                      if (__pyx_t_10 >= __pyx_temp) break;
                    }
                    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                    __pyx_t_7 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_10));
                    #else
                    __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_10);
                    #endif
                    ++__pyx_t_10;
                  }
                  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 307, __pyx_L16_error)
                } else {
                  __pyx_t_7 = __pyx_t_11(__pyx_t_4);
                  if (unlikely(!__pyx_t_7)) {
                    PyObject* exc_type = PyErr_Occurred();
                    if (exc_type) {
                      if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 307, __pyx_L16_error)
                      PyErr_Clear();
                    }
                    break;
                  }
                }
                __Pyx_GOTREF(__pyx_t_7);
                __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v_field, __pyx_t_7);
                __pyx_t_7 = 0;
    /* … */
              }
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_field); __pyx_8genexpr3__pyx_v_field = 0;
              goto __pyx_L20_exit_scope;
              __pyx_L16_error:;
              __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_field); __pyx_8genexpr3__pyx_v_field = 0;
              goto __pyx_L1_error;
              __pyx_L20_exit_scope:;
            } /* exit inner scope */

    +308:                     }, index=fields, name=assets.symbol)

            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_assets, __pyx_mstate_global->__pyx_n_u_symbol); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 308, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_6 = 1;
            #if CYTHON_UNPACK_METHODS
            if (unlikely(PyMethod_Check(__pyx_t_9))) {
              __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
              assert(__pyx_t_5);
              PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9);
              __Pyx_INCREF(__pyx_t_5);
              __Pyx_INCREF(__pyx__function);
              __Pyx_DECREF_SET(__pyx_t_9, __pyx__function);
              __pyx_t_6 = 0;
            }
            #endif
            {
              PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_5, NULL};
              __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 299, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_7);
              if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_data, __pyx_t_8, __pyx_t_7, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 299, __pyx_L1_error)
              if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_index, __pyx_v_fields, __pyx_t_7, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 299, __pyx_L1_error)
              if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_name_2, __pyx_t_4, __pyx_t_7, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 299, __pyx_L1_error)
              __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_9, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7);
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
              if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 299, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_1);
            }
            __pyx_r = __pyx_t_1;
            __pyx_t_1 = 0;
            __Pyx_TraceReturnValue(__pyx_r, 80, 0, __PYX_ERR(0, 299, __pyx_L1_error));
            goto __pyx_L0;
          }
        }

     309:         else:

    +310:             if not multiple_fields:

      /*else*/ {
        __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_multiple_fields)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 310, __pyx_L1_error)
        __pyx_t_3 = (!__pyx_t_2);
        if (__pyx_t_3) {
    /* … */
        }

    +311:                 field = fields

          __Pyx_INCREF(__pyx_v_fields);
          __pyx_v_field = __pyx_v_fields;

     312:

     313:                 # assume assets is iterable

     314:                 # return a Series indexed by asset

    +315:                 if not self._adjust_minutes:

          __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->_adjust_minutes)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 315, __pyx_L1_error)
          __pyx_t_2 = (!__pyx_t_3);
          if (__pyx_t_2) {
    /* … */
          }

    +316:                     return pd.Series(data={

            __Pyx_XDECREF(__pyx_r);
            __pyx_t_9 = NULL;
            __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 316, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_Series); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 316, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            { /* enter inner scope */
              __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 316, __pyx_L25_error)
              __Pyx_GOTREF(__pyx_t_7);

    +317:                         asset: self.data_portal.get_spot_value(

                __pyx_t_14 = __pyx_v_self->data_portal;
                __Pyx_INCREF(__pyx_t_14);

     318:                             asset,

     319:                             field,

    +320:                             self._get_current_minute(),

                __pyx_t_12 = ((struct __pyx_vtabstruct_7zipline_9_protocol_BarData *)__pyx_v_self->__pyx_vtab)->_get_current_minute(__pyx_v_self); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 320, __pyx_L25_error)
                __Pyx_GOTREF(__pyx_t_12);

    +321:                             self.data_frequency

                __pyx_t_6 = 0;
                {
                  PyObject *__pyx_callargs[5] = {__pyx_t_14, __pyx_8genexpr4__pyx_v_asset, __pyx_v_field, __pyx_t_12, __pyx_v_self->data_frequency};
                  __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_spot_value, __pyx_callargs+__pyx_t_6, (5-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                  __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
                  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
                  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 317, __pyx_L25_error)
                  __Pyx_GOTREF(__pyx_t_5);
                }
                if (unlikely(PyDict_SetItem(__pyx_t_7, (PyObject*)__pyx_8genexpr4__pyx_v_asset, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 317, __pyx_L25_error)
                __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

     322:                         )

    +323:                         for asset in assets

              if (likely(PyList_CheckExact(__pyx_v_assets)) || PyTuple_CheckExact(__pyx_v_assets)) {
                __pyx_t_8 = __pyx_v_assets; __Pyx_INCREF(__pyx_t_8);
                __pyx_t_10 = 0;
                __pyx_t_11 = NULL;
              } else {
                __pyx_t_10 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_assets); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 323, __pyx_L25_error)
                __Pyx_GOTREF(__pyx_t_8);
                __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 323, __pyx_L25_error)
              }
              for (;;) {
                if (likely(!__pyx_t_11)) {
                  if (likely(PyList_CheckExact(__pyx_t_8))) {
                    {
                      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_8);
                      #if !CYTHON_ASSUME_SAFE_SIZE
                      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 323, __pyx_L25_error)
                      #endif
                      if (__pyx_t_10 >= __pyx_temp) break;
                    }
                    __pyx_t_5 = __Pyx_PyList_GetItemRef(__pyx_t_8, __pyx_t_10);
                    ++__pyx_t_10;
                  } else {
                    {
                      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_8);
                      #if !CYTHON_ASSUME_SAFE_SIZE
                      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 323, __pyx_L25_error)
                      #endif
                      if (__pyx_t_10 >= __pyx_temp) break;
                    }
                    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                    __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_10));
                    #else
                    __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_8, __pyx_t_10);
                    #endif
                    ++__pyx_t_10;
                  }
                  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 323, __pyx_L25_error)
                } else {
                  __pyx_t_5 = __pyx_t_11(__pyx_t_8);
                  if (unlikely(!__pyx_t_5)) {
                    PyObject* exc_type = PyErr_Occurred();
                    if (exc_type) {
                      if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 323, __pyx_L25_error)
                      PyErr_Clear();
                    }
                    break;
                  }
                }
                __Pyx_GOTREF(__pyx_t_5);
                __Pyx_XDECREF_SET(__pyx_8genexpr4__pyx_v_asset, __pyx_t_5);
                __pyx_t_5 = 0;
    /* … */
              }
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_asset); __pyx_8genexpr4__pyx_v_asset = 0;
              goto __pyx_L29_exit_scope;
              __pyx_L25_error:;
              __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_asset); __pyx_8genexpr4__pyx_v_asset = 0;
              goto __pyx_L1_error;
              __pyx_L29_exit_scope:;
            } /* exit inner scope */

    +324:                     }, index=assets, name=fields)

            __pyx_t_6 = 1;
            #if CYTHON_UNPACK_METHODS
            if (unlikely(PyMethod_Check(__pyx_t_4))) {
              __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
              assert(__pyx_t_9);
              PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
              __Pyx_INCREF(__pyx_t_9);
              __Pyx_INCREF(__pyx__function);
              __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
              __pyx_t_6 = 0;
            }
            #endif
            {
              PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_9, NULL};
              __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 316, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_data, __pyx_t_7, __pyx_t_8, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 316, __pyx_L1_error)
              if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_index, __pyx_v_assets, __pyx_t_8, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 316, __pyx_L1_error)
              if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_name_2, __pyx_v_fields, __pyx_t_8, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 316, __pyx_L1_error)
              __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_4, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8);
              __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 316, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_1);
            }
            __pyx_r = __pyx_t_1;
            __pyx_t_1 = 0;
            __Pyx_TraceReturnValue(__pyx_r, 118, 0, __PYX_ERR(0, 316, __pyx_L1_error));
            goto __pyx_L0;

     325:                 else:

    +326:                     return pd.Series(data={

          /*else*/ {
            __Pyx_XDECREF(__pyx_r);
            __pyx_t_4 = NULL;
            __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 326, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Series); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 326, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            { /* enter inner scope */
              __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 326, __pyx_L32_error)
              __Pyx_GOTREF(__pyx_t_8);

    +327:                         asset: self.data_portal.get_adjusted_value(

                __pyx_t_12 = __pyx_v_self->data_portal;
                __Pyx_INCREF(__pyx_t_12);

     328:                             asset,

     329:                             field,

    +330:                             self._get_current_minute(),

                __pyx_t_14 = ((struct __pyx_vtabstruct_7zipline_9_protocol_BarData *)__pyx_v_self->__pyx_vtab)->_get_current_minute(__pyx_v_self); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 330, __pyx_L32_error)
                __Pyx_GOTREF(__pyx_t_14);

    +331:                             self.simulation_dt_func(),

                __pyx_t_16 = NULL;
                __Pyx_INCREF(__pyx_v_self->simulation_dt_func);
                __pyx_t_15 = __pyx_v_self->simulation_dt_func;
                __pyx_t_6 = 1;
                #if CYTHON_UNPACK_METHODS
                if (likely(PyMethod_Check(__pyx_t_15))) {
                  __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_15);
                  assert(__pyx_t_16);
                  PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_15);
                  __Pyx_INCREF(__pyx_t_16);
                  __Pyx_INCREF(__pyx__function);
                  __Pyx_DECREF_SET(__pyx_t_15, __pyx__function);
                  __pyx_t_6 = 0;
                }
                #endif
                {
                  PyObject *__pyx_callargs[2] = {__pyx_t_16, NULL};
                  __pyx_t_13 = __Pyx_PyObject_FastCall(__pyx_t_15, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
                  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
                  if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 331, __pyx_L32_error)
                  __Pyx_GOTREF(__pyx_t_13);
                }

    +332:                             self.data_frequency

                __pyx_t_6 = 0;
                {
                  PyObject *__pyx_callargs[6] = {__pyx_t_12, __pyx_8genexpr5__pyx_v_asset, __pyx_v_field, __pyx_t_14, __pyx_t_13, __pyx_v_self->data_frequency};
                  __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_adjusted_value, __pyx_callargs+__pyx_t_6, (6-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                  __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
                  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
                  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 327, __pyx_L32_error)
                  __Pyx_GOTREF(__pyx_t_5);
                }
                if (unlikely(PyDict_SetItem(__pyx_t_8, (PyObject*)__pyx_8genexpr5__pyx_v_asset, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 327, __pyx_L32_error)
                __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

     333:                         )

    +334:                         for asset in assets

              if (likely(PyList_CheckExact(__pyx_v_assets)) || PyTuple_CheckExact(__pyx_v_assets)) {
                __pyx_t_9 = __pyx_v_assets; __Pyx_INCREF(__pyx_t_9);
                __pyx_t_10 = 0;
                __pyx_t_11 = NULL;
              } else {
                __pyx_t_10 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_assets); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 334, __pyx_L32_error)
                __Pyx_GOTREF(__pyx_t_9);
                __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 334, __pyx_L32_error)
              }
              for (;;) {
                if (likely(!__pyx_t_11)) {
                  if (likely(PyList_CheckExact(__pyx_t_9))) {
                    {
                      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_9);
                      #if !CYTHON_ASSUME_SAFE_SIZE
                      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 334, __pyx_L32_error)
                      #endif
                      if (__pyx_t_10 >= __pyx_temp) break;
                    }
                    __pyx_t_5 = __Pyx_PyList_GetItemRef(__pyx_t_9, __pyx_t_10);
                    ++__pyx_t_10;
                  } else {
                    {
                      Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_9);
                      #if !CYTHON_ASSUME_SAFE_SIZE
                      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 334, __pyx_L32_error)
                      #endif
                      if (__pyx_t_10 >= __pyx_temp) break;
                    }
                    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                    __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_10));
                    #else
                    __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_9, __pyx_t_10);
                    #endif
                    ++__pyx_t_10;
                  }
                  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 334, __pyx_L32_error)
                } else {
                  __pyx_t_5 = __pyx_t_11(__pyx_t_9);
                  if (unlikely(!__pyx_t_5)) {
                    PyObject* exc_type = PyErr_Occurred();
                    if (exc_type) {
                      if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 334, __pyx_L32_error)
                      PyErr_Clear();
                    }
                    break;
                  }
                }
                __Pyx_GOTREF(__pyx_t_5);
                __Pyx_XDECREF_SET(__pyx_8genexpr5__pyx_v_asset, __pyx_t_5);
                __pyx_t_5 = 0;
    /* … */
              }
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
              __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_asset); __pyx_8genexpr5__pyx_v_asset = 0;
              goto __pyx_L36_exit_scope;
              __pyx_L32_error:;
              __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_asset); __pyx_8genexpr5__pyx_v_asset = 0;
              goto __pyx_L1_error;
              __pyx_L36_exit_scope:;
            } /* exit inner scope */

    +335:                     }, index=assets, name=fields)

            __pyx_t_6 = 1;
            #if CYTHON_UNPACK_METHODS
            if (unlikely(PyMethod_Check(__pyx_t_7))) {
              __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
              assert(__pyx_t_4);
              PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
              __Pyx_INCREF(__pyx_t_4);
              __Pyx_INCREF(__pyx__function);
              __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
              __pyx_t_6 = 0;
            }
            #endif
            {
              PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_4, NULL};
              __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 326, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_9);
              if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_data, __pyx_t_8, __pyx_t_9, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 326, __pyx_L1_error)
              if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_index, __pyx_v_assets, __pyx_t_9, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 326, __pyx_L1_error)
              if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_name_2, __pyx_v_fields, __pyx_t_9, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 326, __pyx_L1_error)
              __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_7, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9);
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
              if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 326, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_1);
            }
            __pyx_r = __pyx_t_1;
            __pyx_t_1 = 0;
            __Pyx_TraceReturnValue(__pyx_r, 143, 0, __PYX_ERR(0, 326, __pyx_L1_error));
            goto __pyx_L0;
          }

     336:

     337:             else:

     338:                 # both assets and fields are iterable

    +339:                 data = {}

        /*else*/ {
          __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 339, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_v_data = ((PyObject*)__pyx_t_1);
          __pyx_t_1 = 0;

     340:

    +341:                 if not self._adjust_minutes:

          __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->_adjust_minutes)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 341, __pyx_L1_error)
          __pyx_t_3 = (!__pyx_t_2);
          if (__pyx_t_3) {
    /* … */
            goto __pyx_L37;
          }

    +342:                     for field in fields:

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

    +343:                         series = pd.Series(data={

              __pyx_t_9 = NULL;
              __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 343, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_Series); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 343, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              { /* enter inner scope */
                __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 343, __pyx_L42_error)
                __Pyx_GOTREF(__pyx_t_8);

    +344:                             asset: self.data_portal.get_spot_value(

                  __pyx_t_14 = __pyx_v_self->data_portal;
                  __Pyx_INCREF(__pyx_t_14);

     345:                                 asset,

     346:                                 field,

    +347:                                 self._get_current_minute(),

                  __pyx_t_12 = ((struct __pyx_vtabstruct_7zipline_9_protocol_BarData *)__pyx_v_self->__pyx_vtab)->_get_current_minute(__pyx_v_self); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 347, __pyx_L42_error)
                  __Pyx_GOTREF(__pyx_t_12);

    +348:                                 self.data_frequency

                  __pyx_t_6 = 0;
                  {
                    PyObject *__pyx_callargs[5] = {__pyx_t_14, __pyx_8genexpr6__pyx_v_asset, __pyx_v_field, __pyx_t_12, __pyx_v_self->data_frequency};
                    __pyx_t_13 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_spot_value, __pyx_callargs+__pyx_t_6, (5-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
                    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
                    if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 344, __pyx_L42_error)
                    __Pyx_GOTREF(__pyx_t_13);
                  }
                  if (unlikely(PyDict_SetItem(__pyx_t_8, (PyObject*)__pyx_8genexpr6__pyx_v_asset, (PyObject*)__pyx_t_13))) __PYX_ERR(0, 344, __pyx_L42_error)
                  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

     349:                             )

    +350:                             for asset in assets

                if (likely(PyList_CheckExact(__pyx_v_assets)) || PyTuple_CheckExact(__pyx_v_assets)) {
                  __pyx_t_5 = __pyx_v_assets; __Pyx_INCREF(__pyx_t_5);
                  __pyx_t_17 = 0;
                  __pyx_t_18 = NULL;
                } else {
                  __pyx_t_17 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_assets); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 350, __pyx_L42_error)
                  __Pyx_GOTREF(__pyx_t_5);
                  __pyx_t_18 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 350, __pyx_L42_error)
                }
                for (;;) {
                  if (likely(!__pyx_t_18)) {
                    if (likely(PyList_CheckExact(__pyx_t_5))) {
                      {
                        Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
                        #if !CYTHON_ASSUME_SAFE_SIZE
                        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 350, __pyx_L42_error)
                        #endif
                        if (__pyx_t_17 >= __pyx_temp) break;
                      }
                      __pyx_t_13 = __Pyx_PyList_GetItemRef(__pyx_t_5, __pyx_t_17);
                      ++__pyx_t_17;
                    } else {
                      {
                        Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
                        #if !CYTHON_ASSUME_SAFE_SIZE
                        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 350, __pyx_L42_error)
                        #endif
                        if (__pyx_t_17 >= __pyx_temp) break;
                      }
                      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                      __pyx_t_13 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_17));
                      #else
                      __pyx_t_13 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_17);
                      #endif
                      ++__pyx_t_17;
                    }
                    if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 350, __pyx_L42_error)
                  } else {
                    __pyx_t_13 = __pyx_t_18(__pyx_t_5);
                    if (unlikely(!__pyx_t_13)) {
                      PyObject* exc_type = PyErr_Occurred();
                      if (exc_type) {
                        if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 350, __pyx_L42_error)
                        PyErr_Clear();
                      }
                      break;
                    }
                  }
                  __Pyx_GOTREF(__pyx_t_13);
                  __Pyx_XDECREF_SET(__pyx_8genexpr6__pyx_v_asset, __pyx_t_13);
                  __pyx_t_13 = 0;
    /* … */
                }
                __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_asset); __pyx_8genexpr6__pyx_v_asset = 0;
                goto __pyx_L46_exit_scope;
                __pyx_L42_error:;
                __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_asset); __pyx_8genexpr6__pyx_v_asset = 0;
                goto __pyx_L1_error;
                __pyx_L46_exit_scope:;
              } /* exit inner scope */

    +351:                         }, index=assets, name=field)

              __pyx_t_6 = 1;
              #if CYTHON_UNPACK_METHODS
              if (unlikely(PyMethod_Check(__pyx_t_4))) {
                __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
                assert(__pyx_t_9);
                PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
                __Pyx_INCREF(__pyx_t_9);
                __Pyx_INCREF(__pyx__function);
                __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
                __pyx_t_6 = 0;
              }
              #endif
              {
                PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_9, NULL};
                __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 343, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_5);
                if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_data, __pyx_t_8, __pyx_t_5, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 343, __pyx_L1_error)
                if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_index, __pyx_v_assets, __pyx_t_5, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 343, __pyx_L1_error)
                if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_name_2, __pyx_v_field, __pyx_t_5, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 343, __pyx_L1_error)
                __pyx_t_7 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_4, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
                __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
                __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
                __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
                if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 343, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_7);
              }
              __Pyx_XDECREF_SET(__pyx_v_series, __pyx_t_7);
              __pyx_t_7 = 0;

    +352:                         data[field] = series

              if (unlikely((PyDict_SetItem(__pyx_v_data, __pyx_v_field, __pyx_v_series) < 0))) __PYX_ERR(0, 352, __pyx_L1_error)

     353:                 else:

    +354:                     for field in fields:

          /*else*/ {
            if (likely(PyList_CheckExact(__pyx_v_fields)) || PyTuple_CheckExact(__pyx_v_fields)) {
              __pyx_t_1 = __pyx_v_fields; __Pyx_INCREF(__pyx_t_1);
              __pyx_t_10 = 0;
              __pyx_t_11 = NULL;
            } else {
              __pyx_t_10 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_fields); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 354, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_1);
              __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 354, __pyx_L1_error)
            }
            for (;;) {
              if (likely(!__pyx_t_11)) {
                if (likely(PyList_CheckExact(__pyx_t_1))) {
                  {
                    Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
                    #if !CYTHON_ASSUME_SAFE_SIZE
                    if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 354, __pyx_L1_error)
                    #endif
                    if (__pyx_t_10 >= __pyx_temp) break;
                  }
                  __pyx_t_7 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_10);
                  ++__pyx_t_10;
                } else {
                  {
                    Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
                    #if !CYTHON_ASSUME_SAFE_SIZE
                    if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 354, __pyx_L1_error)
                    #endif
                    if (__pyx_t_10 >= __pyx_temp) break;
                  }
                  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                  __pyx_t_7 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_10));
                  #else
                  __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_10);
                  #endif
                  ++__pyx_t_10;
                }
                if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 354, __pyx_L1_error)
              } else {
                __pyx_t_7 = __pyx_t_11(__pyx_t_1);
                if (unlikely(!__pyx_t_7)) {
                  PyObject* exc_type = PyErr_Occurred();
                  if (exc_type) {
                    if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 354, __pyx_L1_error)
                    PyErr_Clear();
                  }
                  break;
                }
              }
              __Pyx_GOTREF(__pyx_t_7);
              __Pyx_XDECREF_SET(__pyx_v_field, __pyx_t_7);
              __pyx_t_7 = 0;
    /* … */
            }
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          }
          __pyx_L37:;

    +355:                         series = pd.Series(data={

              __pyx_t_4 = NULL;
              __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 355, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_5);
              __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_Series); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 355, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
              { /* enter inner scope */
                __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 355, __pyx_L52_error)
                __Pyx_GOTREF(__pyx_t_5);

    +356:                             asset: self.data_portal.get_adjusted_value(

                  __pyx_t_12 = __pyx_v_self->data_portal;
                  __Pyx_INCREF(__pyx_t_12);

     357:                                 asset,

     358:                                 field,

    +359:                                 self._get_current_minute(),

                  __pyx_t_14 = ((struct __pyx_vtabstruct_7zipline_9_protocol_BarData *)__pyx_v_self->__pyx_vtab)->_get_current_minute(__pyx_v_self); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 359, __pyx_L52_error)
                  __Pyx_GOTREF(__pyx_t_14);

    +360:                                 self.simulation_dt_func(),

                  __pyx_t_16 = NULL;
                  __Pyx_INCREF(__pyx_v_self->simulation_dt_func);
                  __pyx_t_19 = __pyx_v_self->simulation_dt_func;
                  __pyx_t_6 = 1;
                  #if CYTHON_UNPACK_METHODS
                  if (likely(PyMethod_Check(__pyx_t_19))) {
                    __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_19);
                    assert(__pyx_t_16);
                    PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_19);
                    __Pyx_INCREF(__pyx_t_16);
                    __Pyx_INCREF(__pyx__function);
                    __Pyx_DECREF_SET(__pyx_t_19, __pyx__function);
                    __pyx_t_6 = 0;
                  }
                  #endif
                  {
                    PyObject *__pyx_callargs[2] = {__pyx_t_16, NULL};
                    __pyx_t_15 = __Pyx_PyObject_FastCall(__pyx_t_19, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
                    __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
                    if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 360, __pyx_L52_error)
                    __Pyx_GOTREF(__pyx_t_15);
                  }

    +361:                                 self.data_frequency

                  __pyx_t_6 = 0;
                  {
                    PyObject *__pyx_callargs[6] = {__pyx_t_12, __pyx_8genexpr7__pyx_v_asset, __pyx_v_field, __pyx_t_14, __pyx_t_15, __pyx_v_self->data_frequency};
                    __pyx_t_13 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_adjusted_value, __pyx_callargs+__pyx_t_6, (6-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
                    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
                    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
                    if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 356, __pyx_L52_error)
                    __Pyx_GOTREF(__pyx_t_13);
                  }
                  if (unlikely(PyDict_SetItem(__pyx_t_5, (PyObject*)__pyx_8genexpr7__pyx_v_asset, (PyObject*)__pyx_t_13))) __PYX_ERR(0, 356, __pyx_L52_error)
                  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

     362:                             )

    +363:                             for asset in assets

                if (likely(PyList_CheckExact(__pyx_v_assets)) || PyTuple_CheckExact(__pyx_v_assets)) {
                  __pyx_t_9 = __pyx_v_assets; __Pyx_INCREF(__pyx_t_9);
                  __pyx_t_17 = 0;
                  __pyx_t_18 = NULL;
                } else {
                  __pyx_t_17 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_assets); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 363, __pyx_L52_error)
                  __Pyx_GOTREF(__pyx_t_9);
                  __pyx_t_18 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 363, __pyx_L52_error)
                }
                for (;;) {
                  if (likely(!__pyx_t_18)) {
                    if (likely(PyList_CheckExact(__pyx_t_9))) {
                      {
                        Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_9);
                        #if !CYTHON_ASSUME_SAFE_SIZE
                        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 363, __pyx_L52_error)
                        #endif
                        if (__pyx_t_17 >= __pyx_temp) break;
                      }
                      __pyx_t_13 = __Pyx_PyList_GetItemRef(__pyx_t_9, __pyx_t_17);
                      ++__pyx_t_17;
                    } else {
                      {
                        Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_9);
                        #if !CYTHON_ASSUME_SAFE_SIZE
                        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 363, __pyx_L52_error)
                        #endif
                        if (__pyx_t_17 >= __pyx_temp) break;
                      }
                      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                      __pyx_t_13 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_17));
                      #else
                      __pyx_t_13 = __Pyx_PySequence_ITEM(__pyx_t_9, __pyx_t_17);
                      #endif
                      ++__pyx_t_17;
                    }
                    if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 363, __pyx_L52_error)
                  } else {
                    __pyx_t_13 = __pyx_t_18(__pyx_t_9);
                    if (unlikely(!__pyx_t_13)) {
                      PyObject* exc_type = PyErr_Occurred();
                      if (exc_type) {
                        if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 363, __pyx_L52_error)
                        PyErr_Clear();
                      }
                      break;
                    }
                  }
                  __Pyx_GOTREF(__pyx_t_13);
                  __Pyx_XDECREF_SET(__pyx_8genexpr7__pyx_v_asset, __pyx_t_13);
                  __pyx_t_13 = 0;
    /* … */
                }
                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_asset); __pyx_8genexpr7__pyx_v_asset = 0;
                goto __pyx_L56_exit_scope;
                __pyx_L52_error:;
                __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_asset); __pyx_8genexpr7__pyx_v_asset = 0;
                goto __pyx_L1_error;
                __pyx_L56_exit_scope:;
              } /* exit inner scope */

    +364:                         }, index=assets, name=field)

              __pyx_t_6 = 1;
              #if CYTHON_UNPACK_METHODS
              if (unlikely(PyMethod_Check(__pyx_t_8))) {
                __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
                assert(__pyx_t_4);
                PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
                __Pyx_INCREF(__pyx_t_4);
                __Pyx_INCREF(__pyx__function);
                __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
                __pyx_t_6 = 0;
              }
              #endif
              {
                PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_4, NULL};
                __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 355, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_9);
                if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_data, __pyx_t_5, __pyx_t_9, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 355, __pyx_L1_error)
                if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_index, __pyx_v_assets, __pyx_t_9, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 355, __pyx_L1_error)
                if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_name_2, __pyx_v_field, __pyx_t_9, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 355, __pyx_L1_error)
                __pyx_t_7 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_8, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_9);
                __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
                __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
                __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
                __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
                if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 355, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_7);
              }
              __Pyx_XDECREF_SET(__pyx_v_series, __pyx_t_7);
              __pyx_t_7 = 0;

    +365:                         data[field] = series

              if (unlikely((PyDict_SetItem(__pyx_v_data, __pyx_v_field, __pyx_v_series) < 0))) __PYX_ERR(0, 365, __pyx_L1_error)

     366:

    +367:                 return pd.DataFrame(data)

          __Pyx_XDECREF(__pyx_r);
          __pyx_t_7 = NULL;
          __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 367, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_DataFrame); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 367, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_6 = 1;
          #if CYTHON_UNPACK_METHODS
          if (unlikely(PyMethod_Check(__pyx_t_9))) {
            __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
            assert(__pyx_t_7);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_9, __pyx__function);
            __pyx_t_6 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_data};
            __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
          }
          __pyx_r = __pyx_t_1;
          __pyx_t_1 = 0;
          __Pyx_TraceReturnValue(__pyx_r, 244, 0, __PYX_ERR(0, 367, __pyx_L1_error));
          goto __pyx_L0;
        }
      }

     368:

    +369:     @check_parameters(('continuous_future',),

    /* Python wrapper */
    static PyObject *__pyx_pw_7zipline_9_protocol_7BarData_5current_chain(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    static PyMethodDef __pyx_mdef_7zipline_9_protocol_7BarData_5current_chain = {"current_chain", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_9_protocol_7BarData_5current_chain, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
    static PyObject *__pyx_pw_7zipline_9_protocol_7BarData_5current_chain(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ) {
      PyObject *__pyx_v_continuous_future = 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("current_chain (wrapper)", 0);
      #if !CYTHON_METH_FASTCALL
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
      #endif
      #endif
      __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_continuous_future,0};
      PyObject* values[1] = {0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 369, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 369, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "current_chain", 0) < (0)) __PYX_ERR(0, 369, __pyx_L3_error)
          for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("current_chain", 1, 1, 1, i); __PYX_ERR(0, 369, __pyx_L3_error) }
          }
        } else if (unlikely(__pyx_nargs != 1)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 369, __pyx_L3_error)
        }
        __pyx_v_continuous_future = values[0];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("current_chain", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 369, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("zipline._protocol.BarData.current_chain", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_7zipline_9_protocol_7BarData_4current_chain(((struct __pyx_obj_7zipline_9_protocol_BarData *)__pyx_v_self), __pyx_v_continuous_future);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

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

    static PyObject *__pyx_pf_7zipline_9_protocol_7BarData_4current_chain(struct __pyx_obj_7zipline_9_protocol_BarData *__pyx_v_self, PyObject *__pyx_v_continuous_future) {
      PyObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[49]))
      __Pyx_TraceStartFunc("current_chain", __pyx_f[0], 369, 0, 0, 0, __PYX_ERR(0, 369, __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_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 369, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline._protocol.BarData.current_chain", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7zipline_9_protocol_7BarData_5current_chain, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BarData_current_chain, NULL, __pyx_mstate_global->__pyx_n_u_zipline__protocol, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[49])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 369, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_BarData, __pyx_mstate_global->__pyx_n_u_current_chain, __pyx_t_2) < (0)) __PYX_ERR(0, 369, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = NULL;
      __pyx_t_4 = NULL;
      __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_check_parameters);
      __pyx_t_10 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_check_parameters);
    /* … */
      __Pyx_GetNameInClass(__pyx_t_10, (PyObject*)__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_BarData, __pyx_mstate_global->__pyx_n_u_current_chain); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 369, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_10};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF((PyObject *)__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 369, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_BarData, __pyx_mstate_global->__pyx_n_u_current_chain, __pyx_t_2) < (0)) __PYX_ERR(0, 369, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    /* … */
      __pyx_mstate_global->__pyx_tuple[4] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_n_u_continuous_future); if (unlikely(!__pyx_mstate_global->__pyx_tuple[4])) __PYX_ERR(0, 369, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[4]);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[4]);

    +370:                       (ContinuousFuture,))

      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_ContinuousFuture); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 370, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = PyTuple_Pack(1, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 370, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_mstate_global->__pyx_tuple[4], __pyx_t_8};
        __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 369, __pyx_L1_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_7);
      }

     371:     def current_chain(self, continuous_future):

    +372:         return self.data_portal.get_current_future_chain(

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __pyx_v_self->data_portal;
      __Pyx_INCREF(__pyx_t_2);

     373:             continuous_future,

    +374:             self.simulation_dt_func())

      __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_self->simulation_dt_func);
      __pyx_t_5 = __pyx_v_self->simulation_dt_func;
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
        assert(__pyx_t_4);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 374, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_continuous_future, __pyx_t_3};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_current_future_chain, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 372, __pyx_L1_error));
      goto __pyx_L0;

     375:

    +376:     @check_parameters(('assets',), (Asset,))

    /* Python wrapper */
    static PyObject *__pyx_pw_7zipline_9_protocol_7BarData_7can_trade(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    PyDoc_STRVAR(__pyx_doc_7zipline_9_protocol_7BarData_6can_trade, "For the given asset or iterable of assets, returns True if all of the\n        following are true:\n\n        1. The asset is alive for the session of the current simulation time\n           (if current simulation time is not a market minute, we use the next\n           session).\n        2. The asset's exchange is open at the current simulation time or at\n           the simulation calendar's next market minute.\n        3. There is a known last price for the asset.\n\n        Parameters\n        ----------\n        assets: zipline.assets.Asset or iterable of zipline.assets.Asset\n            Asset(s) for which tradability should be determined.\n\n        Notes\n        -----\n        The second condition above warrants some further explanation:\n\n        - If the asset's exchange calendar is identical to the simulation\n          calendar, then this condition always returns True.\n        - If there are market minutes in the simulation calendar outside of\n          this asset's exchange's trading hours (for example, if the simulation\n          is running on the CMES calendar but the asset is MSFT, which trades\n          on the NYSE), during those minutes, this condition will return False\n          (for example, 3:15 am Eastern on a weekday, during which the CMES is\n          open but the NYSE is closed).\n\n        Returns\n        -------\n        can_trade : bool or pd.Series[bool]\n            Bool or series of bools indicating whether the requested asset(s)\n            can be traded in the current minute.\n        ");
    static PyMethodDef __pyx_mdef_7zipline_9_protocol_7BarData_7can_trade = {"can_trade", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_9_protocol_7BarData_7can_trade, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7zipline_9_protocol_7BarData_6can_trade};
    static PyObject *__pyx_pw_7zipline_9_protocol_7BarData_7can_trade(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ) {
      PyObject *__pyx_v_assets = 0;
      #if !CYTHON_METH_FASTCALL
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      #endif
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("can_trade (wrapper)", 0);
      #if !CYTHON_METH_FASTCALL
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
      #endif
      #endif
      __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_assets,0};
      PyObject* values[1] = {0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 376, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 376, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "can_trade", 0) < (0)) __PYX_ERR(0, 376, __pyx_L3_error)
          for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("can_trade", 1, 1, 1, i); __PYX_ERR(0, 376, __pyx_L3_error) }
          }
        } else if (unlikely(__pyx_nargs != 1)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 376, __pyx_L3_error)
        }
        __pyx_v_assets = values[0];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("can_trade", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 376, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("zipline._protocol.BarData.can_trade", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_7zipline_9_protocol_7BarData_6can_trade(((struct __pyx_obj_7zipline_9_protocol_BarData *)__pyx_v_self), __pyx_v_assets);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

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

    static PyObject *__pyx_pf_7zipline_9_protocol_7BarData_6can_trade(struct __pyx_obj_7zipline_9_protocol_BarData *__pyx_v_self, PyObject *__pyx_v_assets) {
      PyObject *__pyx_v_dt = NULL;
      PyObject *__pyx_v_adjusted_dt = NULL;
      PyObject *__pyx_v_data_portal = NULL;
      PyObject *__pyx_v_tradeable = NULL;
      PyObject *__pyx_8genexpr8__pyx_v_asset = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[50]))
      __Pyx_TraceStartFunc("can_trade", __pyx_f[0], 376, 0, 0, 0, __PYX_ERR(0, 376, __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_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 376, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline._protocol.BarData.can_trade", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_dt);
      __Pyx_XDECREF(__pyx_v_adjusted_dt);
      __Pyx_XDECREF(__pyx_v_data_portal);
      __Pyx_XDECREF(__pyx_v_tradeable);
      __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_asset);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7zipline_9_protocol_7BarData_7can_trade, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BarData_can_trade, NULL, __pyx_mstate_global->__pyx_n_u_zipline__protocol, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[50])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 376, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_BarData, __pyx_mstate_global->__pyx_n_u_can_trade, __pyx_t_2) < (0)) __PYX_ERR(0, 376, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = NULL;
      __pyx_t_5 = NULL;
      __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_check_parameters);
      __pyx_t_8 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_check_parameters);
      __pyx_t_4 = PyTuple_Pack(1, ((PyObject *)__pyx_mstate_global->__pyx_ptype_7zipline_6assets_7_assets_Asset)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 376, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_mstate_global->__pyx_tuple[5], __pyx_t_4};
        __pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 376, __pyx_L1_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_10);
      }
      __Pyx_GetNameInClass(__pyx_t_8, (PyObject*)__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_BarData, __pyx_mstate_global->__pyx_n_u_can_trade); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 376, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_8};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF((PyObject *)__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 376, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_BarData, __pyx_mstate_global->__pyx_n_u_can_trade, __pyx_t_2) < (0)) __PYX_ERR(0, 376, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    /* … */
      __pyx_mstate_global->__pyx_tuple[5] = PyTuple_Pack(1, __pyx_mstate_global->__pyx_n_u_assets); if (unlikely(!__pyx_mstate_global->__pyx_tuple[5])) __PYX_ERR(0, 376, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[5]);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[5]);

     377:     def can_trade(self, assets):

     378:         """For the given asset or iterable of assets, returns True if all of the

     379:         following are true:

     380:

     381:         1. The asset is alive for the session of the current simulation time

     382:            (if current simulation time is not a market minute, we use the next

     383:            session).

     384:         2. The asset's exchange is open at the current simulation time or at

     385:            the simulation calendar's next market minute.

     386:         3. There is a known last price for the asset.

     387:

     388:         Parameters

     389:         ----------

     390:         assets: zipline.assets.Asset or iterable of zipline.assets.Asset

     391:             Asset(s) for which tradability should be determined.

     392:

     393:         Notes

     394:         -----

     395:         The second condition above warrants some further explanation:

     396:

     397:         - If the asset's exchange calendar is identical to the simulation

     398:           calendar, then this condition always returns True.

     399:         - If there are market minutes in the simulation calendar outside of

     400:           this asset's exchange's trading hours (for example, if the simulation

     401:           is running on the CMES calendar but the asset is MSFT, which trades

     402:           on the NYSE), during those minutes, this condition will return False

     403:           (for example, 3:15 am Eastern on a weekday, during which the CMES is

     404:           open but the NYSE is closed).

     405:

     406:         Returns

     407:         -------

     408:         can_trade : bool or pd.Series[bool]

     409:             Bool or series of bools indicating whether the requested asset(s)

     410:             can be traded in the current minute.

     411:         """

    +412:         dt = self.simulation_dt_func()

      __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_v_self->simulation_dt_func);
      __pyx_t_3 = __pyx_v_self->simulation_dt_func;
      __pyx_t_4 = 1;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        assert(__pyx_t_2);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
        __pyx_t_4 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 412, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_v_dt = __pyx_t_1;
      __pyx_t_1 = 0;

     413:

    +414:         if self._adjust_minutes:

      __pyx_t_5 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->_adjust_minutes)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 414, __pyx_L1_error)
      if (__pyx_t_5) {
    /* … */
        goto __pyx_L3;
      }

    +415:             adjusted_dt = self._get_current_minute()

        __pyx_t_1 = ((struct __pyx_vtabstruct_7zipline_9_protocol_BarData *)__pyx_v_self->__pyx_vtab)->_get_current_minute(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 415, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_v_adjusted_dt = __pyx_t_1;
        __pyx_t_1 = 0;

     416:         else:

    +417:             adjusted_dt = dt

      /*else*/ {
        __Pyx_INCREF(__pyx_v_dt);
        __pyx_v_adjusted_dt = __pyx_v_dt;
      }
      __pyx_L3:;

     418:

    +419:         data_portal = self.data_portal

      __pyx_t_1 = __pyx_v_self->data_portal;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_data_portal = __pyx_t_1;
      __pyx_t_1 = 0;

     420:

    +421:         if isinstance(assets, Asset):

      __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_assets, __pyx_mstate_global->__pyx_ptype_7zipline_6assets_7_assets_Asset);
      if (__pyx_t_5) {
    /* … */
      }

    +422:             return self._can_trade_for_asset(

        __Pyx_XDECREF(__pyx_r);
    /* … */
        __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7zipline_9_protocol_BarData *)__pyx_v_self->__pyx_vtab)->_can_trade_for_asset(__pyx_v_self, __pyx_v_assets, __pyx_v_dt, __pyx_v_adjusted_dt, __pyx_v_data_portal)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 422, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        __Pyx_TraceReturnValue(__pyx_r, 22, 0, __PYX_ERR(0, 422, __pyx_L1_error));
        goto __pyx_L0;

     423:                 assets, dt, adjusted_dt, data_portal

     424:             )

     425:         else:

    +426:             tradeable = [

      /*else*/ {
        { /* enter inner scope */
          __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 426, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);

    +427:                 self._can_trade_for_asset(

            __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_7zipline_9_protocol_BarData *)__pyx_v_self->__pyx_vtab)->_can_trade_for_asset(__pyx_v_self, __pyx_8genexpr8__pyx_v_asset, __pyx_v_dt, __pyx_v_adjusted_dt, __pyx_v_data_portal)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 427, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_2);
            if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 426, __pyx_L7_error)
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     428:                     asset, dt, adjusted_dt, data_portal

     429:                 )

    +430:                 for asset in assets

          if (likely(PyList_CheckExact(__pyx_v_assets)) || PyTuple_CheckExact(__pyx_v_assets)) {
            __pyx_t_3 = __pyx_v_assets; __Pyx_INCREF(__pyx_t_3);
            __pyx_t_6 = 0;
            __pyx_t_7 = NULL;
          } else {
            __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_assets); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 430, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L7_error)
          }
          for (;;) {
            if (likely(!__pyx_t_7)) {
              if (likely(PyList_CheckExact(__pyx_t_3))) {
                {
                  Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
                  #if !CYTHON_ASSUME_SAFE_SIZE
                  if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 430, __pyx_L7_error)
                  #endif
                  if (__pyx_t_6 >= __pyx_temp) break;
                }
                __pyx_t_2 = __Pyx_PyList_GetItemRef(__pyx_t_3, __pyx_t_6);
                ++__pyx_t_6;
              } else {
                {
                  Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
                  #if !CYTHON_ASSUME_SAFE_SIZE
                  if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 430, __pyx_L7_error)
                  #endif
                  if (__pyx_t_6 >= __pyx_temp) break;
                }
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6));
                #else
                __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_6);
                #endif
                ++__pyx_t_6;
              }
              if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 430, __pyx_L7_error)
            } else {
              __pyx_t_2 = __pyx_t_7(__pyx_t_3);
              if (unlikely(!__pyx_t_2)) {
                PyObject* exc_type = PyErr_Occurred();
                if (exc_type) {
                  if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 430, __pyx_L7_error)
                  PyErr_Clear();
                }
                break;
              }
            }
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_XDECREF_SET(__pyx_8genexpr8__pyx_v_asset, __pyx_t_2);
            __pyx_t_2 = 0;
    /* … */
          }
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_asset); __pyx_8genexpr8__pyx_v_asset = 0;
          goto __pyx_L11_exit_scope;
          __pyx_L7_error:;
          __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_asset); __pyx_8genexpr8__pyx_v_asset = 0;
          goto __pyx_L1_error;
          __pyx_L11_exit_scope:;
        } /* exit inner scope */
        __pyx_v_tradeable = ((PyObject*)__pyx_t_1);
        __pyx_t_1 = 0;

     431:             ]

    +432:             return pd.Series(data=tradeable, index=assets, dtype=bool)

        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 432, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Series); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 432, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_4 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
          __pyx_t_4 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_3, NULL};
          __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 432, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_data, __pyx_v_tradeable, __pyx_t_2, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 432, __pyx_L1_error)
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_index, __pyx_v_assets, __pyx_t_2, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 432, __pyx_L1_error)
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, ((PyObject *)__pyx_mstate_global->__pyx_ptype_7cpython_4bool_bool), __pyx_t_2, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 432, __pyx_L1_error)
          __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_8, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_2);
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 432, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        __Pyx_TraceReturnValue(__pyx_r, 42, 0, __PYX_ERR(0, 432, __pyx_L1_error));
        goto __pyx_L0;
      }

     433:

    +434:     cdef bool _can_trade_for_asset(self, asset, dt, adjusted_dt, data_portal):

    static PyLongObject *__pyx_f_7zipline_9_protocol_7BarData__can_trade_for_asset(struct __pyx_obj_7zipline_9_protocol_BarData *__pyx_v_self, PyObject *__pyx_v_asset, PyObject *__pyx_v_dt, PyObject *__pyx_v_adjusted_dt, PyObject *__pyx_v_data_portal) {
      PyObject *__pyx_v_session_label = 0;
      PyObject *__pyx_v_dt_to_use_for_exchange_check = 0;
      PyLongObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[51]))
      __Pyx_TraceStartFunc("_can_trade_for_asset", __pyx_f[0], 434, 0, 0, 0, __PYX_ERR(0, 434, __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_7);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 434, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline._protocol.BarData._can_trade_for_asset", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_session_label);
      __Pyx_XDECREF(__pyx_v_dt_to_use_for_exchange_check);
      __Pyx_XGIVEREF((PyObject *)__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     435:         cdef object session_label

     436:         cdef object dt_to_use_for_exchange_check,

     437:

    +438:         if self._is_restricted(asset, adjusted_dt):

      __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_v_self->_is_restricted);
      __pyx_t_3 = __pyx_v_self->_is_restricted;
      __pyx_t_4 = 1;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        assert(__pyx_t_2);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
        __pyx_t_4 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_asset, __pyx_v_adjusted_dt};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 438, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_5) {
    /* … */
      }

    +439:             return False

        __Pyx_XDECREF((PyObject *)__pyx_r);
        __Pyx_INCREF(Py_False);
        __pyx_r = ((PyLongObject *)Py_False);
        __Pyx_TraceReturnValue((PyObject *)__pyx_r, 7, 0, __PYX_ERR(0, 439, __pyx_L1_error));
        goto __pyx_L0;

     440:

    +441:         session_label = self._trading_calendar.minute_to_session(dt)

      __pyx_t_3 = __pyx_v_self->_trading_calendar;
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_dt};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_minute_to_session, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_v_session_label = __pyx_t_1;
      __pyx_t_1 = 0;

     442:

    +443:         if not asset.is_alive_for_session(session_label):

      __pyx_t_3 = __pyx_v_asset;
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_session_label};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_is_alive_for_session, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 443, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 443, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = (!__pyx_t_5);
      if (__pyx_t_6) {
    /* … */
      }

     444:             # asset isn't alive

    +445:             return False

        __Pyx_XDECREF((PyObject *)__pyx_r);
        __Pyx_INCREF(Py_False);
        __pyx_r = ((PyLongObject *)Py_False);
        __Pyx_TraceReturnValue((PyObject *)__pyx_r, 21, 0, __PYX_ERR(0, 445, __pyx_L1_error));
        goto __pyx_L0;

     446:

    +447:         if asset.auto_close_date and session_label > asset.auto_close_date:

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_asset, __pyx_mstate_global->__pyx_n_u_auto_close_date); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 447, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_5) {
      } else {
        __pyx_t_6 = __pyx_t_5;
        goto __pyx_L6_bool_binop_done;
      }
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_asset, __pyx_mstate_global->__pyx_n_u_auto_close_date); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_session_label, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 447, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 447, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __pyx_t_5;
      __pyx_L6_bool_binop_done:;
      if (__pyx_t_6) {
    /* … */
      }

    +448:             return False

        __Pyx_XDECREF((PyObject *)__pyx_r);
        __Pyx_INCREF(Py_False);
        __pyx_r = ((PyLongObject *)Py_False);
        __Pyx_TraceReturnValue((PyObject *)__pyx_r, 31, 0, __PYX_ERR(0, 448, __pyx_L1_error));
        goto __pyx_L0;

     449:

    +450:         if not self._daily_mode:

      __pyx_t_6 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->_daily_mode)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 450, __pyx_L1_error)
      __pyx_t_5 = (!__pyx_t_6);
      if (__pyx_t_5) {
    /* … */
      }

     451:             # Find the next market minute for this calendar, and check if this

     452:             # asset's exchange is open at that minute.

    +453:             if self._trading_calendar.is_open_on_minute(dt):

        __pyx_t_1 = __pyx_v_self->_trading_calendar;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_dt};
          __pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_is_open_on_minute, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 453, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
        }
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 453, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (__pyx_t_5) {
    /* … */
          goto __pyx_L9;
        }

    +454:                 dt_to_use_for_exchange_check = dt

          __Pyx_INCREF(__pyx_v_dt);
          __pyx_v_dt_to_use_for_exchange_check = __pyx_v_dt;

     455:             else:

    +456:                 dt_to_use_for_exchange_check = self._trading_calendar.next_open(dt)

        /*else*/ {
          __pyx_t_1 = __pyx_v_self->_trading_calendar;
          __Pyx_INCREF(__pyx_t_1);
          __pyx_t_4 = 0;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_dt};
            __pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_next_open, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 456, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
          }
          __pyx_v_dt_to_use_for_exchange_check = __pyx_t_3;
          __pyx_t_3 = 0;
        }
        __pyx_L9:;

     457:

    +458:             if not asset.is_exchange_open(dt_to_use_for_exchange_check):

        __pyx_t_1 = __pyx_v_asset;
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_4 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_dt_to_use_for_exchange_check};
          __pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_is_exchange_open, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 458, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
        }
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 458, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_6 = (!__pyx_t_5);
        if (__pyx_t_6) {
    /* … */
        }

    +459:                 return False

          __Pyx_XDECREF((PyObject *)__pyx_r);
          __Pyx_INCREF(Py_False);
          __pyx_r = ((PyLongObject *)Py_False);
          __Pyx_TraceReturnValue((PyObject *)__pyx_r, 57, 0, __PYX_ERR(0, 459, __pyx_L1_error));
          goto __pyx_L0;

     460:

     461:         # is there a last price?

    +462:         return not np.isnan(

      __Pyx_XDECREF((PyObject *)__pyx_r);
      __pyx_t_1 = NULL;
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_isnan); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    /* … */
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 462, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyBool_FromLong((!__pyx_t_6)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_mstate_global->__pyx_ptype_7cpython_4bool_bool)))) __PYX_ERR(0, 462, __pyx_L1_error)
      __pyx_r = ((PyLongObject *)__pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_TraceReturnValue((PyObject *)__pyx_r, 59, 0, __PYX_ERR(0, 462, __pyx_L1_error));
      goto __pyx_L0;

    +463:             data_portal.get_spot_value(

      __pyx_t_8 = __pyx_v_data_portal;
      __Pyx_INCREF(__pyx_t_8);

    +464:                 asset, "price", adjusted_dt, self.data_frequency

      __pyx_t_4 = 0;
      {
        PyObject *__pyx_callargs[5] = {__pyx_t_8, __pyx_v_asset, __pyx_mstate_global->__pyx_n_u_price, __pyx_v_adjusted_dt, __pyx_v_self->data_frequency};
        __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_spot_value, __pyx_callargs+__pyx_t_4, (5-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 463, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __pyx_t_4 = 1;
      #if CYTHON_UNPACK_METHODS
      if (unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
        assert(__pyx_t_1);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
        __pyx_t_4 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_2};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 462, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }

     465:             )

     466:         )

     467:

    +468:     @check_parameters(('assets',), (Asset,))

    /* Python wrapper */
    static PyObject *__pyx_pw_7zipline_9_protocol_7BarData_9is_stale(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    PyDoc_STRVAR(__pyx_doc_7zipline_9_protocol_7BarData_8is_stale, "For the given asset or iterable of assets, returns True if the asset\n        is alive and there is no trade data for the current simulation time.\n\n        If the asset has never traded, returns False.\n\n        If the current simulation time is not a valid market time, we use the\n        current time to check if the asset is alive, but we use the last\n        market minute/day for the trade data check.\n\n        Parameters\n        ----------\n        assets: zipline.assets.Asset or iterable of zipline.assets.Asset\n            Asset(s) for which staleness should be determined.\n\n        Returns\n        -------\n        is_stale : bool or pd.Series[bool]\n            Bool or series of bools indicating whether the requested asset(s)\n            are stale.\n        ");
    static PyMethodDef __pyx_mdef_7zipline_9_protocol_7BarData_9is_stale = {"is_stale", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_9_protocol_7BarData_9is_stale, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7zipline_9_protocol_7BarData_8is_stale};
    static PyObject *__pyx_pw_7zipline_9_protocol_7BarData_9is_stale(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ) {
      PyObject *__pyx_v_assets = 0;
      #if !CYTHON_METH_FASTCALL
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      #endif
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("is_stale (wrapper)", 0);
      #if !CYTHON_METH_FASTCALL
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
      #endif
      #endif
      __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_assets,0};
      PyObject* values[1] = {0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 468, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 468, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "is_stale", 0) < (0)) __PYX_ERR(0, 468, __pyx_L3_error)
          for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("is_stale", 1, 1, 1, i); __PYX_ERR(0, 468, __pyx_L3_error) }
          }
        } else if (unlikely(__pyx_nargs != 1)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 468, __pyx_L3_error)
        }
        __pyx_v_assets = values[0];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("is_stale", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 468, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("zipline._protocol.BarData.is_stale", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_7zipline_9_protocol_7BarData_8is_stale(((struct __pyx_obj_7zipline_9_protocol_BarData *)__pyx_v_self), __pyx_v_assets);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

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

    static PyObject *__pyx_pf_7zipline_9_protocol_7BarData_8is_stale(struct __pyx_obj_7zipline_9_protocol_BarData *__pyx_v_self, PyObject *__pyx_v_assets) {
      PyObject *__pyx_v_dt = NULL;
      PyObject *__pyx_v_adjusted_dt = NULL;
      PyObject *__pyx_v_data_portal = NULL;
      PyObject *__pyx_8genexpr9__pyx_v_asset = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[52]))
      __Pyx_TraceStartFunc("is_stale", __pyx_f[0], 468, 0, 0, 0, __PYX_ERR(0, 468, __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_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_10);
      __Pyx_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 468, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline._protocol.BarData.is_stale", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_dt);
      __Pyx_XDECREF(__pyx_v_adjusted_dt);
      __Pyx_XDECREF(__pyx_v_data_portal);
      __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_asset);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7zipline_9_protocol_7BarData_9is_stale, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BarData_is_stale, NULL, __pyx_mstate_global->__pyx_n_u_zipline__protocol, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[52])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 468, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_BarData, __pyx_mstate_global->__pyx_n_u_is_stale, __pyx_t_2) < (0)) __PYX_ERR(0, 468, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_10 = NULL;
      __pyx_t_7 = NULL;
      __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_check_parameters);
      __pyx_t_4 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_check_parameters);
      __pyx_t_5 = PyTuple_Pack(1, ((PyObject *)__pyx_mstate_global->__pyx_ptype_7zipline_6assets_7_assets_Asset)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 468, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_mstate_global->__pyx_tuple[5], __pyx_t_5};
        __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 468, __pyx_L1_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_8);
      }
      __Pyx_GetNameInClass(__pyx_t_4, (PyObject*)__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_BarData, __pyx_mstate_global->__pyx_n_u_is_stale); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 468, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_4};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF((PyObject *)__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 468, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_BarData, __pyx_mstate_global->__pyx_n_u_is_stale, __pyx_t_2) < (0)) __PYX_ERR(0, 468, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     469:     def is_stale(self, assets):

     470:         """For the given asset or iterable of assets, returns True if the asset

     471:         is alive and there is no trade data for the current simulation time.

     472:

     473:         If the asset has never traded, returns False.

     474:

     475:         If the current simulation time is not a valid market time, we use the

     476:         current time to check if the asset is alive, but we use the last

     477:         market minute/day for the trade data check.

     478:

     479:         Parameters

     480:         ----------

     481:         assets: zipline.assets.Asset or iterable of zipline.assets.Asset

     482:             Asset(s) for which staleness should be determined.

     483:

     484:         Returns

     485:         -------

     486:         is_stale : bool or pd.Series[bool]

     487:             Bool or series of bools indicating whether the requested asset(s)

     488:             are stale.

     489:         """

    +490:         dt = self.simulation_dt_func()

      __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_v_self->simulation_dt_func);
      __pyx_t_3 = __pyx_v_self->simulation_dt_func;
      __pyx_t_4 = 1;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        assert(__pyx_t_2);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
        __pyx_t_4 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_v_dt = __pyx_t_1;
      __pyx_t_1 = 0;

    +491:         if self._adjust_minutes:

      __pyx_t_5 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->_adjust_minutes)); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 491, __pyx_L1_error)
      if (__pyx_t_5) {
    /* … */
        goto __pyx_L3;
      }

    +492:             adjusted_dt = self._get_current_minute()

        __pyx_t_1 = ((struct __pyx_vtabstruct_7zipline_9_protocol_BarData *)__pyx_v_self->__pyx_vtab)->_get_current_minute(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_v_adjusted_dt = __pyx_t_1;
        __pyx_t_1 = 0;

     493:         else:

    +494:             adjusted_dt = dt

      /*else*/ {
        __Pyx_INCREF(__pyx_v_dt);
        __pyx_v_adjusted_dt = __pyx_v_dt;
      }
      __pyx_L3:;

     495:

    +496:         data_portal = self.data_portal

      __pyx_t_1 = __pyx_v_self->data_portal;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_data_portal = __pyx_t_1;
      __pyx_t_1 = 0;

     497:

    +498:         if isinstance(assets, Asset):

      __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_assets, __pyx_mstate_global->__pyx_ptype_7zipline_6assets_7_assets_Asset);
      if (__pyx_t_5) {
    /* … */
      }

    +499:             return self._is_stale_for_asset(

        __Pyx_XDECREF(__pyx_r);
    /* … */
        __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7zipline_9_protocol_BarData *)__pyx_v_self->__pyx_vtab)->_is_stale_for_asset(__pyx_v_self, __pyx_v_assets, __pyx_v_dt, __pyx_v_adjusted_dt, __pyx_v_data_portal)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 499, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        __Pyx_TraceReturnValue(__pyx_r, 22, 0, __PYX_ERR(0, 499, __pyx_L1_error));
        goto __pyx_L0;

     500:                 assets, dt, adjusted_dt, data_portal

     501:             )

     502:         else:

    +503:             return pd.Series(data={

      /*else*/ {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 503, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Series); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 503, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        { /* enter inner scope */
          __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 503, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_2);

    +504:                 asset: self._is_stale_for_asset(

            __pyx_t_10 = ((PyObject *)((struct __pyx_vtabstruct_7zipline_9_protocol_BarData *)__pyx_v_self->__pyx_vtab)->_is_stale_for_asset(__pyx_v_self, __pyx_8genexpr9__pyx_v_asset, __pyx_v_dt, __pyx_v_adjusted_dt, __pyx_v_data_portal)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 504, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_10);
            if (unlikely(PyDict_SetItem(__pyx_t_2, (PyObject*)__pyx_8genexpr9__pyx_v_asset, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 504, __pyx_L7_error)
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

     505:                     asset, dt, adjusted_dt, data_portal

     506:                 )

    +507:                 for asset in assets

          if (likely(PyList_CheckExact(__pyx_v_assets)) || PyTuple_CheckExact(__pyx_v_assets)) {
            __pyx_t_7 = __pyx_v_assets; __Pyx_INCREF(__pyx_t_7);
            __pyx_t_8 = 0;
            __pyx_t_9 = NULL;
          } else {
            __pyx_t_8 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_assets); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 507, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 507, __pyx_L7_error)
          }
          for (;;) {
            if (likely(!__pyx_t_9)) {
              if (likely(PyList_CheckExact(__pyx_t_7))) {
                {
                  Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_7);
                  #if !CYTHON_ASSUME_SAFE_SIZE
                  if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 507, __pyx_L7_error)
                  #endif
                  if (__pyx_t_8 >= __pyx_temp) break;
                }
                __pyx_t_10 = __Pyx_PyList_GetItemRef(__pyx_t_7, __pyx_t_8);
                ++__pyx_t_8;
              } else {
                {
                  Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_7);
                  #if !CYTHON_ASSUME_SAFE_SIZE
                  if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 507, __pyx_L7_error)
                  #endif
                  if (__pyx_t_8 >= __pyx_temp) break;
                }
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                __pyx_t_10 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_8));
                #else
                __pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_7, __pyx_t_8);
                #endif
                ++__pyx_t_8;
              }
              if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 507, __pyx_L7_error)
            } else {
              __pyx_t_10 = __pyx_t_9(__pyx_t_7);
              if (unlikely(!__pyx_t_10)) {
                PyObject* exc_type = PyErr_Occurred();
                if (exc_type) {
                  if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 507, __pyx_L7_error)
                  PyErr_Clear();
                }
                break;
              }
            }
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_XDECREF_SET(__pyx_8genexpr9__pyx_v_asset, __pyx_t_10);
            __pyx_t_10 = 0;
    /* … */
          }
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_asset); __pyx_8genexpr9__pyx_v_asset = 0;
          goto __pyx_L11_exit_scope;
          __pyx_L7_error:;
          __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_asset); __pyx_8genexpr9__pyx_v_asset = 0;
          goto __pyx_L1_error;
          __pyx_L11_exit_scope:;
        } /* exit inner scope */
        __pyx_t_4 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
          assert(__pyx_t_3);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
          __pyx_t_4 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, NULL};
          __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 503, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_data, __pyx_t_2, __pyx_t_7, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 503, __pyx_L1_error)
          __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_6, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_7);
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        __Pyx_TraceReturnValue(__pyx_r, 30, 0, __PYX_ERR(0, 503, __pyx_L1_error));
        goto __pyx_L0;
      }

     508:             })

     509:

    +510:     cdef bool _is_stale_for_asset(self, asset, dt, adjusted_dt, data_portal):

    static PyLongObject *__pyx_f_7zipline_9_protocol_7BarData__is_stale_for_asset(struct __pyx_obj_7zipline_9_protocol_BarData *__pyx_v_self, PyObject *__pyx_v_asset, PyObject *__pyx_v_dt, PyObject *__pyx_v_adjusted_dt, PyObject *__pyx_v_data_portal) {
      PyObject *__pyx_v_session_label = NULL;
      PyObject *__pyx_v_current_volume = NULL;
      PyObject *__pyx_v_last_traded_dt = NULL;
      PyLongObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[53]))
      __Pyx_TraceStartFunc("_is_stale_for_asset", __pyx_f[0], 510, 0, 0, 0, __PYX_ERR(0, 510, __pyx_L1_error));
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 510, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline._protocol.BarData._is_stale_for_asset", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_session_label);
      __Pyx_XDECREF(__pyx_v_current_volume);
      __Pyx_XDECREF(__pyx_v_last_traded_dt);
      __Pyx_XGIVEREF((PyObject *)__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +511:         session_label = dt.normalize()  # FIXME

      __pyx_t_2 = __pyx_v_dt;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_normalize, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 511, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_v_session_label = __pyx_t_1;
      __pyx_t_1 = 0;

     512:

    +513:         if not asset.is_alive_for_session(session_label):

      __pyx_t_2 = __pyx_v_asset;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_session_label};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_is_alive_for_session, __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 513, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = (!__pyx_t_4);
      if (__pyx_t_5) {
    /* … */
      }

    +514:             return False

        __Pyx_XDECREF((PyObject *)__pyx_r);
        __Pyx_INCREF(Py_False);
        __pyx_r = ((PyLongObject *)Py_False);
        __Pyx_TraceReturnValue((PyObject *)__pyx_r, 11, 0, __PYX_ERR(0, 514, __pyx_L1_error));
        goto __pyx_L0;

     515:

    +516:         current_volume = data_portal.get_spot_value(

      __pyx_t_2 = __pyx_v_data_portal;
      __Pyx_INCREF(__pyx_t_2);

    +517:             asset, "volume", adjusted_dt, self.data_frequency

      __pyx_t_3 = 0;
      {
        PyObject *__pyx_callargs[5] = {__pyx_t_2, __pyx_v_asset, __pyx_mstate_global->__pyx_n_u_volume, __pyx_v_adjusted_dt, __pyx_v_self->data_frequency};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_spot_value, __pyx_callargs+__pyx_t_3, (5-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_v_current_volume = __pyx_t_1;
      __pyx_t_1 = 0;

     518:         )

     519:

    +520:         if current_volume > 0:

      __pyx_t_1 = PyObject_RichCompare(__pyx_v_current_volume, __pyx_mstate_global->__pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error)
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 520, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_5) {
    /* … */
      }

     521:             # found a current value, so we know this asset is not stale.

    +522:             return False

        __Pyx_XDECREF((PyObject *)__pyx_r);
        __Pyx_INCREF(Py_False);
        __pyx_r = ((PyLongObject *)Py_False);
        __Pyx_TraceReturnValue((PyObject *)__pyx_r, 26, 0, __PYX_ERR(0, 522, __pyx_L1_error));
        goto __pyx_L0;

     523:         else:

     524:             # we need to distinguish between if this asset has ever traded

     525:             # (stale = True) or has never traded (stale = False)

    +526:             last_traded_dt = \

      /*else*/ {

    +527:                 data_portal.get_spot_value(asset, "last_traded", adjusted_dt,

        __pyx_t_2 = __pyx_v_data_portal;
        __Pyx_INCREF(__pyx_t_2);

    +528:                                            self.data_frequency)

        __pyx_t_3 = 0;
        {
          PyObject *__pyx_callargs[5] = {__pyx_t_2, __pyx_v_asset, __pyx_mstate_global->__pyx_n_u_last_traded, __pyx_v_adjusted_dt, __pyx_v_self->data_frequency};
          __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_spot_value, __pyx_callargs+__pyx_t_3, (5-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 527, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
        }
        __pyx_v_last_traded_dt = __pyx_t_1;
        __pyx_t_1 = 0;

     529:

    +530:             return not (last_traded_dt is pd.NaT)

        __Pyx_XDECREF((PyObject *)__pyx_r);
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_NaT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 530, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_5 = (__pyx_v_last_traded_dt != __pyx_t_2);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 530, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_7cpython_4bool_bool)))) __PYX_ERR(0, 530, __pyx_L1_error)
        __pyx_r = ((PyLongObject *)__pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_TraceReturnValue((PyObject *)__pyx_r, 37, 0, __PYX_ERR(0, 530, __pyx_L1_error));
        goto __pyx_L0;
      }

     531:

    +532:     @check_parameters(('assets', 'fields', 'bar_count', 'frequency'),

    /* Python wrapper */
    static PyObject *__pyx_pw_7zipline_9_protocol_7BarData_11history(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ); /*proto*/
    PyDoc_STRVAR(__pyx_doc_7zipline_9_protocol_7BarData_10history, "Returns a trailing window of length ``bar_count`` with data for\n        the given assets, fields, and frequency, adjusted for splits, dividends,\n        and mergers as of the current simulation time.\n\n        The semantics for missing data are identical to the ones described in\n        the notes for :meth:`current`.\n\n        Parameters\n        ----------\n        assets: zipline.assets.Asset or iterable of zipline.assets.Asset\n            The asset(s) for which data is requested.\n        fields: string or iterable of string.\n            Requested data field(s). Valid field names are: \"price\",\n            \"last_traded\", \"open\", \"high\", \"low\", \"close\", and \"volume\".\n        bar_count: int\n            Number of data observations requested.\n        frequency: str\n            String indicating whether to load daily or minutely data\n            observations. Pass '1m' for minutely data, '1d' for daily data.\n\n        Returns\n        -------\n        history : pd.Series or pd.DataFrame or pd.Panel\n            See notes below.\n\n        Notes\n        -----\n        The return type of this function depends on the types of ``assets`` and\n        ``fields``:\n\n        - If a single asset and a single field are requested, the returned\n          value is a :class:`pd.Series` of length ``bar_count`` whose index is\n          :class:`pd.DatetimeIndex`.\n\n        - If a single asset and multiple fields are requested, the returned\n          value is a :class:`pd.DataFrame` with shape\n          ``(bar_count, len(fields))``. The frame's index will be a\n          :class:`pd.DatetimeIndex`, and its columns will be ``fields``.\n\n        - If multiple assets and a single field are requested, the returned\n          value is a :class:`pd.DataFrame` with shape\n          ``(bar_count, len(assets))``. The frame's index will be a\n          :class:`pd.DatetimeIndex`, and its columns will be ``assets``.\n\n        - If multiple assets and multiple fi""elds are requested, the returned\n          value is a :class:`pd.DataFrame` with a pd.MultiIndex containing\n          pairs of :class:`pd.DatetimeIndex`, and ``assets``, while the columns\n          while contain the field(s). It has shape ``(bar_count * len(assets),\n          len(fields))``. The names of the pd.MultiIndex are\n\n              - ``date`` if frequency == '1d'`` or ``date_time`` if frequency == '1m``, and\n              - ``asset``\n\n        If the current simulation time is not a valid market time, we use the last market close instead.\n        ");
    static PyMethodDef __pyx_mdef_7zipline_9_protocol_7BarData_11history = {"history", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_9_protocol_7BarData_11history, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7zipline_9_protocol_7BarData_10history};
    static PyObject *__pyx_pw_7zipline_9_protocol_7BarData_11history(PyObject *__pyx_v_self,
    #if CYTHON_METH_FASTCALL
    PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
    #else
    PyObject *__pyx_args, PyObject *__pyx_kwds
    #endif
    ) {
      PyObject *__pyx_v_assets = 0;
      PyObject *__pyx_v_fields = 0;
      PyObject *__pyx_v_bar_count = 0;
      PyObject *__pyx_v_frequency = 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("history (wrapper)", 0);
      #if !CYTHON_METH_FASTCALL
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
      #endif
      #endif
      __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_assets,&__pyx_mstate_global->__pyx_n_u_fields,&__pyx_mstate_global->__pyx_n_u_bar_count,&__pyx_mstate_global->__pyx_n_u_frequency,0};
      PyObject* values[4] = {0,0,0,0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 532, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  4:
            values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 532, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  3:
            values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 532, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 532, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 532, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "history", 0) < (0)) __PYX_ERR(0, 532, __pyx_L3_error)
          for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("history", 1, 4, 4, i); __PYX_ERR(0, 532, __pyx_L3_error) }
          }
        } else if (unlikely(__pyx_nargs != 4)) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 532, __pyx_L3_error)
          values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 532, __pyx_L3_error)
          values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 532, __pyx_L3_error)
          values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
          if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 532, __pyx_L3_error)
        }
        __pyx_v_assets = values[0];
        __pyx_v_fields = values[1];
        __pyx_v_bar_count = values[2];
        __pyx_v_frequency = values[3];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("history", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 532, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("zipline._protocol.BarData.history", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_7zipline_9_protocol_7BarData_10history(((struct __pyx_obj_7zipline_9_protocol_BarData *)__pyx_v_self), __pyx_v_assets, __pyx_v_fields, __pyx_v_bar_count, __pyx_v_frequency);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

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

    static PyObject *__pyx_pf_7zipline_9_protocol_7BarData_10history(struct __pyx_obj_7zipline_9_protocol_BarData *__pyx_v_self, PyObject *__pyx_v_assets, PyObject *__pyx_v_fields, PyObject *__pyx_v_bar_count, PyObject *__pyx_v_frequency) {
      int __pyx_v_single_field;
      int __pyx_v_single_asset;
      PyObject *__pyx_v_asset_list = NULL;
      PyObject *__pyx_v_df = NULL;
      PyObject *__pyx_v_adjs = NULL;
      PyObject *__pyx_v_df_dict = NULL;
      PyObject *__pyx_v_dt_label = NULL;
      PyObject *__pyx_v_stack_future_compatible = NULL;
      PyObject *__pyx_9genexpr10__pyx_v_field = NULL;
      PyObject *__pyx_9genexpr11__pyx_v_field = NULL;
      PyObject *__pyx_9genexpr12__pyx_v_field = NULL;
      PyObject *__pyx_9genexpr12__pyx_v_df = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[54]))
      __Pyx_TraceStartFunc("history", __pyx_f[0], 532, 0, 0, 0, __PYX_ERR(0, 532, __pyx_L1_error));
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_11);
      __Pyx_XDECREF(__pyx_t_12);
      __Pyx_XDECREF(__pyx_t_16);
      __Pyx_XDECREF(__pyx_t_17);
      __Pyx_XDECREF(__pyx_t_18);
      __Pyx_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 532, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline._protocol.BarData.history", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_asset_list);
      __Pyx_XDECREF(__pyx_v_df);
      __Pyx_XDECREF(__pyx_v_adjs);
      __Pyx_XDECREF(__pyx_v_df_dict);
      __Pyx_XDECREF(__pyx_v_dt_label);
      __Pyx_XDECREF(__pyx_v_stack_future_compatible);
      __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_field);
      __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_field);
      __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_field);
      __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_df);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7zipline_9_protocol_7BarData_11history, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BarData_history, NULL, __pyx_mstate_global->__pyx_n_u_zipline__protocol, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[54])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 532, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_BarData, __pyx_mstate_global->__pyx_n_u_history, __pyx_t_2) < (0)) __PYX_ERR(0, 532, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = NULL;
      __pyx_t_10 = NULL;
      __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_check_parameters);
      __pyx_t_5 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_check_parameters);
    /* … */
      __Pyx_GetNameInClass(__pyx_t_5, (PyObject*)__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_BarData, __pyx_mstate_global->__pyx_n_u_history); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 532, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_5};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF((PyObject *)__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 532, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7zipline_9_protocol_BarData, __pyx_mstate_global->__pyx_n_u_history, __pyx_t_2) < (0)) __PYX_ERR(0, 532, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +533:                       ((Asset, ContinuousFuture, str),

      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_ContinuousFuture); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 533, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_3 = PyTuple_Pack(3, ((PyObject *)__pyx_mstate_global->__pyx_ptype_7zipline_6assets_7_assets_Asset), __pyx_t_7, ((PyObject *)(&PyUnicode_Type))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 533, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    /* … */
      __pyx_t_11 = PyTuple_Pack(4, __pyx_t_3, __pyx_t_7, ((PyObject *)(&PyLong_Type)), __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 533, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_10, __pyx_mstate_global->__pyx_tuple[6], __pyx_t_11};
        __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 532, __pyx_L1_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_4);
      }

    +534:                        (str,),

      __pyx_t_7 = PyTuple_Pack(1, ((PyObject *)(&PyUnicode_Type))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 534, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);

     535:                        int,

    +536:                        (str,)))

      __pyx_t_9 = PyTuple_Pack(1, ((PyObject *)(&PyUnicode_Type))); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 536, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);

     537:     def history(self, assets, fields, bar_count, frequency):

     538:         """Returns a trailing window of length ``bar_count`` with data for

     539:         the given assets, fields, and frequency, adjusted for splits, dividends,

     540:         and mergers as of the current simulation time.

     541:

     542:         The semantics for missing data are identical to the ones described in

     543:         the notes for :meth:`current`.

     544:

     545:         Parameters

     546:         ----------

     547:         assets: zipline.assets.Asset or iterable of zipline.assets.Asset

     548:             The asset(s) for which data is requested.

     549:         fields: string or iterable of string.

     550:             Requested data field(s). Valid field names are: "price",

     551:             "last_traded", "open", "high", "low", "close", and "volume".

     552:         bar_count: int

     553:             Number of data observations requested.

     554:         frequency: str

     555:             String indicating whether to load daily or minutely data

     556:             observations. Pass '1m' for minutely data, '1d' for daily data.

     557:

     558:         Returns

     559:         -------

     560:         history : pd.Series or pd.DataFrame or pd.Panel

     561:             See notes below.

     562:

     563:         Notes

     564:         -----

     565:         The return type of this function depends on the types of ``assets`` and

     566:         ``fields``:

     567:

     568:         - If a single asset and a single field are requested, the returned

     569:           value is a :class:`pd.Series` of length ``bar_count`` whose index is

     570:           :class:`pd.DatetimeIndex`.

     571:

     572:         - If a single asset and multiple fields are requested, the returned

     573:           value is a :class:`pd.DataFrame` with shape

     574:           ``(bar_count, len(fields))``. The frame's index will be a

     575:           :class:`pd.DatetimeIndex`, and its columns will be ``fields``.

     576:

     577:         - If multiple assets and a single field are requested, the returned

     578:           value is a :class:`pd.DataFrame` with shape

     579:           ``(bar_count, len(assets))``. The frame's index will be a

     580:           :class:`pd.DatetimeIndex`, and its columns will be ``assets``.

     581:

     582:         - If multiple assets and multiple fields are requested, the returned

     583:           value is a :class:`pd.DataFrame` with a pd.MultiIndex containing

     584:           pairs of :class:`pd.DatetimeIndex`, and ``assets``, while the columns

     585:           while contain the field(s). It has shape ``(bar_count * len(assets),

     586:           len(fields))``. The names of the pd.MultiIndex are

     587:

     588:               - ``date`` if frequency == '1d'`` or ``date_time`` if frequency == '1m``, and

     589:               - ``asset``

     590:

     591:         If the current simulation time is not a valid market time, we use the last market close instead.

     592:         """

     593:

    +594:         single_field = isinstance(fields, str)

      __pyx_t_1 = PyUnicode_Check(__pyx_v_fields);
      __pyx_v_single_field = __pyx_t_1;

     595:

    +596:         single_asset = isinstance(assets, PricingDataAssociable)

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_PricingDataAssociable); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 596, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PyObject_IsInstance(__pyx_v_assets, __pyx_t_2); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 596, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_single_asset = __pyx_t_1;

    +597:         if single_asset:

      if (__pyx_v_single_asset) {
    /* … */
        goto __pyx_L3;
      }

    +598:             asset_list = [assets]

        __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 598, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_v_assets);
        __Pyx_GIVEREF(__pyx_v_assets);
        if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_assets) != (0)) __PYX_ERR(0, 598, __pyx_L1_error);
        __pyx_v_asset_list = __pyx_t_2;
        __pyx_t_2 = 0;

     599:         else:

    +600:             asset_list = assets

      /*else*/ {
        __Pyx_INCREF(__pyx_v_assets);
        __pyx_v_asset_list = __pyx_v_assets;
      }
      __pyx_L3:;

     601:

    +602:         if single_field:  # for one or more assets:

      if (__pyx_v_single_field) {
    /* … */
      }

    +603:             df = self.data_portal.get_history_window(

        __pyx_t_3 = __pyx_v_self->data_portal;
        __Pyx_INCREF(__pyx_t_3);

     604:                 asset_list,

    +605:                 self._get_current_minute(),

        __pyx_t_4 = ((struct __pyx_vtabstruct_7zipline_9_protocol_BarData *)__pyx_v_self->__pyx_vtab)->_get_current_minute(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 605, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);

     606:                 bar_count,

     607:                 frequency,

     608:                 fields,

    +609:                 self.data_frequency,

        __pyx_t_5 = 0;
        {
          PyObject *__pyx_callargs[7] = {__pyx_t_3, __pyx_v_asset_list, __pyx_t_4, __pyx_v_bar_count, __pyx_v_frequency, __pyx_v_fields, __pyx_v_self->data_frequency};
          __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_history_window, __pyx_callargs+__pyx_t_5, (7-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 603, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_v_df = __pyx_t_2;
        __pyx_t_2 = 0;

     610:             )

     611:

    +612:             if self._adjust_minutes:

        __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->_adjust_minutes)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 612, __pyx_L1_error)
        if (__pyx_t_1) {
    /* … */
        }

    +613:                 adjs = self.data_portal.get_adjustments(

          __pyx_t_4 = __pyx_v_self->data_portal;
          __Pyx_INCREF(__pyx_t_4);

     614:                     asset_list,

     615:                     fields,

    +616:                     self._get_current_minute(),

          __pyx_t_3 = ((struct __pyx_vtabstruct_7zipline_9_protocol_BarData *)__pyx_v_self->__pyx_vtab)->_get_current_minute(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 616, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);

    +617:                     self.simulation_dt_func()

          __pyx_t_7 = NULL;
          __Pyx_INCREF(__pyx_v_self->simulation_dt_func);
          __pyx_t_8 = __pyx_v_self->simulation_dt_func;
          __pyx_t_5 = 1;
          #if CYTHON_UNPACK_METHODS
          if (likely(PyMethod_Check(__pyx_t_8))) {
            __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
            assert(__pyx_t_7);
            PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(__pyx__function);
            __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
            __pyx_t_5 = 0;
          }
          #endif
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
            __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 617, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
          }
          __pyx_t_5 = 0;
          {
            PyObject *__pyx_callargs[5] = {__pyx_t_4, __pyx_v_asset_list, __pyx_v_fields, __pyx_t_3, __pyx_t_6};
            __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_adjustments, __pyx_callargs+__pyx_t_5, (5-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 613, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
          }
          __pyx_v_adjs = __pyx_t_2;
          __pyx_t_2 = 0;

     618:                 )

     619:

    +620:                 df = df * adjs

          __pyx_t_2 = PyNumber_Multiply(__pyx_v_df, __pyx_v_adjs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 620, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF_SET(__pyx_v_df, __pyx_t_2);
          __pyx_t_2 = 0;

     621:

    +622:             if single_asset:

        if (__pyx_v_single_asset) {
    /* … */
        }

     623:                 # single asset, single field: return pd.Series with pd.DateTimeIndex

    +624:                 return df.loc[:, assets]

          __Pyx_XDECREF(__pyx_r);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_mstate_global->__pyx_n_u_loc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 624, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 624, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[0]);
          __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_mstate_global->__pyx_slice[0]) != (0)) __PYX_ERR(0, 624, __pyx_L1_error);
          __Pyx_INCREF(__pyx_v_assets);
          __Pyx_GIVEREF(__pyx_v_assets);
          if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_assets) != (0)) __PYX_ERR(0, 624, __pyx_L1_error);
          __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_r = __pyx_t_3;
          __pyx_t_3 = 0;
          __Pyx_TraceReturnValue(__pyx_r, 56, 0, __PYX_ERR(0, 624, __pyx_L1_error));
          goto __pyx_L0;
    /* … */
      __pyx_mstate_global->__pyx_slice[0] = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[0])) __PYX_ERR(0, 624, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[0]);
      __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]);

     625:             else:

     626:                 # multiple assets, single field: return DataFrame with pd.DateTimeIndex

     627:                 # and assets in columns.

    +628:                 return df

        /*else*/ {
          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(__pyx_v_df);
          __pyx_r = __pyx_v_df;
          __Pyx_TraceReturnValue(__pyx_r, 61, 0, __PYX_ERR(0, 628, __pyx_L1_error));
          goto __pyx_L0;
        }

     629:         else:  # multiple fields

     630:             # if single_asset:

     631:             # todo: optimize by querying multiple fields

     632:             # Make multiple history calls, one per field, then combine results

     633:

    +634:             df_dict = {

      /*else*/ {
        { /* enter inner scope */
          __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 634, __pyx_L9_error)
          __Pyx_GOTREF(__pyx_t_3);

    +635:                 field: self.data_portal.get_history_window(asset_list,

            __pyx_t_4 = __pyx_v_self->data_portal;
            __Pyx_INCREF(__pyx_t_4);

    +636:                                                            self._get_current_minute(),

            __pyx_t_8 = ((struct __pyx_vtabstruct_7zipline_9_protocol_BarData *)__pyx_v_self->__pyx_vtab)->_get_current_minute(__pyx_v_self); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 636, __pyx_L9_error)
            __Pyx_GOTREF(__pyx_t_8);

     637:                                                            bar_count,

     638:                                                            frequency,

     639:                                                            field,

    +640:                                                            self.data_frequency,

            __pyx_t_5 = 0;
            {
              PyObject *__pyx_callargs[7] = {__pyx_t_4, __pyx_v_asset_list, __pyx_t_8, __pyx_v_bar_count, __pyx_v_frequency, __pyx_9genexpr10__pyx_v_field, __pyx_v_self->data_frequency};
              __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_history_window, __pyx_callargs+__pyx_t_5, (7-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
              if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 635, __pyx_L9_error)
              __Pyx_GOTREF(__pyx_t_2);
            }

    +641:                                                            ).loc[:, asset_list]

            __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_loc); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 641, __pyx_L9_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 641, __pyx_L9_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_INCREF(__pyx_mstate_global->__pyx_slice[0]);
            __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]);
            if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_mstate_global->__pyx_slice[0]) != (0)) __PYX_ERR(0, 641, __pyx_L9_error);
            __Pyx_INCREF(__pyx_v_asset_list);
            __Pyx_GIVEREF(__pyx_v_asset_list);
            if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_asset_list) != (0)) __PYX_ERR(0, 641, __pyx_L9_error);
            __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 641, __pyx_L9_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            if (unlikely(PyDict_SetItem(__pyx_t_3, (PyObject*)__pyx_9genexpr10__pyx_v_field, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 635, __pyx_L9_error)
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +642:                 for field in fields

          if (likely(PyList_CheckExact(__pyx_v_fields)) || PyTuple_CheckExact(__pyx_v_fields)) {
            __pyx_t_6 = __pyx_v_fields; __Pyx_INCREF(__pyx_t_6);
            __pyx_t_9 = 0;
            __pyx_t_10 = NULL;
          } else {
            __pyx_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_fields); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 642, __pyx_L9_error)
            __Pyx_GOTREF(__pyx_t_6);
            __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 642, __pyx_L9_error)
          }
          for (;;) {
            if (likely(!__pyx_t_10)) {
              if (likely(PyList_CheckExact(__pyx_t_6))) {
                {
                  Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
                  #if !CYTHON_ASSUME_SAFE_SIZE
                  if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 642, __pyx_L9_error)
                  #endif
                  if (__pyx_t_9 >= __pyx_temp) break;
                }
                __pyx_t_2 = __Pyx_PyList_GetItemRef(__pyx_t_6, __pyx_t_9);
                ++__pyx_t_9;
              } else {
                {
                  Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
                  #if !CYTHON_ASSUME_SAFE_SIZE
                  if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 642, __pyx_L9_error)
                  #endif
                  if (__pyx_t_9 >= __pyx_temp) break;
                }
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_9));
                #else
                __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_9);
                #endif
                ++__pyx_t_9;
              }
              if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 642, __pyx_L9_error)
            } else {
              __pyx_t_2 = __pyx_t_10(__pyx_t_6);
              if (unlikely(!__pyx_t_2)) {
                PyObject* exc_type = PyErr_Occurred();
                if (exc_type) {
                  if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 642, __pyx_L9_error)
                  PyErr_Clear();
                }
                break;
              }
            }
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_XDECREF_SET(__pyx_9genexpr10__pyx_v_field, __pyx_t_2);
            __pyx_t_2 = 0;
    /* … */
          }
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_field); __pyx_9genexpr10__pyx_v_field = 0;
          goto __pyx_L13_exit_scope;
          __pyx_L9_error:;
          __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_field); __pyx_9genexpr10__pyx_v_field = 0;
          goto __pyx_L1_error;
          __pyx_L13_exit_scope:;
        } /* exit inner scope */
        __pyx_v_df_dict = ((PyObject*)__pyx_t_3);
        __pyx_t_3 = 0;

     643:             }

     644:

    +645:             if self._adjust_minutes:

        __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->_adjust_minutes)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 645, __pyx_L1_error)
        if (__pyx_t_1) {
    /* … */
        }

    +646:                 adjs = {

          { /* enter inner scope */
            __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 646, __pyx_L17_error)
            __Pyx_GOTREF(__pyx_t_3);

    +647:                     field: self.data_portal.get_adjustments(

              __pyx_t_2 = __pyx_v_self->data_portal;
              __Pyx_INCREF(__pyx_t_2);

     648:                         assets,

     649:                         field,

    +650:                         self._get_current_minute(),

              __pyx_t_8 = ((struct __pyx_vtabstruct_7zipline_9_protocol_BarData *)__pyx_v_self->__pyx_vtab)->_get_current_minute(__pyx_v_self); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 650, __pyx_L17_error)
              __Pyx_GOTREF(__pyx_t_8);

    +651:                         self.simulation_dt_func()

              __pyx_t_11 = NULL;
              __Pyx_INCREF(__pyx_v_self->simulation_dt_func);
              __pyx_t_12 = __pyx_v_self->simulation_dt_func;
              __pyx_t_5 = 1;
              #if CYTHON_UNPACK_METHODS
              if (likely(PyMethod_Check(__pyx_t_12))) {
                __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
                assert(__pyx_t_11);
                PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12);
                __Pyx_INCREF(__pyx_t_11);
                __Pyx_INCREF(__pyx__function);
                __Pyx_DECREF_SET(__pyx_t_12, __pyx__function);
                __pyx_t_5 = 0;
              }
              #endif
              {
                PyObject *__pyx_callargs[2] = {__pyx_t_11, NULL};
                __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_12, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
                __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
                if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 651, __pyx_L17_error)
                __Pyx_GOTREF(__pyx_t_7);
              }
              __pyx_t_5 = 0;
              {
                PyObject *__pyx_callargs[5] = {__pyx_t_2, __pyx_v_assets, __pyx_9genexpr11__pyx_v_field, __pyx_t_8, __pyx_t_7};
                __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_adjustments, __pyx_callargs+__pyx_t_5, (5-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
                __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
                __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
                __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
                if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 647, __pyx_L17_error)
                __Pyx_GOTREF(__pyx_t_4);
              }

    +652:                     )[0] for field in fields

            if (likely(PyList_CheckExact(__pyx_v_fields)) || PyTuple_CheckExact(__pyx_v_fields)) {
              __pyx_t_6 = __pyx_v_fields; __Pyx_INCREF(__pyx_t_6);
              __pyx_t_9 = 0;
              __pyx_t_10 = NULL;
            } else {
              __pyx_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_fields); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 652, __pyx_L17_error)
              __Pyx_GOTREF(__pyx_t_6);
              __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 652, __pyx_L17_error)
            }
            for (;;) {
              if (likely(!__pyx_t_10)) {
                if (likely(PyList_CheckExact(__pyx_t_6))) {
                  {
                    Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
                    #if !CYTHON_ASSUME_SAFE_SIZE
                    if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 652, __pyx_L17_error)
                    #endif
                    if (__pyx_t_9 >= __pyx_temp) break;
                  }
                  __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_6, __pyx_t_9);
                  ++__pyx_t_9;
                } else {
                  {
                    Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
                    #if !CYTHON_ASSUME_SAFE_SIZE
                    if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 652, __pyx_L17_error)
                    #endif
                    if (__pyx_t_9 >= __pyx_temp) break;
                  }
                  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                  __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_9));
                  #else
                  __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_9);
                  #endif
                  ++__pyx_t_9;
                }
                if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 652, __pyx_L17_error)
              } else {
                __pyx_t_4 = __pyx_t_10(__pyx_t_6);
                if (unlikely(!__pyx_t_4)) {
                  PyObject* exc_type = PyErr_Occurred();
                  if (exc_type) {
                    if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 652, __pyx_L17_error)
                    PyErr_Clear();
                  }
                  break;
                }
              }
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_XDECREF_SET(__pyx_9genexpr11__pyx_v_field, __pyx_t_4);
              __pyx_t_4 = 0;
    /* … */
              __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 652, __pyx_L17_error)
              __Pyx_GOTREF(__pyx_t_7);
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              if (unlikely(PyDict_SetItem(__pyx_t_3, (PyObject*)__pyx_9genexpr11__pyx_v_field, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 647, __pyx_L17_error)
              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            }
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_field); __pyx_9genexpr11__pyx_v_field = 0;
            goto __pyx_L21_exit_scope;
            __pyx_L17_error:;
            __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_field); __pyx_9genexpr11__pyx_v_field = 0;
            goto __pyx_L1_error;
            __pyx_L21_exit_scope:;
          } /* exit inner scope */
          __pyx_v_adjs = __pyx_t_3;
          __pyx_t_3 = 0;

     653:                 }

     654:

    +655:                 df_dict = {field: df * adjs[field]

          { /* enter inner scope */
            __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 655, __pyx_L24_error)
            __Pyx_GOTREF(__pyx_t_3);
    /* … */
              __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_adjs, __pyx_9genexpr12__pyx_v_field); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 655, __pyx_L24_error)
              __Pyx_GOTREF(__pyx_t_4);
              __pyx_t_7 = PyNumber_Multiply(__pyx_9genexpr12__pyx_v_df, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 655, __pyx_L24_error)
              __Pyx_GOTREF(__pyx_t_7);
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
              if (unlikely(PyDict_SetItem(__pyx_t_3, (PyObject*)__pyx_9genexpr12__pyx_v_field, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 655, __pyx_L24_error)
              __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            }
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_df); __pyx_9genexpr12__pyx_v_df = 0;
            __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_field); __pyx_9genexpr12__pyx_v_field = 0;
            goto __pyx_L27_exit_scope;
            __pyx_L24_error:;
            __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_df); __pyx_9genexpr12__pyx_v_df = 0;
            __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_field); __pyx_9genexpr12__pyx_v_field = 0;
            goto __pyx_L1_error;
            __pyx_L27_exit_scope:;
          } /* exit inner scope */
          __Pyx_DECREF_SET(__pyx_v_df_dict, ((PyObject*)__pyx_t_3));
          __pyx_t_3 = 0;

    +656:                            for field, df in df_dict.items()}

            __pyx_t_9 = 0;
            __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_df_dict, 1, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_13), (&__pyx_t_14)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 656, __pyx_L24_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_XDECREF(__pyx_t_6);
            __pyx_t_6 = __pyx_t_7;
            __pyx_t_7 = 0;
            while (1) {
              __pyx_t_15 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_13, &__pyx_t_9, &__pyx_t_7, &__pyx_t_4, NULL, __pyx_t_14);
              if (unlikely(__pyx_t_15 == 0)) break;
              if (unlikely(__pyx_t_15 == -1)) __PYX_ERR(0, 656, __pyx_L24_error)
              __Pyx_GOTREF(__pyx_t_7);
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_XDECREF_SET(__pyx_9genexpr12__pyx_v_field, __pyx_t_7);
              __pyx_t_7 = 0;
              __Pyx_XDECREF_SET(__pyx_9genexpr12__pyx_v_df, __pyx_t_4);
              __pyx_t_4 = 0;

     657:

    +658:             dt_label = 'date' if frequency == '1d' else 'date_time'

        __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_frequency, __pyx_mstate_global->__pyx_kp_u_1d, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 658, __pyx_L1_error)
        if (__pyx_t_1) {
          __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_date);
          __pyx_t_3 = __pyx_mstate_global->__pyx_n_u_date;
        } else {
          __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_date_time);
          __pyx_t_3 = __pyx_mstate_global->__pyx_n_u_date_time;
        }
        __pyx_v_dt_label = ((PyObject*)__pyx_t_3);
        __pyx_t_3 = 0;

    +659:             from zipline.utils.pandas_utils import stack_future_compatible

        __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 659, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_stack_future_compatible);
        __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_stack_future_compatible);
        if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_mstate_global->__pyx_n_u_stack_future_compatible) != (0)) __PYX_ERR(0, 659, __pyx_L1_error);
        __pyx_t_6 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_zipline_utils_pandas_utils, __pyx_t_3, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 659, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_stack_future_compatible); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 659, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_3);
        __pyx_v_stack_future_compatible = __pyx_t_3;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    +660:             df = (stack_future_compatible(

        __pyx_t_4 = NULL;
        __Pyx_INCREF(__pyx_v_stack_future_compatible);
        __pyx_t_8 = __pyx_v_stack_future_compatible;

    +661:                       pd.concat(df_dict,

        __pyx_t_12 = NULL;
        __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_pd); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 661, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_concat); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 661, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

    +662:                                 keys=df_dict.keys(),

        __pyx_t_11 = __Pyx_PyDict_Keys(__pyx_v_df_dict); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 662, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);

    +663:                                 names=['fields', dt_label]),

        __pyx_t_17 = PyList_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 663, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_fields);
        __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_fields);
        if (__Pyx_PyList_SET_ITEM(__pyx_t_17, 0, __pyx_mstate_global->__pyx_n_u_fields) != (0)) __PYX_ERR(0, 663, __pyx_L1_error);
        __Pyx_INCREF(__pyx_v_dt_label);
        __Pyx_GIVEREF(__pyx_v_dt_label);
        if (__Pyx_PyList_SET_ITEM(__pyx_t_17, 1, __pyx_v_dt_label) != (0)) __PYX_ERR(0, 663, __pyx_L1_error);
        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_16))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_16);
          assert(__pyx_t_12);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_16);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_16, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_12, __pyx_v_df_dict};
          __pyx_t_18 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 661, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_18);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_keys, __pyx_t_11, __pyx_t_18, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 661, __pyx_L1_error)
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_names, __pyx_t_17, __pyx_t_18, __pyx_callargs+2, 1) < (0)) __PYX_ERR(0, 661, __pyx_L1_error)
          __pyx_t_2 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_16, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_18);
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 661, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }

    +664:                       future_stack=True  # ensure we return all fields/assets/dates despite missing values

        __pyx_t_5 = 1;
        #if CYTHON_UNPACK_METHODS
        if (unlikely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
          assert(__pyx_t_4);
          PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(__pyx__function);
          __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
          __pyx_t_5 = 0;
        }
        #endif
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_t_2};
          __pyx_t_16 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 660, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_16);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_future_stack, Py_True, __pyx_t_16, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 660, __pyx_L1_error)
          __pyx_t_7 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_8, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_16);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 660, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
        }
        __pyx_t_3 = __pyx_t_7;
        __Pyx_INCREF(__pyx_t_3);
        __pyx_t_5 = 0;
        {
          PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_3, NULL};
          __pyx_t_8 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 666, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_level, __pyx_mstate_global->__pyx_n_u_fields, __pyx_t_8, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 666, __pyx_L1_error)
          __pyx_t_6 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_unstack, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_8);
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 666, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
        }
        __pyx_v_df = __pyx_t_6;
        __pyx_t_6 = 0;

     665:                   )

     666:                   .unstack(level='fields'))

    +667:             df.index.set_names([dt_label, 'asset'])

        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_df, __pyx_mstate_global->__pyx_n_u_index); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 667, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_7 = __pyx_t_8;
        __Pyx_INCREF(__pyx_t_7);
        __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 667, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_v_dt_label);
        __Pyx_GIVEREF(__pyx_v_dt_label);
        if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_dt_label) != (0)) __PYX_ERR(0, 667, __pyx_L1_error);
        __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_asset);
        __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_asset);
        if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_mstate_global->__pyx_n_u_asset) != (0)) __PYX_ERR(0, 667, __pyx_L1_error);
        __pyx_t_5 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_3};
          __pyx_t_6 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_set_names, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 667, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
        }
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    +668:             return df.sort_index()

        __Pyx_XDECREF(__pyx_r);
        __pyx_t_8 = __pyx_v_df;
        __Pyx_INCREF(__pyx_t_8);
        __pyx_t_5 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
          __pyx_t_6 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_sort_index, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 668, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
        }
        __pyx_r = __pyx_t_6;
        __pyx_t_6 = 0;
        __Pyx_TraceReturnValue(__pyx_r, 159, 0, __PYX_ERR(0, 668, __pyx_L1_error));
        goto __pyx_L0;
      }

     669:

     670:     property current_dt:

    +671:         def __get__(self):

    /* Python wrapper */
    static PyObject *__pyx_pw_7zipline_9_protocol_7BarData_10current_dt_1__get__(PyObject *__pyx_v_self); /*proto*/
    static PyObject *__pyx_pw_7zipline_9_protocol_7BarData_10current_dt_1__get__(PyObject *__pyx_v_self) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      __pyx_r = __pyx_pf_7zipline_9_protocol_7BarData_10current_dt___get__(((struct __pyx_obj_7zipline_9_protocol_BarData *)__pyx_v_self));

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

    static PyObject *__pyx_pf_7zipline_9_protocol_7BarData_10current_dt___get__(struct __pyx_obj_7zipline_9_protocol_BarData *__pyx_v_self) {
      PyObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[55]))
      __Pyx_TraceStartFunc("__get__", __pyx_f[0], 671, 0, 0, 0, __PYX_ERR(0, 671, __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_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 671, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline._protocol.BarData.current_dt.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +672:             return self.simulation_dt_func()

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_v_self->simulation_dt_func);
      __pyx_t_3 = __pyx_v_self->simulation_dt_func;
      __pyx_t_4 = 1;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        assert(__pyx_t_2);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
        __pyx_t_4 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
        __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 672, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 672, __pyx_L1_error));
      goto __pyx_L0;

     673:

    +674:     @property

    /* Python wrapper */
    static PyObject *__pyx_pw_7zipline_9_protocol_7BarData_14fetcher_assets_1__get__(PyObject *__pyx_v_self); /*proto*/
    static PyObject *__pyx_pw_7zipline_9_protocol_7BarData_14fetcher_assets_1__get__(PyObject *__pyx_v_self) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      __pyx_r = __pyx_pf_7zipline_9_protocol_7BarData_14fetcher_assets___get__(((struct __pyx_obj_7zipline_9_protocol_BarData *)__pyx_v_self));

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

    static PyObject *__pyx_pf_7zipline_9_protocol_7BarData_14fetcher_assets___get__(struct __pyx_obj_7zipline_9_protocol_BarData *__pyx_v_self) {
      PyObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[56]))
      __Pyx_TraceStartFunc("__get__", __pyx_f[0], 674, 0, 0, 0, __PYX_ERR(0, 674, __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_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 674, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline._protocol.BarData.fetcher_assets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     675:     def fetcher_assets(self):

    +676:         return self.data_portal.get_fetcher_assets(self.simulation_dt_func())

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __pyx_v_self->data_portal;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_self->simulation_dt_func);
      __pyx_t_5 = __pyx_v_self->simulation_dt_func;
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
        assert(__pyx_t_4);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 676, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_fetcher_assets, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 676, __pyx_L1_error));
      goto __pyx_L0;

     677:

     678:     property _handle_non_market_minutes:

    +679:         def __set__(self, val):

    /* Python wrapper */
    static int __pyx_pw_7zipline_9_protocol_7BarData_26_handle_non_market_minutes_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
    static int __pyx_pw_7zipline_9_protocol_7BarData_26_handle_non_market_minutes_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      __pyx_r = __pyx_pf_7zipline_9_protocol_7BarData_26_handle_non_market_minutes___set__(((struct __pyx_obj_7zipline_9_protocol_BarData *)__pyx_v_self), ((PyObject *)__pyx_v_val));

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

    static int __pyx_pf_7zipline_9_protocol_7BarData_26_handle_non_market_minutes___set__(struct __pyx_obj_7zipline_9_protocol_BarData *__pyx_v_self, PyObject *__pyx_v_val) {
      int __pyx_r;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[57]))
      __Pyx_TraceStartFunc("__set__", __pyx_f[0], 679, 0, 0, 0, __PYX_ERR(0, 679, __pyx_L1_error));
    /* … */
      /* function exit code */
      __pyx_r = 0;
      __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 679, __pyx_L1_error));
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 679, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline._protocol.BarData._handle_non_market_minutes.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +680:             self._adjust_minutes = val

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

     681:

     682:     property current_session:

    +683:         def __get__(self):

    /* Python wrapper */
    static PyObject *__pyx_pw_7zipline_9_protocol_7BarData_15current_session_1__get__(PyObject *__pyx_v_self); /*proto*/
    static PyObject *__pyx_pw_7zipline_9_protocol_7BarData_15current_session_1__get__(PyObject *__pyx_v_self) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      __pyx_r = __pyx_pf_7zipline_9_protocol_7BarData_15current_session___get__(((struct __pyx_obj_7zipline_9_protocol_BarData *)__pyx_v_self));

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

    static PyObject *__pyx_pf_7zipline_9_protocol_7BarData_15current_session___get__(struct __pyx_obj_7zipline_9_protocol_BarData *__pyx_v_self) {
      PyObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[58]))
      __Pyx_TraceStartFunc("__get__", __pyx_f[0], 683, 0, 0, 0, __PYX_ERR(0, 683, __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_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 683, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline._protocol.BarData.current_session.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +684:             return self._trading_calendar.minute_to_session(

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __pyx_v_self->_trading_calendar;
      __Pyx_INCREF(__pyx_t_2);

    +685:                 self.simulation_dt_func(),

      __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_self->simulation_dt_func);
      __pyx_t_5 = __pyx_v_self->simulation_dt_func;
      __pyx_t_6 = 1;
      #if CYTHON_UNPACK_METHODS
      if (likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
        assert(__pyx_t_4);
        PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx__function);
        __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
        __pyx_t_6 = 0;
      }
      #endif
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 685, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, __pyx_t_3};
        __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 684, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_direction, __pyx_mstate_global->__pyx_n_u_next, __pyx_t_5, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 684, __pyx_L1_error)
        __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_minute_to_session, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 684, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 684, __pyx_L1_error));
      goto __pyx_L0;

     686:                 direction="next"

     687:             )

     688:

     689:     property current_session_minutes:

    +690:         def __get__(self):

    /* Python wrapper */
    static PyObject *__pyx_pw_7zipline_9_protocol_7BarData_23current_session_minutes_1__get__(PyObject *__pyx_v_self); /*proto*/
    static PyObject *__pyx_pw_7zipline_9_protocol_7BarData_23current_session_minutes_1__get__(PyObject *__pyx_v_self) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      __pyx_r = __pyx_pf_7zipline_9_protocol_7BarData_23current_session_minutes___get__(((struct __pyx_obj_7zipline_9_protocol_BarData *)__pyx_v_self));

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

    static PyObject *__pyx_pf_7zipline_9_protocol_7BarData_23current_session_minutes___get__(struct __pyx_obj_7zipline_9_protocol_BarData *__pyx_v_self) {
      PyObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[59]))
      __Pyx_TraceStartFunc("__get__", __pyx_f[0], 690, 0, 0, 0, __PYX_ERR(0, 690, __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_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 690, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline._protocol.BarData.current_session_minutes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +691:             return self._trading_calendar.session_minutes(

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __pyx_v_self->_trading_calendar;
      __Pyx_INCREF(__pyx_t_2);

    +692:                 self.current_session

      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_current_session); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 692, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_session_minutes, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 691, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 691, __pyx_L1_error));
      goto __pyx_L0;

     693:             )

     694:

     695: cdef class InnerPosition:

     696:     """The real values of a position.

     697:

     698:     This exists to be owned by both a

     699:     :class:`zipline.finance.position.Position` and a

     700:     :class:`zipline.protocol.Position` at the same time without a cycle.

     701:     """

    +702:     def __init__(self,

    /* Python wrapper */
    static int __pyx_pw_7zipline_9_protocol_13InnerPosition_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static int __pyx_pw_7zipline_9_protocol_13InnerPosition_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_asset = 0;
      PyObject *__pyx_v_amount = 0;
      PyObject *__pyx_v_cost_basis = 0;
      PyObject *__pyx_v_last_sale_price = 0;
      PyObject *__pyx_v_last_sale_date = 0;
      CYTHON_UNUSED Py_ssize_t __pyx_nargs;
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      int __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
      #if CYTHON_ASSUME_SAFE_SIZE
      __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
      #else
      __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
      #endif
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      {
        PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_asset,&__pyx_mstate_global->__pyx_n_u_amount,&__pyx_mstate_global->__pyx_n_u_cost_basis,&__pyx_mstate_global->__pyx_n_u_last_sale_price,&__pyx_mstate_global->__pyx_n_u_last_sale_date,0};
      PyObject* values[5] = {0,0,0,0,0};
        const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0;
        if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 702, __pyx_L3_error)
        if (__pyx_kwds_len > 0) {
          switch (__pyx_nargs) {
            case  5:
            values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 702, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  4:
            values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 702, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  3:
            values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 702, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 702, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 702, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          const Py_ssize_t kwd_pos_args = __pyx_nargs;
          if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 702, __pyx_L3_error)
          if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0));
          if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_float_0_0));
          if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_float_0_0));
    /* … */
      /* function exit code */
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static int __pyx_pf_7zipline_9_protocol_13InnerPosition___init__(struct __pyx_obj_7zipline_9_protocol_InnerPosition *__pyx_v_self, PyObject *__pyx_v_asset, PyObject *__pyx_v_amount, PyObject *__pyx_v_cost_basis, PyObject *__pyx_v_last_sale_price, PyObject *__pyx_v_last_sale_date) {
      int __pyx_r;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[62]))
      __Pyx_TraceStartFunc("__init__", __pyx_f[0], 702, 0, 0, 0, __PYX_ERR(0, 702, __pyx_L1_error));
    /* … */
      /* function exit code */
      __pyx_r = 0;
      __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 702, __pyx_L1_error));
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 702, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline._protocol.InnerPosition.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     703:                  asset,

     704:                  amount=0,

     705:                  cost_basis=0.0,

     706:                  last_sale_price=0.0,

    +707:                  last_sale_date=None):

          if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
          for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
            if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 5, i); __PYX_ERR(0, 702, __pyx_L3_error) }
          }
        } else {
          switch (__pyx_nargs) {
            case  5:
            values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 702, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  4:
            values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 702, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  3:
            values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 702, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  2:
            values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 702, __pyx_L3_error)
            CYTHON_FALLTHROUGH;
            case  1:
            values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
            if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 702, __pyx_L3_error)
            break;
            default: goto __pyx_L5_argtuple_error;
          }
          if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0));
          if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_float_0_0));
          if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_float_0_0));
          if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
        }
        __pyx_v_asset = values[0];
        __pyx_v_amount = values[1];
        __pyx_v_cost_basis = values[2];
        __pyx_v_last_sale_price = values[3];
        __pyx_v_last_sale_date = values[4];
      }
      goto __pyx_L6_skip;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 5, __pyx_nargs); __PYX_ERR(0, 702, __pyx_L3_error)
      __pyx_L6_skip:;
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
        Py_XDECREF(values[__pyx_temp]);
      }
      __Pyx_AddTraceback("zipline._protocol.InnerPosition.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return -1;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_7zipline_9_protocol_13InnerPosition___init__(((struct __pyx_obj_7zipline_9_protocol_InnerPosition *)__pyx_v_self), __pyx_v_asset, __pyx_v_amount, __pyx_v_cost_basis, __pyx_v_last_sale_price, __pyx_v_last_sale_date);

    +708:         self.asset = asset

      __pyx_t_1 = __pyx_v_asset;
      __Pyx_INCREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_mstate_global->__pyx_ptype_7zipline_6assets_7_assets_Asset))))) __PYX_ERR(0, 708, __pyx_L1_error)
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF((PyObject *)__pyx_v_self->asset);
      __Pyx_DECREF((PyObject *)__pyx_v_self->asset);
      __pyx_v_self->asset = ((struct __pyx_obj_7zipline_6assets_7_assets_Asset *)__pyx_t_1);
      __pyx_t_1 = 0;

    +709:         self.amount = amount

      __pyx_t_2 = __Pyx_PyLong_As_npy_int64(__pyx_v_amount); if (unlikely((__pyx_t_2 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 709, __pyx_L1_error)
      __pyx_v_self->amount = __pyx_t_2;

    +710:         self.cost_basis = cost_basis  # per share

      __pyx_t_3 = __Pyx_PyFloat_AsDouble(__pyx_v_cost_basis); if (unlikely((__pyx_t_3 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 710, __pyx_L1_error)
      __pyx_v_self->cost_basis = __pyx_t_3;

    +711:         self.last_sale_price = last_sale_price

      __pyx_t_3 = __Pyx_PyFloat_AsDouble(__pyx_v_last_sale_price); if (unlikely((__pyx_t_3 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 711, __pyx_L1_error)
      __pyx_v_self->last_sale_price = __pyx_t_3;

    +712:         self.last_sale_date = last_sale_date

      __Pyx_INCREF(__pyx_v_last_sale_date);
      __Pyx_GIVEREF(__pyx_v_last_sale_date);
      __Pyx_GOTREF(__pyx_v_self->last_sale_date);
      __Pyx_DECREF(__pyx_v_self->last_sale_date);
      __pyx_v_self->last_sale_date = __pyx_v_last_sale_date;

     713:

    +714:     def __repr__(self):

    /* Python wrapper */
    static PyObject *__pyx_pw_7zipline_9_protocol_13InnerPosition_3__repr__(PyObject *__pyx_v_self); /*proto*/
    static PyObject *__pyx_pw_7zipline_9_protocol_13InnerPosition_3__repr__(PyObject *__pyx_v_self) {
      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
      __pyx_r = __pyx_pf_7zipline_9_protocol_13InnerPosition_2__repr__(((struct __pyx_obj_7zipline_9_protocol_InnerPosition *)__pyx_v_self));

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

    static PyObject *__pyx_pf_7zipline_9_protocol_13InnerPosition_2__repr__(struct __pyx_obj_7zipline_9_protocol_InnerPosition *__pyx_v_self) {
      PyObject *__pyx_r = NULL;
      __Pyx_TraceDeclarationsFunc
      __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[63]))
      __Pyx_TraceStartFunc("__repr__", __pyx_f[0], 714, 0, 0, 0, __PYX_ERR(0, 714, __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_XDECREF(__pyx_t_8);
      __Pyx_TraceException(__pyx_lineno, 0, 0);
      #if CYTHON_USE_SYS_MONITORING
      __Pyx_TraceExceptionUnwind(0, 0);
      #else
      __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 714, __pyx_L1_error));
      #endif
      __Pyx_AddTraceback("zipline._protocol.InnerPosition.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_PyMonitoring_ExitScope(0);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +715:         return (

      __Pyx_XDECREF(__pyx_r);

    +716:                 '%s(asset=%r, amount=%r, cost_basis=%r,'

      __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 12, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 7 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 9 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 13 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 18 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 17 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3));
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 716, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_8;
      __pyx_t_8 = 0;
      __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 715, __pyx_L1_error));
      goto __pyx_L0;

     717:                 ' last_sale_price=%r, last_sale_date=%r)' % (

    +718:                     type(self).__name__,

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))), __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 718, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_1), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 718, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +719:                     self.asset,

      __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(((PyObject *)__pyx_v_self->asset)), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 719, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);

    +720:                     self.amount,

      __pyx_t_3 = __Pyx_PyLong_From_npy_int64(__pyx_v_self->amount); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 720, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 720, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +721:                     self.cost_basis,

      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->cost_basis); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 721, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 721, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +722:                     self.last_sale_price,

      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->last_sale_price); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 722, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_t_3), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 722, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +723:                     self.last_sale_date,

      __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Repr(__pyx_v_self->last_sale_date), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 723, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7[0] = __pyx_t_2;
      __pyx_t_7[1] = __pyx_mstate_global->__pyx_kp_u_asset_2;
      __pyx_t_7[2] = __pyx_t_1;
      __pyx_t_7[3] = __pyx_mstate_global->__pyx_kp_u_amount_2;
      __pyx_t_7[4] = __pyx_t_4;
      __pyx_t_7[5] = __pyx_mstate_global->__pyx_kp_u_cost_basis_2;
      __pyx_t_7[6] = __pyx_t_5;
      __pyx_t_7[7] = __pyx_mstate_global->__pyx_kp_u_last_sale_price_2;
      __pyx_t_7[8] = __pyx_t_6;
      __pyx_t_7[9] = __pyx_mstate_global->__pyx_kp_u_last_sale_date_2;
      __pyx_t_7[10] = __pyx_t_3;
      __pyx_t_7[11] = __pyx_mstate_global->__pyx_kp_u__5;

     724:                 )

     725:         )