mirror of
https://github.com/wassname/catalyst.git
synced 2026-08-12 11:50:11 +08:00
MAINT: Remove left over simple transform code.
Remove pieces that are no longer used now that the simple transforms are wrappers around history via the SIDData object. Move window length related pieces into batch_transform, since the rest of the utils module is no longer used.
This commit is contained in:
+6
-32
@@ -62,13 +62,9 @@ from zipline.finance.slippage import (
|
||||
SlippageModel,
|
||||
transact_partial
|
||||
)
|
||||
from zipline.gens.composites import (
|
||||
date_sorted_sources,
|
||||
sequential_transforms,
|
||||
)
|
||||
from zipline.gens.composites import date_sorted_sources
|
||||
from zipline.gens.tradesimulation import AlgorithmSimulator
|
||||
from zipline.sources import DataFrameSource, DataPanelSource
|
||||
from zipline.transforms.utils import StatefulTransform
|
||||
from zipline.utils.api_support import ZiplineAPI, api_method
|
||||
import zipline.utils.events
|
||||
from zipline.utils.events import (
|
||||
@@ -143,8 +139,6 @@ class TradingAlgorithm(object):
|
||||
"""
|
||||
self.datetime = None
|
||||
|
||||
self.registered_transforms = {}
|
||||
self.transforms = []
|
||||
self.sources = []
|
||||
|
||||
# List of trading controls to be used to validate orders.
|
||||
@@ -312,8 +306,8 @@ class TradingAlgorithm(object):
|
||||
|
||||
def _create_data_generator(self, source_filter, sim_params=None):
|
||||
"""
|
||||
Create a merged data generator using the sources and
|
||||
transforms attached to this algorithm.
|
||||
Create a merged data generator using the sources 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
|
||||
@@ -350,11 +344,8 @@ class TradingAlgorithm(object):
|
||||
if source_filter:
|
||||
date_sorted = filter(source_filter, date_sorted)
|
||||
|
||||
with_tnfms = sequential_transforms(date_sorted,
|
||||
*self.transforms)
|
||||
|
||||
with_benchmarks = date_sorted_sources(benchmark_return_source,
|
||||
with_tnfms)
|
||||
date_sorted)
|
||||
|
||||
# Group together events with the same dt field. This depends on the
|
||||
# events already being sorted.
|
||||
@@ -362,8 +353,7 @@ class TradingAlgorithm(object):
|
||||
|
||||
def _create_generator(self, sim_params, source_filter=None):
|
||||
"""
|
||||
Create a basic generator setup using the sources and
|
||||
transforms attached to this algorithm.
|
||||
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
|
||||
@@ -459,23 +449,11 @@ class TradingAlgorithm(object):
|
||||
self.sim_params.data_frequency,
|
||||
)
|
||||
|
||||
# Create transforms by wrapping them into StatefulTransforms
|
||||
self.transforms = []
|
||||
for namestring, trans_descr in iteritems(self.registered_transforms):
|
||||
sf = StatefulTransform(
|
||||
trans_descr['class'],
|
||||
*trans_descr['args'],
|
||||
**trans_descr['kwargs']
|
||||
)
|
||||
sf.namestring = namestring
|
||||
|
||||
self.transforms.append(sf)
|
||||
|
||||
# force a reset of the performance tracker, in case
|
||||
# this is a repeat run of the algorithm.
|
||||
self.perf_tracker = None
|
||||
|
||||
# create transforms and zipline
|
||||
# create zipline
|
||||
self.gen = self._create_generator(self.sim_params)
|
||||
|
||||
with ZiplineAPI(self):
|
||||
@@ -854,10 +832,6 @@ class TradingAlgorithm(object):
|
||||
assert isinstance(sources, list)
|
||||
self.sources = sources
|
||||
|
||||
def set_transforms(self, transforms):
|
||||
assert isinstance(transforms, list)
|
||||
self.transforms = transforms
|
||||
|
||||
# Remain backwards compatibility
|
||||
@property
|
||||
def data_frequency(self):
|
||||
|
||||
Reference in New Issue
Block a user