Merge branch 'new_world_order' of github.com:quantopian/zipline into new_world_order

This commit is contained in:
fawce
2012-08-02 18:14:52 -04:00
2 changed files with 10 additions and 12 deletions
+8 -9
View File
@@ -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)
+2 -3
View File
@@ -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,