mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-25 13:10:33 +08:00
Remove all namedicts.
This commit is contained in:
@@ -17,7 +17,7 @@ from zipline.finance.trading import TradingEnvironment
|
||||
from zipline.simulator import AddressAllocator
|
||||
from zipline.lines import SimulatedTrading
|
||||
from zipline.finance.performance import PerformanceTracker
|
||||
from zipline.utils.protocol_utils import namedict
|
||||
from zipline.utils.protocol_utils import ndict
|
||||
from zipline.finance.trading import TransactionSimulator, SIMULATION_STYLE
|
||||
|
||||
DEFAULT_TIMEOUT = 15 # seconds
|
||||
@@ -434,7 +434,7 @@ class FinanceTestCase(TestCase):
|
||||
|
||||
order_date = start_date
|
||||
for i in xrange(order_count):
|
||||
order = namedict(
|
||||
order = ndict(
|
||||
{
|
||||
'sid' : sid,
|
||||
'amount' : order_amount * alternator**i,
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
from zipline.utils.protocol_utils import ndict, namedict
|
||||
from zipline.utils.protocol_utils import ndict
|
||||
|
||||
def test_ndict():
|
||||
nd = ndict({})
|
||||
|
||||
@@ -547,7 +547,7 @@ shares in position"
|
||||
#create a transaction for all but
|
||||
#first trade in each sid, to simulate None transaction
|
||||
if(event.dt != self.trading_environment.period_start):
|
||||
txn = zp.namedict({
|
||||
txn = zp.ndict({
|
||||
'sid' : event.sid,
|
||||
'amount' : -25,
|
||||
'dt' : event.dt,
|
||||
|
||||
@@ -45,7 +45,7 @@ class ProtocolTestCase(TestCase):
|
||||
|
||||
for trade in trades:
|
||||
#simulate data source sending frame
|
||||
msg = zp.DATASOURCE_FRAME(zp.namedict(trade))
|
||||
msg = zp.DATASOURCE_FRAME(zp.ndict(trade))
|
||||
#feed unpacking frame
|
||||
recovered_trade = zp.DATASOURCE_UNFRAME(msg)
|
||||
#feed sending frame
|
||||
@@ -74,13 +74,13 @@ class ProtocolTestCase(TestCase):
|
||||
self.assertTrue(event.helloworld == 2345.6)
|
||||
event.delete('helloworld')
|
||||
|
||||
self.assertEqual(zp.namedict(trade), event)
|
||||
self.assertEqual(zp.ndict(trade), event)
|
||||
|
||||
@timed(DEFAULT_TIMEOUT)
|
||||
def test_order_protocol(self):
|
||||
#client places an order
|
||||
now = datetime.utcnow().replace(tzinfo=pytz.utc)
|
||||
order = zp.namedict({
|
||||
order = zp.ndict({
|
||||
'dt':now,
|
||||
'sid':133,
|
||||
'amount':100
|
||||
@@ -94,7 +94,7 @@ class ProtocolTestCase(TestCase):
|
||||
self.assertEqual(order.dt, now)
|
||||
|
||||
#order datasource datasource frames the order
|
||||
order_event = zp.namedict({
|
||||
order_event = zp.ndict({
|
||||
"sid" : order.sid,
|
||||
"amount" : order.amount,
|
||||
"dt" : order.dt,
|
||||
@@ -111,7 +111,7 @@ class ProtocolTestCase(TestCase):
|
||||
self.assertEqual(now, recovered_order.dt)
|
||||
|
||||
#create a transaction from the order
|
||||
txn = zp.namedict({
|
||||
txn = zp.ndict({
|
||||
'sid' : recovered_order.sid,
|
||||
'amount' : recovered_order.amount,
|
||||
'dt' : recovered_order.dt,
|
||||
|
||||
Reference in New Issue
Block a user