Notebook
In [170]:
vixx = local_csv('Book3.csv',  date_column='Date')
In [171]:
from quantopian.pipeline import Pipeline
from quantopian.pipeline import CustomFactor
from quantopian.research import run_pipeline
from quantopian.pipeline.data import morningstar
from quantopian.pipeline.data.builtin import USEquityPricing

class MyFactor(CustomFactor):
    inputs = vixx['Price']
    window_length = 5

    def compute(self, today, assets, out, price):

        out[:] = price

pipe = Pipeline()
       
pipe.add(MyFactor(), 'MyFactor')

Pipe = Pipeline(
    columns={'MyFactor':MyFactor})
AttributeErrorTraceback (most recent call last)
<ipython-input-171-13b3878f2e3d> in <module>()
     15 pipe = Pipeline()
     16 
---> 17 pipe.add(MyFactor(), 'MyFactor')
     18 
     19 Pipe = Pipeline(

/build/src/qexec_repo/zipline_repo/zipline/pipeline/mixins.pyc in __new__(cls, inputs, outputs, window_length, mask, dtype, missing_value, ndim, **kwargs)
    138             missing_value=missing_value,
    139             ndim=ndim,
--> 140             **kwargs
    141         )
    142 

/build/src/qexec_repo/zipline_repo/zipline/pipeline/term.pyc in __new__(cls, inputs, outputs, window_length, mask, *args, **kwargs)
    472             mask=mask,
    473             window_length=window_length,
--> 474             *args, **kwargs
    475         )
    476 

/build/src/qexec_repo/zipline_repo/zipline/pipeline/term.pyc in __new__(cls, domain, dtype, missing_value, window_safe, ndim, *args, **kwargs)
    129                     ndim=ndim,
    130                     params=params,
--> 131                     *args, **kwargs
    132                 )
    133             return new_instance

/build/src/qexec_repo/zipline_repo/zipline/pipeline/term.pyc in _init(self, inputs, outputs, window_length, mask, *args, **kwargs)
    480         self.window_length = window_length
    481         self.mask = mask
--> 482         return super(ComputableTerm, self)._init(*args, **kwargs)
    483 
    484     @classmethod

/build/src/qexec_repo/zipline_repo/zipline/pipeline/term.pyc in _init(self, domain, dtype, missing_value, window_safe, ndim, params)
    267         # should set this flag to True.
    268         self._subclass_called_super_validate = False
