id
int64
0
328k
repository_name
stringlengths
7
58
file_path
stringlengths
9
302
class_name
stringlengths
5
256
human_written_code
stringlengths
16
2.16M
class_skeleton
stringlengths
18
1.49M
⌀
total_program_units
int64
1
1.76k
total_doc_str
int64
0
771
AvgCountLine
float64
0
7.89k
AvgCountLineBlank
float64
0
297
AvgCountLineCode
float64
0
7.89k
AvgCountLineComment
float64
0
7.89k
AvgCyclomatic
float64
0
130
CommentToCodeRatio
float64
0
168
CountClassBase
float64
0
40
CountClassCoupled
float64
0
583
CountClassCoupledModified
float64
0
575
CountClassDerived
float64
0
5.35k
CountDeclInstanceMethod
float64
0
529
CountDeclInstanceVariable
float64
0
296
CountDeclMethod
float64
0
599
CountDeclMethodAll
float64
0
1.12k
CountLine
float64
1
40.4k
CountLineBlank
float64
0
8.16k
CountLineCode
float64
1
25.7k
CountLineCodeDecl
float64
1
8.15k
CountLineCodeExe
float64
0
24.2k
CountLineComment
float64
0
16.5k
CountStmt
float64
1
9.71k
CountStmtDecl
float64
1
8.15k
CountStmtExe
float64
0
9.69k
MaxCyclomatic
float64
0
759
MaxInheritanceTree
float64
0
16
MaxNesting
float64
0
34
SumCyclomatic
float64
0
2.9k
16,500
quantopian/zipline
quantopian_zipline/zipline/pipeline/classifiers/classifier.py
zipline.pipeline.classifiers.classifier.Classifier
from functools import partial from zipline.utils.input_validation import expect_types, expect_dtypes from zipline.pipeline.term import ComputableTerm from ..mixins import CustomTermMixin, LatestMixin, PositiveWindowLengthMixin, RestrictedDTypeMixin, SingleInputMixin, StandardOutputs from zipline.lib.labelarray import L...
class Classifier(RestrictedDTypeMixin, ComputableTerm): ''' A Pipeline expression computing a categorical output. Classifiers are most commonly useful for describing grouping keys for complex transformations on Factor outputs. For example, Factor.demean() and Factor.zscore() can be passed a Classif...
26
12
22
2
11
9
2
0.79
2
17
6
4
13
1
14
49
373
45
183
34
156
145
76
26
59
7
3
2
31
16,501
quantopian/zipline
quantopian_zipline/zipline/pipeline/classifiers/classifier.py
zipline.pipeline.classifiers.classifier.CustomClassifier
from ..mixins import CustomTermMixin, LatestMixin, PositiveWindowLengthMixin, RestrictedDTypeMixin, SingleInputMixin, StandardOutputs from zipline.errors import UnsupportedDataType from zipline.utils.numpy_utils import categorical_dtype, int64_dtype, vectorized_is_element from zipline.pipeline.dtypes import CLASSIFIER_...
class CustomClassifier(PositiveWindowLengthMixin, StandardOutputs, CustomTermMixin, Classifier): ''' Base class for user-defined Classifiers. Does not suppport multiple outputs. See Also -------- zipline.pipeline.CustomFactor zipline.pipeline.CustomFilter ''' def _validate(self): ...
3
2
16
1
12
4
3
0.54
4
3
1
5
2
1
2
59
47
4
28
7
22
15
13
3
10
4
4
2
6
16,502
quantopian/zipline
quantopian_zipline/zipline/pipeline/classifiers/classifier.py
zipline.pipeline.classifiers.classifier.Everything
from zipline.utils.numpy_utils import categorical_dtype, int64_dtype, vectorized_is_element from numpy import where, isnan, nan, zeros class Everything(Classifier): """ A trivial classifier that classifies everything the same. """ dtype = int64_dtype window_length = 0 inputs = () missing_va...
class Everything(Classifier): ''' A trivial classifier that classifies everything the same. ''' def _compute(self, arrays, dates, assets, mask): pass
2
1
6
0
6
0
1
0.27
1
0
0
0
1
0
1
50
15
1
11
6
9
3
7
6
5
1
4
0
1
16,503
quantopian/zipline
quantopian_zipline/zipline/pipeline/classifiers/classifier.py
zipline.pipeline.classifiers.classifier.InvalidClassifierComparison
class InvalidClassifierComparison(TypeError): def __init__(self, classifier, compval): super(InvalidClassifierComparison, self).__init__("Can't compare classifier of dtype {dtype} to value {value} of type {type}.".format(dtype=classifier.dtype, value=compval, type=type(compval).__name__))
class InvalidClassifierComparison(TypeError): def __init__(self, classifier, compval): pass
2
0
9
0
9
0
1
0
1
2
0
0
1
0
1
12
10
0
10
2
8
0
3
2
1
1
4
0
1
16,504
quantopian/zipline
quantopian_zipline/zipline/pipeline/classifiers/classifier.py
zipline.pipeline.classifiers.classifier.Quantiles
from zipline.lib.quantiles import quantiles from numpy import where, isnan, nan, zeros from ..mixins import CustomTermMixin, LatestMixin, PositiveWindowLengthMixin, RestrictedDTypeMixin, SingleInputMixin, StandardOutputs from zipline.utils.numpy_utils import categorical_dtype, int64_dtype, vectorized_is_element class ...
class Quantiles(SingleInputMixin, Classifier): ''' A classifier computing quantiles over an input. ''' def _compute(self, arrays, dates, assets, mask): pass def graph_repr(self): '''Short repr to use when rendering Pipeline graphs.''' pass
3
2
6
0
5
2
1
0.43
2
1
0
0
2
0
2
52
22
2
14
11
11
6
14
11
11
1
4
0
2
16,505
quantopian/zipline
quantopian_zipline/zipline/pipeline/classifiers/classifier.py
zipline.pipeline.classifiers.classifier.Relabel
from ..mixins import CustomTermMixin, LatestMixin, PositiveWindowLengthMixin, RestrictedDTypeMixin, SingleInputMixin, StandardOutputs from zipline.utils.numpy_utils import categorical_dtype, int64_dtype, vectorized_is_element from zipline.lib.labelarray import LabelArray from zipline.utils.input_validation import expec...
class Relabel(SingleInputMixin, Classifier): ''' A classifier applying a relabeling function on the result of another classifier. Parameters ---------- arg : zipline.pipeline.Classifier Term produceing the input to be relabeled. relabel_func : function(LabelArray) -> LabelArray ...
5
1
11
1
10
0
2
0.44
2
3
1
0
2
0
2
52
40
4
25
9
20
11
13
8
10
2
4
1
3
16,506
quantopian/zipline
quantopian_zipline/zipline/pipeline/data/dataset.py
zipline.pipeline.data.dataset.BoundColumn
from zipline.currency import Currency from zipline.pipeline.domain import Domain, GENERIC from zipline.pipeline.filters import Filter, Latest as LatestFilter from zipline.utils.input_validation import coerce_types, ensure_dtype, expect_types from zipline.pipeline.term import AssetExists, LoadableTerm, validate_dtype fr...
class BoundColumn(LoadableTerm): ''' A column of data that's been concretely bound to a particular dataset. Attributes ---------- dtype : numpy.dtype The dtype of data produced when this column is loaded. latest : zipline.pipeline.LoadableTerm A :class:`~zipline.pipeline.Filter`...
28
12
11
1
8
2
1
0.41
1
6
0
0
17
8
18
33
252
30
158
68
108
64
67
35
48
3
3
1
25
16,507
quantopian/zipline
quantopian_zipline/zipline/pipeline/data/dataset.py
zipline.pipeline.data.dataset.Column
from zipline.utils.input_validation import coerce_types, ensure_dtype, expect_types from zipline.pipeline.sentinels import NotSpecified, sentinel from zipline.utils.preprocess import preprocess from zipline.utils.numpy_utils import float64_dtype, NoDefaultMissingValue class Column(object): """ An abstract colu...
class Column(object): ''' An abstract column of data, not yet associated with a dataset. ''' @preprocess(dtype=ensure_dtype) def __init__(self, dtype, missing_value=NotSpecified, doc=None, metadata=None, currency_aware=False): pass def bind(self, name): ''' Bind a `Colu...
4
2
15
1
13
2
2
0.21
1
2
1
0
2
5
2
2
36
2
28
14
19
6
11
8
8
3
1
1
4
16,508
quantopian/zipline
quantopian_zipline/zipline/pipeline/data/dataset.py
zipline.pipeline.data.dataset.DataSet
from zipline.utils.string_formatting import bulleted_list from six import iteritems, with_metaclass from zipline.pipeline.domain import Domain, GENERIC class DataSet(with_metaclass(DataSetMeta, object)): """ Base class for Pipeline datasets. A :class:`DataSet` is defined by two parts: 1. A collection...
class DataSet(with_metaclass(DataSetMeta, object)): ''' Base class for Pipeline datasets. A :class:`DataSet` is defined by two parts: 1. A collection of :class:`~zipline.pipeline.data.Column` objects that describe the queryable attributes of the dataset. 2. A :class:`~zipline.pipeline.domain...
3
2
39
4
20
15
3
3.08
1
3
1
20
0
0
1
1
120
22
24
7
21
74
12
6
10
3
1
2
3
16,509
quantopian/zipline
quantopian_zipline/zipline/pipeline/data/dataset.py
zipline.pipeline.data.dataset.DataSetFamily
from collections import namedtuple, OrderedDict from six import iteritems, with_metaclass from zipline.pipeline.domain import Domain, GENERIC from zipline.utils.formatting import s, plural from itertools import repeat class DataSetFamily(with_metaclass(DataSetFamilyMeta)): """ Base class for Pipeline dataset f...
class DataSetFamily(with_metaclass(DataSetFamilyMeta)): ''' Base class for Pipeline dataset families. Dataset families are used to represent data where the unique identifier for a row requires more than just asset and date coordinates. A :class:`DataSetFamily` can also be thought of as a collection...
11
4
27
3
20
5
3
0.8
1
11
1
13
0
0
3
3
194
35
89
28
78
71
49
23
42
8
1
2
12
16,510
quantopian/zipline
quantopian_zipline/zipline/pipeline/data/dataset.py
zipline.pipeline.data.dataset.DataSetFamilyLookupError
from textwrap import dedent class DataSetFamilyLookupError(AttributeError): """Exception thrown when a column is accessed on a DataSetFamily instead of on the result of a slice. Parameters ---------- family_name : str The name of the DataSetFamily on which the access occurred. column_n...
class DataSetFamilyLookupError(AttributeError): '''Exception thrown when a column is accessed on a DataSetFamily instead of on the result of a slice. Parameters ---------- family_name : str The name of the DataSetFamily on which the access occurred. column_name : str The name of...
3
1
8
1
6
1
1
0.77
1
0
0
0
2
2
2
13
27
4
13
5
10
10
6
5
3
1
4
0
2
16,511
quantopian/zipline
quantopian_zipline/zipline/pipeline/data/dataset.py
zipline.pipeline.data.dataset.DataSetFamilyMeta
from collections import namedtuple, OrderedDict import abc class DataSetFamilyMeta(abc.ABCMeta): def __new__(cls, name, bases, dict_): columns = {} for k, v in dict_.items(): if isinstance(v, Column): columns[k] = v dict_[k] = _DataSetFamilyColumn(k) ...
class DataSetFamilyMeta(abc.ABCMeta): def __new__(cls, name, bases, dict_): pass class BaseSlice(self._SliceType): def __repr__(self): pass
4
0
25
4
19
3
3
0.13
1
8
3
0
2
0
2
22
53
10
38
12
34
5
24
11
20
5
3
2
6
16,512
quantopian/zipline
quantopian_zipline/zipline/pipeline/data/dataset.py
zipline.pipeline.data.dataset.DataSetFamilySlice
class DataSetFamilySlice(DataSet): """Marker type for slices of a :class:`zipline.pipeline.data.dataset.DataSetFamily` objects """
class DataSetFamilySlice(DataSet): '''Marker type for slices of a :class:`zipline.pipeline.data.dataset.DataSetFamily` objects ''' pass
1
1
0
0
0
0
0
3
1
0
0
0
0
0
0
1
4
0
1
1
0
3
1
1
0
0
2
0
0
16,513
quantopian/zipline
quantopian_zipline/zipline/pipeline/data/dataset.py
zipline.pipeline.data.dataset.DataSetMeta
from six import iteritems, with_metaclass from zipline.pipeline.domain import Domain, GENERIC from zipline.utils.input_validation import coerce_types, ensure_dtype, expect_types from weakref import WeakKeyDictionary class DataSetMeta(type): """ Metaclass for DataSets Supplies name and dataset information ...
class DataSetMeta(type): ''' Metaclass for DataSets Supplies name and dataset information to Column attributes, and manages families of specialized dataset. ''' def __new__(mcls, name, bases, dict_): pass @expect_types(domain=Domain) def specialize(self, domain): ''' ...
13
3
15
2
9
4
2
0.57
1
8
1
0
9
2
9
22
160
23
87
26
74
50
58
21
48
6
2
2
21
16,514
quantopian/zipline
quantopian_zipline/zipline/pipeline/data/dataset.py
zipline.pipeline.data.dataset._BoundColumnDescr
from zipline.utils.numpy_utils import float64_dtype, NoDefaultMissingValue from zipline.pipeline.term import AssetExists, LoadableTerm, validate_dtype class _BoundColumnDescr(object): """ Intermediate class that sits on `DataSet` objects and returns memoized `BoundColumn` objects when requested. This ...
class _BoundColumnDescr(object): ''' Intermediate class that sits on `DataSet` objects and returns memoized `BoundColumn` objects when requested. This exists so that subclasses of DataSets don't share columns with their parent classes. ''' def __init__(self, dtype, missing_value, name,...
3
2
24
1
18
6
2
0.46
1
2
2
0
2
6
2
2
57
3
37
14
28
17
12
8
9
2
1
1
3
16,515
quantopian/zipline
quantopian_zipline/zipline/pipeline/data/dataset.py
zipline.pipeline.data.dataset._DataSetFamilyColumn
class _DataSetFamilyColumn(object): """Descriptor used to raise a helpful error when a column is accessed on a DataSetFamily instead of on the result of a slice. Parameters ---------- column_names : str The name of the column. """ def __init__(self, column_name): self.colum...
class _DataSetFamilyColumn(object): '''Descriptor used to raise a helpful error when a column is accessed on a DataSetFamily instead of on the result of a slice. Parameters ---------- column_names : str The name of the column. ''' def __init__(self, column_name): pass d...
3
1
4
0
4
0
1
0.88
1
1
1
0
2
1
2
2
17
2
8
4
5
7
5
4
2
1
1
0
2
16,516
quantopian/zipline
quantopian_zipline/zipline/pipeline/data/equity_pricing.py
zipline.pipeline.data.equity_pricing.EquityPricing
from zipline.utils.numpy_utils import float64_dtype, categorical_dtype from .dataset import Column, DataSet class EquityPricing(DataSet): """ :class:`~zipline.pipeline.data.DataSet` containing daily trading prices and volumes. """ open = Column(float64_dtype, currency_aware=True) high = Column(...
class EquityPricing(DataSet): ''' :class:`~zipline.pipeline.data.DataSet` containing daily trading prices and volumes. ''' pass
1
1
0
0
0
0
0
0.57
1
0
0
0
0
0
0
1
11
0
7
6
6
4
7
6
6
0
2
0
0
16,517
quantopian/zipline
quantopian_zipline/zipline/pipeline/domain.py
zipline.pipeline.domain.AmbiguousDomain
from zipline.utils.formatting import bulleted_list from textwrap import dedent class AmbiguousDomain(Exception): """ Raised when we attempt to infer a domain from a collection of mixed terms. """ _TEMPLATE = dedent(' Found terms with conflicting domains:\n {domains}') def __init__(se...
class AmbiguousDomain(Exception): ''' Raised when we attempt to infer a domain from a collection of mixed terms. ''' def __init__(self, domains): pass def __str__(self): pass
3
1
3
0
3
0
1
0.25
1
0
0
0
2
1
2
12
17
2
12
5
9
3
6
5
3
1
3
0
2
16,518
quantopian/zipline
quantopian_zipline/zipline/pipeline/domain.py
zipline.pipeline.domain.EquityCalendarDomain
import pandas as pd from zipline.utils.input_validation import expect_types, optional import datetime from zipline.utils.memoize import lazyval import numpy as np from trading_calendars import get_calendar class EquityCalendarDomain(Domain): """ An equity domain whose sessions are defined by a named TradingCal...
class EquityCalendarDomain(Domain): ''' An equity domain whose sessions are defined by a named TradingCalendar. Parameters ---------- country_code : str ISO-3166 two-letter country code of the domain calendar_name : str Name of the calendar, to be looked by by trading_calendar.g...
10
1
7
0
6
0
1
0.39
1
2
0
0
6
3
6
6
68
7
44
23
27
17
22
13
15
2
1
1
8
16,519
quantopian/zipline
quantopian_zipline/zipline/pipeline/domain.py
zipline.pipeline.domain.EquitySessionDomain
import pytz from zipline.utils.input_validation import expect_types, optional import pandas as pd import datetime from zipline.utils.pandas_utils import days_at_time class EquitySessionDomain(Domain): """A domain built directly from an index of sessions. Mostly useful for testing. Parameters --------...
class EquitySessionDomain(Domain): '''A domain built directly from an index of sessions. Mostly useful for testing. Parameters ---------- sessions : pd.DatetimeIndex Sessions to use as output labels for pipelines run on this domain. country_code : str ISO 3166 country code of eq...
7
1
7
1
6
0
2
0.48
1
2
0
0
4
4
4
4
57
8
33
21
16
16
16
9
11
3
1
1
6
16,520
quantopian/zipline
quantopian_zipline/zipline/pipeline/domain.py
zipline.pipeline.domain.GenericDomain
class GenericDomain(Domain): """Special singleton class used to represent generic DataSets and Columns. """ def all_sessions(self): raise NotImplementedError("Can't get sessions for generic domain.") @property def country_code(self): raise NotImplementedError("Can't get country cod...
class GenericDomain(Domain): '''Special singleton class used to represent generic DataSets and Columns. ''' def all_sessions(self): pass @property def country_code(self): pass def data_query_cutoff_for_sessions(self, sessions): pass def __repr__(self): ...
6
1
3
0
3
0
1
0.17
1
1
0
0
4
0
4
4
17
3
12
6
6
2
9
5
4
1
1
0
4
16,521
quantopian/zipline
quantopian_zipline/zipline/pipeline/domain.py
zipline.pipeline.domain.IDomain
from interface import default, implements, Interface import pandas as pd class IDomain(Interface): """Domain interface. """ def all_sessions(self): """ Get all trading sessions for the calendar of this domain. This determines the row labels of Pipeline outputs for pipelines run on...
class IDomain(Interface): '''Domain interface. ''' def all_sessions(self): ''' Get all trading sessions for the calendar of this domain. This determines the row labels of Pipeline outputs for pipelines run on this domain. Returns ------- sessions : p...
7
5
15
2
4
9
1
1.9
1
2
0
0
4
0
4
4
69
11
20
8
13
38
11
6
6
2
1
1
5
16,522
quantopian/zipline
quantopian_zipline/zipline/pipeline/engine.py
zipline.pipeline.engine.ExplodingPipelineEngine
class ExplodingPipelineEngine(PipelineEngine): """ A PipelineEngine that doesn't do anything. """ def run_pipeline(self, pipeline, start_date, end_date, hooks=None): raise NoEngineRegistered('Attempted to run a pipeline but no pipeline resources were registered.') def run_chunked_pipeline(...
class ExplodingPipelineEngine(PipelineEngine): ''' A PipelineEngine that doesn't do anything. ''' def run_pipeline(self, pipeline, start_date, end_date, hooks=None): pass def run_chunked_pipeline(self, pipeline, start_date, end_date, chunksize, hooks=None): pass
3
1
8
0
8
0
1
0.19
1
1
1
0
2
0
2
4
20
1
16
8
8
3
5
3
2
1
2
0
2
16,523
quantopian/zipline
quantopian_zipline/zipline/pipeline/engine.py
zipline.pipeline.engine.NoEngineRegistered
class NoEngineRegistered(Exception): """ Raised if a user tries to call pipeline_output in an algorithm that hasn't set up a pipeline engine. """
class NoEngineRegistered(Exception): ''' Raised if a user tries to call pipeline_output in an algorithm that hasn't set up a pipeline engine. ''' pass
1
1
0
0
0
0
0
4
1
0
0
0
0
0
0
10
5
0
1
1
0
4
1
1
0
0
3
0
0
16,524
quantopian/zipline
quantopian_zipline/zipline/pipeline/engine.py
zipline.pipeline.engine.PipelineEngine
from abc import ABCMeta, abstractmethod from six import iteritems, with_metaclass, viewkeys class PipelineEngine(with_metaclass(ABCMeta)): @abstractmethod def run_pipeline(self, pipeline, start_date, end_date, hooks=None): """ Compute values for ``pipeline`` from ``start_date`` to ``end_date``...
class PipelineEngine(with_metaclass(ABCMeta)): @abstractmethod def run_pipeline(self, pipeline, start_date, end_date, hooks=None): ''' Compute values for ``pipeline`` from ``start_date`` to ``end_date``. Parameters ---------- pipeline : zipline.pipeline.Pipeline ...
5
2
38
5
5
28
1
4.67
1
1
0
2
2
0
2
2
80
12
12
10
2
56
5
3
2
1
1
0
2
16,525
quantopian/zipline
quantopian_zipline/zipline/pipeline/engine.py
zipline.pipeline.engine.SimplePipelineEngine
from .graph import maybe_specialize from zipline.lib.adjusted_array import ensure_adjusted_array, ensure_ndarray from zipline.utils.date_utils import compute_date_range_chunks from zipline.utils.numpy_utils import as_column, repeat_first_axis, repeat_last_axis from numpy import array, arange from zipline.utils.pandas_u...
class SimplePipelineEngine(PipelineEngine): ''' PipelineEngine class that computes each term independently. Parameters ---------- get_loader : callable A function that is given a loadable term and returns a PipelineLoader to use to retrieve raw data for that term. asset_finder :...
17
11
45
4
23
18
3
0.81
1
12
5
0
12
7
13
15
680
76
334
107
293
270
156
81
141
8
2
3
45
16,526
quantopian/zipline
quantopian_zipline/zipline/pipeline/expression.py
zipline.pipeline.expression.BadBinaryOperator
class BadBinaryOperator(TypeError): """ Called when a bad binary operation is encountered. Parameters ---------- op : str The attempted operation left : zipline.computable.Term The left hand side of the operation. right : zipline.computable.Term The right hand side o...
class BadBinaryOperator(TypeError): ''' Called when a bad binary operation is encountered. Parameters ---------- op : str The attempted operation left : zipline.computable.Term The left hand side of the operation. right : zipline.computable.Term The right hand side of...
2
1
8
0
8
0
1
1.22
1
2
0
0
1
0
1
12
21
1
9
2
7
11
3
2
1
1
4
0
1
16,527
quantopian/zipline
quantopian_zipline/zipline/pipeline/expression.py
zipline.pipeline.expression.NumericalExpression
from zipline.utils.numpy_utils import bool_dtype from numpy import full, inf from numexpr.necompiler import getExprNames from zipline.pipeline.term import Term, ComputableTerm from numbers import Number import numexpr import re class NumericalExpression(ComputableTerm): """ Term binding to a numexpr expression...
class NumericalExpression(ComputableTerm): ''' Term binding to a numexpr expression. Parameters ---------- expr : string A string suitable for passing to numexpr. All variables in 'expr' should be of the form "x_i", where i is the index of the corresponding factor input in ...
14
7
14
1
9
4
2
0.56
1
14
1
4
10
2
11
45
178
19
102
33
88
57
63
31
51
5
3
2
20
16,528
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/Factor.py
zipline.pipeline.factors.Factor.CustomFactor
from zipline.pipeline.dtypes import CLASSIFIER_DTYPES, FACTOR_DTYPES, FILTER_DTYPES from zipline.utils.numpy_utils import as_column, bool_dtype, coerce_to_dtype, float64_dtype, is_missing from zipline.pipeline.mixins import CustomTermMixin, LatestMixin, PositiveWindowLengthMixin, RestrictedDTypeMixin, SingleInputMixin ...
null
4
1
14
0
14
0
3
2.44
3
7
2
1
3
0
3
65
190
35
45
6
41
110
23
6
19
4
4
2
10
16,529
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/Factor.py
zipline.pipeline.factors.Factor.Factor
from zipline.lib.rank import masked_rankdata_2d, rankdata_1d_descending from scipy.stats import rankdata from zipline.pipeline.sentinels import NotSpecified, NotSpecifiedType from zipline.pipeline.classifiers import Classifier, Everything, Quantiles from zipline.pipeline.expression import BadBinaryOperator, COMPARISONS...
class Factor(RestrictedDTypeMixin, ComputableTerm): ''' Pipeline API expression producing a numerical or date-valued output. Factors are the most commonly-used Pipeline term, representing the result of any computation producing a numerical result. Factors can be combined, both with other Factors an...
41
19
38
6
6
26
1
2.75
2
10
10
6
19
3
20
55
885
145
198
75
125
544
64
30
39
3
3
1
25
16,530
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/Factor.py
zipline.pipeline.factors.Factor.GroupedRowTransform
from zipline.lib.normalize import naive_grouped_rowwise_apply from numpy import empty_like, inf, isnan, nan, where from zipline.pipeline.sentinels import NotSpecified, NotSpecifiedType from zipline.pipeline.classifiers import Classifier, Everything, Quantiles class GroupedRowTransform(Factor): """ A Factor tha...
class GroupedRowTransform(Factor): ''' A Factor that transforms an input factor by applying a row-wise shape-preserving transformation on classifier-defined groups of that Factor. This is most often useful for normalization operators like ``zscore`` or ``demean`` or for performing ranking using...
9
2
10
1
9
0
1
0.55
1
3
1
0
5
2
6
61
103
13
58
22
41
32
24
12
17
3
4
1
8
16,531
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/Factor.py
zipline.pipeline.factors.Factor.Rank
from zipline.pipeline.term import AssetExists, ComputableTerm, Term from zipline.lib.rank import masked_rankdata_2d, rankdata_1d_descending from zipline.pipeline.mixins import CustomTermMixin, LatestMixin, PositiveWindowLengthMixin, RestrictedDTypeMixin, SingleInputMixin from zipline.errors import BadPercentileBounds, ...
class Rank(SingleInputMixin, Factor): ''' A Factor representing the row-wise rank data of another Factor. Parameters ---------- factor : zipline.pipeline.Factor The factor on which to compute ranks. method : str, {'average', 'min', 'max', 'dense', 'ordinal'} The method used to a...
9
3
8
0
7
1
1
0.52
2
5
2
0
6
2
7
63
93
11
54
15
45
28
25
14
17
2
4
1
9
16,532
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/basic.py
zipline.pipeline.factors.basic.AnnualizedVolatility
from zipline.utils.math_utils import nanargmax, nanmax, nanmean, nanstd, nansum from .factor import CustomFactor class AnnualizedVolatility(CustomFactor): """ Volatility. The degree of variation of a series over time as measured by the standard deviation of daily returns. https://en.wikipedia.org/wiki/...
class AnnualizedVolatility(CustomFactor): ''' Volatility. The degree of variation of a series over time as measured by the standard deviation of daily returns. https://en.wikipedia.org/wiki/Volatility_(finance) **Default Inputs:** [Returns(window_length=2)] Parameters ---------- annuali...
2
1
2
0
2
0
1
1.83
1
0
0
0
1
0
1
66
20
3
6
5
4
11
6
5
4
1
5
0
1
16,533
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/basic.py
zipline.pipeline.factors.basic.AverageDollarVolume
from zipline.utils.math_utils import nanargmax, nanmax, nanmean, nanstd, nansum from .factor import CustomFactor from zipline.pipeline.data import EquityPricing class AverageDollarVolume(CustomFactor): """ Average Daily Dollar Volume **Default Inputs:** [EquityPricing.close, EquityPricing.volume] **D...
class AverageDollarVolume(CustomFactor): ''' Average Daily Dollar Volume **Default Inputs:** [EquityPricing.close, EquityPricing.volume] **Default Window Length:** None ''' def compute(self, today, assets, out, close, volume): pass
2
1
2
0
2
0
1
1.25
1
0
0
0
1
0
1
66
12
3
4
3
2
5
4
3
2
1
5
0
1
16,534
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/basic.py
zipline.pipeline.factors.basic.Clip
from .factor import CustomFactor from numpy import arange, average, clip, copyto, exp, fmax, full, isnan, log, NINF, sqrt, sum as np_sum, unique class Clip(CustomFactor): """ Clip (limit) the values in a factor. Given an interval, values outside the interval are clipped to the interval edges. For exam...
class Clip(CustomFactor): ''' Clip (limit) the values in a factor. Given an interval, values outside the interval are clipped to the interval edges. For example, if an interval of ``[0, 1]`` is specified, values smaller than 0 become 0, and values larger than 1 become 1. **Default Window Length...
2
1
2
0
2
0
1
4.4
1
0
0
0
1
0
1
66
35
8
5
4
3
22
5
4
3
1
5
0
1
16,535
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/basic.py
zipline.pipeline.factors.basic.DailyReturns
from zipline.pipeline.data import EquityPricing class DailyReturns(Returns): """ Calculates daily percent change in close price. **Default Inputs**: [EquityPricing.close] """ inputs = [EquityPricing.close] window_safe = True window_length = 2
class DailyReturns(Returns): ''' Calculates daily percent change in close price. **Default Inputs**: [EquityPricing.close] ''' pass
1
1
0
0
0
0
0
1
1
0
0
0
0
0
0
67
9
1
4
4
3
4
4
4
3
0
6
0
0
16,536
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/basic.py
zipline.pipeline.factors.basic.ExponentialWeightedMovingAverage
from numpy import arange, average, clip, copyto, exp, fmax, full, isnan, log, NINF, sqrt, sum as np_sum, unique class ExponentialWeightedMovingAverage(_ExponentialWeightedFactor): """ Exponentially Weighted Moving Average **Default Inputs:** None **Default Window Length:** None Parameters --...
class ExponentialWeightedMovingAverage(_ExponentialWeightedFactor): ''' Exponentially Weighted Moving Average **Default Inputs:** None **Default Window Length:** None Parameters ---------- inputs : length-1 list/tuple of BoundColumn The expression over which to compute the average. ...
2
1
6
0
6
0
1
3.14
1
0
0
0
1
0
1
70
36
7
7
2
5
22
3
2
1
1
6
0
1
16,537
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/basic.py
zipline.pipeline.factors.basic.ExponentialWeightedMovingStdDev
from numpy import arange, average, clip, copyto, exp, fmax, full, isnan, log, NINF, sqrt, sum as np_sum, unique class ExponentialWeightedMovingStdDev(_ExponentialWeightedFactor): """ Exponentially Weighted Moving Standard Deviation **Default Inputs:** None **Default Window Length:** None Paramet...
class ExponentialWeightedMovingStdDev(_ExponentialWeightedFactor): ''' Exponentially Weighted Moving Standard Deviation **Default Inputs:** None **Default Window Length:** None Parameters ---------- inputs : length-1 list/tuple of BoundColumn The expression over which to compute the...
2
1
11
2
9
0
1
2.2
1
0
0
0
1
0
1
70
42
10
10
7
8
22
8
7
6
1
6
0
1
16,538
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/basic.py
zipline.pipeline.factors.basic.LinearWeightedMovingAverage
from zipline.utils.numpy_utils import float64_dtype, ignore_nanwarnings from .factor import CustomFactor from ..mixins import SingleInputMixin from numpy import arange, average, clip, copyto, exp, fmax, full, isnan, log, NINF, sqrt, sum as np_sum, unique from zipline.utils.math_utils import nanargmax, nanmax, nanmean, ...
class LinearWeightedMovingAverage(SingleInputMixin, CustomFactor): ''' Weighted Average Value of an arbitrary column **Default Inputs**: None **Default Window Length**: None ''' def compute(self, today, assets, out, data): pass
2
1
14
4
6
4
1
1.5
2
0
0
0
1
0
1
67
27
7
8
7
6
12
8
7
6
1
5
0
1
16,539
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/basic.py
zipline.pipeline.factors.basic.MaxDrawdown
from numpy import arange, average, clip, copyto, exp, fmax, full, isnan, log, NINF, sqrt, sum as np_sum, unique from .factor import CustomFactor from ..mixins import SingleInputMixin from zipline.utils.math_utils import nanargmax, nanmax, nanmean, nanstd, nansum from zipline.utils.numpy_utils import float64_dtype, igno...
class MaxDrawdown(SingleInputMixin, CustomFactor): ''' Max Drawdown **Default Inputs:** None **Default Window Length:** None ''' def compute(self, today, assets, out, data): pass
2
1
9
1
7
1
2
0.67
2
1
0
0
1
0
1
67
19
4
9
7
7
6
9
7
7
2
5
1
2
16,540
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/basic.py
zipline.pipeline.factors.basic.PeerCount
from ..mixins import SingleInputMixin from .factor import CustomFactor from numpy import arange, average, clip, copyto, exp, fmax, full, isnan, log, NINF, sqrt, sum as np_sum, unique class PeerCount(SingleInputMixin, CustomFactor): """ Peer Count of distinct categories in a given classifier. This factor i...
class PeerCount(SingleInputMixin, CustomFactor): ''' Peer Count of distinct categories in a given classifier. This factor is returned by the classifier instance method peer_count() **Default Inputs:** None **Default Window Length:** 1 ''' def _validate(self): pass def compute...
3
1
9
0
9
1
2
0.42
2
2
0
0
2
0
2
68
30
4
19
6
16
8
10
6
7
2
5
1
3
16,541
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/basic.py
zipline.pipeline.factors.basic.PercentChange
from ..mixins import SingleInputMixin from .factor import CustomFactor class PercentChange(SingleInputMixin, CustomFactor): """ Calculates the percent change over the given window_length. **Default Inputs:** None **Default Window Length:** None Notes ----- Percent change is calculated as...
class PercentChange(SingleInputMixin, CustomFactor): ''' Calculates the percent change over the given window_length. **Default Inputs:** None **Default Window Length:** None Notes ----- Percent change is calculated as ``(new - old) / abs(old)``. ''' def _validate(self): pas...
3
1
6
0
6
0
2
0.62
2
2
0
0
2
0
2
68
26
5
13
4
10
8
8
4
5
2
5
1
3
16,542
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/basic.py
zipline.pipeline.factors.basic.Returns
from .factor import CustomFactor from zipline.pipeline.data import EquityPricing class Returns(CustomFactor): """ Calculates the percent change in close price over the given window_length. **Default Inputs**: [EquityPricing.close] """ inputs = [EquityPricing.close] window_safe = True def ...
class Returns(CustomFactor): ''' Calculates the percent change in close price over the given window_length. **Default Inputs**: [EquityPricing.close] ''' def _validate(self): pass def compute(self, today, assets, out, close): pass
3
1
5
0
5
0
2
0.31
1
2
0
1
2
0
2
67
20
3
13
5
10
4
9
5
6
2
5
1
3
16,543
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/basic.py
zipline.pipeline.factors.basic.SimpleMovingAverage
from ..mixins import SingleInputMixin from zipline.utils.numpy_utils import float64_dtype, ignore_nanwarnings from .factor import CustomFactor from zipline.utils.math_utils import nanargmax, nanmax, nanmean, nanstd, nansum class SimpleMovingAverage(SingleInputMixin, CustomFactor): """ Average Value of an arbit...
class SimpleMovingAverage(SingleInputMixin, CustomFactor): ''' Average Value of an arbitrary column **Default Inputs**: None **Default Window Length**: None ''' def compute(self, today, assets, out, data): pass
2
1
2
0
2
0
1
2
2
0
0
0
1
0
1
67
15
3
4
3
2
8
4
3
2
1
5
0
1
16,544
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/basic.py
zipline.pipeline.factors.basic.VWAP
from zipline.pipeline.data import EquityPricing class VWAP(WeightedAverageValue): """ Volume Weighted Average Price **Default Inputs:** [EquityPricing.close, EquityPricing.volume] **Default Window Length:** None """ inputs = (EquityPricing.close, EquityPricing.volume)
class VWAP(WeightedAverageValue): ''' Volume Weighted Average Price **Default Inputs:** [EquityPricing.close, EquityPricing.volume] **Default Window Length:** None ''' pass
1
1
0
0
0
0
0
2.5
1
0
0
0
0
0
0
66
9
2
2
2
1
5
2
2
1
0
6
0
0
16,545
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/basic.py
zipline.pipeline.factors.basic.WeightedAverageValue
from .factor import CustomFactor from zipline.utils.math_utils import nanargmax, nanmax, nanmean, nanstd, nansum class WeightedAverageValue(CustomFactor): """ Helper for VWAP-like computations. **Default Inputs:** None **Default Window Length:** None """ def compute(self, today, assets, out,...
class WeightedAverageValue(CustomFactor): ''' Helper for VWAP-like computations. **Default Inputs:** None **Default Window Length:** None ''' def compute(self, today, assets, out, base, weight): pass
2
1
2
0
2
0
1
1.67
1
0
0
1
1
0
1
66
10
2
3
2
1
5
3
2
1
1
5
0
1
16,546
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/basic.py
zipline.pipeline.factors.basic._ExponentialWeightedFactor
from .factor import CustomFactor from zipline.utils.input_validation import expect_types from numpy import arange, average, clip, copyto, exp, fmax, full, isnan, log, NINF, sqrt, sum as np_sum, unique from ..mixins import SingleInputMixin from numbers import Number class _ExponentialWeightedFactor(SingleInputMixin, Cu...
class _ExponentialWeightedFactor(SingleInputMixin, CustomFactor): ''' Base class for factors implementing exponential-weighted operations. **Default Inputs:** None **Default Window Length:** None Parameters ---------- inputs : length-1 list or tuple of BoundColumn The expression ove...
9
4
42
5
12
25
2
2.18
2
1
0
2
0
0
3
69
164
24
44
14
31
96
16
7
12
2
5
1
5
16,547
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/events.py
zipline.pipeline.factors.events.BusinessDaysSincePreviousEvent
from .factor import Factor from zipline.utils.numpy_utils import NaTD, busday_count_mask_NaT, datetime64D_dtype, float64_dtype from numpy import newaxis class BusinessDaysSincePreviousEvent(Factor): """ Abstract class for business days since a previous event. Returns the number of **business days** (not tr...
class BusinessDaysSincePreviousEvent(Factor): ''' Abstract class for business days since a previous event. Returns the number of **business days** (not trading days!) since the most recent event date for each asset. This doesn't use trading days for symmetry with BusinessDaysUntilNextEarnings. ...
2
1
11
3
5
3
1
3.63
1
0
0
0
1
0
1
56
49
12
8
6
6
29
8
6
6
1
4
0
1
16,548
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/events.py
zipline.pipeline.factors.events.BusinessDaysUntilNextEvent
from zipline.utils.numpy_utils import NaTD, busday_count_mask_NaT, datetime64D_dtype, float64_dtype from numpy import newaxis from .factor import Factor class BusinessDaysUntilNextEvent(Factor): """ Abstract class for business days since a next event. Returns the number of **business days** (not trading da...
class BusinessDaysUntilNextEvent(Factor): ''' Abstract class for business days since a next event. Returns the number of **business days** (not trading days!) until the next known event date for each asset. This doesn't use trading days because the trading calendar includes information that may...
2
1
11
3
5
3
1
2.13
1
0
0
0
1
0
1
56
33
8
8
6
6
17
8
6
6
1
4
0
1
16,549
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/factor.py
zipline.pipeline.factors.factor.CustomFactor
from zipline.pipeline.sentinels import NotSpecified, NotSpecifiedType from zipline.pipeline.mixins import CustomTermMixin, LatestMixin, PositiveWindowLengthMixin, RestrictedDTypeMixin, SingleInputMixin from zipline.utils.numpy_utils import as_column, bool_dtype, coerce_to_dtype, float64_dtype, is_missing from zipline.e...
null
4
1
14
0
14
0
3
2.44
3
7
2
77
3
0
3
65
190
35
45
6
41
110
23
6
19
4
4
2
10
16,550
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/factor.py
zipline.pipeline.factors.factor.DailySummary
from zipline.pipeline.mixins import CustomTermMixin, LatestMixin, PositiveWindowLengthMixin, RestrictedDTypeMixin, SingleInputMixin from zipline.utils.numpy_utils import as_column, bool_dtype, coerce_to_dtype, float64_dtype, is_missing from numpy import empty_like, inf, isnan, nan, where class DailySummary(SingleInput...
class DailySummary(SingleInputMixin, Factor): '''1D Factor that computes a summary statistic across all assets. ''' def __new__(cls, func, input_, mask, dtype): pass def _compute(self, arrays, dates, assets, mask): pass def __repr__(self): pass
4
1
11
1
9
1
2
0.13
2
2
0
0
3
0
3
59
43
7
32
10
28
4
18
10
14
2
4
1
5
16,551
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/factor.py
zipline.pipeline.factors.factor.Factor
from zipline.pipeline.mixins import CustomTermMixin, LatestMixin, PositiveWindowLengthMixin, RestrictedDTypeMixin, SingleInputMixin from zipline.pipeline.expression import BadBinaryOperator, COMPARISONS, is_comparison, MATH_BINOPS, method_name_for_op, NumericalExpression, NUMEXPR_MATH_FUNCS, UNARY_OPS, unary_op_name fr...
class Factor(RestrictedDTypeMixin, ComputableTerm): ''' Pipeline API expression producing a numerical or date-valued output. Factors are the most commonly-used Pipeline term, representing the result of any computation producing a numerical result. Factors can be combined, both with other Factors an...
41
19
38
6
6
26
1
2.75
2
10
10
8
19
3
20
55
885
145
198
75
125
544
64
30
39
3
3
1
25
16,552
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/factor.py
zipline.pipeline.factors.factor.GroupedRowTransform
from zipline.pipeline.classifiers import Classifier, Everything, Quantiles from zipline.lib.normalize import naive_grouped_rowwise_apply from numpy import empty_like, inf, isnan, nan, where from zipline.pipeline.sentinels import NotSpecified, NotSpecifiedType class GroupedRowTransform(Factor): """ A Factor tha...
class GroupedRowTransform(Factor): ''' A Factor that transforms an input factor by applying a row-wise shape-preserving transformation on classifier-defined groups of that Factor. This is most often useful for normalization operators like ``zscore`` or ``demean`` or for performing ranking using...
9
2
10
1
9
0
1
0.55
1
3
1
0
5
2
6
61
103
13
58
22
41
32
24
12
17
3
4
1
8
16,553
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/factor.py
zipline.pipeline.factors.factor.NumExprFactor
from zipline.pipeline.expression import BadBinaryOperator, COMPARISONS, is_comparison, MATH_BINOPS, method_name_for_op, NumericalExpression, NUMEXPR_MATH_FUNCS, UNARY_OPS, unary_op_name class NumExprFactor(NumericalExpression, Factor): """ Factor computed from a numexpr expression. Parameters --------...
class NumExprFactor(NumericalExpression, Factor): ''' Factor computed from a numexpr expression. Parameters ---------- expr : string A string suitable for passing to numexpr. All variables in 'expr' should be of the form "x_i", where i is the index of the corresponding factor ...
1
1
0
0
0
0
0
7.5
2
0
0
0
0
0
0
66
19
2
2
1
1
15
2
1
1
0
4
0
0
16,554
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/factor.py
zipline.pipeline.factors.factor.Rank
from zipline.utils.numpy_utils import as_column, bool_dtype, coerce_to_dtype, float64_dtype, is_missing from zipline.lib.rank import masked_rankdata_2d, rankdata_1d_descending from zipline.pipeline.term import AssetExists, ComputableTerm, Term from zipline.errors import BadPercentileBounds, UnknownRankMethod, Unsupport...
class Rank(SingleInputMixin, Factor): ''' A Factor representing the row-wise rank data of another Factor. Parameters ---------- factor : zipline.pipeline.Factor The factor on which to compute ranks. method : str, {'average', 'min', 'max', 'dense', 'ordinal'} The method used to a...
9
3
8
0
7
1
1
0.52
2
5
2
0
6
2
7
63
93
11
54
15
45
28
25
14
17
2
4
1
9
16,555
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/factor.py
zipline.pipeline.factors.factor.RecarrayField
from zipline.pipeline.mixins import CustomTermMixin, LatestMixin, PositiveWindowLengthMixin, RestrictedDTypeMixin, SingleInputMixin class RecarrayField(SingleInputMixin, Factor): """ A single field from a multi-output factor. """ def __new__(cls, factor, attribute): return super(RecarrayField,...
class RecarrayField(SingleInputMixin, Factor): ''' A single field from a multi-output factor. ''' def __new__(cls, factor, attribute): pass def _init(self, attribute, *args, **kwargs): pass @classmethod def _static_identity(cls, attribute, *args, **kwargs): pass ...
7
1
5
0
5
0
1
0.12
2
1
0
0
4
1
5
61
32
4
25
8
18
3
12
7
6
1
4
0
5
16,556
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/factor.py
zipline.pipeline.factors.factor.summary_funcs
from zipline.utils.numpy_utils import as_column, bool_dtype, coerce_to_dtype, float64_dtype, is_missing from zipline.utils.math_utils import nanmax, nanmean, nanmedian, nanmin, nanstd, nansum class summary_funcs(object): """Namespace of functions meant to be used with DailySummary. """ @staticmethod d...
class summary_funcs(object): '''Namespace of functions meant to be used with DailySummary. ''' @staticmethod def mean(a, missing_value): pass @staticmethod def stddev(a, missing_value): pass @staticmethod def max(a, missing_value): pass @staticmethod def ...
15
1
2
0
2
0
1
0.09
1
0
0
0
0
0
7
7
33
8
23
16
8
2
16
9
8
1
1
0
7
16,557
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/statistical.py
zipline.pipeline.factors.statistical.RollingLinearRegression
from numpy import broadcast_arrays from zipline.utils.input_validation import expect_bounded, expect_dtypes, expect_types from zipline.pipeline.factors import CustomFactor from zipline.pipeline.sentinels import NotSpecified from scipy.stats import linregress, spearmanr from zipline.errors import IncompatibleTerms clas...
class RollingLinearRegression(CustomFactor): ''' A Factor that performs an ordinary least-squares regression predicting the columns of a given Factor from either the columns of another Factor/BoundColumn or a slice/single column of data. Parameters ---------- dependent : zipline.pipeline.Fa...
6
1
16
1
12
3
2
1.03
1
3
1
1
2
0
2
67
75
8
33
17
23
34
22
12
18
2
5
1
5
16,558
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/statistical.py
zipline.pipeline.factors.statistical.RollingLinearRegressionOfReturns
from zipline.pipeline.sentinels import NotSpecified from zipline.pipeline.term import AssetExists from zipline.pipeline.filters import SingleAsset from .basic import Returns class RollingLinearRegressionOfReturns(RollingLinearRegression): """ Perform an ordinary least-squares regression predicting the returns ...
class RollingLinearRegressionOfReturns(RollingLinearRegression): ''' Perform an ordinary least-squares regression predicting the returns of all other assets on the given asset. Parameters ---------- target : zipline.assets.Asset The asset to regress against all other assets. returns...
2
1
18
0
16
2
1
4.56
1
4
3
0
1
0
1
68
117
17
18
8
12
82
5
4
3
1
6
0
1
16,559
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/statistical.py
zipline.pipeline.factors.statistical.RollingPearson
class RollingPearson(_RollingCorrelation): """ A Factor that computes pearson correlation coefficients between the columns of a given Factor and either the columns of another Factor/BoundColumn or a slice/single column of data. Parameters ---------- base_factor : zipline.pipeline.Factor ...
class RollingPearson(_RollingCorrelation): ''' A Factor that computes pearson correlation coefficients between the columns of a given Factor and either the columns of another Factor/BoundColumn or a slice/single column of data. Parameters ---------- base_factor : zipline.pipeline.Factor ...
2
1
7
0
7
0
1
3.33
1
0
0
1
1
0
1
67
43
4
9
3
7
30
4
3
2
1
6
0
1
16,560
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/statistical.py
zipline.pipeline.factors.statistical.RollingPearsonOfReturns
from zipline.pipeline.filters import SingleAsset from zipline.pipeline.term import AssetExists from .basic import Returns from zipline.pipeline.sentinels import NotSpecified class RollingPearsonOfReturns(RollingPearson): """ Calculates the Pearson product-moment correlation coefficient of the returns of th...
class RollingPearsonOfReturns(RollingPearson): ''' Calculates the Pearson product-moment correlation coefficient of the returns of the given asset with the returns of all other assets. Pearson correlation is what most people mean when they say "correlation coefficient" or "R-value". Parameters ...
2
1
18
0
16
2
1
3.71
1
4
3
0
1
0
1
68
91
11
17
7
11
63
4
3
2
1
7
0
1
16,561
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/statistical.py
zipline.pipeline.factors.statistical.RollingSpearman
from scipy.stats import linregress, spearmanr from numpy import broadcast_arrays class RollingSpearman(_RollingCorrelation): """ A Factor that computes spearman rank correlation coefficients between the columns of a given Factor and either the columns of another Factor/BoundColumn or a slice/single col...
class RollingSpearman(_RollingCorrelation): ''' A Factor that computes spearman rank correlation coefficients between the columns of a given Factor and either the columns of another Factor/BoundColumn or a slice/single column of data. Parameters ---------- base_factor : zipline.pipeline.Fac...
2
1
8
0
4
4
2
5.67
1
1
0
1
1
0
1
67
44
4
6
4
4
34
6
4
4
2
6
1
2
16,562
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/statistical.py
zipline.pipeline.factors.statistical.RollingSpearmanOfReturns
from zipline.pipeline.sentinels import NotSpecified from zipline.pipeline.filters import SingleAsset from .basic import Returns from zipline.pipeline.term import AssetExists class RollingSpearmanOfReturns(RollingSpearman): """ Calculates the Spearman rank correlation coefficient of the returns of the given...
class RollingSpearmanOfReturns(RollingSpearman): ''' Calculates the Spearman rank correlation coefficient of the returns of the given asset with the returns of all other assets. Parameters ---------- target : zipline.assets.Asset The asset to correlate with all other assets. returns...
2
1
18
0
16
2
1
1.65
1
4
3
0
1
0
1
68
48
3
17
7
11
28
4
3
2
1
7
0
1
16,563
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/statistical.py
zipline.pipeline.factors.statistical.SimpleBeta
from zipline.pipeline.filters import SingleAsset from zipline.pipeline.factors import CustomFactor from zipline.pipeline.mixins import StandardOutputs from zipline.pipeline.term import AssetExists from .basic import Returns from zipline.assets import Asset from zipline.utils.numpy_utils import float64_dtype, int64_dtyp...
class SimpleBeta(CustomFactor, StandardOutputs): ''' Factor producing the slope of a regression line between each asset's daily returns to the daily returns of a single "target" asset. Parameters ---------- target : zipline.Asset Asset against which other assets should be regressed. ...
9
2
10
0
9
1
1
0.29
2
7
3
0
5
0
5
71
85
6
62
27
35
18
16
11
10
1
5
0
5
16,564
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/statistical.py
zipline.pipeline.factors.statistical._RollingCorrelation
from zipline.errors import IncompatibleTerms from zipline.pipeline.sentinels import NotSpecified from zipline.utils.input_validation import expect_bounded, expect_dtypes, expect_types from zipline.pipeline.factors import CustomFactor class _RollingCorrelation(CustomFactor): @expect_dtypes(base_factor=ALLOWED_DTYP...
class _RollingCorrelation(CustomFactor): @expect_dtypes(base_factor=ALLOWED_DTYPES, target=ALLOWED_DTYPES) @expect_bounded(correlation_length=(2, None)) def __new__(cls, base_factor, target, correlation_length, mask=NotSpecified): pass
4
0
14
1
13
0
2
0
1
2
1
2
1
0
1
66
18
2
16
7
8
0
5
2
3
2
5
1
2
16,565
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/technical.py
zipline.pipeline.factors.technical.Aroon
from zipline.utils.math_utils import nanargmax, nanargmin, nanmax, nanmean, nanstd, nanmin from zipline.pipeline.data import EquityPricing from numexpr import evaluate from zipline.pipeline.factors import CustomFactor class Aroon(CustomFactor): """ Aroon technical indicator. https://www.fidelity.com/learni...
class Aroon(CustomFactor): ''' Aroon technical indicator. https://www.fidelity.com/learning-center/trading-investing/technical-analysis/technical-indicator-guide/aroon-indicator **Defaults Inputs:** :data:`zipline.pipeline.data.EquityPricing.low`, :data:`zipline.pipeline.data.E...
2
1
20
0
20
0
1
0.48
1
0
0
0
1
0
1
66
38
4
23
7
21
11
9
7
7
1
5
0
1
16,566
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/technical.py
zipline.pipeline.factors.technical.BollingerBands
from zipline.pipeline.data import EquityPricing from zipline.utils.math_utils import nanargmax, nanargmin, nanmax, nanmean, nanstd, nanmin from zipline.pipeline.factors import CustomFactor class BollingerBands(CustomFactor): """ Bollinger Bands technical indicator. https://en.wikipedia.org/wiki/Bollinger_B...
class BollingerBands(CustomFactor): ''' Bollinger Bands technical indicator. https://en.wikipedia.org/wiki/Bollinger_Bands **Default Inputs:** :data:`zipline.pipeline.data.EquityPricing.close` Parameters ---------- inputs : length-1 iterable[BoundColumn] The expression over which to...
2
1
5
0
5
0
1
1.67
1
0
0
0
1
0
1
66
27
3
9
7
7
15
9
6
7
1
5
0
1
16,567
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/technical.py
zipline.pipeline.factors.technical.FastStochasticOscillator
from zipline.pipeline.factors import CustomFactor from zipline.utils.math_utils import nanargmax, nanargmin, nanmax, nanmean, nanstd, nanmin from numexpr import evaluate from zipline.pipeline.data import EquityPricing class FastStochasticOscillator(CustomFactor): """ Fast Stochastic Oscillator Indicator [%K, M...
class FastStochasticOscillator(CustomFactor): ''' Fast Stochastic Oscillator Indicator [%K, Momentum Indicator] https://wiki.timetotrade.eu/Stochastic This stochastic is considered volatile, and varies a lot when used in market analysis. It is recommended to use the slow stochastic oscillator o...
2
1
16
2
14
0
1
0.78
1
0
0
0
1
0
1
66
39
7
18
8
16
14
9
8
7
1
5
0
1
16,568
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/technical.py
zipline.pipeline.factors.technical.IchimokuKinkoHyo
from zipline.pipeline.factors import CustomFactor from zipline.pipeline.data import EquityPricing class IchimokuKinkoHyo(CustomFactor): """Compute the various metrics for the Ichimoku Kinko Hyo (Ichimoku Cloud). http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:ichimoku_cloud **D...
class IchimokuKinkoHyo(CustomFactor): '''Compute the various metrics for the Ichimoku Kinko Hyo (Ichimoku Cloud). http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:ichimoku_cloud **Default Inputs:** :data:`zipline.pipeline.data.EquityPricing.high`, :data:`z...
3
1
16
1
15
0
2
0.38
1
2
0
0
2
0
2
67
69
7
45
19
33
17
16
8
13
3
5
2
4
16,569
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/technical.py
zipline.pipeline.factors.technical.MovingAverageConvergenceDivergenceSignal
from numpy import abs, average, clip, diff, dstack, inf from zipline.pipeline.factors import CustomFactor from zipline.utils.numpy_utils import rolling_window from zipline.utils.input_validation import expect_bounded from zipline.pipeline.data import EquityPricing from .basic import exponential_weights class MovingAve...
class MovingAverageConvergenceDivergenceSignal(CustomFactor): ''' Moving Average Convergence/Divergence (MACD) Signal line https://en.wikipedia.org/wiki/MACD A technical indicator originally developed by Gerald Appel in the late 1970's. MACD shows the relationship between two moving averages and ...
5
1
14
1
14
0
1
0.52
1
2
0
0
3
0
3
68
84
9
50
22
34
26
15
10
11
2
5
1
4
16,570
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/technical.py
zipline.pipeline.factors.technical.RSI
from zipline.pipeline.factors import CustomFactor from zipline.utils.math_utils import nanargmax, nanargmin, nanmax, nanmean, nanstd, nanmin from numpy import abs, average, clip, diff, dstack, inf from numexpr import evaluate from zipline.pipeline.data import EquityPricing from zipline.pipeline.mixins import SingleInpu...
class RSI(SingleInputMixin, CustomFactor): ''' Relative Strength Index **Default Inputs**: :data:`zipline.pipeline.data.EquityPricing.close` **Default Window Length**: 15 ''' def compute(self, today, assets, out, closes): pass
2
1
10
0
10
0
1
0.36
2
0
0
0
1
0
1
67
22
3
14
8
12
5
9
8
7
1
5
0
1
16,571
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/technical.py
zipline.pipeline.factors.technical.RateOfChangePercentage
from numexpr import evaluate from zipline.pipeline.factors import CustomFactor class RateOfChangePercentage(CustomFactor): """ Rate of change Percentage ROC measures the percentage change in price from one period to the next. The ROC calculation compares the current price with the price `n` periods...
class RateOfChangePercentage(CustomFactor): ''' Rate of change Percentage ROC measures the percentage change in price from one period to the next. The ROC calculation compares the current price with the price `n` periods ago. Formula for calculation: ((price - prevPrice) / prevPrice) * 100 ...
2
1
11
0
11
0
1
0.75
1
0
0
0
1
0
1
66
21
0
12
4
10
9
5
4
3
1
5
0
1
16,572
quantopian/zipline
quantopian_zipline/zipline/pipeline/factors/technical.py
zipline.pipeline.factors.technical.TrueRange
from numpy import abs, average, clip, diff, dstack, inf from zipline.utils.math_utils import nanargmax, nanargmin, nanmax, nanmean, nanstd, nanmin from zipline.pipeline.data import EquityPricing from zipline.pipeline.factors import CustomFactor class TrueRange(CustomFactor): """ True Range A technical ind...
class TrueRange(CustomFactor): ''' True Range A technical indicator originally developed by J. Welles Wilder, Jr. Indicates the true degree of daily price change in an underlying. **Default Inputs:** :data:`zipline.pipeline.data.EquityPricing.high`, :data:`zipline.pipeline.d...
2
1
12
0
12
0
1
0.47
1
0
0
0
1
0
1
66
32
4
19
7
17
9
8
7
6
1
5
0
1
16,573
quantopian/zipline
quantopian_zipline/zipline/pipeline/filters/Filter.py
zipline.pipeline.filters.Filter.AllPresent
from zipline.lib.labelarray import LabelArray from numpy import any as np_any, float64, nan, nanpercentile, uint8 from zipline.lib.rank import is_missing, grouped_masked_is_maximal from zipline.pipeline.mixins import CustomTermMixin, IfElseMixin, LatestMixin, PositiveWindowLengthMixin, RestrictedDTypeMixin, SingleInput...
class AllPresent(CustomFilter, SingleInputMixin, StandardOutputs): '''Pipeline filter indicating input term has data for a given window. ''' def _validate(self): pass def compute(self, today, assets, out, value): pass
3
1
8
1
7
0
2
0.13
3
3
1
0
2
0
2
50
20
3
15
3
12
2
9
3
6
2
5
1
4
16,574
quantopian/zipline
quantopian_zipline/zipline/pipeline/filters/Filter.py
zipline.pipeline.filters.Filter.Filter
from zipline.utils.input_validation import expect_types from zipline.utils.numpy_utils import same, bool_dtype, int64_dtype, repeat_first_axis from zipline.pipeline.term import ComputableTerm, Term from zipline.pipeline.dtypes import CLASSIFIER_DTYPES, FACTOR_DTYPES, FILTER_DTYPES from zipline.pipeline.mixins import Cu...
class Filter(RestrictedDTypeMixin, ComputableTerm): ''' Pipeline expression computing a boolean output. Filters are most commonly useful for describing sets of assets to include or exclude for some particular purpose. Many Pipeline API functions accept a ``mask`` argument, which can be supplied a F...
6
2
35
6
14
15
3
1.37
2
6
2
9
2
0
3
38
182
35
62
15
56
85
28
13
24
5
3
1
8
16,575
quantopian/zipline
quantopian_zipline/zipline/pipeline/filters/Filter.py
zipline.pipeline.filters.Filter.MaximumFilter
from zipline.pipeline.mixins import CustomTermMixin, IfElseMixin, LatestMixin, PositiveWindowLengthMixin, RestrictedDTypeMixin, SingleInputMixin, StandardOutputs from zipline.utils.numpy_utils import same, bool_dtype, int64_dtype, repeat_first_axis from numpy import any as np_any, float64, nan, nanpercentile, uint8 fro...
class MaximumFilter(Filter, StandardOutputs): '''Pipeline filter that selects the top asset, possibly grouped and masked. ''' def __new__(cls, factor, groupby, mask): pass def _compute(self, arrays, dates, assets, mask): pass def __repr__(self): pass def graph_repr(s...
5
1
11
1
8
2
1
0.26
2
2
1
0
4
0
4
43
50
6
35
10
29
9
16
10
10
2
4
1
5
16,576
quantopian/zipline
quantopian_zipline/zipline/pipeline/filters/Filter.py
zipline.pipeline.filters.Filter.NotNullFilter
from zipline.lib.labelarray import LabelArray from zipline.pipeline.mixins import CustomTermMixin, IfElseMixin, LatestMixin, PositiveWindowLengthMixin, RestrictedDTypeMixin, SingleInputMixin, StandardOutputs from zipline.lib.rank import is_missing, grouped_masked_is_maximal class NotNullFilter(SingleInputMixin, Filter...
class NotNullFilter(SingleInputMixin, Filter): ''' A Filter indicating whether input values are **not** missing from an input. Parameters ---------- factor : zipline.pipeline.Term The factor to compare against its missing_value. ''' def __new__(cls, term): pass def _co...
3
1
5
0
5
0
2
0.58
2
2
1
0
2
0
2
41
22
3
12
5
9
7
9
5
6
2
4
1
3
16,577
quantopian/zipline
quantopian_zipline/zipline/pipeline/filters/Filter.py
zipline.pipeline.filters.Filter.NullFilter
from zipline.lib.labelarray import LabelArray from zipline.lib.rank import is_missing, grouped_masked_is_maximal from zipline.pipeline.mixins import CustomTermMixin, IfElseMixin, LatestMixin, PositiveWindowLengthMixin, RestrictedDTypeMixin, SingleInputMixin, StandardOutputs class NullFilter(SingleInputMixin, Filter): ...
class NullFilter(SingleInputMixin, Filter): ''' A Filter indicating whether input values are missing from an input. Parameters ---------- factor : zipline.pipeline.Term The factor to compare against its missing_value. ''' def __new__(cls, term): pass def _compute(self,...
3
1
5
0
5
0
2
0.58
2
2
1
0
2
0
2
41
22
3
12
5
9
7
9
5
6
2
4
1
3
16,578
quantopian/zipline
quantopian_zipline/zipline/pipeline/filters/Filter.py
zipline.pipeline.filters.Filter.PercentileFilter
from numpy import any as np_any, float64, nan, nanpercentile, uint8 from zipline.errors import BadPercentileBounds, NonExistentAssetInTimeFrame, UnsupportedDataType from zipline.pipeline.mixins import CustomTermMixin, IfElseMixin, LatestMixin, PositiveWindowLengthMixin, RestrictedDTypeMixin, SingleInputMixin, StandardO...
class PercentileFilter(SingleInputMixin, Filter): ''' A Filter representing assets falling between percentile bounds of a Factor. Parameters ---------- factor : zipline.pipeline.factor.Factor The factor over which to compute percentile bounds. min_percentile : float [0.0, 1.0] T...
8
3
11
0
8
2
1
0.49
2
3
1
0
5
2
6
45
84
8
51
14
43
25
22
13
15
2
4
1
7
16,579
quantopian/zipline
quantopian_zipline/zipline/pipeline/filters/Filter.py
zipline.pipeline.filters.Filter.SingleAsset
from zipline.utils.numpy_utils import same, bool_dtype, int64_dtype, repeat_first_axis from zipline.errors import BadPercentileBounds, NonExistentAssetInTimeFrame, UnsupportedDataType class SingleAsset(Filter): """ A Filter that computes to True only for the given asset. """ inputs = [] window_leng...
class SingleAsset(Filter): ''' A Filter that computes to True only for the given asset. ''' def __new__(cls, asset): pass def _init(self, asset, *args, **kwargs): pass @classmethod def _static_identity(cls, asset, *args, **kwargs): pass def _compute(self, arra...
7
1
4
0
4
1
1
0.26
1
2
1
0
4
1
5
43
34
5
23
12
16
6
18
11
12
2
4
1
6
16,580
quantopian/zipline
quantopian_zipline/zipline/pipeline/filters/filter.py
zipline.pipeline.filters.filter.AllPresent
from numpy import any as np_any, float64, nan, nanpercentile, uint8 from zipline.pipeline.mixins import CustomTermMixin, IfElseMixin, LatestMixin, PositiveWindowLengthMixin, RestrictedDTypeMixin, SingleInputMixin, StandardOutputs from zipline.lib.rank import is_missing, grouped_masked_is_maximal from zipline.lib.labela...
class AllPresent(CustomFilter, SingleInputMixin, StandardOutputs): '''Pipeline filter indicating input term has data for a given window. ''' def _validate(self): pass def compute(self, today, assets, out, value): pass
3
1
8
1
7
0
2
0.13
3
3
1
0
2
0
2
50
20
3
15
3
12
2
9
3
6
2
5
1
4
16,581
quantopian/zipline
quantopian_zipline/zipline/pipeline/filters/filter.py
zipline.pipeline.filters.filter.ArrayPredicate
from zipline.pipeline.mixins import CustomTermMixin, IfElseMixin, LatestMixin, PositiveWindowLengthMixin, RestrictedDTypeMixin, SingleInputMixin, StandardOutputs from zipline.pipeline.term import ComputableTerm, Term from zipline.utils.input_validation import expect_types class ArrayPredicate(SingleInputMixin, Filter)...
class ArrayPredicate(SingleInputMixin, Filter): ''' A filter applying a function from (ndarray, *args) -> ndarray[bool]. Parameters ---------- term : zipline.pipeline.Term Term producing the array over which the predicate will be computed. op : function(ndarray, *args) -> ndarray[bool] ...
5
1
7
0
6
1
1
0.57
2
2
0
0
3
0
3
42
39
4
23
9
18
13
12
8
8
1
4
0
3
16,582
quantopian/zipline
quantopian_zipline/zipline/pipeline/filters/filter.py
zipline.pipeline.filters.filter.CustomFilter
from zipline.errors import BadPercentileBounds, NonExistentAssetInTimeFrame, UnsupportedDataType from zipline.pipeline.dtypes import CLASSIFIER_DTYPES, FACTOR_DTYPES, FILTER_DTYPES from zipline.pipeline.mixins import CustomTermMixin, IfElseMixin, LatestMixin, PositiveWindowLengthMixin, RestrictedDTypeMixin, SingleInput...
null
2
1
17
0
17
0
4
2.22
3
3
1
7
1
1
1
46
67
9
18
3
16
40
9
2
7
4
4
2
4
16,583
quantopian/zipline
quantopian_zipline/zipline/pipeline/filters/filter.py
zipline.pipeline.filters.filter.Filter
from zipline.utils.input_validation import expect_types from zipline.pipeline.expression import BadBinaryOperator, FILTER_BINOPS, method_name_for_op, NumericalExpression from zipline.pipeline.dtypes import CLASSIFIER_DTYPES, FACTOR_DTYPES, FILTER_DTYPES from zipline.errors import BadPercentileBounds, NonExistentAssetIn...
class Filter(RestrictedDTypeMixin, ComputableTerm): ''' Pipeline expression computing a boolean output. Filters are most commonly useful for describing sets of assets to include or exclude for some particular purpose. Many Pipeline API functions accept a ``mask`` argument, which can be supplied a F...
6
2
35
6
14
15
3
1.37
2
6
2
9
2
0
3
38
182
35
62
15
56
85
28
13
24
5
3
1
8
16,584
quantopian/zipline
quantopian_zipline/zipline/pipeline/filters/filter.py
zipline.pipeline.filters.filter.MaximumFilter
from zipline.pipeline.mixins import CustomTermMixin, IfElseMixin, LatestMixin, PositiveWindowLengthMixin, RestrictedDTypeMixin, SingleInputMixin, StandardOutputs from zipline.lib.rank import is_missing, grouped_masked_is_maximal from zipline.utils.numpy_utils import same, bool_dtype, int64_dtype, repeat_first_axis from...
class MaximumFilter(Filter, StandardOutputs): '''Pipeline filter that selects the top asset, possibly grouped and masked. ''' def __new__(cls, factor, groupby, mask): pass def _compute(self, arrays, dates, assets, mask): pass def __repr__(self): pass def graph_repr(s...
5
1
11
1
8
2
1
0.26
2
2
1
0
4
0
4
43
50
6
35
10
29
9
16
10
10
2
4
1
5
16,585
quantopian/zipline
quantopian_zipline/zipline/pipeline/filters/filter.py
zipline.pipeline.filters.filter.NotNullFilter
from zipline.pipeline.mixins import CustomTermMixin, IfElseMixin, LatestMixin, PositiveWindowLengthMixin, RestrictedDTypeMixin, SingleInputMixin, StandardOutputs from zipline.lib.rank import is_missing, grouped_masked_is_maximal from zipline.lib.labelarray import LabelArray class NotNullFilter(SingleInputMixin, Filter...
class NotNullFilter(SingleInputMixin, Filter): ''' A Filter indicating whether input values are **not** missing from an input. Parameters ---------- factor : zipline.pipeline.Term The factor to compare against its missing_value. ''' def __new__(cls, term): pass def _co...
3
1
5
0
5
0
2
0.58
2
2
1
0
2
0
2
41
22
3
12
5
9
7
9
5
6
2
4
1
3
16,586
quantopian/zipline
quantopian_zipline/zipline/pipeline/filters/filter.py
zipline.pipeline.filters.filter.NullFilter
from zipline.pipeline.mixins import CustomTermMixin, IfElseMixin, LatestMixin, PositiveWindowLengthMixin, RestrictedDTypeMixin, SingleInputMixin, StandardOutputs from zipline.lib.rank import is_missing, grouped_masked_is_maximal from zipline.lib.labelarray import LabelArray class NullFilter(SingleInputMixin, Filter): ...
class NullFilter(SingleInputMixin, Filter): ''' A Filter indicating whether input values are missing from an input. Parameters ---------- factor : zipline.pipeline.Term The factor to compare against its missing_value. ''' def __new__(cls, term): pass def _compute(self,...
3
1
5
0
5
0
2
0.58
2
2
1
0
2
0
2
41
22
3
12
5
9
7
9
5
6
2
4
1
3
16,587
quantopian/zipline
quantopian_zipline/zipline/pipeline/filters/filter.py
zipline.pipeline.filters.filter.NumExprFilter
from zipline.pipeline.expression import BadBinaryOperator, FILTER_BINOPS, method_name_for_op, NumericalExpression from zipline.utils.numpy_utils import same, bool_dtype, int64_dtype, repeat_first_axis class NumExprFilter(NumericalExpression, Filter): """ A Filter computed from a numexpr expression. """ ...
class NumExprFilter(NumericalExpression, Filter): ''' A Filter computed from a numexpr expression. ''' @classmethod def create(cls, expr, binds): ''' Helper for creating new NumExprFactors. This is just a wrapper around NumericalExpression.__new__ that always forward...
4
3
10
1
5
5
1
1.09
2
1
0
0
1
0
2
51
26
3
11
4
7
12
5
3
2
1
4
0
2
16,588
quantopian/zipline
quantopian_zipline/zipline/pipeline/filters/filter.py
zipline.pipeline.filters.filter.PercentileFilter
from zipline.errors import BadPercentileBounds, NonExistentAssetInTimeFrame, UnsupportedDataType from numpy import any as np_any, float64, nan, nanpercentile, uint8 from zipline.pipeline.mixins import CustomTermMixin, IfElseMixin, LatestMixin, PositiveWindowLengthMixin, RestrictedDTypeMixin, SingleInputMixin, StandardO...
class PercentileFilter(SingleInputMixin, Filter): ''' A Filter representing assets falling between percentile bounds of a Factor. Parameters ---------- factor : zipline.pipeline.factor.Factor The factor over which to compute percentile bounds. min_percentile : float [0.0, 1.0] T...
8
3
11
0
8
2
1
0.49
2
3
1
0
5
2
6
45
84
8
51
14
43
25
22
13
15
2
4
1
7
16,589
quantopian/zipline
quantopian_zipline/zipline/pipeline/filters/filter.py
zipline.pipeline.filters.filter.SingleAsset
from zipline.errors import BadPercentileBounds, NonExistentAssetInTimeFrame, UnsupportedDataType from zipline.utils.numpy_utils import same, bool_dtype, int64_dtype, repeat_first_axis class SingleAsset(Filter): """ A Filter that computes to True only for the given asset. """ inputs = [] window_leng...
class SingleAsset(Filter): ''' A Filter that computes to True only for the given asset. ''' def __new__(cls, asset): pass def _init(self, asset, *args, **kwargs): pass @classmethod def _static_identity(cls, asset, *args, **kwargs): pass def _compute(self, arra...
7
1
4
0
4
1
1
0.26
1
2
1
0
4
1
5
43
34
5
23
12
16
6
18
11
12
2
4
1
6
16,590
quantopian/zipline
quantopian_zipline/zipline/pipeline/filters/filter.py
zipline.pipeline.filters.filter.StaticAssets
class StaticAssets(StaticSids): """ A Filter that computes True for a specific set of predetermined assets. ``StaticAssets`` is mostly useful for debugging or for interactively computing pipeline terms for a fixed set of assets that are known ahead of time. Parameters ---------- assets...
class StaticAssets(StaticSids): ''' A Filter that computes True for a specific set of predetermined assets. ``StaticAssets`` is mostly useful for debugging or for interactively computing pipeline terms for a fixed set of assets that are known ahead of time. Parameters ---------- assets :...
2
1
3
0
3
0
1
2.5
1
2
0
0
1
0
1
41
16
2
4
3
2
10
4
3
2
1
5
0
1
16,591
quantopian/zipline
quantopian_zipline/zipline/pipeline/filters/filter.py
zipline.pipeline.filters.filter.StaticSids
from zipline.utils.numpy_utils import same, bool_dtype, int64_dtype, repeat_first_axis class StaticSids(Filter): """ A Filter that computes True for a specific set of predetermined sids. ``StaticSids`` is mostly useful for debugging or for interactively computing pipeline terms for a fixed set of sids...
class StaticSids(Filter): ''' A Filter that computes True for a specific set of predetermined sids. ``StaticSids`` is mostly useful for debugging or for interactively computing pipeline terms for a fixed set of sids that are known ahead of time. Parameters ---------- sids : iterable[int...
3
1
3
0
3
0
1
1
1
2
0
1
2
0
2
40
24
4
10
7
7
10
10
7
7
1
4
0
2
16,592
quantopian/zipline
quantopian_zipline/zipline/pipeline/filters/smoothing.py
zipline.pipeline.filters.smoothing.All
from .filter import CustomFilter class All(CustomFilter): """ A Filter requiring that assets produce True for ``window_length`` consecutive days. **Default Inputs:** None **Default Window Length:** None """ def compute(self, today, assets, out, arg): out[:] = arg.sum(axis=0) == s...
class All(CustomFilter): ''' A Filter requiring that assets produce True for ``window_length`` consecutive days. **Default Inputs:** None **Default Window Length:** None ''' def compute(self, today, assets, out, arg): pass
2
1
2
0
2
0
1
2
1
0
0
0
1
0
1
47
12
3
3
2
1
6
3
2
1
1
5
0
1
16,593
quantopian/zipline
quantopian_zipline/zipline/pipeline/filters/smoothing.py
zipline.pipeline.filters.smoothing.Any
from .filter import CustomFilter class Any(CustomFilter): """ A Filter requiring that assets produce True for at least one day in the last ``window_length`` days. **Default Inputs:** None **Default Window Length:** None """ def compute(self, today, assets, out, arg): out[:] = arg...
class Any(CustomFilter): ''' A Filter requiring that assets produce True for at least one day in the last ``window_length`` days. **Default Inputs:** None **Default Window Length:** None ''' def compute(self, today, assets, out, arg): pass
2
1
2
0
2
0
1
2
1
0
0
0
1
0
1
47
12
3
3
2
1
6
3
2
1
1
5
0
1
16,594
quantopian/zipline
quantopian_zipline/zipline/pipeline/filters/smoothing.py
zipline.pipeline.filters.smoothing.AtLeastN
from .filter import CustomFilter class AtLeastN(CustomFilter): """ A Filter requiring that assets produce True for at least N days in the last ``window_length`` days. **Default Inputs:** None **Default Window Length:** None """ params = ('N',) def compute(self, today, assets, out, ar...
class AtLeastN(CustomFilter): ''' A Filter requiring that assets produce True for at least N days in the last ``window_length`` days. **Default Inputs:** None **Default Window Length:** None ''' def compute(self, today, assets, out, arg, N): pass
2
1
2
0
2
0
1
1.5
1
0
0
0
1
0
1
47
14
4
4
3
2
6
4
3
2
1
5
0
1
16,595
quantopian/zipline
quantopian_zipline/zipline/pipeline/graph.py
zipline.pipeline.graph.CyclicDependency
class CyclicDependency(Exception): pass
class CyclicDependency(Exception): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
10
2
0
2
1
1
0
2
1
1
0
3
0
0
16,596
quantopian/zipline
quantopian_zipline/zipline/pipeline/graph.py
zipline.pipeline.graph.ExecutionPlan
import networkx as nx from zipline.utils.memoize import lazyval from .term import LoadableTerm from six import iteritems, itervalues class ExecutionPlan(TermGraph): """ Graph represention of Pipeline Term dependencies that includes metadata about extra rows required to perform computations. Each node ...
class ExecutionPlan(TermGraph): ''' Graph represention of Pipeline Term dependencies that includes metadata about extra rows required to perform computations. Each node in the graph has an `extra_rows` attribute, indicating how many, if any, extra rows we should compute for the node. Extra rows ar...
10
6
34
5
12
17
2
1.64
1
3
1
0
7
2
7
23
275
45
87
43
63
143
42
27
34
3
2
2
14
16,597
quantopian/zipline
quantopian_zipline/zipline/pipeline/graph.py
zipline.pipeline.graph.TermGraph
from .term import LoadableTerm import networkx as nx from six import iteritems, itervalues from zipline.pipeline.visualize import display_graph from zipline.utils.memoize import lazyval class TermGraph(object): """ An abstract representation of Pipeline Term dependencies. This class does not keep any addi...
class TermGraph(object): ''' An abstract representation of Pipeline Term dependencies. This class does not keep any additional metadata about any term relations other than dependency ordering. As such it is only useful in contexts where you care exclusively about order properties (for example, whe...
23
8
10
1
4
4
2
1.15
1
6
2
1
16
3
16
16
206
38
78
35
55
90
63
28
46
4
1
2
26
16,598
quantopian/zipline
quantopian_zipline/zipline/pipeline/hooks/delegate.py
zipline.pipeline.hooks.delegate.DelegatingHooks
from interface import implements from .iface import PipelineHooks, PIPELINE_HOOKS_CONTEXT_MANAGERS from .no import NoHooks class DelegatingHooks(implements(PipelineHooks)): """A PipelineHooks that delegates to one or more other hooks. Parameters ---------- hooks : list[implements(PipelineHooks)] ...
class DelegatingHooks(implements(PipelineHooks)): '''A PipelineHooks that delegates to one or more other hooks. Parameters ---------- hooks : list[implements(PipelineHooks)] Sequence of hooks to delegate to. ''' def __new__(cls, hooks): pass
2
1
13
0
9
4
3
0.93
1
2
1
0
1
0
1
1
29
2
14
3
12
13
9
3
7
3
1
1
3
16,599
quantopian/zipline
quantopian_zipline/zipline/pipeline/hooks/iface.py
zipline.pipeline.hooks.iface.PipelineHooks
from zipline.utils.compat import contextmanager as _contextmanager from interface import Interface class PipelineHooks(Interface): """ Interface for instrumenting SimplePipelineEngine executions. Methods with names like 'on_event()' should be normal methods. They will be called by the engine after the...
class PipelineHooks(Interface): ''' Interface for instrumenting SimplePipelineEngine executions. Methods with names like 'on_event()' should be normal methods. They will be called by the engine after the corresponding event. Methods with names like 'doing_thing()' should be context managers. They ...
9
5
11
1
1
9
1
5.56
1
0
0
0
4
0
4
4
70
11
9
9
0
50
5
5
0
1
1
0
4