From ba2783081cf992251284cfcc3367e60549f44160 Mon Sep 17 00:00:00 2001 From: fawce Date: Fri, 18 May 2012 21:46:42 -0400 Subject: [PATCH] switched SID to sid --- tests/test_finance.py | 8 ++++---- zipline/components/datasource.py | 2 +- zipline/finance/sources.py | 4 ++-- zipline/lines.py | 2 +- zipline/test_algorithms.py | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/test_finance.py b/tests/test_finance.py index ac2938c5..77a04495 100644 --- a/tests/test_finance.py +++ b/tests/test_finance.py @@ -224,11 +224,11 @@ class FinanceTestCase(TestCase): "Portfolio should have one position." ) - SID = self.zipline_test_config['sid'] + sid = self.zipline_test_config['sid'] self.assertEqual( - zipline.get_positions()[SID]['sid'], - SID, - "Portfolio should have one position in " + str(SID) + zipline.get_positions()[sid]['sid'], + sid, + "Portfolio should have one position in " + str(sid) ) self.assertEqual( diff --git a/zipline/components/datasource.py b/zipline/components/datasource.py index d9e7da96..4cafdb5f 100644 --- a/zipline/components/datasource.py +++ b/zipline/components/datasource.py @@ -17,7 +17,7 @@ class DataSource(Component): converting to a dict, and calling send(map). Every datasource has a dict property to hold filters:: - - key -- name of the filter, e.g. SID + - key -- name of the filter, e.g. sid - value -- a primitive representing the filter. e.g. a list of ints. Modify the datasource's filters via the set_filter(name, value) diff --git a/zipline/finance/sources.py b/zipline/finance/sources.py index 73fa56e0..346e4673 100644 --- a/zipline/finance/sources.py +++ b/zipline/finance/sources.py @@ -31,7 +31,7 @@ class TradeDataSource(DataSource): def send(self, event): """ - Sends the event iff it matches the internal SID filter. + Sends the event iff it matches the internal sid filter. :param dict event: is a trade event with data as per :py:func: `zipline.protocol.TRADE_FRAME` :rtype: None @@ -39,7 +39,7 @@ class TradeDataSource(DataSource): event.source_id = self.source_id - if event.sid in self.filter['SID']: + if event.sid in self.filter['sid']: message = zp.DATASOURCE_FRAME(event) else: blank = ndict({ diff --git a/zipline/lines.py b/zipline/lines.py index 5e0b2f8f..0fbd5dc4 100644 --- a/zipline/lines.py +++ b/zipline/lines.py @@ -283,7 +283,7 @@ class SimulatedTrading(object): """ assert isinstance(source, DataSource) self.check_started() - source.set_filter('SID', self.algorithm.get_sid_filter()) + source.set_filter('sid', self.algorithm.get_sid_filter()) self.sim.register_components([source]) # ``id`` is name of source_id, ``get_id`` is the class name diff --git a/zipline/test_algorithms.py b/zipline/test_algorithms.py index 1c1e71c3..83ead2e9 100644 --- a/zipline/test_algorithms.py +++ b/zipline/test_algorithms.py @@ -20,7 +20,7 @@ The algorithm must expose methods: of the current state of the simulation universe. An example data ndict:: +-----------------+--------------+----------------+--------------------+ - | | SID(133) | SID(134) | SID(135) | + | | sid(133) | sid(134) | sid(135) | +=================+==============+================+====================+ | price | $10.10 | $22.50 | $13.37 | +-----------------+--------------+----------------+--------------------+ @@ -33,16 +33,16 @@ The algorithm must expose methods: - set_order: method that accepts a callable. Will be set as the value of the order method of trading_client. An algorithm can then place orders with a - valid SID and a number of shares:: + valid sid and a number of shares:: - self.order(SID(133), share_count) + self.order(sid(133), share_count) - set_performance: property which can be set equal to the cumulative_trading_performance property of the trading_client. An algorithm can then check position information with the Portfolio object:: - self.Portfolio[SID(133)]['cost_basis'] + self.Portfolio[sid(133)]['cost_basis'] """