--> 269         self._validate()
    270         assert self._subclass_called_super_validate, (
    271             "Term._validate() was not called.\n"

/build/src/qexec_repo/zipline_repo/zipline/pipeline/mixins.pyc in _validate(self)
     40     """
     41     def _validate(self):
---> 42         super(PositiveWindowLengthMixin, self)._validate()
     43         if not self.windowed:
     44             raise WindowLengthNotPositive(window_length=self.window_length)

/build/src/qexec_repo/zipline_repo/zipline/pipeline/mixins.pyc in _validate(self)
     85 
     86     def _validate(self):
---> 87         super(RestrictedDTypeMixin, self)._validate()
     88         assert self.ALLOWED_DTYPES is not NotSpecified, (
     89             "ALLOWED_DTYPES not supplied on subclass "

/build/src/qexec_repo/zipline_repo/zipline/pipeline/term.pyc in _validate(self)
    537         if self.window_length:
    538             for child in self.inputs:
--> 539                 if not child.window_safe:
    540                     raise NonWindowSafeInput(parent=self, child=child)
    541 

AttributeError: 'numpy.int64' object has no attribute 'window_safe'
In [164]:
idx = pd.date_range('01-01-2002 00:00:00+00:00', '09-30-2002 00:00:00+00:00')
vixx = vixx.reindex(idx, method='backfill')
In [165]:
 
AttributeErrorTraceback (most recent call last)
<ipython-input-165-e893e74a3714> in <module>()
     21 pipe = Pipeline()
     22 
---> 23 pipe.add(MyFactor(), 'MyFactor')
     24 
     25 Pipe = Pipeline(

/build/src/qexec_repo/zipline_repo/zipline/pipeline/mixins.pyc in __new__(cls, inputs, outputs, window_length, mask, dtype, missing_value, ndim, **kwargs)
    138             missing_value=missing_value,
    139             ndim=ndim,
--> 140             **kwargs
    141         )
    142 

/build/src/qexec_repo/zipline_repo/zipline/pipeline/term.pyc in __new__(cls, inputs, outputs, window_length, mask, *args, **kwargs)
    472             mask=mask,
    473             window_length=window_length,
--> 474             *args, **kwargs
    475         )
    476 

/build/src/qexec_repo/zipline_repo/zipline/pipeline/term.pyc in __new__(cls, domain, dtype, missing_value, window_safe, ndim, *args, **kwargs)
    129                     ndim=ndim,
    130                     params=params,
--> 131                     *args, **kwargs
    132                 )
    133             return new_instance

/build/src/qexec_repo/zipline_repo/zipline/pipeline/term.pyc in _init(self, inputs, outputs, window_length, mask, *args, **kwargs)
    480         self.window_length = window_length
    481         self.mask = mask
--> 482         return super(ComputableTerm, self)._init(*args, **kwargs)
    483 
    484     @classmethod

/build/src/qexec_repo/zipline_repo/zipline/pipeline/term.pyc in _init(self, domain, dtype, missing_value, window_safe, ndim, params)
    267         # should set this flag to True.
    268         self._subclass_called_super_validate = False
--> 269         self._validate()
    270         assert self._subclass_called_super_validate, (
    271             "Term._validate() was not called.\n"

/build/src/qexec_repo/zipline_repo/zipline/pipeline/mixins.pyc in _validate(self)
     40     """
     41     def _validate(self):
---> 42         super(PositiveWindowLengthMixin, self)._validate()
     43         if not self.windowed:
     44             raise WindowLengthNotPositive(window_length=self.window_length)

/build/src/qexec_repo/zipline_repo/zipline/pipeline/mixins.pyc in _validate(self)
     85 
     86     def _validate(self):
---> 87         super(RestrictedDTypeMixin, self)._validate()
     88         assert self.ALLOWED_DTYPES is not NotSpecified, (
     89             "ALLOWED_DTYPES not supplied on subclass "

/build/src/qexec_repo/zipline_repo/zipline/pipeline/term.pyc in _validate(self)
    537         if self.window_length:
    538             for child in self.inputs:
--> 539                 if not child.window_safe:
    540                     raise NonWindowSafeInput(parent=self, child=child)
    541 

AttributeError: 'numpy.int64' object has no attribute 'window_safe'
In [ ]:
 
In [ ]:
In [ ]:
In [ ]:
 
In [ ]:
 
In [163]:
 
AttributeErrorTraceback (most recent call last)
<ipython-input-163-42081f40902b> in <module>()
      5 from quantopian.pipeline.data.builtin import USEquityPricing
      6 
----> 7 class MyFactor(CustomFactor):
      8     inputs = vixx['Price'].latest
      9     window_length = 5

<ipython-input-163-42081f40902b> in MyFactor()
      6 
      7 class MyFactor(CustomFactor):
----> 8     inputs = vixx['Price'].latest
      9     window_length = 5
     10 

/usr/local/lib/python2.7/dist-packages/pandas/core/generic.pyc in __getattr__(self, name)
   2670             if name in self._info_axis:
   2671                 return self[name]
-> 2672             return object.__getattribute__(self, name)
   2673 
   2674     def __setattr__(self, name, value):

AttributeError: 'Series' object has no attribute 'latest'
In [157]:
run_pipeline(pipe, start_date='2015-11-01', end_date='2015-11-25')
Out[157]:
2015-11-02 00:00:00+00:00 Equity(2 [ARNC])
Equity(21 [AAME])
Equity(24 [AAPL])
Equity(25 [ARNC_PR])
Equity(31 [ABAX])
Equity(39 [DDC])
Equity(41 [ARCB])
Equity(52 [ABM])
Equity(53 [ABMD])
Equity(62 [ABT])
Equity(64 [ABX])
Equity(66 [AB])
Equity(67 [ADSK])
Equity(69 [ACAT])
Equity(70 [VBF])
Equity(76 [TAP])
Equity(84 [ACET])
Equity(86 [ACG])
Equity(88 [ACI])
Equity(100 [IEP])
Equity(106 [ACU])
Equity(110 [ACXM])
Equity(112 [ACY])
Equity(114 [ADBE])
Equity(117 [AEY])
Equity(122 [ADI])
Equity(128 [ADM])
Equity(134 [SXCL])
Equity(149 [ADX])
Equity(153 [AE])
... ...
2015-11-25 00:00:00+00:00 Equity(49587 [BLVD_W])
Equity(49588 [PRME])
Equity(49589 [CERC_W])
Equity(49590 [CERC_Z])
Equity(49591 [CERC])
Equity(49592 [GSD])
Equity(49593 [IAGG])
Equity(49594 [INST])
Equity(49595 [JHA])
Equity(49597 [MESO])
Equity(49599 [ANDA_U])
Equity(49600 [CSC_WI])
Equity(49601 [CSRA_WI])
Equity(49603 [COYN_W])
Equity(49605 [CONG])
Equity(49606 [MIME])
Equity(49607 [AXSM])
Equity(49608 [MTCH])
Equity(49609 [AFGH])
Equity(49610 [SQ])
Equity(49611 [KTOV])
Equity(49613 [BOXL])
Equity(49614 [KTOV_W])
Equity(49615 [DLTH])
Equity(49616 [ETHO])
Equity(49617 [HGSD])
Equity(49618 [NBLX])
Equity(49619 [TRUK])
Equity(49622 [ASET])
Equity(49623 [PMVAU])

151176 rows × 0 columns

In [ ]: