mirror of
https://github.com/wassname/catalyst.git
synced 2026-08-02 12:30:45 +08:00
switched SID to sid
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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({
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -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']
|
||||
|
||||
"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user