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


Python slippage.transact_partial函数代码示例

本文整理汇总了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;未经允许,请勿转载。