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


Python TradingAlgorithm.all_api_methods方法代码示例

本文整理汇总了Python中zipline.TradingAlgorithm.all_api_methods方法的典型用法代码示例。如果您正苦于以下问题:Python TradingAlgorithm.all_api_methods方法的具体用法?Python TradingAlgorithm.all_api_methods怎么用?Python TradingAlgorithm.all_api_methods使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在zipline.TradingAlgorithm的用法示例。


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

示例1: main

# 需要导入模块: from zipline import TradingAlgorithm [as 别名]
# 或者: from zipline.TradingAlgorithm import all_api_methods [as 别名]
def main():
    with open(api.__file__.rstrip('c') + 'i', 'w') as stub:
        # Imports so that Asset et al can be resolved.
        # "from MOD import *" will re-export the imports from the stub, so
        # explicitly importing.
        stub.write(dedent("""\
        from zipline.assets import Asset, Equity, Future
        from zipline.assets.futures import FutureChain
        from zipline.finance.cancel_policy import CancelPolicy
        from zipline.pipeline import Pipeline
        from zipline.protocol import Order
        from zipline.utils.events import EventRule


        """))

        # Sort to generate consistent stub file:
        for api_func in sorted(TradingAlgorithm.all_api_methods(),
                               key=attrgetter('__name__')):
            sig = inspect._signature_bound_method(inspect.signature(api_func))

            indent = ' ' * 4
            stub.write(dedent('''\
                def {func_name}{func_sig}:
                    """'''.format(func_name=api_func.__name__,
                                  func_sig=sig)))
            stub.write(dedent('{indent}{func_doc}'.format(
                func_doc=api_func.__doc__ or '\n',  # handle None docstring
                indent=indent,
            )))
            stub.write('{indent}"""\n\n'.format(indent=indent))
开发者ID:4ever911,项目名称:zipline,代码行数:33,代码来源:gen_type_stubs.py


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