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: continuous_futures.c
+001: # cython: embedsignature=True
__pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_5) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
002: #
003: # Copyright 2016 Quantopian, Inc.
004: #
005: # Licensed under the Apache License, Version 2.0 (the "License");
006: # you may not use this file except in compliance with the License.
007: # You may obtain a copy of the License at
008: #
009: # http://www.apache.org/licenses/LICENSE-2.0
010: #
011: # Unless required by applicable law or agreed to in writing, software
012: # distributed under the License is distributed on an "AS IS" BASIS,
013: # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: # See the License for the specific language governing permissions and
015: # limitations under the License.
016:
017: """Cythonized ContinuousFutures object."""
018:
019: cimport cython
020: from cpython.number cimport PyNumber_Index
021: from cpython.object cimport (
022: Py_EQ,
023: Py_NE,
024: Py_GE,
025: Py_LE,
026: Py_GT,
027: Py_LT,
028: )
029: # from cpython cimport bool
+030: from functools import partial
__pyx_t_5 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_partial); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_functools, __pyx_t_5, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_partial); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_partial, __pyx_t_5) < (0)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
031:
+032: from numpy import array, empty, iinfo
__pyx_t_4 = __Pyx_PyList_Pack(3, __pyx_mstate_global->__pyx_n_u_array, __pyx_mstate_global->__pyx_n_u_empty, __pyx_mstate_global->__pyx_n_u_iinfo); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_numpy, __pyx_t_4, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_array, __pyx_t_4) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_empty, __pyx_t_4) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_iinfo); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_iinfo, __pyx_t_4) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
033: from numpy cimport int64_t, int64_t
+034: from pandas import Timestamp
__pyx_t_5 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_Timestamp); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pandas, __pyx_t_5, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_ImportFrom(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Timestamp); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_Timestamp, __pyx_t_5) < (0)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+035: from zipline.utils.calendar_utils import get_calendar
__pyx_t_4 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_get_calendar); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_zipline_utils_calendar_utils, __pyx_t_4, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_get_calendar); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_get_calendar, __pyx_t_4) < (0)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
036: # import warnings
037:
038:
+039: def delivery_predicate(codes, contract):
/* Python wrapper */ static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_1delivery_predicate(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_7zipline_6assets_18continuous_futures_delivery_predicate, "delivery_predicate(codes, contract)"); static PyMethodDef __pyx_mdef_7zipline_6assets_18continuous_futures_1delivery_predicate = {"delivery_predicate", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_6assets_18continuous_futures_1delivery_predicate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7zipline_6assets_18continuous_futures_delivery_predicate}; static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_1delivery_predicate(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_codes = 0; PyObject *__pyx_v_contract = 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("delivery_predicate (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_codes,&__pyx_mstate_global->__pyx_n_u_contract,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, 39, __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, 39, __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, 39, __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, "delivery_predicate", 0) < (0)) __PYX_ERR(0, 39, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("delivery_predicate", 1, 2, 2, i); __PYX_ERR(0, 39, __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, 39, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 39, __pyx_L3_error) } __pyx_v_codes = values[0]; __pyx_v_contract = values[1]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("delivery_predicate", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 39, __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.assets.continuous_futures.delivery_predicate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7zipline_6assets_18continuous_futures_delivery_predicate(__pyx_self, __pyx_v_codes, __pyx_v_contract); 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_6assets_18continuous_futures_delivery_predicate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_codes, PyObject *__pyx_v_contract) { PyObject *__pyx_v_delivery_code = NULL; PyObject *__pyx_r = NULL; __Pyx_TraceDeclarationsFunc __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[35])) __Pyx_TraceStartFunc("delivery_predicate", __pyx_f[0], 39, 0, 0, 0, __PYX_ERR(0, 39, __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, 39, __pyx_L1_error)); #endif __Pyx_AddTraceback("zipline.assets.continuous_futures.delivery_predicate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_delivery_code); __Pyx_XGIVEREF(__pyx_r); __Pyx_PyMonitoring_ExitScope(0); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7zipline_6assets_18continuous_futures_1delivery_predicate, 0, __pyx_mstate_global->__pyx_n_u_delivery_predicate, NULL, __pyx_mstate_global->__pyx_n_u_zipline_assets_continuous_future, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[35])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_delivery_predicate, __pyx_t_5) < (0)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
040: # This relies on symbols that are construct following a pattern of
041: # root symbol + delivery code + year, e.g. PLF16
042: # This check would be more robust if the future contract class had
043: # a 'delivery_month' member.
+044: delivery_code = contract.symbol[-3]
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_contract, __pyx_mstate_global->__pyx_n_u_symbol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, -3L, long, 1, __Pyx_PyLong_From_long, 0, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_delivery_code = __pyx_t_2; __pyx_t_2 = 0;
+045: return delivery_code in codes
__Pyx_XDECREF(__pyx_r); __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_v_delivery_code, __pyx_v_codes, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 45, __pyx_L1_error) __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_TraceReturnValue(__pyx_r, 6, 0, __PYX_ERR(0, 45, __pyx_L1_error)); goto __pyx_L0;
046:
+047: march_cycle_delivery_predicate = partial(delivery_predicate,
__pyx_t_4 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_partial); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_delivery_predicate); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_11 = PySet_New(0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 48, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); if (PySet_Add(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_H) < (0)) __PYX_ERR(0, 48, __pyx_L1_error) if (PySet_Add(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_M) < (0)) __PYX_ERR(0, 48, __pyx_L1_error) if (PySet_Add(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_U) < (0)) __PYX_ERR(0, 48, __pyx_L1_error) if (PySet_Add(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_Z) < (0)) __PYX_ERR(0, 48, __pyx_L1_error) __pyx_t_7 = 1; { PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_10, __pyx_t_11}; __pyx_t_5 = __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_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_march_cycle_delivery_predicate, __pyx_t_5) < (0)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
048: set(['H', 'M', 'U', 'Z']))
049:
050: CHAIN_PREDICATES = {
+051: 'EL': march_cycle_delivery_predicate,
__pyx_t_5 = __Pyx_PyDict_NewPresized(12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_march_cycle_delivery_predicate); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_EL, __pyx_t_6) < (0)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+052: 'ME': march_cycle_delivery_predicate,
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_march_cycle_delivery_predicate); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_ME, __pyx_t_6) < (0)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+053: 'PL': partial(delivery_predicate, set(['F', 'J', 'N', 'V'])),
__pyx_t_11 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_partial); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_delivery_predicate); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_12 = PySet_New(0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); if (PySet_Add(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_F) < (0)) __PYX_ERR(0, 53, __pyx_L1_error) if (PySet_Add(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_J) < (0)) __PYX_ERR(0, 53, __pyx_L1_error) if (PySet_Add(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_N) < (0)) __PYX_ERR(0, 53, __pyx_L1_error) if (PySet_Add(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_V) < (0)) __PYX_ERR(0, 53, __pyx_L1_error) __pyx_t_7 = 1; { PyObject *__pyx_callargs[3] = {__pyx_t_11, __pyx_t_4, __pyx_t_12}; __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); } if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_PL, __pyx_t_6) < (0)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+054: 'PA': march_cycle_delivery_predicate,
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_march_cycle_delivery_predicate); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_PA, __pyx_t_6) < (0)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
055:
056: # The majority of trading in these currency futures is done on a
057: # March quarterly cycle (Mar, Jun, Sep, Dec) but contracts are
058: # listed for the first 3 consecutive months from the present day. We
059: # want the continuous futures to be composed of just the quarterly
060: # contracts.
+061: 'JY': march_cycle_delivery_predicate,
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_march_cycle_delivery_predicate); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_JY, __pyx_t_6) < (0)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+062: 'CD': march_cycle_delivery_predicate,
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_march_cycle_delivery_predicate); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_CD, __pyx_t_6) < (0)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+063: 'AD': march_cycle_delivery_predicate,
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_march_cycle_delivery_predicate); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_AD, __pyx_t_6) < (0)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+064: 'BP': march_cycle_delivery_predicate,
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_march_cycle_delivery_predicate); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_BP, __pyx_t_6) < (0)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
065:
066: # Gold and silver contracts trade on an unusual specific set of months.
+067: 'GC': partial(delivery_predicate, set(['G', 'J', 'M', 'Q', 'V', 'Z'])),
__pyx_t_10 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_partial); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_delivery_predicate); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_11 = PySet_New(0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); if (PySet_Add(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_G) < (0)) __PYX_ERR(0, 67, __pyx_L1_error) if (PySet_Add(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_J) < (0)) __PYX_ERR(0, 67, __pyx_L1_error) if (PySet_Add(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_M) < (0)) __PYX_ERR(0, 67, __pyx_L1_error) if (PySet_Add(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_Q) < (0)) __PYX_ERR(0, 67, __pyx_L1_error) if (PySet_Add(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_V) < (0)) __PYX_ERR(0, 67, __pyx_L1_error) if (PySet_Add(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_Z) < (0)) __PYX_ERR(0, 67, __pyx_L1_error) __pyx_t_7 = 1; { PyObject *__pyx_callargs[3] = {__pyx_t_10, __pyx_t_4, __pyx_t_11}; __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_12, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__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(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); } if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_GC, __pyx_t_6) < (0)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+068: 'XG': partial(delivery_predicate, set(['G', 'J', 'M', 'Q', 'V', 'Z'])),
__pyx_t_12 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_partial); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_delivery_predicate); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_10 = PySet_New(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (PySet_Add(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_G) < (0)) __PYX_ERR(0, 68, __pyx_L1_error) if (PySet_Add(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_J) < (0)) __PYX_ERR(0, 68, __pyx_L1_error) if (PySet_Add(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_M) < (0)) __PYX_ERR(0, 68, __pyx_L1_error) if (PySet_Add(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_Q) < (0)) __PYX_ERR(0, 68, __pyx_L1_error) if (PySet_Add(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_V) < (0)) __PYX_ERR(0, 68, __pyx_L1_error) if (PySet_Add(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_Z) < (0)) __PYX_ERR(0, 68, __pyx_L1_error) __pyx_t_7 = 1; { PyObject *__pyx_callargs[3] = {__pyx_t_12, __pyx_t_4, __pyx_t_10}; __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); } if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_XG, __pyx_t_6) < (0)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+069: 'SV': partial(delivery_predicate, set(['H', 'K', 'N', 'U', 'Z'])),
__pyx_t_11 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_partial); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_delivery_predicate); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_12 = PySet_New(0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); if (PySet_Add(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_H) < (0)) __PYX_ERR(0, 69, __pyx_L1_error) if (PySet_Add(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_K) < (0)) __PYX_ERR(0, 69, __pyx_L1_error) if (PySet_Add(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_N) < (0)) __PYX_ERR(0, 69, __pyx_L1_error) if (PySet_Add(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_U) < (0)) __PYX_ERR(0, 69, __pyx_L1_error) if (PySet_Add(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_Z) < (0)) __PYX_ERR(0, 69, __pyx_L1_error) __pyx_t_7 = 1; { PyObject *__pyx_callargs[3] = {__pyx_t_11, __pyx_t_4, __pyx_t_12}; __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); } if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_SV, __pyx_t_6) < (0)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+070: 'YS': partial(delivery_predicate, set(['H', 'K', 'N', 'U', 'Z'])),
__pyx_t_10 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_partial); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_delivery_predicate); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_11 = PySet_New(0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); if (PySet_Add(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_H) < (0)) __PYX_ERR(0, 70, __pyx_L1_error) if (PySet_Add(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_K) < (0)) __PYX_ERR(0, 70, __pyx_L1_error) if (PySet_Add(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_N) < (0)) __PYX_ERR(0, 70, __pyx_L1_error) if (PySet_Add(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_U) < (0)) __PYX_ERR(0, 70, __pyx_L1_error) if (PySet_Add(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_Z) < (0)) __PYX_ERR(0, 70, __pyx_L1_error) __pyx_t_7 = 1; { PyObject *__pyx_callargs[3] = {__pyx_t_10, __pyx_t_4, __pyx_t_11}; __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_12, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__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(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); } if (PyDict_SetItem(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_YS, __pyx_t_6) < (0)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_CHAIN_PREDICATES, __pyx_t_5) < (0)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
071: }
072:
+073: ADJUSTMENT_STYLES = {'add', 'mul', None}
__pyx_t_5 = PySet_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PySet_Add(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_add) < (0)) __PYX_ERR(0, 73, __pyx_L1_error) if (PySet_Add(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_mul) < (0)) __PYX_ERR(0, 73, __pyx_L1_error) if (PySet_Add(__pyx_t_5, Py_None) < (0)) __PYX_ERR(0, 73, __pyx_L1_error) if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_ADJUSTMENT_STYLES, __pyx_t_5) < (0)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
074:
075:
+076: cdef class ContinuousFuture:
struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture {
PyObject_HEAD
struct __pyx_vtabstruct_7zipline_6assets_18continuous_futures_ContinuousFuture *__pyx_vtab;
__pyx_t_5numpy_int64_t sid;
__pyx_t_5numpy_int64_t sid_hash;
PyObject *root_symbol;
int offset;
PyObject *roll_style;
PyObject *start_date;
PyObject *end_date;
PyObject *exchange_info;
PyObject *adjustment;
};
/* … */
struct __pyx_vtabstruct_7zipline_6assets_18continuous_futures_ContinuousFuture {
PyObject *(*__pyx___reduce__)(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *, int __pyx_skip_dispatch);
PyObject *(*to_dict)(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_7zipline_6assets_18continuous_futures_ContinuousFuture *__pyx_vtabptr_7zipline_6assets_18continuous_futures_ContinuousFuture;
077: """Represents a specifier for a chain of future contracts, where the
078: coordinates for the chain are:
079: root_symbol : str
080: The root symbol of the contracts.
081: offset : int
082: The distance from the primary chain.
083: e.g. 0 specifies the primary chain, 1 the secondary, etc.
084: roll_style : str
085: How rolls from contract to contract should be calculated.
086: Currently supports 'calendar'.
087:
088: Instances of this class are exposed to the algorithm.
089: """
090:
+091: cdef readonly int64_t sid
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_3sid_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_3sid_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_6assets_18continuous_futures_16ContinuousFuture_3sid___get__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_3sid___get__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[52]))
__Pyx_TraceStartFunc("__get__", __pyx_f[0], 91, 0, 0, 0, __PYX_ERR(0, 91, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyLong_From_npy_int64(__pyx_v_self->sid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
__Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 91, __pyx_L1_error));
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 91, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.sid.__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;
}
092: # Cached hash of self.sid
093: cdef int64_t sid_hash
094:
+095: cdef readonly object root_symbol
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_11root_symbol_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_11root_symbol_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_6assets_18continuous_futures_16ContinuousFuture_11root_symbol___get__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_11root_symbol___get__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[53]))
__Pyx_TraceStartFunc("__get__", __pyx_f[0], 95, 0, 0, 0, __PYX_ERR(0, 95, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->root_symbol);
__pyx_r = __pyx_v_self->root_symbol;
__Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 95, __pyx_L1_error));
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 95, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.root_symbol.__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;
}
+096: cdef readonly int offset
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_6offset_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_6offset_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_6assets_18continuous_futures_16ContinuousFuture_6offset___get__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_6offset___get__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[54]))
__Pyx_TraceStartFunc("__get__", __pyx_f[0], 96, 0, 0, 0, __PYX_ERR(0, 96, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->offset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
__Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 96, __pyx_L1_error));
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 96, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.offset.__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;
}
+097: cdef readonly object roll_style
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_10roll_style_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_10roll_style_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_6assets_18continuous_futures_16ContinuousFuture_10roll_style___get__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_10roll_style___get__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *__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], 97, 0, 0, 0, __PYX_ERR(0, 97, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->roll_style);
__pyx_r = __pyx_v_self->roll_style;
__Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 97, __pyx_L1_error));
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 97, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.roll_style.__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;
}
098:
+099: cdef readonly object start_date
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_10start_date_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_10start_date_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_6assets_18continuous_futures_16ContinuousFuture_10start_date___get__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_10start_date___get__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *__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], 99, 0, 0, 0, __PYX_ERR(0, 99, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->start_date);
__pyx_r = __pyx_v_self->start_date;
__Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 99, __pyx_L1_error));
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 99, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.start_date.__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;
}
+100: cdef readonly object end_date
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_8end_date_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_8end_date_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_6assets_18continuous_futures_16ContinuousFuture_8end_date___get__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_8end_date___get__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[57]))
__Pyx_TraceStartFunc("__get__", __pyx_f[0], 100, 0, 0, 0, __PYX_ERR(0, 100, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->end_date);
__pyx_r = __pyx_v_self->end_date;
__Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 100, __pyx_L1_error));
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 100, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.end_date.__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;
}
101:
+102: cdef readonly object exchange_info
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_13exchange_info_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_13exchange_info_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_6assets_18continuous_futures_16ContinuousFuture_13exchange_info___get__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_13exchange_info___get__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *__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], 102, 0, 0, 0, __PYX_ERR(0, 102, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->exchange_info);
__pyx_r = __pyx_v_self->exchange_info;
__Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 102, __pyx_L1_error));
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 102, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.exchange_info.__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;
}
103:
+104: cdef readonly object adjustment
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_10adjustment_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_10adjustment_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_6assets_18continuous_futures_16ContinuousFuture_10adjustment___get__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_10adjustment___get__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *__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], 104, 0, 0, 0, __PYX_ERR(0, 104, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->adjustment);
__pyx_r = __pyx_v_self->adjustment;
__Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 104, __pyx_L1_error));
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 104, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.adjustment.__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;
}
105:
+106: _kwargnames = frozenset({
__pyx_t_5 = PySet_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PySet_Add(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_sid) < (0)) __PYX_ERR(0, 107, __pyx_L1_error) if (PySet_Add(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_root_symbol) < (0)) __PYX_ERR(0, 107, __pyx_L1_error) if (PySet_Add(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_offset) < (0)) __PYX_ERR(0, 107, __pyx_L1_error) if (PySet_Add(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_start_date) < (0)) __PYX_ERR(0, 107, __pyx_L1_error) if (PySet_Add(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_end_date) < (0)) __PYX_ERR(0, 107, __pyx_L1_error) if (PySet_Add(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_exchange) < (0)) __PYX_ERR(0, 107, __pyx_L1_error) __pyx_t_6 = __Pyx_PyFrozenSet_New(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7zipline_6assets_18continuous_futures_ContinuousFuture, __pyx_mstate_global->__pyx_n_u_kwargnames, __pyx_t_6) < (0)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
107: 'sid',
108: 'root_symbol',
109: 'offset',
110: 'start_date',
111: 'end_date',
112: 'exchange',
113: })
114:
+115: def __init__(self,
/* Python wrapper */
static int __pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
__pyx_t_5numpy_int64_t __pyx_v_sid;
PyObject *__pyx_v_root_symbol = 0;
int __pyx_v_offset;
PyObject *__pyx_v_roll_style = 0;
PyObject *__pyx_v_start_date = 0;
PyObject *__pyx_v_end_date = 0;
PyObject *__pyx_v_exchange_info = 0;
PyObject *__pyx_v_adjustment = 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_sid,&__pyx_mstate_global->__pyx_n_u_root_symbol,&__pyx_mstate_global->__pyx_n_u_offset,&__pyx_mstate_global->__pyx_n_u_roll_style,&__pyx_mstate_global->__pyx_n_u_start_date,&__pyx_mstate_global->__pyx_n_u_end_date,&__pyx_mstate_global->__pyx_n_u_exchange_info,&__pyx_mstate_global->__pyx_n_u_adjustment,0};
PyObject* values[8] = {0,0,0,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, 115, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 8:
values[7] = __Pyx_ArgRef_VARARGS(__pyx_args, 7);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 115, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 7:
values[6] = __Pyx_ArgRef_VARARGS(__pyx_args, 6);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 115, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 6:
values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 115, __pyx_L3_error)
CYTHON_FALLTHROUGH;
case 5:
values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 115, __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, 115, __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, 115, __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, 115, __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, 115, __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, 115, __pyx_L3_error)
/* … */
/* 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_6assets_18continuous_futures_16ContinuousFuture___init__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *__pyx_v_self, __pyx_t_5numpy_int64_t __pyx_v_sid, PyObject *__pyx_v_root_symbol, int __pyx_v_offset, PyObject *__pyx_v_roll_style, PyObject *__pyx_v_start_date, PyObject *__pyx_v_end_date, PyObject *__pyx_v_exchange_info, PyObject *__pyx_v_adjustment) {
int __pyx_r;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[36]))
__Pyx_TraceStartFunc("__init__", __pyx_f[0], 115, 0, 0, 0, __PYX_ERR(0, 115, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_r = 0;
__Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 115, __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, 115, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_PyMonitoring_ExitScope(0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
116: int64_t sid, # sid is required
117: object root_symbol,
118: int offset,
119: object roll_style,
120: object start_date,
121: object end_date,
122: object exchange_info,
+123: object adjustment=None):
if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None)); for (Py_ssize_t i = __pyx_nargs; i < 7; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 7, 8, i); __PYX_ERR(0, 115, __pyx_L3_error) } } } else { switch (__pyx_nargs) { case 8: values[7] = __Pyx_ArgRef_VARARGS(__pyx_args, 7); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 115, __pyx_L3_error) CYTHON_FALLTHROUGH; case 7: values[6] = __Pyx_ArgRef_VARARGS(__pyx_args, 6); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 115, __pyx_L3_error) values[5] = __Pyx_ArgRef_VARARGS(__pyx_args, 5); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 115, __pyx_L3_error) values[4] = __Pyx_ArgRef_VARARGS(__pyx_args, 4); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 115, __pyx_L3_error) values[3] = __Pyx_ArgRef_VARARGS(__pyx_args, 3); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 115, __pyx_L3_error) values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 115, __pyx_L3_error) values[1] = __Pyx_ArgRef_VARARGS(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 115, __pyx_L3_error) values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 115, __pyx_L3_error) break; default: goto __pyx_L5_argtuple_error; } if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)Py_None)); } __pyx_v_sid = __Pyx_PyLong_As_npy_int64(values[0]); if (unlikely((__pyx_v_sid == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L3_error) __pyx_v_root_symbol = values[1]; __pyx_v_offset = __Pyx_PyLong_As_int(values[2]); if (unlikely((__pyx_v_offset == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 118, __pyx_L3_error) __pyx_v_roll_style = values[3]; __pyx_v_start_date = values[4]; __pyx_v_end_date = values[5]; __pyx_v_exchange_info = values[6]; __pyx_v_adjustment = values[7]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 0, 7, 8, __pyx_nargs); __PYX_ERR(0, 115, __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.assets.continuous_futures.ContinuousFuture.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture___init__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *)__pyx_v_self), __pyx_v_sid, __pyx_v_root_symbol, __pyx_v_offset, __pyx_v_roll_style, __pyx_v_start_date, __pyx_v_end_date, __pyx_v_exchange_info, __pyx_v_adjustment);
124:
+125: self.sid = sid
__pyx_v_self->sid = __pyx_v_sid;
+126: self.sid_hash = hash(sid)
__pyx_t_1 = __Pyx_PyLong_From_npy_int64(__pyx_v_sid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_Hash(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_hash_t)-1))) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->sid_hash = __pyx_t_2;
+127: self.root_symbol = root_symbol
__Pyx_INCREF(__pyx_v_root_symbol); __Pyx_GIVEREF(__pyx_v_root_symbol); __Pyx_GOTREF(__pyx_v_self->root_symbol); __Pyx_DECREF(__pyx_v_self->root_symbol); __pyx_v_self->root_symbol = __pyx_v_root_symbol;
+128: self.roll_style = roll_style
__Pyx_INCREF(__pyx_v_roll_style); __Pyx_GIVEREF(__pyx_v_roll_style); __Pyx_GOTREF(__pyx_v_self->roll_style); __Pyx_DECREF(__pyx_v_self->roll_style); __pyx_v_self->roll_style = __pyx_v_roll_style;
+129: self.offset = offset
__pyx_v_self->offset = __pyx_v_offset;
+130: self.exchange_info = exchange_info
__Pyx_INCREF(__pyx_v_exchange_info); __Pyx_GIVEREF(__pyx_v_exchange_info); __Pyx_GOTREF(__pyx_v_self->exchange_info); __Pyx_DECREF(__pyx_v_self->exchange_info); __pyx_v_self->exchange_info = __pyx_v_exchange_info;
+131: self.start_date = start_date
__Pyx_INCREF(__pyx_v_start_date); __Pyx_GIVEREF(__pyx_v_start_date); __Pyx_GOTREF(__pyx_v_self->start_date); __Pyx_DECREF(__pyx_v_self->start_date); __pyx_v_self->start_date = __pyx_v_start_date;
+132: self.end_date = end_date
__Pyx_INCREF(__pyx_v_end_date); __Pyx_GIVEREF(__pyx_v_end_date); __Pyx_GOTREF(__pyx_v_self->end_date); __Pyx_DECREF(__pyx_v_self->end_date); __pyx_v_self->end_date = __pyx_v_end_date;
+133: self.adjustment = adjustment
__Pyx_INCREF(__pyx_v_adjustment); __Pyx_GIVEREF(__pyx_v_adjustment); __Pyx_GOTREF(__pyx_v_self->adjustment); __Pyx_DECREF(__pyx_v_self->adjustment); __pyx_v_self->adjustment = __pyx_v_adjustment;
134:
+135: @property
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_8exchange_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_8exchange_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_6assets_18continuous_futures_16ContinuousFuture_8exchange___get__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_8exchange___get__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[37]))
__Pyx_TraceStartFunc("__get__", __pyx_f[0], 135, 0, 0, 0, __PYX_ERR(0, 135, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 135, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.exchange.__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;
}
136: def exchange(self):
+137: return self.exchange_info.canonical_name
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->exchange_info, __pyx_mstate_global->__pyx_n_u_canonical_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __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, 137, __pyx_L1_error)); goto __pyx_L0;
138:
+139: @property
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_13exchange_full_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_13exchange_full_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_6assets_18continuous_futures_16ContinuousFuture_13exchange_full___get__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_13exchange_full___get__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[38]))
__Pyx_TraceStartFunc("__get__", __pyx_f[0], 139, 0, 0, 0, __PYX_ERR(0, 139, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 139, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.exchange_full.__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;
}
140: def exchange_full(self):
+141: return self.exchange_info.name
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->exchange_info, __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __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, 141, __pyx_L1_error)); goto __pyx_L0;
142:
+143: def __int__(self):
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_3__int__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_3__int__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__int__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_2__int__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_2__int__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[39]))
__Pyx_TraceStartFunc("__int__", __pyx_f[0], 143, 0, 0, 0, __PYX_ERR(0, 143, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 143, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.__int__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_PyMonitoring_ExitScope(0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+144: return self.sid
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyLong_From_npy_int64(__pyx_v_self->sid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 144, __pyx_L1_error)); goto __pyx_L0;
145:
+146: def __index__(self):
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_5__index__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_5__index__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__index__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_4__index__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_4__index__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[40]))
__Pyx_TraceStartFunc("__index__", __pyx_f[0], 146, 0, 0, 0, __PYX_ERR(0, 146, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 146, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.__index__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_PyMonitoring_ExitScope(0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+147: return self.sid
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyLong_From_npy_int64(__pyx_v_self->sid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 147, __pyx_L1_error)); goto __pyx_L0;
148:
+149: def __hash__(self):
/* Python wrapper */
static Py_hash_t __pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_7__hash__(PyObject *__pyx_v_self); /*proto*/
static Py_hash_t __pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_7__hash__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
Py_hash_t __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_6__hash__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static Py_hash_t __pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_6__hash__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *__pyx_v_self) {
Py_hash_t __pyx_r;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[41]))
__Pyx_TraceStartFunc("__hash__", __pyx_f[0], 149, 0, 0, 0, __PYX_ERR(0, 149, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 149, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
__Pyx_PyMonitoring_ExitScope(0);
return __pyx_r;
}
+150: return self.sid_hash
__pyx_r = __pyx_v_self->sid_hash; __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_FromHash_t, 1, 0, __PYX_ERR(0, 150, __pyx_L1_error)); goto __pyx_L0;
151:
+152: def __richcmp__(x, y, int op):
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_9__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_9__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_8__richcmp__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *)__pyx_v_x), ((PyObject *)__pyx_v_y), ((int)__pyx_v_op));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_8__richcmp__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op) {
__pyx_t_5numpy_int64_t __pyx_v_x_as_int;
__pyx_t_5numpy_int64_t __pyx_v_y_as_int;
__pyx_t_5numpy_int64_t __pyx_v_compared;
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[42]))
__Pyx_TraceStartFunc("__richcmp__", __pyx_f[0], 152, 0, 0, 0, __PYX_ERR(0, 152, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_XDECREF(__pyx_t_9);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_XDECREF(__pyx_t_11);
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 152, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_PyMonitoring_ExitScope(0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
153: """Cython rich comparison method.
154: This is used in place of various
155: equality checkers in pure python.
156: """
157: cdef int64_t x_as_int, y_as_int
158:
+159: try:
{
/*try:*/ {
/* … */
}
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L8_try_end;
__pyx_L3_error:;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_TraceException(__pyx_lineno, 0, 0);
/* … */
__pyx_L5_except_error:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L1_error;
__pyx_L6_except_return:;
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
goto __pyx_L0;
__pyx_L8_try_end:;
}
+160: x_as_int = PyNumber_Index(x)
__pyx_t_4 = PyNumber_Index(((PyObject *)__pyx_v_x)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 160, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyLong_As_npy_int64(__pyx_t_4); if (unlikely((__pyx_t_5 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 160, __pyx_L3_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_x_as_int = __pyx_t_5;
+161: except (TypeError, OverflowError):
__pyx_t_6 = __Pyx_PyErr_ExceptionMatches2(__pyx_builtin_TypeError, __pyx_builtin_OverflowError);
if (__pyx_t_6) {
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_TraceExceptionHandled(0);
__Pyx_ErrRestore(0,0,0);
__Pyx_TraceExceptionDone();
+162: return NotImplemented
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_builtin_NotImplemented); __pyx_r = __pyx_builtin_NotImplemented; __Pyx_TraceReturnValue(__pyx_r, 8, 0, __PYX_ERR(0, 162, __pyx_L5_except_error)); goto __pyx_L6_except_return; } goto __pyx_L5_except_error;
163:
+164: try:
{
/*try:*/ {
/* … */
}
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L16_try_end;
__pyx_L11_error:;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_TraceException(__pyx_lineno, 0, 0);
/* … */
__pyx_L13_except_error:;
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
goto __pyx_L1_error;
__pyx_L14_except_return:;
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
goto __pyx_L0;
__pyx_L16_try_end:;
}
+165: y_as_int = PyNumber_Index(y)
__pyx_t_4 = PyNumber_Index(__pyx_v_y); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 165, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyLong_As_npy_int64(__pyx_t_4); if (unlikely((__pyx_t_5 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 165, __pyx_L11_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_y_as_int = __pyx_t_5;
+166: except (TypeError, OverflowError):
__pyx_t_6 = __Pyx_PyErr_ExceptionMatches2(__pyx_builtin_TypeError, __pyx_builtin_OverflowError);
if (__pyx_t_6) {
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_TraceExceptionHandled(0);
__Pyx_ErrRestore(0,0,0);
__Pyx_TraceExceptionDone();
+167: return NotImplemented
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_builtin_NotImplemented); __pyx_r = __pyx_builtin_NotImplemented; __Pyx_TraceReturnValue(__pyx_r, 17, 0, __PYX_ERR(0, 167, __pyx_L13_except_error)); goto __pyx_L14_except_return; } goto __pyx_L13_except_error;
168:
+169: compared = x_as_int - y_as_int
__pyx_v_compared = (__pyx_v_x_as_int - __pyx_v_y_as_int);
170:
171: # Handle == and != first because they're significantly more common
172: # operations.
+173: if op == Py_EQ:
__pyx_t_7 = (__pyx_v_op == Py_EQ);
if (__pyx_t_7) {
/* … */
}
+174: return compared == 0
__Pyx_XDECREF(__pyx_r); __pyx_t_4 = __Pyx_PyBool_FromLong((__pyx_v_compared == 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; __Pyx_TraceReturnValue(__pyx_r, 27, 0, __PYX_ERR(0, 174, __pyx_L1_error)); goto __pyx_L0;
+175: elif op == Py_NE:
__pyx_t_7 = (__pyx_v_op == Py_NE);
if (__pyx_t_7) {
/* … */
}
+176: return compared != 0
__Pyx_XDECREF(__pyx_r); __pyx_t_4 = __Pyx_PyBool_FromLong((__pyx_v_compared != 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 176, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; __Pyx_TraceReturnValue(__pyx_r, 34, 0, __PYX_ERR(0, 176, __pyx_L1_error)); goto __pyx_L0;
+177: elif op == Py_LT:
__pyx_t_7 = (__pyx_v_op == Py_LT);
if (__pyx_t_7) {
/* … */
}
+178: return compared < 0
__Pyx_XDECREF(__pyx_r); __pyx_t_4 = __Pyx_PyBool_FromLong((__pyx_v_compared < 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; __Pyx_TraceReturnValue(__pyx_r, 41, 0, __PYX_ERR(0, 178, __pyx_L1_error)); goto __pyx_L0;
+179: elif op == Py_LE:
__pyx_t_7 = (__pyx_v_op == Py_LE);
if (__pyx_t_7) {
/* … */
}
+180: return compared <= 0
__Pyx_XDECREF(__pyx_r); __pyx_t_4 = __Pyx_PyBool_FromLong((__pyx_v_compared <= 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; __Pyx_TraceReturnValue(__pyx_r, 48, 0, __PYX_ERR(0, 180, __pyx_L1_error)); goto __pyx_L0;
+181: elif op == Py_GT:
__pyx_t_7 = (__pyx_v_op == Py_GT);
if (__pyx_t_7) {
/* … */
}
+182: return compared > 0
__Pyx_XDECREF(__pyx_r); __pyx_t_4 = __Pyx_PyBool_FromLong((__pyx_v_compared > 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; __Pyx_TraceReturnValue(__pyx_r, 55, 0, __PYX_ERR(0, 182, __pyx_L1_error)); goto __pyx_L0;
+183: elif op == Py_GE:
__pyx_t_7 = (__pyx_v_op == Py_GE);
if (likely(__pyx_t_7)) {
/* … */
}
+184: return compared >= 0
__Pyx_XDECREF(__pyx_r); __pyx_t_4 = __Pyx_PyBool_FromLong((__pyx_v_compared >= 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; __Pyx_TraceReturnValue(__pyx_r, 62, 0, __PYX_ERR(0, 184, __pyx_L1_error)); goto __pyx_L0;
185: else:
+186: raise AssertionError('%d is not an operator' % op)
/*else*/ {
__pyx_t_8 = NULL;
__Pyx_INCREF(__pyx_builtin_AssertionError);
__pyx_t_9 = __pyx_builtin_AssertionError;
__pyx_t_10 = __Pyx_PyLong_From_int(__pyx_v_op); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 186, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_11 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_d_is_not_an_operator, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 186, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_12 = 1;
{
PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_11};
__pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 186, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
}
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__PYX_ERR(0, 186, __pyx_L1_error)
}
187:
+188: def __str__(self):
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_11__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_11__str__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_10__str__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_10__str__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[43]))
__Pyx_TraceStartFunc("__str__", __pyx_f[0], 188, 0, 0, 0, __PYX_ERR(0, 188, __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, 188, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_PyMonitoring_ExitScope(0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+189: return '%s(%d [%s, %s, %s, %s])' % (
__Pyx_XDECREF(__pyx_r); /* … */ __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 12, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 2 * 5 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 189, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_r = __pyx_t_8; __pyx_t_8 = 0; __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 189, __pyx_L1_error)); goto __pyx_L0;
+190: type(self).__name__,
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))), __pyx_mstate_global->__pyx_n_u_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __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, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+191: self.sid,
__pyx_t_1 = __Pyx_PyLong_From_npy_int64(__pyx_v_self->sid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_FormatAndDecref(__Pyx_PyNumber_Long(__pyx_t_1), __pyx_mstate_global->__pyx_n_u_d); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+192: self.root_symbol,
__pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_v_self->root_symbol), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1);
+193: self.offset,
__pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_self->offset, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4);
+194: self.roll_style,
__pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_v_self->roll_style), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5);
+195: self.adjustment,
__pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_v_self->adjustment), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 195, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7[0] = __pyx_t_2; __pyx_t_7[1] = __pyx_mstate_global->__pyx_kp_u__6; __pyx_t_7[2] = __pyx_t_3; __pyx_t_7[3] = __pyx_mstate_global->__pyx_kp_u__7; __pyx_t_7[4] = __pyx_t_1; __pyx_t_7[5] = __pyx_mstate_global->__pyx_kp_u__8; __pyx_t_7[6] = __pyx_t_4; __pyx_t_7[7] = __pyx_mstate_global->__pyx_kp_u__8; __pyx_t_7[8] = __pyx_t_5; __pyx_t_7[9] = __pyx_mstate_global->__pyx_kp_u__8; __pyx_t_7[10] = __pyx_t_6; __pyx_t_7[11] = __pyx_mstate_global->__pyx_kp_u__9;
196: )
197:
+198: def __repr__(self):
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_13__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_13__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_6assets_18continuous_futures_16ContinuousFuture_12__repr__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_gb_7zipline_6assets_18continuous_futures_16ContinuousFuture_8__repr___2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
/* … */
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_12__repr__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *__pyx_v_self) {
struct __pyx_obj_7zipline_6assets_18continuous_futures___pyx_scope_struct____repr__ *__pyx_cur_scope;
PyObject *__pyx_v_attrs = NULL;
PyObject *__pyx_v_tuples = NULL;
PyObject *__pyx_v_strings = NULL;
PyObject *__pyx_v_params = NULL;
PyObject *__pyx_gb_7zipline_6assets_18continuous_futures_16ContinuousFuture_8__repr___2generator = 0;
PyObject *__pyx_gb_7zipline_6assets_18continuous_futures_16ContinuousFuture_8__repr___5generator1 = 0;
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[46]))
__pyx_cur_scope = (struct __pyx_obj_7zipline_6assets_18continuous_futures___pyx_scope_struct____repr__ *)__pyx_tp_new_7zipline_6assets_18continuous_futures___pyx_scope_struct____repr__(__pyx_mstate_global->__pyx_ptype_7zipline_6assets_18continuous_futures___pyx_scope_struct____repr__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__pyx_cur_scope = ((struct __pyx_obj_7zipline_6assets_18continuous_futures___pyx_scope_struct____repr__ *)Py_None);
__Pyx_INCREF(Py_None);
__PYX_ERR(0, 198, __pyx_L1_error)
} else {
__Pyx_GOTREF((PyObject *)__pyx_cur_scope);
}
__Pyx_TraceStartFunc("__repr__", __pyx_f[0], 198, 0, 0, 0, __PYX_ERR(0, 198, __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);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 198, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_attrs);
__Pyx_XDECREF(__pyx_v_tuples);
__Pyx_XDECREF(__pyx_v_strings);
__Pyx_XDECREF(__pyx_v_params);
__Pyx_XDECREF(__pyx_gb_7zipline_6assets_18continuous_futures_16ContinuousFuture_8__repr___2generator);
__Pyx_XDECREF(__pyx_gb_7zipline_6assets_18continuous_futures_16ContinuousFuture_8__repr___5generator1);
__Pyx_DECREF((PyObject *)__pyx_cur_scope);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_PyMonitoring_ExitScope(0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
struct __pyx_obj_7zipline_6assets_18continuous_futures___pyx_scope_struct____repr__ {
PyObject_HEAD
struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *__pyx_v_self;
};
+199: attrs = ('root_symbol', 'offset', 'roll_style', 'adjustment')
__Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[2]); __pyx_v_attrs = __pyx_mstate_global->__pyx_tuple[2]; /* … */ __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(4, __pyx_mstate_global->__pyx_n_u_root_symbol, __pyx_mstate_global->__pyx_n_u_offset, __pyx_mstate_global->__pyx_n_u_roll_style, __pyx_mstate_global->__pyx_n_u_adjustment); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]);
+200: tuples = ((attr, repr(getattr(self, attr, None)))
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_8__repr___genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
struct __pyx_obj_7zipline_6assets_18continuous_futures___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__pyx_cur_scope = (struct __pyx_obj_7zipline_6assets_18continuous_futures___pyx_scope_struct_1_genexpr *)__pyx_tp_new_7zipline_6assets_18continuous_futures___pyx_scope_struct_1_genexpr(__pyx_mstate_global->__pyx_ptype_7zipline_6assets_18continuous_futures___pyx_scope_struct_1_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__pyx_cur_scope = ((struct __pyx_obj_7zipline_6assets_18continuous_futures___pyx_scope_struct_1_genexpr *)Py_None);
__Pyx_INCREF(Py_None);
__PYX_ERR(0, 200, __pyx_L1_error)
} else {
__Pyx_GOTREF((PyObject *)__pyx_cur_scope);
}
__pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7zipline_6assets_18continuous_futures___pyx_scope_struct____repr__ *) __pyx_self;
__Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
__Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
__pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
__Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
{
__pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7zipline_6assets_18continuous_futures_16ContinuousFuture_8__repr___2generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[44]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_repr___locals_genexpr, __pyx_mstate_global->__pyx_n_u_zipline_assets_continuous_future); if (unlikely(!gen)) __PYX_ERR(0, 200, __pyx_L1_error)
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.__repr__.genexpr", __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_6assets_18continuous_futures_16ContinuousFuture_8__repr___2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("genexpr", 0);
__Pyx_TraceDeclarationsGen
__pyx_L3_first_run:;
__Pyx_TraceStartGen("genexpr", __pyx_f[0], 200, 0, 0, 0, __PYX_ERR(0, 200, __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, 200, __pyx_L1_error)
}
/* … */
if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 200, __pyx_L1_error) }
__pyx_t_3 = ((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self);
__Pyx_INCREF(__pyx_t_3);
__pyx_t_4 = __Pyx_GetAttr3(__pyx_t_3, __pyx_cur_scope->__pyx_v_attr, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 200, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyObject_Repr(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 200, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_attr);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_attr);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_attr) != (0)) __PYX_ERR(0, 200, __pyx_L1_error);
__Pyx_GIVEREF(__pyx_t_3);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 200, __pyx_L1_error);
__pyx_t_3 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
__Pyx_XGIVEREF(__pyx_t_1);
__pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
__pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
__Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 200, __pyx_L1_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_L6_resume_from_yield:;
__Pyx_TraceResumeGen("genexpr", __pyx_f[0], 200, 0, __PYX_ERR(0, 200, __pyx_L1_error));
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_cur_scope->__pyx_t_0 = 0;
__Pyx_XGOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 200, __pyx_L1_error)
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
if (__Pyx_PyErr_Occurred()) {
__Pyx_TraceException(__pyx_lineno, 0, 0);
__Pyx_Generator_Replace_StopIteration(0);
__Pyx_AddTraceback("genexpr", __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;
}
static PyObject *__pyx_gb_7zipline_6assets_18continuous_futures_16ContinuousFuture_8__repr___5generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
/* … */
__pyx_t_1 = __pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_8__repr___genexpr(((PyObject*)__pyx_cur_scope), __pyx_v_attrs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_tuples = __pyx_t_1;
__pyx_t_1 = 0;
/* … */
struct __pyx_obj_7zipline_6assets_18continuous_futures___pyx_scope_struct_1_genexpr {
PyObject_HEAD
struct __pyx_obj_7zipline_6assets_18continuous_futures___pyx_scope_struct____repr__ *__pyx_outer_scope;
PyObject *__pyx_genexpr_arg_0;
PyObject *__pyx_v_attr;
PyObject *__pyx_t_0;
Py_ssize_t __pyx_t_1;
};
+201: for attr in attrs)
if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 201, __pyx_L1_error) }
__pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
__pyx_t_2 = 0;
for (;;) {
{
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, 201, __pyx_L1_error)
#endif
if (__pyx_t_2 >= __pyx_temp) break;
}
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
__pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
#else
__pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
#endif
++__pyx_t_2;
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_attr);
__Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_attr, ((PyObject*)__pyx_t_3));
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
/* … */
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
__Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 200, __pyx_L1_error));
+202: strings = ('%s=%s' % (t[0], t[1]) for t in tuples)
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_8__repr___3genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
struct __pyx_obj_7zipline_6assets_18continuous_futures___pyx_scope_struct_2_genexpr *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__pyx_cur_scope = (struct __pyx_obj_7zipline_6assets_18continuous_futures___pyx_scope_struct_2_genexpr *)__pyx_tp_new_7zipline_6assets_18continuous_futures___pyx_scope_struct_2_genexpr(__pyx_mstate_global->__pyx_ptype_7zipline_6assets_18continuous_futures___pyx_scope_struct_2_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__pyx_cur_scope = ((struct __pyx_obj_7zipline_6assets_18continuous_futures___pyx_scope_struct_2_genexpr *)Py_None);
__Pyx_INCREF(Py_None);
__PYX_ERR(0, 202, __pyx_L1_error)
} else {
__Pyx_GOTREF((PyObject *)__pyx_cur_scope);
}
__pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
__Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
{
__pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7zipline_6assets_18continuous_futures_16ContinuousFuture_8__repr___5generator1, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[45]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_repr___locals_genexpr, __pyx_mstate_global->__pyx_n_u_zipline_assets_continuous_future); if (unlikely(!gen)) __PYX_ERR(0, 202, __pyx_L1_error)
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.__repr__.genexpr", __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_6assets_18continuous_futures_16ContinuousFuture_8__repr___5generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("genexpr", 0);
__Pyx_TraceDeclarationsGen
__pyx_L3_first_run:;
__Pyx_TraceStartGen("genexpr", __pyx_f[0], 202, 0, 0, 0, __PYX_ERR(0, 202, __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, 202, __pyx_L1_error)
}
if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 202, __pyx_L1_error) }
if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
__pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
__pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error)
}
for (;;) {
if (likely(!__pyx_t_3)) {
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, 202, __pyx_L1_error)
#endif
if (__pyx_t_2 >= __pyx_temp) break;
}
__pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
++__pyx_t_2;
} 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, 202, __pyx_L1_error)
#endif
if (__pyx_t_2 >= __pyx_temp) break;
}
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
__pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
#else
__pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
#endif
++__pyx_t_2;
}
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 202, __pyx_L1_error)
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
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, 202, __pyx_L1_error)
PyErr_Clear();
}
break;
}
}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_t);
__Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_t, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
__pyx_t_4 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_t, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 202, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_4), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 202, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_t, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 202, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Str(__pyx_t_4), __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 202, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_7[0] = __pyx_t_5;
__pyx_t_7[1] = __pyx_mstate_global->__pyx_kp_u__10;
__pyx_t_7[2] = __pyx_t_6;
__pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6));
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 202, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
__Pyx_XGIVEREF(__pyx_t_1);
__pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
__pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
__pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
__Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 202, __pyx_L1_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_L6_resume_from_yield:;
__Pyx_TraceResumeGen("genexpr", __pyx_f[0], 202, 0, __PYX_ERR(0, 202, __pyx_L1_error));
__pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
__pyx_cur_scope->__pyx_t_0 = 0;
__Pyx_XGOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
__pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 202, __pyx_L1_error)
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
__Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 202, __pyx_L1_error));
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
if (__Pyx_PyErr_Occurred()) {
__Pyx_TraceException(__pyx_lineno, 0, 0);
__Pyx_Generator_Replace_StopIteration(0);
__Pyx_AddTraceback("genexpr", __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_1 = __pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_8__repr___3genexpr(NULL, __pyx_v_tuples); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_strings = __pyx_t_1;
__pyx_t_1 = 0;
/* … */
struct __pyx_obj_7zipline_6assets_18continuous_futures___pyx_scope_struct_2_genexpr {
PyObject_HEAD
PyObject *__pyx_genexpr_arg_0;
PyObject *__pyx_v_t;
PyObject *__pyx_t_0;
Py_ssize_t __pyx_t_1;
PyObject *(*__pyx_t_2)(PyObject *);
};
+203: params = ', '.join(strings)
__pyx_t_1 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__8, __pyx_v_strings); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_params = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+204: return 'ContinuousFuture(%d, %s)' % (self.sid, params)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyLong_From_npy_int64(__pyx_cur_scope->__pyx_v_self->sid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_FormatAndDecref(__Pyx_PyNumber_Long(__pyx_t_1), __pyx_mstate_global->__pyx_n_u_d); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyUnicode_Unicode(__pyx_v_params); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3[0] = __pyx_mstate_global->__pyx_kp_u_ContinuousFuture; __pyx_t_3[1] = __pyx_t_2; __pyx_t_3[2] = __pyx_mstate_global->__pyx_kp_u__8; __pyx_t_3[3] = __pyx_t_1; __pyx_t_3[4] = __pyx_mstate_global->__pyx_kp_u__5; __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_3, 5, 17 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 1, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; __Pyx_TraceReturnValue(__pyx_r, 15, 0, __PYX_ERR(0, 204, __pyx_L1_error)); goto __pyx_L0;
205:
+206: cpdef __reduce__(self):
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_15__reduce__(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 PyObject *__pyx_f_7zipline_6assets_18continuous_futures_16ContinuousFuture___reduce__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *__pyx_v_self, int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[47]))
__Pyx_TraceStartFunc("__reduce__", __pyx_f[0], 206, 0, 0, __pyx_skip_dispatch, __PYX_ERR(0, 206, __pyx_L1_error));
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_7zipline_6assets_18continuous_futures_ContinuousFuture &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_reduce); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_15__reduce__)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__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, 206, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 206, __pyx_L1_error));
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* 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_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, 206, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_PyMonitoring_ExitScope(0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_15__reduce__(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_6assets_18continuous_futures_16ContinuousFuture_14__reduce__, "ContinuousFuture.__reduce__(self)\n\nFunction used by pickle to determine how to serialize/deserialize this\nclass. Should return a tuple whose first element is self.__class__,\nand whose second element is a tuple of all the attributes that should\nbe serialized/deserialized during pickling.");
static PyMethodDef __pyx_mdef_7zipline_6assets_18continuous_futures_16ContinuousFuture_15__reduce__ = {"__reduce__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_15__reduce__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7zipline_6assets_18continuous_futures_16ContinuousFuture_14__reduce__};
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_15__reduce__(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
) {
#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("__reduce__ (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);
if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce__", 1, 0, 0, __pyx_nargs); return NULL; }
const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len < 0)) return NULL;
if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce__", __pyx_kwds); return NULL;}
__pyx_r = __pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_14__reduce__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_14__reduce__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[47]))
__Pyx_TraceStartFunc("__reduce__ (wrapper)", __pyx_f[0], 206, 0, 0, 0, __PYX_ERR(0, 206, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_7zipline_6assets_18continuous_futures_16ContinuousFuture___reduce__(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 206, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.__reduce__", __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_6 = __Pyx_CyFunction_New(&__pyx_mdef_7zipline_6assets_18continuous_futures_16ContinuousFuture_15__reduce__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ContinuousFuture___reduce, NULL, __pyx_mstate_global->__pyx_n_u_zipline_assets_continuous_future, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[47])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 206, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7zipline_6assets_18continuous_futures_ContinuousFuture, __pyx_mstate_global->__pyx_n_u_reduce, __pyx_t_6) < (0)) __PYX_ERR(0, 206, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
207: """Function used by pickle to determine how to serialize/deserialize this
208: class. Should return a tuple whose first element is self.__class__,
209: and whose second element is a tuple of all the attributes that should
210: be serialized/deserialized during pickling.
211: """
+212: return (self.__class__, (self.sid,
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyLong_From_npy_int64(__pyx_v_self->sid); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); /* … */ __pyx_t_6 = PyTuple_New(7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_2); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 212, __pyx_L1_error); __Pyx_INCREF(__pyx_v_self->root_symbol); __Pyx_GIVEREF(__pyx_v_self->root_symbol); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_self->root_symbol) != (0)) __PYX_ERR(0, 212, __pyx_L1_error); __Pyx_INCREF(__pyx_v_self->start_date); __Pyx_GIVEREF(__pyx_v_self->start_date); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_self->start_date) != (0)) __PYX_ERR(0, 212, __pyx_L1_error); __Pyx_INCREF(__pyx_v_self->end_date); __Pyx_GIVEREF(__pyx_v_self->end_date); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_v_self->end_date) != (0)) __PYX_ERR(0, 212, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_4); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_4) != (0)) __PYX_ERR(0, 212, __pyx_L1_error); __Pyx_INCREF(__pyx_v_self->roll_style); __Pyx_GIVEREF(__pyx_v_self->roll_style); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_v_self->roll_style) != (0)) __PYX_ERR(0, 212, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_3); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 6, __pyx_t_3) != (0)) __PYX_ERR(0, 212, __pyx_L1_error); __pyx_t_2 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 212, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_6); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6) != (0)) __PYX_ERR(0, 212, __pyx_L1_error); __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 212, __pyx_L1_error)); goto __pyx_L0;
213: self.root_symbol,
214: self.start_date,
215: self.end_date,
+216: self.offset,
__pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_self->offset); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4);
217: self.roll_style,
+218: self.exchange))
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_exchange); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3);
219:
+220: cpdef to_dict(self):
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_17to_dict(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 PyObject *__pyx_f_7zipline_6assets_18continuous_futures_16ContinuousFuture_to_dict(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *__pyx_v_self, int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[48]))
__Pyx_TraceStartFunc("to_dict", __pyx_f[0], 220, 0, 0, __pyx_skip_dispatch, __PYX_ERR(0, 220, __pyx_L1_error));
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_7zipline_6assets_18continuous_futures_ContinuousFuture &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_to_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_17to_dict)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_5 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__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, 220, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 220, __pyx_L1_error));
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* 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_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 220, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.to_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_PyMonitoring_ExitScope(0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_17to_dict(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_6assets_18continuous_futures_16ContinuousFuture_16to_dict, "ContinuousFuture.to_dict(self)\n\nConvert to a python dict.");
static PyMethodDef __pyx_mdef_7zipline_6assets_18continuous_futures_16ContinuousFuture_17to_dict = {"to_dict", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_17to_dict, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7zipline_6assets_18continuous_futures_16ContinuousFuture_16to_dict};
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_17to_dict(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
) {
#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("to_dict (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);
if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("to_dict", 1, 0, 0, __pyx_nargs); return NULL; }
const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len < 0)) return NULL;
if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("to_dict", __pyx_kwds); return NULL;}
__pyx_r = __pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_16to_dict(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_16to_dict(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[48]))
__Pyx_TraceStartFunc("to_dict (wrapper)", __pyx_f[0], 220, 0, 0, 0, __PYX_ERR(0, 220, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_7zipline_6assets_18continuous_futures_16ContinuousFuture_to_dict(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 220, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.to_dict", __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_6 = __Pyx_CyFunction_New(&__pyx_mdef_7zipline_6assets_18continuous_futures_16ContinuousFuture_17to_dict, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ContinuousFuture_to_dict, NULL, __pyx_mstate_global->__pyx_n_u_zipline_assets_continuous_future, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[48])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 220, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7zipline_6assets_18continuous_futures_ContinuousFuture, __pyx_mstate_global->__pyx_n_u_to_dict, __pyx_t_6) < (0)) __PYX_ERR(0, 220, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
221: """Convert to a python dict."""
+222: return {
__Pyx_XDECREF(__pyx_r);
+223: 'sid': self.sid,
__pyx_t_1 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyLong_From_npy_int64(__pyx_v_self->sid); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_sid, __pyx_t_2) < (0)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+224: 'root_symbol': self.root_symbol,
if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_root_symbol, __pyx_v_self->root_symbol) < (0)) __PYX_ERR(0, 223, __pyx_L1_error)
+225: 'start_date': self.start_date,
if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_start_date, __pyx_v_self->start_date) < (0)) __PYX_ERR(0, 223, __pyx_L1_error)
+226: 'end_date': self.end_date,
if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_end_date, __pyx_v_self->end_date) < (0)) __PYX_ERR(0, 223, __pyx_L1_error)
+227: 'offset': self.offset,
__pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_self->offset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_offset, __pyx_t_2) < (0)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+228: 'roll_style': self.roll_style,
if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_roll_style, __pyx_v_self->roll_style) < (0)) __PYX_ERR(0, 223, __pyx_L1_error)
+229: 'exchange': self.exchange,
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_exchange); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_exchange, __pyx_t_2) < (0)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 222, __pyx_L1_error)); goto __pyx_L0;
230: }
231:
+232: @classmethod
/* Python wrapper */ static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_19from_dict(PyObject *__pyx_v_cls, #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_6assets_18continuous_futures_16ContinuousFuture_18from_dict, "ContinuousFuture.from_dict(cls, dict_)\n\nBuild an ContinuousFuture instance from a dict."); static PyMethodDef __pyx_mdef_7zipline_6assets_18continuous_futures_16ContinuousFuture_19from_dict = {"from_dict", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_19from_dict, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7zipline_6assets_18continuous_futures_16ContinuousFuture_18from_dict}; static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_19from_dict(PyObject *__pyx_v_cls, #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_dict_ = 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("from_dict (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_dict_2,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, 232, __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, 232, __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, "from_dict", 0) < (0)) __PYX_ERR(0, 232, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("from_dict", 1, 1, 1, i); __PYX_ERR(0, 232, __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, 232, __pyx_L3_error) } __pyx_v_dict_ = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("from_dict", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 232, __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.assets.continuous_futures.ContinuousFuture.from_dict", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_18from_dict(((PyTypeObject*)__pyx_v_cls), __pyx_v_dict_); 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_6assets_18continuous_futures_16ContinuousFuture_18from_dict(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_dict_) { PyObject *__pyx_r = NULL; __Pyx_TraceDeclarationsFunc __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[49])) __Pyx_TraceStartFunc("from_dict", __pyx_f[0], 232, 0, 0, 0, __PYX_ERR(0, 232, __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, 232, __pyx_L1_error)); #endif __Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.from_dict", __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_6 = __Pyx_CyFunction_New(&__pyx_mdef_7zipline_6assets_18continuous_futures_16ContinuousFuture_19from_dict, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ContinuousFuture_from_dict, NULL, __pyx_mstate_global->__pyx_n_u_zipline_assets_continuous_future, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[49])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7zipline_6assets_18continuous_futures_ContinuousFuture, __pyx_mstate_global->__pyx_n_u_from_dict, __pyx_t_6) < (0)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GetNameInClass(__pyx_t_6, (PyObject*)__pyx_mstate_global->__pyx_ptype_7zipline_6assets_18continuous_futures_ContinuousFuture, __pyx_mstate_global->__pyx_n_u_from_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_Method_ClassMethod(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7zipline_6assets_18continuous_futures_ContinuousFuture, __pyx_mstate_global->__pyx_n_u_from_dict, __pyx_t_5) < (0)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
233: def from_dict(cls, dict_):
234: """Build an ContinuousFuture instance from a dict."""
+235: return cls(**dict_)
__Pyx_XDECREF(__pyx_r); if (unlikely(__pyx_v_dict_ == Py_None)) { PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); __PYX_ERR(0, 235, __pyx_L1_error) } if (likely(PyDict_CheckExact(__pyx_v_dict_))) { __pyx_t_1 = PyDict_Copy(__pyx_v_dict_); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } else { __pyx_t_1 = __Pyx_PyObject_CallOneArg((PyObject*)&PyDict_Type, __pyx_v_dict_); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_cls), __pyx_mstate_global->__pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 235, __pyx_L1_error)); goto __pyx_L0;
236:
+237: def is_alive_for_session(self, session_label):
/* Python wrapper */ static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_21is_alive_for_session(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_6assets_18continuous_futures_16ContinuousFuture_20is_alive_for_session, "ContinuousFuture.is_alive_for_session(self, session_label)\n\nReturns whether the continuous future is alive at the given dt.\n\nParameters\n----------\nsession_label: pd.Timestamp\n The desired session label to check. (midnight UTC)\n\nReturns\n-------\nboolean: whether the continuous is alive at the given dt."); static PyMethodDef __pyx_mdef_7zipline_6assets_18continuous_futures_16ContinuousFuture_21is_alive_for_session = {"is_alive_for_session", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_21is_alive_for_session, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7zipline_6assets_18continuous_futures_16ContinuousFuture_20is_alive_for_session}; static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_21is_alive_for_session(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_session_label = 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_alive_for_session (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_session_label,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, 237, __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, 237, __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_alive_for_session", 0) < (0)) __PYX_ERR(0, 237, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("is_alive_for_session", 1, 1, 1, i); __PYX_ERR(0, 237, __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, 237, __pyx_L3_error) } __pyx_v_session_label = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("is_alive_for_session", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 237, __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.assets.continuous_futures.ContinuousFuture.is_alive_for_session", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_20is_alive_for_session(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *)__pyx_v_self), __pyx_v_session_label); 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_6assets_18continuous_futures_16ContinuousFuture_20is_alive_for_session(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *__pyx_v_self, PyObject *__pyx_v_session_label) { __pyx_t_5numpy_int64_t __pyx_v_ref_start; __pyx_t_5numpy_int64_t __pyx_v_ref_end; PyObject *__pyx_r = NULL; __Pyx_TraceDeclarationsFunc __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[50])) __Pyx_TraceStartFunc("is_alive_for_session", __pyx_f[0], 237, 0, 0, 0, __PYX_ERR(0, 237, __pyx_L1_error)); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __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, 237, __pyx_L1_error)); #endif __Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.is_alive_for_session", __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_5 = __Pyx_CyFunction_New(&__pyx_mdef_7zipline_6assets_18continuous_futures_16ContinuousFuture_21is_alive_for_session, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ContinuousFuture_is_alive_for_se, NULL, __pyx_mstate_global->__pyx_n_u_zipline_assets_continuous_future, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[50])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7zipline_6assets_18continuous_futures_ContinuousFuture, __pyx_mstate_global->__pyx_n_u_is_alive_for_session, __pyx_t_5) < (0)) __PYX_ERR(0, 237, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
238: """Returns whether the continuous future is alive at the given dt.
239:
240: Parameters
241: ----------
242: session_label: pd.Timestamp
243: The desired session label to check. (midnight UTC)
244:
245: Returns
246: -------
247: boolean: whether the continuous is alive at the given dt.
248: """
249: cdef int64_t ref_start
250: cdef int64_t ref_end
251:
+252: ref_start = self.start_date.value
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->start_date, __pyx_mstate_global->__pyx_n_u_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyLong_As_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_2 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_ref_start = __pyx_t_2;
+253: ref_end = self.end_date.value
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->end_date, __pyx_mstate_global->__pyx_n_u_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyLong_As_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_2 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 253, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_ref_end = __pyx_t_2;
254:
+255: return ref_start <= session_label.value <= ref_end
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyLong_From_npy_int64(__pyx_v_ref_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_session_label, __pyx_mstate_global->__pyx_n_u_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 255, __pyx_L1_error) if (__Pyx_PyObject_IsTrue(__pyx_t_4)) { __Pyx_DECREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyLong_From_npy_int64(__pyx_v_ref_end); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_5, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; __Pyx_TraceReturnValue(__pyx_r, 9, 0, __PYX_ERR(0, 255, __pyx_L1_error)); goto __pyx_L0;
256:
+257: def is_exchange_open(self, dt_minute):
/* Python wrapper */ static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_23is_exchange_open(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_6assets_18continuous_futures_16ContinuousFuture_22is_exchange_open, "ContinuousFuture.is_exchange_open(self, dt_minute)\n\nParameters\n----------\ndt_minute: pd.Timestamp (UTC, tz-aware)\n The minute to check.\n\nReturns\n-------\nboolean: whether the continuous futures's exchange is open at the\ngiven minute."); static PyMethodDef __pyx_mdef_7zipline_6assets_18continuous_futures_16ContinuousFuture_23is_exchange_open = {"is_exchange_open", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_23is_exchange_open, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7zipline_6assets_18continuous_futures_16ContinuousFuture_22is_exchange_open}; static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16ContinuousFuture_23is_exchange_open(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_dt_minute = 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_exchange_open (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_dt_minute,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, 257, __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, 257, __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_exchange_open", 0) < (0)) __PYX_ERR(0, 257, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("is_exchange_open", 1, 1, 1, i); __PYX_ERR(0, 257, __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, 257, __pyx_L3_error) } __pyx_v_dt_minute = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("is_exchange_open", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 257, __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.assets.continuous_futures.ContinuousFuture.is_exchange_open", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7zipline_6assets_18continuous_futures_16ContinuousFuture_22is_exchange_open(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *)__pyx_v_self), __pyx_v_dt_minute); 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_6assets_18continuous_futures_16ContinuousFuture_22is_exchange_open(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContinuousFuture *__pyx_v_self, PyObject *__pyx_v_dt_minute) { PyObject *__pyx_v_calendar = NULL; PyObject *__pyx_r = NULL; __Pyx_TraceDeclarationsFunc __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[51])) __Pyx_TraceStartFunc("is_exchange_open", __pyx_f[0], 257, 0, 0, 0, __PYX_ERR(0, 257, __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_TraceException(__pyx_lineno, 0, 0); #if CYTHON_USE_SYS_MONITORING __Pyx_TraceExceptionUnwind(0, 0); #else __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 257, __pyx_L1_error)); #endif __Pyx_AddTraceback("zipline.assets.continuous_futures.ContinuousFuture.is_exchange_open", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_calendar); __Pyx_XGIVEREF(__pyx_r); __Pyx_PyMonitoring_ExitScope(0); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7zipline_6assets_18continuous_futures_16ContinuousFuture_23is_exchange_open, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_ContinuousFuture_is_exchange_ope, NULL, __pyx_mstate_global->__pyx_n_u_zipline_assets_continuous_future, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[51])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7zipline_6assets_18continuous_futures_ContinuousFuture, __pyx_mstate_global->__pyx_n_u_is_exchange_open, __pyx_t_5) < (0)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
258: """
259:
260: Parameters
261: ----------
262: dt_minute: pd.Timestamp (UTC, tz-aware)
263: The minute to check.
264:
265: Returns
266: -------
267: boolean: whether the continuous futures's exchange is open at the
268: given minute.
269: """
+270: calendar = get_calendar(self.exchange)
__pyx_t_2 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_get_calendar); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 270, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_exchange); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 270, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); assert(__pyx_t_2); PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx__function); __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); __pyx_t_5 = 0; } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_calendar = __pyx_t_1; __pyx_t_1 = 0;
+271: return calendar.is_open_on_minute(dt_minute)
__Pyx_XDECREF(__pyx_r); __pyx_t_3 = __pyx_v_calendar; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_dt_minute}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_is_open_on_minute, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 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, 6, 0, __PYX_ERR(0, 271, __pyx_L1_error)); goto __pyx_L0;
272:
273:
+274: cdef class ContractNode:
struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode {
PyObject_HEAD
PyObject *contract;
PyObject *prev;
PyObject *next;
};
275:
+276: cdef readonly object contract
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_12ContractNode_8contract_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_12ContractNode_8contract_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_6assets_18continuous_futures_12ContractNode_8contract___get__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_12ContractNode_8contract___get__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[63]))
__Pyx_TraceStartFunc("__get__", __pyx_f[0], 276, 0, 0, 0, __PYX_ERR(0, 276, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->contract);
__pyx_r = __pyx_v_self->contract;
__Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 276, __pyx_L1_error));
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 276, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContractNode.contract.__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;
}
+277: cdef public object prev
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_12ContractNode_4prev_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_12ContractNode_4prev_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_6assets_18continuous_futures_12ContractNode_4prev___get__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_12ContractNode_4prev___get__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[64]))
__Pyx_TraceStartFunc("__get__", __pyx_f[0], 277, 0, 0, 0, __PYX_ERR(0, 277, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->prev);
__pyx_r = __pyx_v_self->prev;
__Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 277, __pyx_L1_error));
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 277, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContractNode.prev.__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;
}
/* Python wrapper */
static int __pyx_pw_7zipline_6assets_18continuous_futures_12ContractNode_4prev_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_7zipline_6assets_18continuous_futures_12ContractNode_4prev_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
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_6assets_18continuous_futures_12ContractNode_4prev_2__set__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode *)__pyx_v_self), ((PyObject *)__pyx_v_value));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_7zipline_6assets_18continuous_futures_12ContractNode_4prev_2__set__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode *__pyx_v_self, PyObject *__pyx_v_value) {
int __pyx_r;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[65]))
__Pyx_TraceStartFunc("__set__", __pyx_f[0], 277, 0, 0, 0, __PYX_ERR(0, 277, __pyx_L1_error));
__Pyx_INCREF(__pyx_v_value);
__Pyx_GIVEREF(__pyx_v_value);
__Pyx_GOTREF(__pyx_v_self->prev);
__Pyx_DECREF(__pyx_v_self->prev);
__pyx_v_self->prev = __pyx_v_value;
/* function exit code */
__pyx_r = 0;
__Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 277, __pyx_L1_error));
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 277, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContractNode.prev.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_PyMonitoring_ExitScope(0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static int __pyx_pw_7zipline_6assets_18continuous_futures_12ContractNode_4prev_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_7zipline_6assets_18continuous_futures_12ContractNode_4prev_5__del__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_7zipline_6assets_18continuous_futures_12ContractNode_4prev_4__del__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_7zipline_6assets_18continuous_futures_12ContractNode_4prev_4__del__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode *__pyx_v_self) {
int __pyx_r;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[66]))
__Pyx_TraceStartFunc("__del__", __pyx_f[0], 277, 0, 0, 0, __PYX_ERR(0, 277, __pyx_L1_error));
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_GOTREF(__pyx_v_self->prev);
__Pyx_DECREF(__pyx_v_self->prev);
__pyx_v_self->prev = Py_None;
/* function exit code */
__pyx_r = 0;
__Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 277, __pyx_L1_error));
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 277, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContractNode.prev.__del__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_PyMonitoring_ExitScope(0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+278: cdef public object next
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_12ContractNode_4next_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_12ContractNode_4next_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_6assets_18continuous_futures_12ContractNode_4next___get__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_12ContractNode_4next___get__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[67]))
__Pyx_TraceStartFunc("__get__", __pyx_f[0], 278, 0, 0, 0, __PYX_ERR(0, 278, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->next);
__pyx_r = __pyx_v_self->next;
__Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 278, __pyx_L1_error));
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 278, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContractNode.next.__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;
}
/* Python wrapper */
static int __pyx_pw_7zipline_6assets_18continuous_futures_12ContractNode_4next_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_7zipline_6assets_18continuous_futures_12ContractNode_4next_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
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_6assets_18continuous_futures_12ContractNode_4next_2__set__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode *)__pyx_v_self), ((PyObject *)__pyx_v_value));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_7zipline_6assets_18continuous_futures_12ContractNode_4next_2__set__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode *__pyx_v_self, PyObject *__pyx_v_value) {
int __pyx_r;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[68]))
__Pyx_TraceStartFunc("__set__", __pyx_f[0], 278, 0, 0, 0, __PYX_ERR(0, 278, __pyx_L1_error));
__Pyx_INCREF(__pyx_v_value);
__Pyx_GIVEREF(__pyx_v_value);
__Pyx_GOTREF(__pyx_v_self->next);
__Pyx_DECREF(__pyx_v_self->next);
__pyx_v_self->next = __pyx_v_value;
/* function exit code */
__pyx_r = 0;
__Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 278, __pyx_L1_error));
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 278, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContractNode.next.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_PyMonitoring_ExitScope(0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static int __pyx_pw_7zipline_6assets_18continuous_futures_12ContractNode_4next_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_7zipline_6assets_18continuous_futures_12ContractNode_4next_5__del__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_7zipline_6assets_18continuous_futures_12ContractNode_4next_4__del__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_7zipline_6assets_18continuous_futures_12ContractNode_4next_4__del__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode *__pyx_v_self) {
int __pyx_r;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[69]))
__Pyx_TraceStartFunc("__del__", __pyx_f[0], 278, 0, 0, 0, __PYX_ERR(0, 278, __pyx_L1_error));
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_GOTREF(__pyx_v_self->next);
__Pyx_DECREF(__pyx_v_self->next);
__pyx_v_self->next = Py_None;
/* function exit code */
__pyx_r = 0;
__Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 278, __pyx_L1_error));
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 278, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContractNode.next.__del__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_PyMonitoring_ExitScope(0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
279:
+280: def __init__(self, contract):
/* Python wrapper */
static int __pyx_pw_7zipline_6assets_18continuous_futures_12ContractNode_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7zipline_6assets_18continuous_futures_12ContractNode_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_contract = 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_contract,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, 280, __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, 280, __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, 280, __pyx_L3_error)
for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(0, 280, __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, 280, __pyx_L3_error)
}
__pyx_v_contract = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 280, __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.assets.continuous_futures.ContractNode.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_7zipline_6assets_18continuous_futures_12ContractNode___init__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode *)__pyx_v_self), __pyx_v_contract);
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_6assets_18continuous_futures_12ContractNode___init__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode *__pyx_v_self, PyObject *__pyx_v_contract) {
int __pyx_r;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[60]))
__Pyx_TraceStartFunc("__init__", __pyx_f[0], 280, 0, 0, 0, __PYX_ERR(0, 280, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_r = 0;
__Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 280, __pyx_L1_error));
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 280, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContractNode.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_PyMonitoring_ExitScope(0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+281: self.contract = contract
__Pyx_INCREF(__pyx_v_contract); __Pyx_GIVEREF(__pyx_v_contract); __Pyx_GOTREF(__pyx_v_self->contract); __Pyx_DECREF(__pyx_v_self->contract); __pyx_v_self->contract = __pyx_v_contract;
+282: self.prev = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->prev); __Pyx_DECREF(__pyx_v_self->prev); __pyx_v_self->prev = Py_None;
+283: self.next = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->next); __Pyx_DECREF(__pyx_v_self->next); __pyx_v_self->next = Py_None;
284:
+285: def __rshift__(self, offset):
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_12ContractNode_3__rshift__(PyObject *__pyx_v_self, PyObject *__pyx_v_offset); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_12ContractNode_3__rshift__(PyObject *__pyx_v_self, PyObject *__pyx_v_offset) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__rshift__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_7zipline_6assets_18continuous_futures_12ContractNode_2__rshift__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode *)__pyx_v_self), ((PyObject *)__pyx_v_offset));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_12ContractNode_2__rshift__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode *__pyx_v_self, PyObject *__pyx_v_offset) {
PyObject *__pyx_v_i = NULL;
PyObject *__pyx_v_curr = NULL;
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[61]))
__Pyx_TraceStartFunc("__rshift__", __pyx_f[0], 285, 0, 0, 0, __PYX_ERR(0, 285, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_L1_error:;
__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, 285, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContractNode.__rshift__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_i);
__Pyx_XDECREF(__pyx_v_curr);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_PyMonitoring_ExitScope(0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+286: i = 0
__Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
__pyx_v_i = __pyx_mstate_global->__pyx_int_0;
+287: curr = self
__Pyx_INCREF((PyObject *)__pyx_v_self);
__pyx_v_curr = ((PyObject *)__pyx_v_self);
+288: while i < offset and curr is not None:
while (1) {
__pyx_t_2 = PyObject_RichCompare(__pyx_v_i, __pyx_v_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 288, __pyx_L1_error)
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 288, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_3) {
} else {
__pyx_t_1 = __pyx_t_3;
goto __pyx_L5_bool_binop_done;
}
__pyx_t_3 = (__pyx_v_curr != Py_None);
__pyx_t_1 = __pyx_t_3;
__pyx_L5_bool_binop_done:;
if (!__pyx_t_1) break;
+289: curr = curr.next
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_curr, __pyx_mstate_global->__pyx_n_u_next); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 289, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF_SET(__pyx_v_curr, __pyx_t_2); __pyx_t_2 = 0;
+290: i += 1
__pyx_t_2 = __Pyx_PyLong_AddObjC(__pyx_v_i, __pyx_mstate_global->__pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_2); __pyx_t_2 = 0; }
+291: return curr
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_curr); __pyx_r = __pyx_v_curr; __Pyx_TraceReturnValue(__pyx_r, 18, 0, __PYX_ERR(0, 291, __pyx_L1_error)); goto __pyx_L0;
292:
+293: def __lshift__(self, offset):
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_12ContractNode_5__lshift__(PyObject *__pyx_v_self, PyObject *__pyx_v_offset); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_12ContractNode_5__lshift__(PyObject *__pyx_v_self, PyObject *__pyx_v_offset) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__lshift__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_7zipline_6assets_18continuous_futures_12ContractNode_4__lshift__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode *)__pyx_v_self), ((PyObject *)__pyx_v_offset));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_12ContractNode_4__lshift__(struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode *__pyx_v_self, PyObject *__pyx_v_offset) {
PyObject *__pyx_v_i = NULL;
PyObject *__pyx_v_curr = NULL;
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[62]))
__Pyx_TraceStartFunc("__lshift__", __pyx_f[0], 293, 0, 0, 0, __PYX_ERR(0, 293, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_L1_error:;
__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, 293, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.ContractNode.__lshift__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_i);
__Pyx_XDECREF(__pyx_v_curr);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_PyMonitoring_ExitScope(0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+294: i = 0
__Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
__pyx_v_i = __pyx_mstate_global->__pyx_int_0;
+295: curr = self
__Pyx_INCREF((PyObject *)__pyx_v_self);
__pyx_v_curr = ((PyObject *)__pyx_v_self);
+296: while i < offset and curr is not None:
while (1) {
__pyx_t_2 = PyObject_RichCompare(__pyx_v_i, __pyx_v_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 296, __pyx_L1_error)
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 296, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_3) {
} else {
__pyx_t_1 = __pyx_t_3;
goto __pyx_L5_bool_binop_done;
}
__pyx_t_3 = (__pyx_v_curr != Py_None);
__pyx_t_1 = __pyx_t_3;
__pyx_L5_bool_binop_done:;
if (!__pyx_t_1) break;
+297: curr = curr.prev
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_curr, __pyx_mstate_global->__pyx_n_u_prev); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 297, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF_SET(__pyx_v_curr, __pyx_t_2); __pyx_t_2 = 0;
+298: i += 1
__pyx_t_2 = __Pyx_PyLong_AddObjC(__pyx_v_i, __pyx_mstate_global->__pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_2); __pyx_t_2 = 0; }
+299: return curr
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_curr); __pyx_r = __pyx_v_curr; __Pyx_TraceReturnValue(__pyx_r, 18, 0, __PYX_ERR(0, 299, __pyx_L1_error)); goto __pyx_L0;
300:
301:
+302: cdef class OrderedContracts:
struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts {
PyObject_HEAD
struct __pyx_vtabstruct_7zipline_6assets_18continuous_futures_OrderedContracts *__pyx_vtab;
PyObject *root_symbol;
PyObject *_head_contract;
PyObject *sid_to_contract;
__pyx_t_5numpy_int64_t _start_date;
__pyx_t_5numpy_int64_t _end_date;
PyObject *chain_predicate;
};
/* … */
struct __pyx_vtabstruct_7zipline_6assets_18continuous_futures_OrderedContracts {
__pyx_t_5numpy_int64_t (*contract_before_auto_close)(struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *, __pyx_t_5numpy_int64_t, int __pyx_skip_dispatch);
PyObject *(*contract_at_offset)(struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *, __pyx_t_5numpy_int64_t, Py_ssize_t, __pyx_t_5numpy_int64_t, int __pyx_skip_dispatch);
__Pyx_memviewslice (*active_chain)(struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_7zipline_6assets_18continuous_futures_OrderedContracts *__pyx_vtabptr_7zipline_6assets_18continuous_futures_OrderedContracts;
303: """A container for aligned values of a future contract chain, in sorted order
304: of their occurrence.
305: Used to get answers about contracts in relation to their auto close
306: dates and start dates.
307:
308: Members
309: -------
310: root_symbol : str
311: The root symbol of the future contract chain.
312: contracts : deque
313: The contracts in the chain in order of occurrence.
314: start_dates : long[:]
315: The start dates of the contracts in the chain.
316: Corresponds by index with contract_sids.
317: auto_close_dates : long[:]
318: The auto close dates of the contracts in the chain.
319: Corresponds by index with contract_sids.
320: future_chain_predicates : dict
321: A dict mapping root symbol to a predicate function which accepts a contract
322: as a parameter and returns whether or not the contract should be included in the
323: chain.
324:
325: Instances of this class are used by the simulation engine, but not
326: exposed to the algorithm.
327: """
328:
+329: cdef readonly object root_symbol
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_11root_symbol_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_11root_symbol_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_6assets_18continuous_futures_16OrderedContracts_11root_symbol___get__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16OrderedContracts_11root_symbol___get__(struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[79]))
__Pyx_TraceStartFunc("__get__", __pyx_f[0], 329, 0, 0, 0, __PYX_ERR(0, 329, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->root_symbol);
__pyx_r = __pyx_v_self->root_symbol;
__Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 329, __pyx_L1_error));
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 329, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.OrderedContracts.root_symbol.__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;
}
+330: cdef readonly object _head_contract
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_14_head_contract_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_14_head_contract_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_6assets_18continuous_futures_16OrderedContracts_14_head_contract___get__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16OrderedContracts_14_head_contract___get__(struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[80]))
__Pyx_TraceStartFunc("__get__", __pyx_f[0], 330, 0, 0, 0, __PYX_ERR(0, 330, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->_head_contract);
__pyx_r = __pyx_v_self->_head_contract;
__Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 330, __pyx_L1_error));
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 330, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.OrderedContracts._head_contract.__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;
}
+331: cdef readonly dict sid_to_contract
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_15sid_to_contract_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_15sid_to_contract_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_6assets_18continuous_futures_16OrderedContracts_15sid_to_contract___get__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16OrderedContracts_15sid_to_contract___get__(struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[81]))
__Pyx_TraceStartFunc("__get__", __pyx_f[0], 331, 0, 0, 0, __PYX_ERR(0, 331, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->sid_to_contract);
__pyx_r = __pyx_v_self->sid_to_contract;
__Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 331, __pyx_L1_error));
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 331, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.OrderedContracts.sid_to_contract.__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;
}
+332: cdef readonly int64_t _start_date
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_11_start_date_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_11_start_date_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_6assets_18continuous_futures_16OrderedContracts_11_start_date___get__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16OrderedContracts_11_start_date___get__(struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[82]))
__Pyx_TraceStartFunc("__get__", __pyx_f[0], 332, 0, 0, 0, __PYX_ERR(0, 332, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyLong_From_npy_int64(__pyx_v_self->_start_date); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
__Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 332, __pyx_L1_error));
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 332, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.OrderedContracts._start_date.__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;
}
+333: cdef readonly int64_t _end_date
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_9_end_date_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_9_end_date_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_6assets_18continuous_futures_16OrderedContracts_9_end_date___get__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16OrderedContracts_9_end_date___get__(struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[83]))
__Pyx_TraceStartFunc("__get__", __pyx_f[0], 333, 0, 0, 0, __PYX_ERR(0, 333, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyLong_From_npy_int64(__pyx_v_self->_end_date); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
__Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 333, __pyx_L1_error));
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 333, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.OrderedContracts._end_date.__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;
}
+334: cdef readonly object chain_predicate
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_15chain_predicate_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_15chain_predicate_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_6assets_18continuous_futures_16OrderedContracts_15chain_predicate___get__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16OrderedContracts_15chain_predicate___get__(struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[84]))
__Pyx_TraceStartFunc("__get__", __pyx_f[0], 334, 0, 0, 0, __PYX_ERR(0, 334, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->chain_predicate);
__pyx_r = __pyx_v_self->chain_predicate;
__Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 334, __pyx_L1_error));
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 334, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.OrderedContracts.chain_predicate.__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;
}
335:
+336: def __init__(self, object root_symbol, object contracts, object chain_predicate=None):
/* Python wrapper */
static int __pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_root_symbol = 0;
PyObject *__pyx_v_contracts = 0;
PyObject *__pyx_v_chain_predicate = 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_root_symbol,&__pyx_mstate_global->__pyx_n_u_contracts,&__pyx_mstate_global->__pyx_n_u_chain_predicate,0};
PyObject* values[3] = {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, 336, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 3:
values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 336, __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, 336, __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, 336, __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, 336, __pyx_L3_error)
if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, i); __PYX_ERR(0, 336, __pyx_L3_error) }
}
} else {
switch (__pyx_nargs) {
case 3:
values[2] = __Pyx_ArgRef_VARARGS(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 336, __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, 336, __pyx_L3_error)
values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 336, __pyx_L3_error)
break;
default: goto __pyx_L5_argtuple_error;
}
if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));
}
__pyx_v_root_symbol = values[0];
__pyx_v_contracts = values[1];
__pyx_v_chain_predicate = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 336, __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.assets.continuous_futures.OrderedContracts.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_7zipline_6assets_18continuous_futures_16OrderedContracts___init__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *)__pyx_v_self), __pyx_v_root_symbol, __pyx_v_contracts, __pyx_v_chain_predicate);
/* 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_6assets_18continuous_futures_16OrderedContracts___init__(struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *__pyx_v_self, PyObject *__pyx_v_root_symbol, PyObject *__pyx_v_contracts, PyObject *__pyx_v_chain_predicate) {
struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode *__pyx_v_prev = NULL;
PyObject *__pyx_v_contract = NULL;
struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode *__pyx_v_curr = NULL;
int __pyx_r;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[73]))
__Pyx_TraceStartFunc("__init__", __pyx_f[0], 336, 0, 0, 0, __PYX_ERR(0, 336, __pyx_L1_error));
__Pyx_INCREF(__pyx_v_chain_predicate);
/* … */
/* function exit code */
__pyx_r = 0;
__Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 336, __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_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, 336, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.OrderedContracts.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_prev);
__Pyx_XDECREF(__pyx_v_contract);
__Pyx_XDECREF((PyObject *)__pyx_v_curr);
__Pyx_XDECREF(__pyx_v_chain_predicate);
__Pyx_PyMonitoring_ExitScope(0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
337:
+338: self.root_symbol = root_symbol
__Pyx_INCREF(__pyx_v_root_symbol); __Pyx_GIVEREF(__pyx_v_root_symbol); __Pyx_GOTREF(__pyx_v_self->root_symbol); __Pyx_DECREF(__pyx_v_self->root_symbol); __pyx_v_self->root_symbol = __pyx_v_root_symbol;
339:
+340: self.sid_to_contract = {}
__pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->sid_to_contract); __Pyx_DECREF(__pyx_v_self->sid_to_contract); __pyx_v_self->sid_to_contract = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
341:
+342: self._start_date = iinfo('int64').max
__pyx_t_2 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_iinfo); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 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_4 = 0; } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_u_int64}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (2-__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, 342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_max); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = __Pyx_PyLong_As_npy_int64(__pyx_t_3); if (unlikely((__pyx_t_5 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 342, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->_start_date = __pyx_t_5;
+343: self._end_date = 0
__pyx_v_self->_end_date = 0;
344:
+345: if chain_predicate is None:
__pyx_t_6 = (__pyx_v_chain_predicate == Py_None);
if (__pyx_t_6) {
/* … */
}
+346: chain_predicate = lambda x: True
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_8__init___lambda2(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_6assets_18continuous_futures_16OrderedContracts_8__init___lambda2 = {"lambda2", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_8__init___lambda2, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_8__init___lambda2(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
) {
CYTHON_UNUSED PyObject *__pyx_v_x = 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("lambda2 (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_x,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, 346, __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, 346, __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, "lambda2", 0) < (0)) __PYX_ERR(0, 346, __pyx_L3_error)
for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda2", 1, 1, 1, i); __PYX_ERR(0, 346, __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, 346, __pyx_L3_error)
}
__pyx_v_x = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("lambda2", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 346, __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.assets.continuous_futures.OrderedContracts.__init__.lambda2", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_lambda_funcdef_lambda2(__pyx_self, __pyx_v_x);
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_lambda_funcdef_lambda2(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_x) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[72]))
__Pyx_TraceStartFunc("lambda2", __pyx_f[0], 346, 0, 0, 0, __PYX_ERR(0, 346, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(Py_True);
__pyx_r = Py_True;
__Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 346, __pyx_L1_error));
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 346, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.OrderedContracts.__init__.lambda2", __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_3 = __Pyx_CyFunction_New(&__pyx_mdef_7zipline_6assets_18continuous_futures_16OrderedContracts_8__init___lambda2, 0, __pyx_mstate_global->__pyx_n_u_init___locals_lambda, NULL, __pyx_mstate_global->__pyx_n_u_zipline_assets_continuous_future, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[72])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF_SET(__pyx_v_chain_predicate, __pyx_t_3);
__pyx_t_3 = 0;
347:
+348: self._head_contract = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->_head_contract); __Pyx_DECREF(__pyx_v_self->_head_contract); __pyx_v_self->_head_contract = Py_None;
+349: prev = None
__Pyx_INCREF(Py_None);
__pyx_v_prev = ((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode *)Py_None);
+350: while contracts:
while (1) {
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_contracts); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 350, __pyx_L1_error)
if (!__pyx_t_6) break;
+351: contract = contracts.popleft()
__pyx_t_1 = __pyx_v_contracts;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = 0;
{
PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
__pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_popleft, __pyx_callargs+__pyx_t_4, (1-__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, 351, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
}
__Pyx_XDECREF_SET(__pyx_v_contract, __pyx_t_3);
__pyx_t_3 = 0;
352:
353: # It is possible that the first contract in our list has a start
354: # date on or after its auto close date. In that case the contract
355: # is not tradable, so do not include it in the chain.
+356: if prev is None and contract.start_date >= contract.auto_close_date:
__pyx_t_7 = (((PyObject *)__pyx_v_prev) == Py_None);
if (__pyx_t_7) {
} else {
__pyx_t_6 = __pyx_t_7;
goto __pyx_L7_bool_binop_done;
}
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_contract, __pyx_mstate_global->__pyx_n_u_start_date); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_contract, __pyx_mstate_global->__pyx_n_u_auto_close_date); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 356, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 356, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_6 = __pyx_t_7;
__pyx_L7_bool_binop_done:;
if (__pyx_t_6) {
/* … */
}
+357: continue
goto __pyx_L4_continue;
358:
+359: if not chain_predicate(contract):
__pyx_t_1 = NULL;
__Pyx_INCREF(__pyx_v_chain_predicate);
__pyx_t_3 = __pyx_v_chain_predicate;
__pyx_t_4 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
assert(__pyx_t_1);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_1);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
__pyx_t_4 = 0;
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_contract};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __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_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 359, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 359, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_7 = (!__pyx_t_6);
if (__pyx_t_7) {
/* … */
}
+360: continue
goto __pyx_L4_continue;
361:
+362: self._start_date = min(contract.start_date.value, self._start_date)
__pyx_t_5 = __pyx_v_self->_start_date;
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_contract, __pyx_mstate_global->__pyx_n_u_start_date); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 362, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 362, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_1 = __Pyx_PyLong_From_npy_int64(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 362, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_8 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 362, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 362, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
if (__pyx_t_7) {
__pyx_t_8 = __Pyx_PyLong_From_npy_int64(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 362, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_2 = __pyx_t_8;
__pyx_t_8 = 0;
} else {
__Pyx_INCREF(__pyx_t_3);
__pyx_t_2 = __pyx_t_3;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_5 = __Pyx_PyLong_As_npy_int64(__pyx_t_2); if (unlikely((__pyx_t_5 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 362, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_self->_start_date = __pyx_t_5;
+363: self._end_date = max(contract.end_date.value, self._end_date)
__pyx_t_5 = __pyx_v_self->_end_date;
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_contract, __pyx_mstate_global->__pyx_n_u_end_date); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 363, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 363, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_8 = __Pyx_PyLong_From_npy_int64(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 363, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_1 = PyObject_RichCompare(__pyx_t_8, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 363, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 363, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_7) {
__pyx_t_1 = __Pyx_PyLong_From_npy_int64(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 363, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_t_1;
__pyx_t_1 = 0;
} else {
__Pyx_INCREF(__pyx_t_3);
__pyx_t_2 = __pyx_t_3;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_5 = __Pyx_PyLong_As_npy_int64(__pyx_t_2); if (unlikely((__pyx_t_5 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 363, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_v_self->_end_date = __pyx_t_5;
364:
+365: curr = ContractNode(contract)
__pyx_t_3 = NULL;
__Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_7zipline_6assets_18continuous_futures_ContractNode);
__pyx_t_1 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_7zipline_6assets_18continuous_futures_ContractNode);
__pyx_t_4 = 1;
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_contract};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 365, __pyx_L1_error)
__Pyx_GOTREF((PyObject *)__pyx_t_2);
}
__Pyx_XDECREF_SET(__pyx_v_curr, ((struct __pyx_obj_7zipline_6assets_18continuous_futures_ContractNode *)__pyx_t_2));
__pyx_t_2 = 0;
+366: self.sid_to_contract[contract.sid] = curr
if (unlikely(__pyx_v_self->sid_to_contract == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
__PYX_ERR(0, 366, __pyx_L1_error)
}
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_contract, __pyx_mstate_global->__pyx_n_u_sid); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 366, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (unlikely((PyDict_SetItem(__pyx_v_self->sid_to_contract, __pyx_t_2, ((PyObject *)__pyx_v_curr)) < 0))) __PYX_ERR(0, 366, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+367: if self._head_contract is None:
__pyx_t_7 = (__pyx_v_self->_head_contract == Py_None);
if (__pyx_t_7) {
/* … */
}
+368: self._head_contract = curr
__Pyx_INCREF((PyObject *)__pyx_v_curr); __Pyx_GIVEREF((PyObject *)__pyx_v_curr); __Pyx_GOTREF(__pyx_v_self->_head_contract); __Pyx_DECREF(__pyx_v_self->_head_contract); __pyx_v_self->_head_contract = ((PyObject *)__pyx_v_curr);
+369: prev = curr
__Pyx_INCREF((PyObject *)__pyx_v_curr); __Pyx_DECREF_SET(__pyx_v_prev, __pyx_v_curr);
+370: continue
goto __pyx_L4_continue;
+371: curr.prev = prev
__Pyx_INCREF((PyObject *)__pyx_v_prev); __Pyx_GIVEREF((PyObject *)__pyx_v_prev); __Pyx_GOTREF(__pyx_v_curr->prev); __Pyx_DECREF(__pyx_v_curr->prev); __pyx_v_curr->prev = ((PyObject *)__pyx_v_prev);
+372: prev.next = curr
__Pyx_INCREF((PyObject *)__pyx_v_curr); __Pyx_GIVEREF((PyObject *)__pyx_v_curr); __Pyx_GOTREF(__pyx_v_prev->next); __Pyx_DECREF(__pyx_v_prev->next); __pyx_v_prev->next = ((PyObject *)__pyx_v_curr);
+373: prev = curr
__Pyx_INCREF((PyObject *)__pyx_v_curr); __Pyx_DECREF_SET(__pyx_v_prev, __pyx_v_curr); __pyx_L4_continue:; }
374:
+375: cpdef int64_t contract_before_auto_close(self, int64_t dt_value):
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_3contract_before_auto_close(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 __pyx_t_5numpy_int64_t __pyx_f_7zipline_6assets_18continuous_futures_16OrderedContracts_contract_before_auto_close(struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *__pyx_v_self, __pyx_t_5numpy_int64_t __pyx_v_dt_value, int __pyx_skip_dispatch) {
PyObject *__pyx_v_curr = NULL;
__pyx_t_5numpy_int64_t __pyx_r;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[74]))
__Pyx_TraceStartFunc("contract_before_auto_close", __pyx_f[0], 375, 0, 0, __pyx_skip_dispatch, __PYX_ERR(0, 375, __pyx_L1_error));
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_7zipline_6assets_18continuous_futures_OrderedContracts &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_contract_before_auto_close); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 375, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_3contract_before_auto_close)) {
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = __Pyx_PyLong_From_npy_int64(__pyx_v_dt_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 375, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_6 = 0;
}
#endif
{
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, 375, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_t_7 = __Pyx_PyLong_As_npy_int64(__pyx_t_2); if (unlikely((__pyx_t_7 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 375, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_7;
__Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_npy_int64, 0, 0, __PYX_ERR(0, 375, __pyx_L1_error));
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* 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, 375, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.OrderedContracts.contract_before_auto_close", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_curr);
__Pyx_PyMonitoring_ExitScope(0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_3contract_before_auto_close(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_6assets_18continuous_futures_16OrderedContracts_2contract_before_auto_close, "OrderedContracts.contract_before_auto_close(self, int64_t dt_value) -> int64_t\n\nGet the contract with next upcoming auto close date.");
static PyMethodDef __pyx_mdef_7zipline_6assets_18continuous_futures_16OrderedContracts_3contract_before_auto_close = {"contract_before_auto_close", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_3contract_before_auto_close, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7zipline_6assets_18continuous_futures_16OrderedContracts_2contract_before_auto_close};
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_3contract_before_auto_close(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
) {
__pyx_t_5numpy_int64_t __pyx_v_dt_value;
#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("contract_before_auto_close (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_SIZE
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_dt_value,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, 375, __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, 375, __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, "contract_before_auto_close", 0) < (0)) __PYX_ERR(0, 375, __pyx_L3_error)
for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("contract_before_auto_close", 1, 1, 1, i); __PYX_ERR(0, 375, __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, 375, __pyx_L3_error)
}
__pyx_v_dt_value = __Pyx_PyLong_As_npy_int64(values[0]); if (unlikely((__pyx_v_dt_value == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 375, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("contract_before_auto_close", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 375, __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.assets.continuous_futures.OrderedContracts.contract_before_auto_close", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_7zipline_6assets_18continuous_futures_16OrderedContracts_2contract_before_auto_close(((struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *)__pyx_v_self), __pyx_v_dt_value);
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_6assets_18continuous_futures_16OrderedContracts_2contract_before_auto_close(struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *__pyx_v_self, __pyx_t_5numpy_int64_t __pyx_v_dt_value) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[74]))
__Pyx_TraceStartFunc("contract_before_auto_close (wrapper)", __pyx_f[0], 375, 0, 0, 0, __PYX_ERR(0, 375, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_7zipline_6assets_18continuous_futures_16OrderedContracts_contract_before_auto_close(__pyx_v_self, __pyx_v_dt_value, 1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 375, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyLong_From_npy_int64(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 375, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__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, 375, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.OrderedContracts.contract_before_auto_close", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_PyMonitoring_ExitScope(0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7zipline_6assets_18continuous_futures_16OrderedContracts_3contract_before_auto_close, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_OrderedContracts_contract_before, NULL, __pyx_mstate_global->__pyx_n_u_zipline_assets_continuous_future, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[74])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 375, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7zipline_6assets_18continuous_futures_OrderedContracts, __pyx_mstate_global->__pyx_n_u_contract_before_auto_close, __pyx_t_5) < (0)) __PYX_ERR(0, 375, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
376: """Get the contract with next upcoming auto close date."""
+377: curr = self._head_contract
__pyx_t_1 = __pyx_v_self->_head_contract;
__Pyx_INCREF(__pyx_t_1);
__pyx_v_curr = __pyx_t_1;
__pyx_t_1 = 0;
+378: while curr.next is not None:
while (1) {
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_curr, __pyx_mstate_global->__pyx_n_u_next); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_8 = (__pyx_t_1 != Py_None);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (!__pyx_t_8) break;
+379: if curr.contract.auto_close_date.value > dt_value:
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_curr, __pyx_mstate_global->__pyx_n_u_contract); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 379, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_auto_close_date); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 379, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 379, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyLong_From_npy_int64(__pyx_v_dt_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 379, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 379, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 379, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_8) { /* … */ }
+380: break
goto __pyx_L4_break;
+381: curr = curr.next
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_curr, __pyx_mstate_global->__pyx_n_u_next); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF_SET(__pyx_v_curr, __pyx_t_4); __pyx_t_4 = 0; } __pyx_L4_break:;
+382: return curr.contract.sid
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_curr, __pyx_mstate_global->__pyx_n_u_contract); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 382, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_sid); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 382, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_7 = __Pyx_PyLong_As_npy_int64(__pyx_t_2); if (unlikely((__pyx_t_7 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 382, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_7; __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_npy_int64, 20, 0, __PYX_ERR(0, 382, __pyx_L1_error)); goto __pyx_L0;
383:
+384: cpdef contract_at_offset(self, int64_t sid, Py_ssize_t offset, int64_t start_cap):
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_5contract_at_offset(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 PyObject *__pyx_f_7zipline_6assets_18continuous_futures_16OrderedContracts_contract_at_offset(struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *__pyx_v_self, __pyx_t_5numpy_int64_t __pyx_v_sid, Py_ssize_t __pyx_v_offset, __pyx_t_5numpy_int64_t __pyx_v_start_cap, int __pyx_skip_dispatch) {
Py_ssize_t __pyx_v_i;
PyObject *__pyx_v_curr = NULL;
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[75]))
__Pyx_TraceStartFunc("contract_at_offset", __pyx_f[0], 384, 0, 0, __pyx_skip_dispatch, __PYX_ERR(0, 384, __pyx_L1_error));
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_7zipline_6assets_18continuous_futures_OrderedContracts &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_contract_at_offset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 384, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_5contract_at_offset)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = __Pyx_PyLong_From_npy_int64(__pyx_v_sid); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 384, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = PyLong_FromSsize_t(__pyx_v_offset); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 384, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_7 = __Pyx_PyLong_From_npy_int64(__pyx_v_start_cap); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 384, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_8 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_8 = 0;
}
#endif
{
PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_t_5, __pyx_t_6, __pyx_t_7};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_8, (4-__pyx_t_8) | (__pyx_t_8*__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_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 384, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 384, __pyx_L1_error));
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* 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_7);
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 384, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.OrderedContracts.contract_at_offset", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_curr);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_PyMonitoring_ExitScope(0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_5contract_at_offset(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_6assets_18continuous_futures_16OrderedContracts_4contract_at_offset, "OrderedContracts.contract_at_offset(self, int64_t sid, Py_ssize_t offset, int64_t start_cap)\n\nGet the sid which is the given sid plus the offset distance.\nAn offset of 0 should be reflexive.");
static PyMethodDef __pyx_mdef_7zipline_6assets_18continuous_futures_16OrderedContracts_5contract_at_offset = {"contract_at_offset", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_5contract_at_offset, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7zipline_6assets_18continuous_futures_16OrderedContracts_4contract_at_offset};
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_5contract_at_offset(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
) {
__pyx_t_5numpy_int64_t __pyx_v_sid;
Py_ssize_t __pyx_v_offset;
__pyx_t_5numpy_int64_t __pyx_v_start_cap;
#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("contract_at_offset (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_sid,&__pyx_mstate_global->__pyx_n_u_offset,&__pyx_mstate_global->__pyx_n_u_start_cap,0};
PyObject* values[3] = {0,0,0};
const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 384, __pyx_L3_error)
if (__pyx_kwds_len > 0) {
switch (__pyx_nargs) {
case 3:
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 384, __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, 384, __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, 384, __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, "contract_at_offset", 0) < (0)) __PYX_ERR(0, 384, __pyx_L3_error)
for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("contract_at_offset", 1, 3, 3, i); __PYX_ERR(0, 384, __pyx_L3_error) }
}
} else if (unlikely(__pyx_nargs != 3)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 384, __pyx_L3_error)
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 384, __pyx_L3_error)
values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 384, __pyx_L3_error)
}
__pyx_v_sid = __Pyx_PyLong_As_npy_int64(values[0]); if (unlikely((__pyx_v_sid == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 384, __pyx_L3_error)
__pyx_v_offset = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_offset == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 384, __pyx_L3_error)
__pyx_v_start_cap = __Pyx_PyLong_As_npy_int64(values[2]); if (unlikely((__pyx_v_start_cap == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 384, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("contract_at_offset", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 384, __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.assets.continuous_futures.OrderedContracts.contract_at_offset", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_7zipline_6assets_18continuous_futures_16OrderedContracts_4contract_at_offset(((struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *)__pyx_v_self), __pyx_v_sid, __pyx_v_offset, __pyx_v_start_cap);
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_6assets_18continuous_futures_16OrderedContracts_4contract_at_offset(struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *__pyx_v_self, __pyx_t_5numpy_int64_t __pyx_v_sid, Py_ssize_t __pyx_v_offset, __pyx_t_5numpy_int64_t __pyx_v_start_cap) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[75]))
__Pyx_TraceStartFunc("contract_at_offset (wrapper)", __pyx_f[0], 384, 0, 0, 0, __PYX_ERR(0, 384, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_7zipline_6assets_18continuous_futures_16OrderedContracts_contract_at_offset(__pyx_v_self, __pyx_v_sid, __pyx_v_offset, __pyx_v_start_cap, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 384, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 384, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.OrderedContracts.contract_at_offset", __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_5 = __Pyx_CyFunction_New(&__pyx_mdef_7zipline_6assets_18continuous_futures_16OrderedContracts_5contract_at_offset, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_OrderedContracts_contract_at_off, NULL, __pyx_mstate_global->__pyx_n_u_zipline_assets_continuous_future, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[75])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 384, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7zipline_6assets_18continuous_futures_OrderedContracts, __pyx_mstate_global->__pyx_n_u_contract_at_offset, __pyx_t_5) < (0)) __PYX_ERR(0, 384, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
385: """Get the sid which is the given sid plus the offset distance.
386: An offset of 0 should be reflexive.
387: """
388: cdef Py_ssize_t i
+389: curr = self.sid_to_contract[sid]
if (unlikely(__pyx_v_self->sid_to_contract == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
__PYX_ERR(0, 389, __pyx_L1_error)
}
__pyx_t_1 = __Pyx_PyLong_From_npy_int64(__pyx_v_sid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 389, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_self->sid_to_contract, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 389, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_curr = __pyx_t_2;
__pyx_t_2 = 0;
+390: i = 0
__pyx_v_i = 0;
+391: while i < offset:
while (1) {
__pyx_t_9 = (__pyx_v_i < __pyx_v_offset);
if (!__pyx_t_9) break;
+392: if curr.next is None:
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_curr, __pyx_mstate_global->__pyx_n_u_next); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 392, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_9 = (__pyx_t_2 == Py_None); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_9) { /* … */ }
+393: return None
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_TraceReturnValue(__pyx_r, 17, 0, __PYX_ERR(0, 393, __pyx_L1_error)); goto __pyx_L0;
+394: curr = curr.next
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_curr, __pyx_mstate_global->__pyx_n_u_next); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 394, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF_SET(__pyx_v_curr, __pyx_t_2); __pyx_t_2 = 0;
+395: i += 1
__pyx_v_i = (__pyx_v_i + 1); }
+396: if curr.contract.start_date.value <= start_cap:
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_curr, __pyx_mstate_global->__pyx_n_u_contract); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 396, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_start_date); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 396, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 396, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyLong_From_npy_int64(__pyx_v_start_cap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 396, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 396, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 396, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_9) { /* … */ }
+397: return curr.contract.sid
__Pyx_XDECREF(__pyx_r); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_curr, __pyx_mstate_global->__pyx_n_u_contract); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 397, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_sid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 397, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; __Pyx_TraceReturnValue(__pyx_r, 31, 0, __PYX_ERR(0, 397, __pyx_L1_error)); goto __pyx_L0;
398: else:
+399: return None
/*else*/ {
__Pyx_XDECREF(__pyx_r);
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
__Pyx_TraceReturnValue(__pyx_r, 35, 0, __PYX_ERR(0, 399, __pyx_L1_error));
goto __pyx_L0;
}
400:
+401: cpdef int64_t[:] active_chain(self, int64_t starting_sid, int64_t dt_value):
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_7active_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 __Pyx_memviewslice __pyx_f_7zipline_6assets_18continuous_futures_16OrderedContracts_active_chain(struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *__pyx_v_self, __pyx_t_5numpy_int64_t __pyx_v_starting_sid, __pyx_t_5numpy_int64_t __pyx_v_dt_value, int __pyx_skip_dispatch) {
PyObject *__pyx_v_curr = NULL;
PyObject *__pyx_v_contracts = 0;
__Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[76]))
__Pyx_TraceStartFunc("active_chain", __pyx_f[0], 401, 0, 0, __pyx_skip_dispatch, __PYX_ERR(0, 401, __pyx_L1_error));
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (
#if !CYTHON_USE_TYPE_SLOTS
unlikely(Py_TYPE(((PyObject *)__pyx_v_self)) != __pyx_mstate_global->__pyx_ptype_7zipline_6assets_18continuous_futures_OrderedContracts &&
__Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), Py_TPFLAGS_HAVE_GC))
#else
unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0 || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))
#endif
) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_active_chain); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 401, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_7active_chain)) {
__pyx_t_3 = NULL;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1;
__pyx_t_5 = __Pyx_PyLong_From_npy_int64(__pyx_v_starting_sid); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 401, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = __Pyx_PyLong_From_npy_int64(__pyx_v_dt_value); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 401, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_7 = 1;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
assert(__pyx_t_3);
PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx__function);
__Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
__pyx_t_7 = 0;
}
#endif
{
PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_5, __pyx_t_6};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_7, (3-__pyx_t_7) | (__pyx_t_7*__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_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 401, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
}
__pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int64_t(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 401, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = __pyx_t_8;
__pyx_t_8.memview = NULL;
__pyx_t_8.data = NULL;
__Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 401, __pyx_L1_error));
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* 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_XCLEAR_MEMVIEW(&__pyx_t_8, 1);
__pyx_r.data = NULL;
__pyx_r.memview = NULL;
__Pyx_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 401, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.OrderedContracts.active_chain", __pyx_clineno, __pyx_lineno, __pyx_filename);
goto __pyx_L2;
__pyx_L0:;
if (unlikely(!__pyx_r.memview)) {
PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
}
__pyx_L2:;
__Pyx_XDECREF(__pyx_v_curr);
__Pyx_XDECREF(__pyx_v_contracts);
__Pyx_PyMonitoring_ExitScope(0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_7active_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*/
PyDoc_STRVAR(__pyx_doc_7zipline_6assets_18continuous_futures_16OrderedContracts_6active_chain, "OrderedContracts.active_chain(self, int64_t starting_sid, int64_t dt_value) -> int64_t[:]");
static PyMethodDef __pyx_mdef_7zipline_6assets_18continuous_futures_16OrderedContracts_7active_chain = {"active_chain", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_7active_chain, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_7zipline_6assets_18continuous_futures_16OrderedContracts_6active_chain};
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_7active_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
) {
__pyx_t_5numpy_int64_t __pyx_v_starting_sid;
__pyx_t_5numpy_int64_t __pyx_v_dt_value;
#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("active_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_starting_sid,&__pyx_mstate_global->__pyx_n_u_dt_value,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, 401, __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, 401, __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, 401, __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, "active_chain", 0) < (0)) __PYX_ERR(0, 401, __pyx_L3_error)
for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("active_chain", 1, 2, 2, i); __PYX_ERR(0, 401, __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, 401, __pyx_L3_error)
values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 401, __pyx_L3_error)
}
__pyx_v_starting_sid = __Pyx_PyLong_As_npy_int64(values[0]); if (unlikely((__pyx_v_starting_sid == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 401, __pyx_L3_error)
__pyx_v_dt_value = __Pyx_PyLong_As_npy_int64(values[1]); if (unlikely((__pyx_v_dt_value == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 401, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("active_chain", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 401, __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.assets.continuous_futures.OrderedContracts.active_chain", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_7zipline_6assets_18continuous_futures_16OrderedContracts_6active_chain(((struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *)__pyx_v_self), __pyx_v_starting_sid, __pyx_v_dt_value);
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_6assets_18continuous_futures_16OrderedContracts_6active_chain(struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *__pyx_v_self, __pyx_t_5numpy_int64_t __pyx_v_starting_sid, __pyx_t_5numpy_int64_t __pyx_v_dt_value) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[76]))
__Pyx_TraceStartFunc("active_chain (wrapper)", __pyx_f[0], 401, 0, 0, 0, __PYX_ERR(0, 401, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_7zipline_6assets_18continuous_futures_16OrderedContracts_active_chain(__pyx_v_self, __pyx_v_starting_sid, __pyx_v_dt_value, 1); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 401, __pyx_L1_error)
__pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_1, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_int64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_int64_t, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 401, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
__pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 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, 401, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.OrderedContracts.active_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_5 = __Pyx_CyFunction_New(&__pyx_mdef_7zipline_6assets_18continuous_futures_16OrderedContracts_7active_chain, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_OrderedContracts_active_chain, NULL, __pyx_mstate_global->__pyx_n_u_zipline_assets_continuous_future, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[76])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 401, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_7zipline_6assets_18continuous_futures_OrderedContracts, __pyx_mstate_global->__pyx_n_u_active_chain, __pyx_t_5) < (0)) __PYX_ERR(0, 401, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+402: curr = self.sid_to_contract[starting_sid]
if (unlikely(__pyx_v_self->sid_to_contract == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
__PYX_ERR(0, 402, __pyx_L1_error)
}
__pyx_t_1 = __Pyx_PyLong_From_npy_int64(__pyx_v_starting_sid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 402, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_self->sid_to_contract, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 402, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_curr = __pyx_t_2;
__pyx_t_2 = 0;
+403: cdef list contracts = []
__pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 403, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_contracts = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0;
404:
+405: while curr is not None:
while (1) {
__pyx_t_9 = (__pyx_v_curr != Py_None);
if (!__pyx_t_9) break;
+406: if curr.contract.start_date.value <= dt_value:
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_curr, __pyx_mstate_global->__pyx_n_u_contract); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 406, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_start_date); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 406, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 406, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyLong_From_npy_int64(__pyx_v_dt_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 406, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 406, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 406, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_9) { /* … */ }
+407: contracts.append(curr.contract.sid)
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_curr, __pyx_mstate_global->__pyx_n_u_contract); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 407, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_sid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_contracts, __pyx_t_1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 407, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+408: curr = curr.next
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_curr, __pyx_mstate_global->__pyx_n_u_next); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 408, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF_SET(__pyx_v_curr, __pyx_t_1); __pyx_t_1 = 0; }
409:
+410: return array(contracts, dtype='int64')
__pyx_t_4 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); assert(__pyx_t_4); PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(__pyx__function); __Pyx_DECREF_SET(__pyx_t_2, __pyx__function); __pyx_t_7 = 0; } #endif { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_v_contracts}; __pyx_t_6 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_dtype, __pyx_mstate_global->__pyx_n_u_int64, __pyx_t_6, __pyx_callargs+2, 0) < (0)) __PYX_ERR(0, 410, __pyx_L1_error) __pyx_t_1 = __Pyx_Object_Vectorcall_CallFromBuilder(__pyx_t_2, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_6); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int64_t(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_8; __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL; __Pyx_TraceReturnValue(Py_None, 28, 0, __PYX_ERR(0, 410, __pyx_L1_error)); goto __pyx_L0;
411:
412: property start_date:
+413: def __get__(self):
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_10start_date_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_10start_date_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_6assets_18continuous_futures_16OrderedContracts_10start_date___get__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16OrderedContracts_10start_date___get__(struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[77]))
__Pyx_TraceStartFunc("__get__", __pyx_f[0], 413, 0, 0, 0, __PYX_ERR(0, 413, __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_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 413, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.OrderedContracts.start_date.__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;
}
+414: return Timestamp(self._start_date)
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Timestamp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyLong_From_npy_int64(__pyx_v_self->_start_date); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 414, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); assert(__pyx_t_2); PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx__function); __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); __pyx_t_5 = 0; } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 414, __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, 414, __pyx_L1_error)); goto __pyx_L0;
415:
416: property end_date:
+417: def __get__(self):
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_8end_date_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_18continuous_futures_16OrderedContracts_8end_date_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_6assets_18continuous_futures_16OrderedContracts_8end_date___get__(((struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_18continuous_futures_16OrderedContracts_8end_date___get__(struct __pyx_obj_7zipline_6assets_18continuous_futures_OrderedContracts *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarationsFunc
__Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[78]))
__Pyx_TraceStartFunc("__get__", __pyx_f[0], 417, 0, 0, 0, __PYX_ERR(0, 417, __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_TraceException(__pyx_lineno, 0, 0);
#if CYTHON_USE_SYS_MONITORING
__Pyx_TraceExceptionUnwind(0, 0);
#else
__Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 417, __pyx_L1_error));
#endif
__Pyx_AddTraceback("zipline.assets.continuous_futures.OrderedContracts.end_date.__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;
}
+418: return Timestamp(self._end_date)
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Timestamp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 418, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyLong_From_npy_int64(__pyx_v_self->_end_date); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 418, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); assert(__pyx_t_2); PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx__function); __Pyx_DECREF_SET(__pyx_t_3, __pyx__function); __pyx_t_5 = 0; } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 418, __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, 418, __pyx_L1_error)); goto __pyx_L0;