Generated by Cython 0.29.36
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: _assets.c
+001: # cython: embedsignature=True
__pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
002: #
003: # Copyright 2015 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: """
018: Cythonized Asset object.
019: """
020: cimport cython
021: from cpython.number cimport PyNumber_Index
022: from cpython.object cimport (
023: Py_EQ,
024: Py_NE,
025: Py_GE,
026: Py_LE,
027: Py_GT,
028: Py_LT,
029: )
030: from cpython cimport bool
031:
+032: import numpy as np
__pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
033: from numpy cimport int64_t
+034: import warnings
__pyx_t_1 = __Pyx_Import(__pyx_n_s_warnings, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_warnings, __pyx_t_1) < 0) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
035: cimport numpy as np
036:
+037: from zipline.utils.calendar_utils import get_calendar
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_get_calendar); __Pyx_GIVEREF(__pyx_n_s_get_calendar); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_get_calendar); __pyx_t_2 = __Pyx_Import(__pyx_n_s_zipline_utils_calendar_utils, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_get_calendar); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_calendar, __pyx_t_1) < 0) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
038:
039:
040: # Users don't construct instances of this object, and embedding the signature
041: # in the docstring seems to confuse Sphinx, so disable it for now.
042: @cython.embedsignature(False)
+043: cdef class Asset:
struct __pyx_vtabstruct_7zipline_6assets_7_assets_Asset {
PyObject *(*__pyx___reduce__)(struct __pyx_obj_7zipline_6assets_7_assets_Asset *, int __pyx_skip_dispatch);
PyObject *(*to_dict)(struct __pyx_obj_7zipline_6assets_7_assets_Asset *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_7zipline_6assets_7_assets_Asset *__pyx_vtabptr_7zipline_6assets_7_assets_Asset;
044: """
045: Base class for entities that can be owned by a trading algorithm.
046:
047: Attributes
048: ----------
049: sid : int
050: Persistent unique identifier assigned to the asset.
051: symbol : str
052: Most recent ticker under which the asset traded. This field can change
053: without warning if the asset changes tickers. Use ``sid`` if you need a
054: persistent identifier.
055: asset_name : str
056: Full name of the asset.
057: exchange : str
058: Canonical short name of the exchange on which the asset trades (e.g.,
059: 'NYSE').
060: exchange_full : str
061: Full name of the exchange on which the asset trades (e.g., 'NEW YORK
062: STOCK EXCHANGE').
063: exchange_info : zipline.assets.ExchangeInfo
064: Information about the exchange this asset is listed on.
065: country_code : str
066: Two character code indicating the country in which the asset trades.
067: start_date : pd.Timestamp
068: Date on which the asset first traded.
069: end_date : pd.Timestamp
070: Last date on which the asset traded. On Quantopian, this value is set
071: to the current (real time) date for assets that are still trading.
072: tick_size : float
073: Minimum amount that the price can change for this asset.
074: auto_close_date : pd.Timestamp
075: Date on which positions in this asset will be automatically liquidated
076: to cash during a simulation. By default, this is three days after
077: ``end_date``.
078: """
079:
+080: _kwargnames = frozenset({
__pyx_t_2 = PySet_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PySet_Add(__pyx_t_2, __pyx_n_u_sid) < 0) __PYX_ERR(0, 81, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_u_symbol) < 0) __PYX_ERR(0, 81, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_u_asset_name) < 0) __PYX_ERR(0, 81, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_u_start_date) < 0) __PYX_ERR(0, 81, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_u_end_date) < 0) __PYX_ERR(0, 81, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_u_first_traded) < 0) __PYX_ERR(0, 81, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_u_auto_close_date) < 0) __PYX_ERR(0, 81, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_u_tick_size) < 0) __PYX_ERR(0, 81, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_u_multiplier) < 0) __PYX_ERR(0, 81, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_u_exchange_info) < 0) __PYX_ERR(0, 81, __pyx_L1_error) __pyx_t_1 = __Pyx_PyFrozenSet_New(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_7zipline_6assets_7_assets_Asset->tp_dict, __pyx_n_s_kwargnames, __pyx_t_1) < 0) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_7zipline_6assets_7_assets_Asset);
081: 'sid',
082: 'symbol',
083: 'asset_name',
084: 'start_date',
085: 'end_date',
086: 'first_traded',
087: 'auto_close_date',
088: 'tick_size',
089: 'multiplier',
090: 'exchange_info',
091: })
092:
+093: def __init__(self,
/* Python wrapper */
static int __pyx_pw_7zipline_6assets_7_assets_5Asset_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7zipline_6assets_7_assets_5Asset_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
__pyx_t_5numpy_int64_t __pyx_v_sid;
PyObject *__pyx_v_exchange_info = 0;
PyObject *__pyx_v_symbol = 0;
PyObject *__pyx_v_asset_name = 0;
PyObject *__pyx_v_start_date = 0;
PyObject *__pyx_v_end_date = 0;
PyObject *__pyx_v_first_traded = 0;
PyObject *__pyx_v_auto_close_date = 0;
PyObject *__pyx_v_tick_size = 0;
float __pyx_v_multiplier;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sid,&__pyx_n_s_exchange_info,&__pyx_n_s_symbol,&__pyx_n_s_asset_name,&__pyx_n_s_start_date,&__pyx_n_s_end_date,&__pyx_n_s_first_traded,&__pyx_n_s_auto_close_date,&__pyx_n_s_tick_size,&__pyx_n_s_multiplier,0};
PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
values[2] = ((PyObject *)__pyx_kp_u_);
values[3] = ((PyObject *)__pyx_kp_u_);
/* … */
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_7zipline_6assets_7_assets_5Asset___init__(struct __pyx_obj_7zipline_6assets_7_assets_Asset *__pyx_v_self, __pyx_t_5numpy_int64_t __pyx_v_sid, PyObject *__pyx_v_exchange_info, PyObject *__pyx_v_symbol, PyObject *__pyx_v_asset_name, PyObject *__pyx_v_start_date, PyObject *__pyx_v_end_date, PyObject *__pyx_v_first_traded, PyObject *__pyx_v_auto_close_date, PyObject *__pyx_v_tick_size, float __pyx_v_multiplier) {
int __pyx_r;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__", 0);
__Pyx_TraceCall("__init__", __pyx_f[0], 93, 0, __PYX_ERR(0, 93, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("zipline.assets._assets.Asset.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_TraceReturn(Py_None, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
094: int64_t sid, # sid is required
095: object exchange_info, # exchange is required
096: object symbol="",
097: object asset_name="",
+098: object start_date=None,
values[4] = ((PyObject *)Py_None);
+099: object end_date=None,
values[5] = ((PyObject *)Py_None);
+100: object first_traded=None,
values[6] = ((PyObject *)Py_None);
+101: object auto_close_date=None,
values[7] = ((PyObject *)Py_None);
values[8] = ((PyObject *)__pyx_float_0_01);
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
CYTHON_FALLTHROUGH;
case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
CYTHON_FALLTHROUGH;
case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
CYTHON_FALLTHROUGH;
case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
CYTHON_FALLTHROUGH;
case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
CYTHON_FALLTHROUGH;
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sid)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exchange_info)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 10, 1); __PYX_ERR(0, 93, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_symbol);
if (value) { values[2] = value; kw_args--; }
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_asset_name);
if (value) { values[3] = value; kw_args--; }
}
CYTHON_FALLTHROUGH;
case 4:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start_date);
if (value) { values[4] = value; kw_args--; }
}
CYTHON_FALLTHROUGH;
case 5:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_end_date);
if (value) { values[5] = value; kw_args--; }
}
CYTHON_FALLTHROUGH;
case 6:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_first_traded);
if (value) { values[6] = value; kw_args--; }
}
CYTHON_FALLTHROUGH;
case 7:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_auto_close_date);
if (value) { values[7] = value; kw_args--; }
}
CYTHON_FALLTHROUGH;
case 8:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tick_size);
if (value) { values[8] = value; kw_args--; }
}
CYTHON_FALLTHROUGH;
case 9:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_multiplier);
if (value) { values[9] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 93, __pyx_L3_error)
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
CYTHON_FALLTHROUGH;
case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
CYTHON_FALLTHROUGH;
case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
CYTHON_FALLTHROUGH;
case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
CYTHON_FALLTHROUGH;
case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
CYTHON_FALLTHROUGH;
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_sid = __Pyx_PyInt_As_npy_int64(values[0]); if (unlikely((__pyx_v_sid == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 94, __pyx_L3_error)
__pyx_v_exchange_info = values[1];
__pyx_v_symbol = values[2];
__pyx_v_asset_name = values[3];
__pyx_v_start_date = values[4];
__pyx_v_end_date = values[5];
__pyx_v_first_traded = values[6];
__pyx_v_auto_close_date = values[7];
__pyx_v_tick_size = values[8];
if (values[9]) {
__pyx_v_multiplier = __pyx_PyFloat_AsFloat(values[9]); if (unlikely((__pyx_v_multiplier == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 103, __pyx_L3_error)
} else {
__pyx_v_multiplier = ((float)1.0);
}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 93, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("zipline.assets._assets.Asset.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_7zipline_6assets_7_assets_5Asset___init__(((struct __pyx_obj_7zipline_6assets_7_assets_Asset *)__pyx_v_self), __pyx_v_sid, __pyx_v_exchange_info, __pyx_v_symbol, __pyx_v_asset_name, __pyx_v_start_date, __pyx_v_end_date, __pyx_v_first_traded, __pyx_v_auto_close_date, __pyx_v_tick_size, __pyx_v_multiplier);
102: object tick_size=0.01,
103: float multiplier=1.0):
104:
+105: self.sid = sid
__pyx_v_self->sid = __pyx_v_sid;
+106: self.symbol = symbol
__Pyx_INCREF(__pyx_v_symbol); __Pyx_GIVEREF(__pyx_v_symbol); __Pyx_GOTREF(__pyx_v_self->symbol); __Pyx_DECREF(__pyx_v_self->symbol); __pyx_v_self->symbol = __pyx_v_symbol;
+107: self.asset_name = asset_name
__Pyx_INCREF(__pyx_v_asset_name); __Pyx_GIVEREF(__pyx_v_asset_name); __Pyx_GOTREF(__pyx_v_self->asset_name); __Pyx_DECREF(__pyx_v_self->asset_name); __pyx_v_self->asset_name = __pyx_v_asset_name;
+108: 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;
+109: 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;
+110: 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;
+111: self.first_traded = first_traded
__Pyx_INCREF(__pyx_v_first_traded); __Pyx_GIVEREF(__pyx_v_first_traded); __Pyx_GOTREF(__pyx_v_self->first_traded); __Pyx_DECREF(__pyx_v_self->first_traded); __pyx_v_self->first_traded = __pyx_v_first_traded;
+112: self.auto_close_date = auto_close_date
__Pyx_INCREF(__pyx_v_auto_close_date); __Pyx_GIVEREF(__pyx_v_auto_close_date); __Pyx_GOTREF(__pyx_v_self->auto_close_date); __Pyx_DECREF(__pyx_v_self->auto_close_date); __pyx_v_self->auto_close_date = __pyx_v_auto_close_date;
+113: self.tick_size = tick_size
__Pyx_INCREF(__pyx_v_tick_size); __Pyx_GIVEREF(__pyx_v_tick_size); __Pyx_GOTREF(__pyx_v_self->tick_size); __Pyx_DECREF(__pyx_v_self->tick_size); __pyx_v_self->tick_size = __pyx_v_tick_size;
+114: self.price_multiplier = multiplier
__pyx_v_self->price_multiplier = __pyx_v_multiplier;
115:
116: @property
+117: def exchange(self):
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_8exchange_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_8exchange_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_7zipline_6assets_7_assets_5Asset_8exchange___get__(((struct __pyx_obj_7zipline_6assets_7_assets_Asset *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_7_assets_5Asset_8exchange___get__(struct __pyx_obj_7zipline_6assets_7_assets_Asset *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_TraceCall("__get__", __pyx_f[0], 117, 0, __PYX_ERR(0, 117, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("zipline.assets._assets.Asset.exchange.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+118: return self.exchange_info.canonical_name
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->exchange_info, __pyx_n_s_canonical_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
119:
120: @property
+121: def exchange_full(self):
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_13exchange_full_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_13exchange_full_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_7zipline_6assets_7_assets_5Asset_13exchange_full___get__(((struct __pyx_obj_7zipline_6assets_7_assets_Asset *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_7_assets_5Asset_13exchange_full___get__(struct __pyx_obj_7zipline_6assets_7_assets_Asset *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_TraceCall("__get__", __pyx_f[0], 121, 0, __PYX_ERR(0, 121, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("zipline.assets._assets.Asset.exchange_full.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+122: return self.exchange_info.name
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->exchange_info, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
123:
124: @property
+125: def country_code(self):
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_12country_code_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_12country_code_1__get__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_pf_7zipline_6assets_7_assets_5Asset_12country_code___get__(((struct __pyx_obj_7zipline_6assets_7_assets_Asset *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_7_assets_5Asset_12country_code___get__(struct __pyx_obj_7zipline_6assets_7_assets_Asset *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
__Pyx_TraceCall("__get__", __pyx_f[0], 125, 0, __PYX_ERR(0, 125, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("zipline.assets._assets.Asset.country_code.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+126: return self.exchange_info.country_code
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->exchange_info, __pyx_n_s_country_code); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
127:
+128: def __int__(self):
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_3__int__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_3__int__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__int__ (wrapper)", 0);
__pyx_r = __pyx_pf_7zipline_6assets_7_assets_5Asset_2__int__(((struct __pyx_obj_7zipline_6assets_7_assets_Asset *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_7_assets_5Asset_2__int__(struct __pyx_obj_7zipline_6assets_7_assets_Asset *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__int__", 0);
__Pyx_TraceCall("__int__", __pyx_f[0], 128, 0, __PYX_ERR(0, 128, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("zipline.assets._assets.Asset.__int__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+129: return self.sid
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_npy_int64(__pyx_v_self->sid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
130:
+131: def __index__(self):
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_5__index__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_5__index__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__index__ (wrapper)", 0);
__pyx_r = __pyx_pf_7zipline_6assets_7_assets_5Asset_4__index__(((struct __pyx_obj_7zipline_6assets_7_assets_Asset *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_7_assets_5Asset_4__index__(struct __pyx_obj_7zipline_6assets_7_assets_Asset *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__index__", 0);
__Pyx_TraceCall("__index__", __pyx_f[0], 131, 0, __PYX_ERR(0, 131, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("zipline.assets._assets.Asset.__index__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+132: return self.sid
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_npy_int64(__pyx_v_self->sid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
133:
+134: def __hash__(self):
/* Python wrapper */
static Py_hash_t __pyx_pw_7zipline_6assets_7_assets_5Asset_7__hash__(PyObject *__pyx_v_self); /*proto*/
static Py_hash_t __pyx_pw_7zipline_6assets_7_assets_5Asset_7__hash__(PyObject *__pyx_v_self) {
Py_hash_t __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
__pyx_r = __pyx_pf_7zipline_6assets_7_assets_5Asset_6__hash__(((struct __pyx_obj_7zipline_6assets_7_assets_Asset *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static Py_hash_t __pyx_pf_7zipline_6assets_7_assets_5Asset_6__hash__(struct __pyx_obj_7zipline_6assets_7_assets_Asset *__pyx_v_self) {
Py_hash_t __pyx_r;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__hash__", 0);
__Pyx_TraceCall("__hash__", __pyx_f[0], 134, 0, __PYX_ERR(0, 134, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("zipline.assets._assets.Asset.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
__Pyx_TraceReturn(Py_None, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+135: return self.sid
__pyx_r = __pyx_v_self->sid; goto __pyx_L0;
136:
+137: def __richcmp__(x, y, int op):
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_9__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_9__richcmp__(PyObject *__pyx_v_x, PyObject *__pyx_v_y, int __pyx_v_op) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
__pyx_r = __pyx_pf_7zipline_6assets_7_assets_5Asset_8__richcmp__(((struct __pyx_obj_7zipline_6assets_7_assets_Asset *)__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_7_assets_5Asset_8__richcmp__(struct __pyx_obj_7zipline_6assets_7_assets_Asset *__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_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__richcmp__", 0);
__Pyx_TraceCall("__richcmp__", __pyx_f[0], 137, 0, __PYX_ERR(0, 137, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_AddTraceback("zipline.assets._assets.Asset.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
138: """
139: Cython rich comparison method. This is used in place of various
140: equality checkers in pure python.
141: """
142: cdef int64_t x_as_int, y_as_int
143:
+144: 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_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:;
}
+145: x_as_int = PyNumber_Index(x)
__pyx_t_4 = PyNumber_Index(((PyObject *)__pyx_v_x)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 145, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyInt_As_npy_int64(__pyx_t_4); if (unlikely((__pyx_t_5 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L3_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_x_as_int = __pyx_t_5;
+146: except (TypeError, OverflowError):
__pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError) || __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OverflowError); if (__pyx_t_6) { __Pyx_AddTraceback("zipline.assets._assets.Asset.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(0, 146, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_8);
+147: return NotImplemented
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_builtin_NotImplemented); __pyx_r = __pyx_builtin_NotImplemented; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L6_except_return; } goto __pyx_L5_except_error; __pyx_L5_except_error:;
148:
+149: 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_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
/* … */
__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:;
}
+150: y_as_int = PyNumber_Index(y)
__pyx_t_8 = PyNumber_Index(__pyx_v_y); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 150, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_5 = __Pyx_PyInt_As_npy_int64(__pyx_t_8); if (unlikely((__pyx_t_5 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L11_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_y_as_int = __pyx_t_5;
+151: except (TypeError, OverflowError):
__pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError) || __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OverflowError); if (__pyx_t_6) { __Pyx_AddTraceback("zipline.assets._assets.Asset.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_4) < 0) __PYX_ERR(0, 151, __pyx_L13_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_4);
+152: return NotImplemented
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_builtin_NotImplemented); __pyx_r = __pyx_builtin_NotImplemented; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L14_except_return; } goto __pyx_L13_except_error; __pyx_L13_except_error:;
153:
+154: compared = x_as_int - y_as_int
__pyx_v_compared = (__pyx_v_x_as_int - __pyx_v_y_as_int);
155:
156: # Handle == and != first because they're significantly more common
157: # operations.
+158: if op == Py_EQ:
__pyx_t_9 = ((__pyx_v_op == Py_EQ) != 0);
if (__pyx_t_9) {
/* … */
}
+159: 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, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0;
+160: elif op == Py_NE:
__pyx_t_9 = ((__pyx_v_op == Py_NE) != 0);
if (__pyx_t_9) {
/* … */
}
+161: 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, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0;
+162: elif op == Py_LT:
__pyx_t_9 = ((__pyx_v_op == Py_LT) != 0);
if (__pyx_t_9) {
/* … */
}
+163: 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, 163, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0;
+164: elif op == Py_LE:
__pyx_t_9 = ((__pyx_v_op == Py_LE) != 0);
if (__pyx_t_9) {
/* … */
}
+165: 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, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0;
+166: elif op == Py_GT:
__pyx_t_9 = ((__pyx_v_op == Py_GT) != 0);
if (__pyx_t_9) {
/* … */
}
+167: 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, 167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0;
+168: elif op == Py_GE:
__pyx_t_9 = ((__pyx_v_op == Py_GE) != 0);
if (likely(__pyx_t_9)) {
/* … */
}
+169: 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, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0;
170: else:
+171: raise AssertionError('%d is not an operator' % op)
/*else*/ {
__pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_op); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 171, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_7 = PyUnicode_Format(__pyx_kp_u_d_is_not_an_operator, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 171, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_AssertionError, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 171, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__PYX_ERR(0, 171, __pyx_L1_error)
}
172:
+173: def __repr__(self):
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_11__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_11__repr__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
__pyx_r = __pyx_pf_7zipline_6assets_7_assets_5Asset_10__repr__(((struct __pyx_obj_7zipline_6assets_7_assets_Asset *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_7_assets_5Asset_10__repr__(struct __pyx_obj_7zipline_6assets_7_assets_Asset *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__repr__", 0);
__Pyx_TraceCall("__repr__", __pyx_f[0], 173, 0, __PYX_ERR(0, 173, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("zipline.assets._assets.Asset.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+174: if self.symbol:
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->symbol); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 174, __pyx_L1_error) if (__pyx_t_1) { /* … */ }
+175: return '%s(%d [%s])' % (type(self).__name__, self.sid, self.symbol)
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyTuple_New(6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_4 = 127; __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))), __pyx_n_s_name_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_4; __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); __pyx_t_6 = 0; __Pyx_INCREF(__pyx_kp_u__2); __pyx_t_3 += 1; __Pyx_GIVEREF(__pyx_kp_u__2); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_kp_u__2); __pyx_t_6 = __Pyx_PyInt_From_npy_int64(__pyx_v_self->sid); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_PyObject_FormatAndDecref(__Pyx_PyNumber_IntOrLong(__pyx_t_6), __pyx_n_u_d); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4; __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5); __pyx_t_5 = 0; __Pyx_INCREF(__pyx_kp_u__3); __pyx_t_3 += 2; __Pyx_GIVEREF(__pyx_kp_u__3); PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_kp_u__3); __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_v_self->symbol), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4; __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_t_5); __pyx_t_5 = 0; __Pyx_INCREF(__pyx_kp_u__4); __pyx_t_3 += 2; __Pyx_GIVEREF(__pyx_kp_u__4); PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_kp_u__4); __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_2, 6, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0;
176: else:
+177: return '%s(%d)' % (type(self).__name__, self.sid)
/*else*/ {
__Pyx_XDECREF(__pyx_r);
__pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 177, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = 0;
__pyx_t_4 = 127;
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))), __pyx_n_s_name_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_2), __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 177, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_4;
__pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
__Pyx_GIVEREF(__pyx_t_6);
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
__pyx_t_6 = 0;
__Pyx_INCREF(__pyx_kp_u__2);
__pyx_t_3 += 1;
__Pyx_GIVEREF(__pyx_kp_u__2);
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_kp_u__2);
__pyx_t_6 = __Pyx_PyInt_From_npy_int64(__pyx_v_self->sid); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 177, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_2 = __Pyx_PyObject_FormatAndDecref(__Pyx_PyNumber_IntOrLong(__pyx_t_6), __pyx_n_u_d); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_4;
__pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_2);
__pyx_t_2 = 0;
__Pyx_INCREF(__pyx_kp_u__5);
__pyx_t_3 += 1;
__Pyx_GIVEREF(__pyx_kp_u__5);
PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_kp_u__5);
__pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_5, 4, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
}
178:
+179: cpdef __reduce__(self):
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_13__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_7zipline_6assets_7_assets_5Asset___reduce__(struct __pyx_obj_7zipline_6assets_7_assets_Asset *__pyx_v_self, int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__reduce__", 0);
__Pyx_TraceCall("__reduce__", __pyx_f[0], 179, 0, __PYX_ERR(0, 179, __pyx_L1_error));
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
#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_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reduce); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7zipline_6assets_7_assets_5Asset_13__reduce__)) {
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_t_1);
__pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_4)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
}
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 179, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__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_type_dict_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_AddTraceback("zipline.assets._assets.Asset.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_13__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7zipline_6assets_7_assets_5Asset_12__reduce__[] = "\n Function used by pickle to determine how to serialize/deserialize this\n class. Should return a tuple whose first element is self.__class__,\n and whose second element is a tuple of all the attributes that should\n be serialized/deserialized during pickling.\n ";
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_13__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
__pyx_r = __pyx_pf_7zipline_6assets_7_assets_5Asset_12__reduce__(((struct __pyx_obj_7zipline_6assets_7_assets_Asset *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_7_assets_5Asset_12__reduce__(struct __pyx_obj_7zipline_6assets_7_assets_Asset *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__reduce__", 0);
__Pyx_TraceCall("__reduce__ (wrapper)", __pyx_f[0], 179, 0, __PYX_ERR(0, 179, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_7zipline_6assets_7_assets_5Asset___reduce__(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("zipline.assets._assets.Asset.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
180: """
181: Function used by pickle to determine how to serialize/deserialize this
182: class. Should return a tuple whose first element is self.__class__,
183: and whose second element is a tuple of all the attributes that should
184: be serialized/deserialized during pickling.
185: """
+186: return (self.__class__, (self.sid,
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_From_npy_int64(__pyx_v_self->sid); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); /* … */ __pyx_t_4 = PyTuple_New(10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 186, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_INCREF(__pyx_v_self->exchange_info); __Pyx_GIVEREF(__pyx_v_self->exchange_info); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self->exchange_info); __Pyx_INCREF(__pyx_v_self->symbol); __Pyx_GIVEREF(__pyx_v_self->symbol); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_self->symbol); __Pyx_INCREF(__pyx_v_self->asset_name); __Pyx_GIVEREF(__pyx_v_self->asset_name); PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_self->asset_name); __Pyx_INCREF(__pyx_v_self->start_date); __Pyx_GIVEREF(__pyx_v_self->start_date); PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_self->start_date); __Pyx_INCREF(__pyx_v_self->end_date); __Pyx_GIVEREF(__pyx_v_self->end_date); PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_v_self->end_date); __Pyx_INCREF(__pyx_v_self->first_traded); __Pyx_GIVEREF(__pyx_v_self->first_traded); PyTuple_SET_ITEM(__pyx_t_4, 6, __pyx_v_self->first_traded); __Pyx_INCREF(__pyx_v_self->auto_close_date); __Pyx_GIVEREF(__pyx_v_self->auto_close_date); PyTuple_SET_ITEM(__pyx_t_4, 7, __pyx_v_self->auto_close_date); __Pyx_INCREF(__pyx_v_self->tick_size); __Pyx_GIVEREF(__pyx_v_self->tick_size); PyTuple_SET_ITEM(__pyx_t_4, 8, __pyx_v_self->tick_size); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 9, __pyx_t_3); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 186, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); __pyx_t_1 = 0; __pyx_t_4 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
187: self.exchange_info,
188: self.symbol,
189: self.asset_name,
190: self.start_date,
191: self.end_date,
192: self.first_traded,
193: self.auto_close_date,
194: self.tick_size,
+195: self.price_multiplier))
__pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->price_multiplier); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 195, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3);
196:
+197: cpdef to_dict(self):
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_15to_dict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_7zipline_6assets_7_assets_5Asset_to_dict(struct __pyx_obj_7zipline_6assets_7_assets_Asset *__pyx_v_self, int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("to_dict", 0);
__Pyx_TraceCall("to_dict", __pyx_f[0], 197, 0, __PYX_ERR(0, 197, __pyx_L1_error));
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
#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_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_to_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7zipline_6assets_7_assets_5Asset_15to_dict)) {
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_t_1);
__pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_4)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
}
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 197, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__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_type_dict_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_AddTraceback("zipline.assets._assets.Asset.to_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_15to_dict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7zipline_6assets_7_assets_5Asset_14to_dict[] = "Convert to a python dict containing all attributes of the asset.\n\n This is often useful for debugging.\n\n Returns\n -------\n as_dict : dict\n ";
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_15to_dict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("to_dict (wrapper)", 0);
__pyx_r = __pyx_pf_7zipline_6assets_7_assets_5Asset_14to_dict(((struct __pyx_obj_7zipline_6assets_7_assets_Asset *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_7_assets_5Asset_14to_dict(struct __pyx_obj_7zipline_6assets_7_assets_Asset *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("to_dict", 0);
__Pyx_TraceCall("to_dict (wrapper)", __pyx_f[0], 197, 0, __PYX_ERR(0, 197, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_7zipline_6assets_7_assets_5Asset_to_dict(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("zipline.assets._assets.Asset.to_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
198: """Convert to a python dict containing all attributes of the asset.
199:
200: This is often useful for debugging.
201:
202: Returns
203: -------
204: as_dict : dict
205: """
+206: return {
__Pyx_XDECREF(__pyx_r);
+207: 'sid': self.sid,
__pyx_t_1 = __Pyx_PyDict_NewPresized(12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_From_npy_int64(__pyx_v_self->sid); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_sid, __pyx_t_2) < 0) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+208: 'symbol': self.symbol,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_symbol, __pyx_v_self->symbol) < 0) __PYX_ERR(0, 207, __pyx_L1_error)
+209: 'asset_name': self.asset_name,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_asset_name, __pyx_v_self->asset_name) < 0) __PYX_ERR(0, 207, __pyx_L1_error)
+210: 'start_date': self.start_date,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_start_date, __pyx_v_self->start_date) < 0) __PYX_ERR(0, 207, __pyx_L1_error)
+211: 'end_date': self.end_date,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_end_date, __pyx_v_self->end_date) < 0) __PYX_ERR(0, 207, __pyx_L1_error)
+212: 'first_traded': self.first_traded,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_first_traded, __pyx_v_self->first_traded) < 0) __PYX_ERR(0, 207, __pyx_L1_error)
+213: 'auto_close_date': self.auto_close_date,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_auto_close_date, __pyx_v_self->auto_close_date) < 0) __PYX_ERR(0, 207, __pyx_L1_error)
+214: 'exchange': self.exchange,
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_exchange); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_exchange, __pyx_t_2) < 0) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+215: 'exchange_full': self.exchange_full,
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_exchange_full); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_exchange_full, __pyx_t_2) < 0) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+216: 'tick_size': self.tick_size,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_tick_size, __pyx_v_self->tick_size) < 0) __PYX_ERR(0, 207, __pyx_L1_error)
+217: 'multiplier': self.price_multiplier,
__pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->price_multiplier); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_multiplier, __pyx_t_2) < 0) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+218: 'exchange_info': self.exchange_info,
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_exchange_info, __pyx_v_self->exchange_info) < 0) __PYX_ERR(0, 207, __pyx_L1_error) __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
219: }
220:
+221: @classmethod
__pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_7zipline_6assets_7_assets_Asset->tp_dict, __pyx_n_s_from_dict, __pyx_t_2) < 0) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_7zipline_6assets_7_assets_Asset);
+222: def from_dict(cls, dict_):
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_17from_dict(PyObject *__pyx_v_cls, PyObject *__pyx_v_dict_); /*proto*/
static char __pyx_doc_7zipline_6assets_7_assets_5Asset_16from_dict[] = "\n Build an Asset instance from a dict.\n ";
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_17from_dict(PyObject *__pyx_v_cls, PyObject *__pyx_v_dict_) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("from_dict (wrapper)", 0);
__pyx_r = __pyx_pf_7zipline_6assets_7_assets_5Asset_16from_dict(((PyTypeObject*)__pyx_v_cls), ((PyObject *)__pyx_v_dict_));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_7_assets_5Asset_16from_dict(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_dict_) {
PyObject *__pyx_7genexpr__pyx_v_k = NULL;
PyObject *__pyx_7genexpr__pyx_v_v = NULL;
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("from_dict", 0);
__Pyx_TraceCall("from_dict", __pyx_f[0], 222, 0, __PYX_ERR(0, 222, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_AddTraceback("zipline.assets._assets.Asset.from_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_7genexpr__pyx_v_k);
__Pyx_XDECREF(__pyx_7genexpr__pyx_v_v);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_7zipline_6assets_7_assets_Asset, __pyx_n_s_from_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
223: """
224: Build an Asset instance from a dict.
225: """
+226: return cls(**{k: v for k, v in dict_.items() if k in cls._kwargnames})
__Pyx_XDECREF(__pyx_r); { /* enter inner scope */ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = 0; if (unlikely(__pyx_v_dict_ == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); __PYX_ERR(0, 226, __pyx_L5_error) } __pyx_t_7 = __Pyx_dict_iterator(__pyx_v_dict_, 0, __pyx_n_s_items, (&__pyx_t_5), (&__pyx_t_6)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 226, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = __pyx_t_7; __pyx_t_7 = 0; while (1) { __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_5, &__pyx_t_4, &__pyx_t_7, &__pyx_t_8, NULL, __pyx_t_6); if (unlikely(__pyx_t_9 == 0)) break; if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 226, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_8); __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_k, __pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_v, __pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_cls), __pyx_n_s_kwargnames); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 226, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_10 = (__Pyx_PySequence_ContainsTF(__pyx_7genexpr__pyx_v_k, __pyx_t_8, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 226, __pyx_L5_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_11 = (__pyx_t_10 != 0); if (__pyx_t_11) { if (unlikely(PyDict_SetItem(__pyx_t_2, (PyObject*)__pyx_7genexpr__pyx_v_k, (PyObject*)__pyx_7genexpr__pyx_v_v))) __PYX_ERR(0, 226, __pyx_L5_error) } } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_7genexpr__pyx_v_k); __pyx_7genexpr__pyx_v_k = 0; __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v); __pyx_7genexpr__pyx_v_v = 0; goto __pyx_L9_exit_scope; __pyx_L5_error:; __Pyx_XDECREF(__pyx_7genexpr__pyx_v_k); __pyx_7genexpr__pyx_v_k = 0; __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v); __pyx_7genexpr__pyx_v_v = 0; goto __pyx_L1_error; __pyx_L9_exit_scope:; } /* exit inner scope */ __pyx_t_1 = PyDict_Copy(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_v_cls), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __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; goto __pyx_L0;
227:
+228: def is_alive_for_session(self, session_label):
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_19is_alive_for_session(PyObject *__pyx_v_self, PyObject *__pyx_v_session_label); /*proto*/
static char __pyx_doc_7zipline_6assets_7_assets_5Asset_18is_alive_for_session[] = "\n Returns whether the asset is alive at the given dt.\n\n Parameters\n ----------\n session_label: pd.Timestamp\n The desired session label to check. (midnight UTC)\n\n Returns\n -------\n boolean: whether the asset is alive at the given dt.\n ";
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_19is_alive_for_session(PyObject *__pyx_v_self, PyObject *__pyx_v_session_label) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_alive_for_session (wrapper)", 0);
__pyx_r = __pyx_pf_7zipline_6assets_7_assets_5Asset_18is_alive_for_session(((struct __pyx_obj_7zipline_6assets_7_assets_Asset *)__pyx_v_self), ((PyObject *)__pyx_v_session_label));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_7_assets_5Asset_18is_alive_for_session(struct __pyx_obj_7zipline_6assets_7_assets_Asset *__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_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_alive_for_session", 0);
__Pyx_TraceCall("is_alive_for_session", __pyx_f[0], 228, 0, __PYX_ERR(0, 228, __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_AddTraceback("zipline.assets._assets.Asset.is_alive_for_session", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
229: """
230: Returns whether the asset is alive at the given dt.
231:
232: Parameters
233: ----------
234: session_label: pd.Timestamp
235: The desired session label to check. (midnight UTC)
236:
237: Returns
238: -------
239: boolean: whether the asset is alive at the given dt.
240: """
241: cdef int64_t ref_start
242: cdef int64_t ref_end
243:
+244: ref_start = self.start_date.value
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->start_date, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_As_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_2 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 244, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_ref_start = __pyx_t_2;
+245: ref_end = self.end_date.value
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->end_date, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_As_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_2 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_ref_end = __pyx_t_2;
246:
+247: return ref_start <= session_label.value <= ref_end
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_npy_int64(__pyx_v_ref_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_session_label, __pyx_n_s_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 247, __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, 247, __pyx_L1_error) if (__Pyx_PyObject_IsTrue(__pyx_t_4)) { __Pyx_DECREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyInt_From_npy_int64(__pyx_v_ref_end); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 247, __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, 247, __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; goto __pyx_L0;
248:
+249: def is_exchange_open(self, dt_minute):
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_21is_exchange_open(PyObject *__pyx_v_self, PyObject *__pyx_v_dt_minute); /*proto*/
static char __pyx_doc_7zipline_6assets_7_assets_5Asset_20is_exchange_open[] = "\n Parameters\n ----------\n dt_minute: pd.Timestamp (UTC, tz-aware)\n The minute to check.\n\n Returns\n -------\n boolean: whether the asset's exchange is open at the given minute.\n ";
static PyObject *__pyx_pw_7zipline_6assets_7_assets_5Asset_21is_exchange_open(PyObject *__pyx_v_self, PyObject *__pyx_v_dt_minute) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_exchange_open (wrapper)", 0);
__pyx_r = __pyx_pf_7zipline_6assets_7_assets_5Asset_20is_exchange_open(((struct __pyx_obj_7zipline_6assets_7_assets_Asset *)__pyx_v_self), ((PyObject *)__pyx_v_dt_minute));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_7_assets_5Asset_20is_exchange_open(struct __pyx_obj_7zipline_6assets_7_assets_Asset *__pyx_v_self, PyObject *__pyx_v_dt_minute) {
PyObject *__pyx_v_calendar = NULL;
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_exchange_open", 0);
__Pyx_TraceCall("is_exchange_open", __pyx_f[0], 249, 0, __PYX_ERR(0, 249, __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_AddTraceback("zipline.assets._assets.Asset.is_exchange_open", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_calendar);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
250: """
251: Parameters
252: ----------
253: dt_minute: pd.Timestamp (UTC, tz-aware)
254: The minute to check.
255:
256: Returns
257: -------
258: boolean: whether the asset's exchange is open at the given minute.
259: """
+260: calendar = get_calendar(self.exchange)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_calendar); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 260, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_exchange); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 260, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_calendar = __pyx_t_1; __pyx_t_1 = 0;
+261: return calendar.is_open_on_minute(dt_minute)
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_calendar, __pyx_n_s_is_open_on_minute); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 261, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_dt_minute) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_dt_minute); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
262:
263:
264: @cython.embedsignature(False)
+265: cdef class Equity(Asset):
struct __pyx_vtabstruct_7zipline_6assets_7_assets_Equity {
struct __pyx_vtabstruct_7zipline_6assets_7_assets_Asset __pyx_base;
};
static struct __pyx_vtabstruct_7zipline_6assets_7_assets_Equity *__pyx_vtabptr_7zipline_6assets_7_assets_Equity;
266: """
267: Asset subclass representing partial ownership of a company, trust, or
268: partnership.
269: """
270: pass
271:
272: @cython.embedsignature(False)
+273: cdef class Future(Asset):
struct __pyx_vtabstruct_7zipline_6assets_7_assets_Future {
struct __pyx_vtabstruct_7zipline_6assets_7_assets_Asset __pyx_base;
};
static struct __pyx_vtabstruct_7zipline_6assets_7_assets_Future *__pyx_vtabptr_7zipline_6assets_7_assets_Future;
274: """Asset subclass representing ownership of a futures contract.
275: """
+276: _kwargnames = frozenset({
__pyx_t_2 = PySet_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 277, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PySet_Add(__pyx_t_2, __pyx_n_u_sid) < 0) __PYX_ERR(0, 277, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_u_symbol) < 0) __PYX_ERR(0, 277, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_u_root_symbol) < 0) __PYX_ERR(0, 277, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_u_asset_name) < 0) __PYX_ERR(0, 277, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_u_start_date) < 0) __PYX_ERR(0, 277, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_u_end_date) < 0) __PYX_ERR(0, 277, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_u_notice_date) < 0) __PYX_ERR(0, 277, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_u_expiration_date) < 0) __PYX_ERR(0, 277, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_u_auto_close_date) < 0) __PYX_ERR(0, 277, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_u_first_traded) < 0) __PYX_ERR(0, 277, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_u_exchange_info) < 0) __PYX_ERR(0, 277, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_u_tick_size) < 0) __PYX_ERR(0, 277, __pyx_L1_error) if (PySet_Add(__pyx_t_2, __pyx_n_u_multiplier) < 0) __PYX_ERR(0, 277, __pyx_L1_error) __pyx_t_1 = __Pyx_PyFrozenSet_New(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 276, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_7zipline_6assets_7_assets_Future->tp_dict, __pyx_n_s_kwargnames, __pyx_t_1) < 0) __PYX_ERR(0, 276, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_7zipline_6assets_7_assets_Future);
277: 'sid',
278: 'symbol',
279: 'root_symbol',
280: 'asset_name',
281: 'start_date',
282: 'end_date',
283: 'notice_date',
284: 'expiration_date',
285: 'auto_close_date',
286: 'first_traded',
287: 'exchange_info',
288: 'tick_size',
289: 'multiplier',
290: })
291:
+292: def __init__(self,
/* Python wrapper */
static int __pyx_pw_7zipline_6assets_7_assets_6Future_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7zipline_6assets_7_assets_6Future_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
__pyx_t_5numpy_int64_t __pyx_v_sid;
PyObject *__pyx_v_exchange_info = 0;
PyObject *__pyx_v_symbol = 0;
PyObject *__pyx_v_root_symbol = 0;
PyObject *__pyx_v_asset_name = 0;
PyObject *__pyx_v_start_date = 0;
PyObject *__pyx_v_end_date = 0;
PyObject *__pyx_v_notice_date = 0;
PyObject *__pyx_v_expiration_date = 0;
PyObject *__pyx_v_auto_close_date = 0;
PyObject *__pyx_v_first_traded = 0;
PyObject *__pyx_v_tick_size = 0;
float __pyx_v_multiplier;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sid,&__pyx_n_s_exchange_info,&__pyx_n_s_symbol,&__pyx_n_s_root_symbol,&__pyx_n_s_asset_name,&__pyx_n_s_start_date,&__pyx_n_s_end_date,&__pyx_n_s_notice_date,&__pyx_n_s_expiration_date,&__pyx_n_s_auto_close_date,&__pyx_n_s_first_traded,&__pyx_n_s_tick_size,&__pyx_n_s_multiplier,0};
PyObject* values[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0};
values[2] = ((PyObject *)__pyx_kp_u_);
values[3] = ((PyObject *)__pyx_kp_u_);
values[4] = ((PyObject *)__pyx_kp_u_);
/* … */
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_7zipline_6assets_7_assets_6Future___init__(struct __pyx_obj_7zipline_6assets_7_assets_Future *__pyx_v_self, __pyx_t_5numpy_int64_t __pyx_v_sid, PyObject *__pyx_v_exchange_info, PyObject *__pyx_v_symbol, PyObject *__pyx_v_root_symbol, PyObject *__pyx_v_asset_name, PyObject *__pyx_v_start_date, PyObject *__pyx_v_end_date, PyObject *__pyx_v_notice_date, PyObject *__pyx_v_expiration_date, PyObject *__pyx_v_auto_close_date, PyObject *__pyx_v_first_traded, PyObject *__pyx_v_tick_size, float __pyx_v_multiplier) {
int __pyx_r;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__", 0);
__Pyx_TraceCall("__init__", __pyx_f[0], 292, 0, __PYX_ERR(0, 292, __pyx_L1_error));
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("zipline.assets._assets.Future.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_TraceReturn(Py_None, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
293: int64_t sid, # sid is required
294: object exchange_info, # exchange is required
295: object symbol="",
296: object root_symbol="",
297: object asset_name="",
+298: object start_date=None,
values[5] = ((PyObject *)Py_None);
+299: object end_date=None,
values[6] = ((PyObject *)Py_None);
+300: object notice_date=None,
values[7] = ((PyObject *)Py_None);
+301: object expiration_date=None,
values[8] = ((PyObject *)Py_None);
+302: object auto_close_date=None,
values[9] = ((PyObject *)Py_None);
+303: object first_traded=None,
values[10] = ((PyObject *)Py_None);
values[11] = ((PyObject *)__pyx_float_0_001);
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
CYTHON_FALLTHROUGH;
case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
CYTHON_FALLTHROUGH;
case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
CYTHON_FALLTHROUGH;
case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
CYTHON_FALLTHROUGH;
case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
CYTHON_FALLTHROUGH;
case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
CYTHON_FALLTHROUGH;
case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
CYTHON_FALLTHROUGH;
case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
CYTHON_FALLTHROUGH;
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sid)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exchange_info)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 13, 1); __PYX_ERR(0, 292, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_symbol);
if (value) { values[2] = value; kw_args--; }
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_root_symbol);
if (value) { values[3] = value; kw_args--; }
}
CYTHON_FALLTHROUGH;
case 4:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_asset_name);
if (value) { values[4] = value; kw_args--; }
}
CYTHON_FALLTHROUGH;
case 5:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start_date);
if (value) { values[5] = value; kw_args--; }
}
CYTHON_FALLTHROUGH;
case 6:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_end_date);
if (value) { values[6] = value; kw_args--; }
}
CYTHON_FALLTHROUGH;
case 7:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_notice_date);
if (value) { values[7] = value; kw_args--; }
}
CYTHON_FALLTHROUGH;
case 8:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_expiration_date);
if (value) { values[8] = value; kw_args--; }
}
CYTHON_FALLTHROUGH;
case 9:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_auto_close_date);
if (value) { values[9] = value; kw_args--; }
}
CYTHON_FALLTHROUGH;
case 10:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_first_traded);
if (value) { values[10] = value; kw_args--; }
}
CYTHON_FALLTHROUGH;
case 11:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tick_size);
if (value) { values[11] = value; kw_args--; }
}
CYTHON_FALLTHROUGH;
case 12:
if (kw_args > 0) {
PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_multiplier);
if (value) { values[12] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 292, __pyx_L3_error)
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
CYTHON_FALLTHROUGH;
case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
CYTHON_FALLTHROUGH;
case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
CYTHON_FALLTHROUGH;
case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
CYTHON_FALLTHROUGH;
case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
CYTHON_FALLTHROUGH;
case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
CYTHON_FALLTHROUGH;
case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
CYTHON_FALLTHROUGH;
case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
CYTHON_FALLTHROUGH;
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_sid = __Pyx_PyInt_As_npy_int64(values[0]); if (unlikely((__pyx_v_sid == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 293, __pyx_L3_error)
__pyx_v_exchange_info = values[1];
__pyx_v_symbol = values[2];
__pyx_v_root_symbol = values[3];
__pyx_v_asset_name = values[4];
__pyx_v_start_date = values[5];
__pyx_v_end_date = values[6];
__pyx_v_notice_date = values[7];
__pyx_v_expiration_date = values[8];
__pyx_v_auto_close_date = values[9];
__pyx_v_first_traded = values[10];
__pyx_v_tick_size = values[11];
if (values[12]) {
__pyx_v_multiplier = __pyx_PyFloat_AsFloat(values[12]); if (unlikely((__pyx_v_multiplier == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 305, __pyx_L3_error)
} else {
__pyx_v_multiplier = ((float)1.0);
}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 13, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 292, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("zipline.assets._assets.Future.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_7zipline_6assets_7_assets_6Future___init__(((struct __pyx_obj_7zipline_6assets_7_assets_Future *)__pyx_v_self), __pyx_v_sid, __pyx_v_exchange_info, __pyx_v_symbol, __pyx_v_root_symbol, __pyx_v_asset_name, __pyx_v_start_date, __pyx_v_end_date, __pyx_v_notice_date, __pyx_v_expiration_date, __pyx_v_auto_close_date, __pyx_v_first_traded, __pyx_v_tick_size, __pyx_v_multiplier);
304: object tick_size=0.001,
305: float multiplier=1.0):
306:
+307: super().__init__(
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 307, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_ptype_7zipline_6assets_7_assets_Future)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7zipline_6assets_7_assets_Future)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_ptype_7zipline_6assets_7_assets_Future)); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self)); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __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_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 307, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* … */ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 307, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_INCREF(__pyx_v_exchange_info); __Pyx_GIVEREF(__pyx_v_exchange_info); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_exchange_info); __pyx_t_2 = 0; /* … */ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 307, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+308: sid,
__pyx_t_2 = __Pyx_PyInt_From_npy_int64(__pyx_v_sid); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 308, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2);
309: exchange_info,
+310: symbol=symbol,
__pyx_t_2 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 310, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_symbol, __pyx_v_symbol) < 0) __PYX_ERR(0, 310, __pyx_L1_error)
+311: asset_name=asset_name,
if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_asset_name, __pyx_v_asset_name) < 0) __PYX_ERR(0, 310, __pyx_L1_error)
+312: start_date=start_date,
if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_start_date, __pyx_v_start_date) < 0) __PYX_ERR(0, 310, __pyx_L1_error)
+313: end_date=end_date,
if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_end_date, __pyx_v_end_date) < 0) __PYX_ERR(0, 310, __pyx_L1_error)
+314: first_traded=first_traded,
if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_first_traded, __pyx_v_first_traded) < 0) __PYX_ERR(0, 310, __pyx_L1_error)
+315: auto_close_date=auto_close_date,
if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_auto_close_date, __pyx_v_auto_close_date) < 0) __PYX_ERR(0, 310, __pyx_L1_error)
+316: tick_size=tick_size,
if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_tick_size, __pyx_v_tick_size) < 0) __PYX_ERR(0, 310, __pyx_L1_error)
+317: multiplier=multiplier
__pyx_t_4 = PyFloat_FromDouble(__pyx_v_multiplier); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 317, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_multiplier, __pyx_t_4) < 0) __PYX_ERR(0, 310, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
318: )
+319: 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;
+320: self.notice_date = notice_date
__Pyx_INCREF(__pyx_v_notice_date); __Pyx_GIVEREF(__pyx_v_notice_date); __Pyx_GOTREF(__pyx_v_self->notice_date); __Pyx_DECREF(__pyx_v_self->notice_date); __pyx_v_self->notice_date = __pyx_v_notice_date;
+321: self.expiration_date = expiration_date
__Pyx_INCREF(__pyx_v_expiration_date); __Pyx_GIVEREF(__pyx_v_expiration_date); __Pyx_GOTREF(__pyx_v_self->expiration_date); __Pyx_DECREF(__pyx_v_self->expiration_date); __pyx_v_self->expiration_date = __pyx_v_expiration_date;
322:
+323: if auto_close_date is None:
__pyx_t_5 = (__pyx_v_auto_close_date == Py_None);
__pyx_t_6 = (__pyx_t_5 != 0);
if (__pyx_t_6) {
/* … */
}
+324: if notice_date is None:
__pyx_t_6 = (__pyx_v_notice_date == Py_None);
__pyx_t_5 = (__pyx_t_6 != 0);
if (__pyx_t_5) {
/* … */
goto __pyx_L4;
}
+325: self.auto_close_date = expiration_date
__Pyx_INCREF(__pyx_v_expiration_date); __Pyx_GIVEREF(__pyx_v_expiration_date); __Pyx_GOTREF(__pyx_v_self->__pyx_base.auto_close_date); __Pyx_DECREF(__pyx_v_self->__pyx_base.auto_close_date); __pyx_v_self->__pyx_base.auto_close_date = __pyx_v_expiration_date;
+326: elif expiration_date is None:
__pyx_t_5 = (__pyx_v_expiration_date == Py_None);
__pyx_t_6 = (__pyx_t_5 != 0);
if (__pyx_t_6) {
/* … */
goto __pyx_L4;
}
+327: self.auto_close_date = notice_date
__Pyx_INCREF(__pyx_v_notice_date); __Pyx_GIVEREF(__pyx_v_notice_date); __Pyx_GOTREF(__pyx_v_self->__pyx_base.auto_close_date); __Pyx_DECREF(__pyx_v_self->__pyx_base.auto_close_date); __pyx_v_self->__pyx_base.auto_close_date = __pyx_v_notice_date;
328: else:
+329: self.auto_close_date = min(notice_date, expiration_date)
/*else*/ {
__Pyx_INCREF(__pyx_v_expiration_date);
__pyx_t_4 = __pyx_v_expiration_date;
__Pyx_INCREF(__pyx_v_notice_date);
__pyx_t_2 = __pyx_v_notice_date;
__pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error)
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 329, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_6) {
__Pyx_INCREF(__pyx_t_4);
__pyx_t_3 = __pyx_t_4;
} else {
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_t_2;
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = __pyx_t_3;
__Pyx_INCREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_GIVEREF(__pyx_t_4);
__Pyx_GOTREF(__pyx_v_self->__pyx_base.auto_close_date);
__Pyx_DECREF(__pyx_v_self->__pyx_base.auto_close_date);
__pyx_v_self->__pyx_base.auto_close_date = __pyx_t_4;
__pyx_t_4 = 0;
}
__pyx_L4:;
330:
+331: cpdef __reduce__(self):
static PyObject *__pyx_pw_7zipline_6assets_7_assets_6Future_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_7zipline_6assets_7_assets_6Future___reduce__(struct __pyx_obj_7zipline_6assets_7_assets_Future *__pyx_v_self, int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__reduce__", 0);
__Pyx_TraceCall("__reduce__", __pyx_f[0], 331, 0, __PYX_ERR(0, 331, __pyx_L1_error));
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
#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_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reduce); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7zipline_6assets_7_assets_6Future_3__reduce__)) {
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_t_1);
__pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_4)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
}
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__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_type_dict_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_AddTraceback("zipline.assets._assets.Future.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_7_assets_6Future_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7zipline_6assets_7_assets_6Future_2__reduce__[] = "\n Function used by pickle to determine how to serialize/deserialize this\n class. Should return a tuple whose first element is self.__class__,\n and whose second element is a tuple of all the attributes that should\n be serialized/deserialized during pickling.\n ";
static PyObject *__pyx_pw_7zipline_6assets_7_assets_6Future_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
__pyx_r = __pyx_pf_7zipline_6assets_7_assets_6Future_2__reduce__(((struct __pyx_obj_7zipline_6assets_7_assets_Future *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_7_assets_6Future_2__reduce__(struct __pyx_obj_7zipline_6assets_7_assets_Future *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__reduce__", 0);
__Pyx_TraceCall("__reduce__ (wrapper)", __pyx_f[0], 331, 0, __PYX_ERR(0, 331, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_7zipline_6assets_7_assets_6Future___reduce__(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("zipline.assets._assets.Future.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
332: """
333: Function used by pickle to determine how to serialize/deserialize this
334: class. Should return a tuple whose first element is self.__class__,
335: and whose second element is a tuple of all the attributes that should
336: be serialized/deserialized during pickling.
337: """
+338: return (self.__class__, (self.sid,
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_From_npy_int64(__pyx_v_self->__pyx_base.sid); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); /* … */ __pyx_t_4 = PyTuple_New(13); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_INCREF(__pyx_v_self->__pyx_base.exchange_info); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.exchange_info); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self->__pyx_base.exchange_info); __Pyx_INCREF(__pyx_v_self->__pyx_base.symbol); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.symbol); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_self->__pyx_base.symbol); __Pyx_INCREF(__pyx_v_self->root_symbol); __Pyx_GIVEREF(__pyx_v_self->root_symbol); PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_self->root_symbol); __Pyx_INCREF(__pyx_v_self->__pyx_base.asset_name); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.asset_name); PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_self->__pyx_base.asset_name); __Pyx_INCREF(__pyx_v_self->__pyx_base.start_date); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.start_date); PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_v_self->__pyx_base.start_date); __Pyx_INCREF(__pyx_v_self->__pyx_base.end_date); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.end_date); PyTuple_SET_ITEM(__pyx_t_4, 6, __pyx_v_self->__pyx_base.end_date); __Pyx_INCREF(__pyx_v_self->notice_date); __Pyx_GIVEREF(__pyx_v_self->notice_date); PyTuple_SET_ITEM(__pyx_t_4, 7, __pyx_v_self->notice_date); __Pyx_INCREF(__pyx_v_self->expiration_date); __Pyx_GIVEREF(__pyx_v_self->expiration_date); PyTuple_SET_ITEM(__pyx_t_4, 8, __pyx_v_self->expiration_date); __Pyx_INCREF(__pyx_v_self->__pyx_base.auto_close_date); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.auto_close_date); PyTuple_SET_ITEM(__pyx_t_4, 9, __pyx_v_self->__pyx_base.auto_close_date); __Pyx_INCREF(__pyx_v_self->__pyx_base.first_traded); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.first_traded); PyTuple_SET_ITEM(__pyx_t_4, 10, __pyx_v_self->__pyx_base.first_traded); __Pyx_INCREF(__pyx_v_self->__pyx_base.tick_size); __Pyx_GIVEREF(__pyx_v_self->__pyx_base.tick_size); PyTuple_SET_ITEM(__pyx_t_4, 11, __pyx_v_self->__pyx_base.tick_size); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 12, __pyx_t_3); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); __pyx_t_1 = 0; __pyx_t_4 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
339: self.exchange_info,
340: self.symbol,
341: self.root_symbol,
342: self.asset_name,
343: self.start_date,
344: self.end_date,
345: self.notice_date,
346: self.expiration_date,
347: self.auto_close_date,
348: self.first_traded,
349: self.tick_size,
+350: self.price_multiplier))
__pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.price_multiplier); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 350, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3);
351:
+352: cpdef to_dict(self):
static PyObject *__pyx_pw_7zipline_6assets_7_assets_6Future_5to_dict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_7zipline_6assets_7_assets_6Future_to_dict(struct __pyx_obj_7zipline_6assets_7_assets_Future *__pyx_v_self, int __pyx_skip_dispatch) {
PyObject *__pyx_v_super_dict = NULL;
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("to_dict", 0);
__Pyx_TraceCall("to_dict", __pyx_f[0], 352, 0, __PYX_ERR(0, 352, __pyx_L1_error));
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
#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_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_to_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 352, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7zipline_6assets_7_assets_6Future_5to_dict)) {
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_t_1);
__pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_4)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
}
}
__pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 352, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__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_type_dict_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_AddTraceback("zipline.assets._assets.Future.to_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_super_dict);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_7_assets_6Future_5to_dict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7zipline_6assets_7_assets_6Future_4to_dict[] = "\n Convert to a python dict.\n ";
static PyObject *__pyx_pw_7zipline_6assets_7_assets_6Future_5to_dict(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("to_dict (wrapper)", 0);
__pyx_r = __pyx_pf_7zipline_6assets_7_assets_6Future_4to_dict(((struct __pyx_obj_7zipline_6assets_7_assets_Future *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_7_assets_6Future_4to_dict(struct __pyx_obj_7zipline_6assets_7_assets_Future *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("to_dict", 0);
__Pyx_TraceCall("to_dict (wrapper)", __pyx_f[0], 352, 0, __PYX_ERR(0, 352, __pyx_L1_error));
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_7zipline_6assets_7_assets_6Future_to_dict(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 352, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("zipline.assets._assets.Future.to_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
353: """
354: Convert to a python dict.
355: """
+356: super_dict = super(Future, self).to_dict()
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_ptype_7zipline_6assets_7_assets_Future)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7zipline_6assets_7_assets_Future)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_7zipline_6assets_7_assets_Future)); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self)); __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_to_dict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_super_dict = __pyx_t_1; __pyx_t_1 = 0;
+357: super_dict['root_symbol'] = self.root_symbol
__pyx_t_1 = __pyx_v_self->root_symbol; __Pyx_INCREF(__pyx_t_1); if (unlikely(PyObject_SetItem(__pyx_v_super_dict, __pyx_n_u_root_symbol, __pyx_t_1) < 0)) __PYX_ERR(0, 357, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+358: super_dict['notice_date'] = self.notice_date
__pyx_t_1 = __pyx_v_self->notice_date; __Pyx_INCREF(__pyx_t_1); if (unlikely(PyObject_SetItem(__pyx_v_super_dict, __pyx_n_u_notice_date, __pyx_t_1) < 0)) __PYX_ERR(0, 358, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+359: super_dict['expiration_date'] = self.expiration_date
__pyx_t_1 = __pyx_v_self->expiration_date; __Pyx_INCREF(__pyx_t_1); if (unlikely(PyObject_SetItem(__pyx_v_super_dict, __pyx_n_u_expiration_date, __pyx_t_1) < 0)) __PYX_ERR(0, 359, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+360: return super_dict
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_super_dict); __pyx_r = __pyx_v_super_dict; goto __pyx_L0;
361:
362:
+363: def make_asset_array(int size, Asset asset):
/* Python wrapper */
static PyObject *__pyx_pw_7zipline_6assets_7_assets_1make_asset_array(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7zipline_6assets_7_assets_make_asset_array[] = "make_asset_array(int size, Asset asset)";
static PyMethodDef __pyx_mdef_7zipline_6assets_7_assets_1make_asset_array = {"make_asset_array", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7zipline_6assets_7_assets_1make_asset_array, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7zipline_6assets_7_assets_make_asset_array};
static PyObject *__pyx_pw_7zipline_6assets_7_assets_1make_asset_array(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
int __pyx_v_size;
struct __pyx_obj_7zipline_6assets_7_assets_Asset *__pyx_v_asset = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_asset_array (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,&__pyx_n_s_asset,0};
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_asset)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("make_asset_array", 1, 2, 2, 1); __PYX_ERR(0, 363, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "make_asset_array") < 0)) __PYX_ERR(0, 363, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_size = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 363, __pyx_L3_error)
__pyx_v_asset = ((struct __pyx_obj_7zipline_6assets_7_assets_Asset *)values[1]);
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_asset_array", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 363, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("zipline.assets._assets.make_asset_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_asset), __pyx_ptype_7zipline_6assets_7_assets_Asset, 1, "asset", 0))) __PYX_ERR(0, 363, __pyx_L1_error)
__pyx_r = __pyx_pf_7zipline_6assets_7_assets_make_asset_array(__pyx_self, __pyx_v_size, __pyx_v_asset);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_7zipline_6assets_7_assets_make_asset_array(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_size, struct __pyx_obj_7zipline_6assets_7_assets_Asset *__pyx_v_asset) {
PyArrayObject *__pyx_v_out = 0;
PyObject *__pyx_r = NULL;
__Pyx_TraceDeclarations
__Pyx_TraceFrameInit(__pyx_codeobj__6)
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_asset_array", 0);
__Pyx_TraceCall("make_asset_array", __pyx_f[0], 363, 0, __PYX_ERR(0, 363, __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_AddTraceback("zipline.assets._assets.make_asset_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_out);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_TraceReturn(__pyx_r, 0);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__14 = PyTuple_Pack(3, __pyx_n_s_size, __pyx_n_s_asset, __pyx_n_s_out); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 363, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__14);
__Pyx_GIVEREF(__pyx_tuple__14);
/* … */
__pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7zipline_6assets_7_assets_1make_asset_array, NULL, __pyx_n_s_zipline_assets__assets); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 363, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_asset_array, __pyx_t_1) < 0) __PYX_ERR(0, 363, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+364: cdef np.ndarray out = np.empty([size], dtype=object)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_builtin_object) < 0) __PYX_ERR(0, 364, __pyx_L1_error) __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 364, __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 364, __pyx_L1_error) __pyx_v_out = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0;
+365: out.fill(asset)
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_out), __pyx_n_s_fill); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 365, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, ((PyObject *)__pyx_v_asset)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_asset)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 365, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+366: return out
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_out)); __pyx_r = ((PyObject *)__pyx_v_out); goto __pyx_L0;