当前位置: 首页>>代码示例>>Python>>正文


Python pipeline.PipeLine类代码示例

本文整理汇总了Python中algotrader.technical.pipeline.PipeLine的典型用法代码示例。如果您正苦于以下问题:Python PipeLine类的具体用法?Python PipeLine怎么用?Python PipeLine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PipeLine类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, input_lhs, input_rhs, func, name, length=1, input_key='close', desc="Pairwise"):
        super(Pairwise, self).__init__(name, [input_lhs, input_rhs], input_key, length=length, desc=desc)
        self.lhs_name = PipeLine.get_input_name(input_lhs)
        self.rhs_name = PipeLine.get_input_name(input_rhs)
        self.func = func
        self.is_input_pipeline = False

        if isinstance(input_lhs, PipeLine) and not isinstance(input_rhs, PipeLine):
            raise TypeError("input_lhs has to be the same type as input_rhs as Pipeline")

        if isinstance(input_lhs, Indicator) and not isinstance(input_rhs, Indicator):
            raise TypeError("input_lhs has to be the same type as input_rhs as Indicator")

        if isinstance(input_lhs, DataSeries) and not isinstance(input_rhs, DataSeries):
            raise TypeError("input_lhs has to be the same type as input_rhs as DataSeries")

        if isinstance(input_lhs, PipeLine):
            self.is_input_pipeline = True
            try:
                np.testing.assert_almost_equal(input_lhs.shape(), input_rhs.shape(), 10)
                self.__shape = input_lhs.shape()
            except AssertionError as e:
                raise ValueError("input_lhs shape should be the same as input_rhs in Pairwise Pipeline operation!")
        else:
            self.__shape = np.array([1, 1])

        super(Pairwise, self).update_all()
开发者ID:alexcwyu,项目名称:python-trading,代码行数:27,代码来源:pairwise.py

示例2: __init__

 def __init__(self, inputs, input_key="close", desc="Cross Sessional SignPower"):
     super(SignPower, self).__init__(
         inputs=inputs,
         np_func=lambda x: np_sign_to_value(x) * np.power(x, e),
         name=PipeLine.get_name(SignPower.__name__, inputs, input_key),
         input_key=input_key,
         length=1,
         desc=desc,
     )
开发者ID:alexcwyu,项目名称:python-trading,代码行数:9,代码来源:cross_sessional_apply.py

示例3: get_name

 def get_name(indicator_name, input_lhs, input_rhs, input_key, *args):
     return PipeLine.get_name(indicator_name,
                              inputs=[input_lhs, input_rhs],
                              input_key=input_key, *args)
开发者ID:alexcwyu,项目名称:python-trading,代码行数:4,代码来源:pairwise.py

示例4: __init__

 def __init__(self, inputs, input_key='close', desc="Cross Sessional Sign"):
     super(Sign, self).__init__(inputs=inputs, np_func=lambda x: np_sign_to_value(x),
                                   name=PipeLine.get_name(Sign.__name__, inputs, input_key),
                                   input_key=input_key, length=1, desc=desc)
开发者ID:jjchan121,项目名称:python-trading,代码行数:4,代码来源:cross_sessional_apply.py

示例5: __init__

 def __init__(self, inputs, input_key='close', desc="Bundle and Sync DataSeries to Vector"):
     super(MakeVector, self).__init__(PipeLine.get_name(MakeVector.__name__, inputs, input_key),
                                               inputs,  input_key, length=1, desc=desc)
     super(MakeVector, self).update_all()
开发者ID:alexcwyu,项目名称:python-trading,代码行数:4,代码来源:make_vector.py

示例6: __init__

 def __init__(self, inputs, ascending=True, input_key='close', desc="Rank"):
     self.ascending = ascending
     super(Rank, self).__init__(PipeLine.get_name(Rank.__name__, inputs, input_key),
                                inputs, input_key, length=1, desc=desc)
开发者ID:alexcwyu,项目名称:python-trading,代码行数:4,代码来源:rank.py

示例7: __init__

 def __init__(self, inputs, input_key='close', length=30, desc="Correlation"):
     super(Corr, self).__init__(PipeLine.get_name(Corr.__name__, input),
                                input,  input_key, length, desc)
     super(Corr, self).update_all()
开发者ID:jjchan121,项目名称:python-trading,代码行数:4,代码来源:corr.py


注:本文中的algotrader.technical.pipeline.PipeLine类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。