• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python slippage.transact_partial函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _create_generator

    def _create_generator(self, sim_params, source_filter=None):
        """
        Create a basic generator setup using the sources to this algorithm.

        ::source_filter:: is a method that receives events in date
        sorted order, and returns True for those events that should be
        processed by the zipline, and False for those that should be
        skipped.
        """

        if not self.initialized:
            self.initialize(*self.initialize_args, **self.initialize_kwargs)
            self.initialized = True

        if self.perf_tracker is None:
            # HACK: When running with the `run` method, we set perf_tracker to
            # None so that it will be overwritten here.
            self.perf_tracker = PerformanceTracker(
                sim_params=sim_params, env=self.trading_environment
            )

        self.portfolio_needs_update = True
        self.account_needs_update = True
        self.performance_needs_update = True

        self.data_gen = self._create_data_generator(source_filter, sim_params)

        self.trading_client = AlgorithmSimulator(self, sim_params)

        transact_method = transact_partial(self.slippage, self.commission)
        self.set_transact(transact_method)

        return self.trading_client.transform(self.data_gen)
开发者ID:qnu,项目名称:zipline,代码行数:33,代码来源:algorithm.py


示例2: _create_generator

    def _create_generator(self, sim_params, source_filter=None):
        """
        Create a basic generator setup using the sources and
        transforms attached to this algorithm.

        ::source_filter:: is a method that receives events in date
        sorted order, and returns True for those events that should be
        processed by the zipline, and False for those that should be
        skipped.
        """
        sim_params.data_frequency = self.data_frequency

        # perf_tracker will be instantiated in __init__ if a sim_params
        # is passed to the constructor. If not, we instantiate here.
        if self.perf_tracker is None:
            self.perf_tracker = PerformanceTracker(sim_params)

        self.data_gen = self._create_data_generator(source_filter,
                                                    sim_params)

        self.trading_client = AlgorithmSimulator(self, sim_params)

        transact_method = transact_partial(self.slippage, self.commission)
        self.set_transact(transact_method)

        return self.trading_client.transform(self.data_gen)
开发者ID:anupamsharma,项目名称:zipline,代码行数:26,代码来源:algorithm.py


示例3: __init__

 def __init__(self):
     self.transact = transact_partial(VolumeShareSlippage(), PerShare())
     # these orders are aggregated by sid
     self.open_orders = defaultdict(list)
     # keep a dict of orders by their own id
     self.orders = {}
     # holding orders that have come in since the last
     # event.
     self.new_orders = []
     self.current_dt = None
开发者ID:johnhan1987,项目名称:zipline,代码行数:10,代码来源:blotter.py


示例4: __init__

 def __init__(self):
     self.transact = transact_partial(VolumeShareSlippage(), PerShare())
     # these orders are aggregated by sid
     self.open_orders = defaultdict(list)
     # keep a dict of orders by their own id
     self.orders = {}
     # track transactions by sid and by order
     self.txns_by_sid = defaultdict(list)
     self.txns_by_order = defaultdict(list)
     # holding orders that have come in since the last
     # event.
     self.new_orders = []
开发者ID:benmccann,项目名称:zipline,代码行数:12,代码来源:tradesimulation.py


示例5: __init__

    def __init__(self, fill_delay=timedelta(minutes=1)):
        self.transact = transact_partial(VolumeShareSlippage(), PerShare())
        # these orders are aggregated by sid
        self.open_orders = defaultdict(list)
        # keep a dict of orders by their own id
        self.orders = {}
        # holding orders that have come in since the last
        # event.
        self.new_orders = []
        self.current_dt = None
        self.max_shares = int(1e+11)

        self.fill_delay = fill_delay
开发者ID:andrebco,项目名称:zipline,代码行数:13,代码来源:blotter.py


示例6: _create_generator

    def _create_generator(self, environment):
        """
        Create a basic generator setup using the sources and
        transforms attached to this algorithm.
        """

        self.date_sorted = date_sorted_sources(*self.sources)
        self.with_tnfms = sequential_transforms(self.date_sorted,
                                                *self.transforms)
        self.trading_client = tsc(self, environment)

        transact_method = transact_partial(self.slippage, self.commission)
        self.set_transact(transact_method)

        return self.trading_client.simulate(self.with_tnfms)
开发者ID:andycwang,项目名称:zipline,代码行数:15,代码来源:algorithm.py


示例7: _create_generator

    def _create_generator(self, environment):
        """
        Create a basic generator setup using the sources and
        transforms attached to this algorithm.
        """

        self.date_sorted = date_sorted_sources(*self.sources)
        self.with_tnfms = sequential_transforms(self.date_sorted,
                                                *self.transforms)
        # Group together events with the same dt field. This depends on the
        # events already being sorted.
        self.grouped_by_date = groupby(self.with_tnfms, attrgetter('dt'))
        self.trading_client = tsc(self, environment)

        transact_method = transact_partial(self.slippage, self.commission)
        self.set_transact(transact_method)

        return self.trading_client.simulate(self.grouped_by_date)
开发者ID:Elektra58,项目名称:zipline,代码行数:18,代码来源:algorithm.py


示例8: _create_generator

    def _create_generator(self, sim_params, source_filter=None):
        """
        Create a basic generator setup using the sources and
        transforms attached to this algorithm.

        ::source_filter:: is a method that receives events in date
        sorted order, and returns True for those events that should be
        processed by the zipline, and False for those that should be
        skipped.
        """
        self.data_gen = self._create_data_generator(source_filter, sim_params)

        self.trading_client = AlgorithmSimulator(self, sim_params)

        transact_method = transact_partial(self.slippage, self.commission)
        self.set_transact(transact_method)

        return self.trading_client.transform(self.data_gen)
开发者ID:johnhan1987,项目名称:zipline,代码行数:18,代码来源:algorithm.py


示例9: __init__

 def __init__(self):
     self.transact = transact_partial(VolumeShareSlippage(), PerShare())
     self.open_orders = defaultdict(list)
开发者ID:aichi,项目名称:zipline,代码行数:3,代码来源:trading.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python slippage.VolumeShareSlippage类代码示例发布时间:2022-05-26
下一篇:
Python performance.PerformanceTracker类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap