From 598b342655aec487b981cefbd9c3642a599c0e58 Mon Sep 17 00:00:00 2001 From: scottsanderson Date: Thu, 2 Aug 2012 18:13:03 -0400 Subject: [PATCH] minor --- zipline/gens/examples.py | 17 ++++++++--------- zipline/gens/tradesimulation.py | 5 ++--- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/zipline/gens/examples.py b/zipline/gens/examples.py index 2f7830c8..84d42c3d 100644 --- a/zipline/gens/examples.py +++ b/zipline/gens/examples.py @@ -42,17 +42,16 @@ if __name__ == "__main__": passthrough = TransformBundle(Passthrough, (), {}) mavg_price = TransformBundle(MovingAverage, (timedelta(minutes = 20), ['price']), {}) tnfm_bundles = (passthrough, mavg_price) + merge_out = merged_transforms(sort_out, tnfm_bundles) - -# # for message in merge_out: -# # print message -# algo = TestAlgorithm(2, 100, 100) -# environment = create_trading_environment(year = 2012) -# style = zp.SIMULATION_STYLE.FIXED_SLIPPAGE + import nose.tools; nose.tools.set_trace() + algo = TestAlgorithm(2, 100, 100, sid_filter = [2,3]) + environment = create_trading_environment(year = 2012) + style = zp.SIMULATION_STYLE.FIXED_SLIPPAGE -# client_out = tsc(merge_out, algo, environment, style) -# for message in client_out: - # pp(message) + client_out = tsc(merge_out, algo, environment, style) + for message in client_out: + pp(message) diff --git a/zipline/gens/tradesimulation.py b/zipline/gens/tradesimulation.py index 6174ac35..a4a576fe 100644 --- a/zipline/gens/tradesimulation.py +++ b/zipline/gens/tradesimulation.py @@ -60,20 +60,19 @@ def trade_simulation_client(stream_in, algo, environment, sim_style): # Creates a txn field on the event containing transaction # information if we filled any pending orders on the event's sid. # TRANSACTION is None if we didn't fill any orders. - with_txns = stateful_transform( + with_txns = StatefulTransform( stream_in, TransactionSimulator, open_orders, style = sim_style ) - # Pipe the events with transactions to perf. This will remove the # txn field added by TransactionSimulator and replace it with # a portfolio object to be passed to the user's algorithm. Also adds # a PERF_MESSAGE field which is usually none, but contains an update # message once per day. - with_portfolio_and_perf_msg = stateful_transform( + with_portfolio_and_perf_msg = StatefulTransform( with_txns, PerformanceTracker, environment,