mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-25 13:10:33 +08:00
MAINT: Changes unittest use of ndict to use specific objects.
Instead of using ndict, changing over to using the objects that are created used when an algorithm is run.
This commit is contained in:
@@ -24,14 +24,15 @@ from unittest import TestCase
|
||||
|
||||
from zipline.finance.slippage import VolumeShareSlippage
|
||||
|
||||
from zipline import ndict
|
||||
from zipline.protocol import Event
|
||||
from zipline.gens.tradesimulation import Order
|
||||
|
||||
|
||||
class SlippageTestCase(TestCase):
|
||||
|
||||
def test_volume_share_slippage(self):
|
||||
|
||||
event = ndict(
|
||||
event = Event(
|
||||
{'volume': 200,
|
||||
'TRANSACTION': None,
|
||||
'type': 4,
|
||||
@@ -51,7 +52,7 @@ class SlippageTestCase(TestCase):
|
||||
slippage_model = VolumeShareSlippage()
|
||||
|
||||
open_orders = {133: [
|
||||
ndict(
|
||||
Order(
|
||||
{'dt': datetime.datetime(2006, 1, 5, 14, 30, tzinfo=pytz.utc),
|
||||
'amount': 100,
|
||||
'filled': 0, 'sid': 133})
|
||||
@@ -72,5 +73,6 @@ class SlippageTestCase(TestCase):
|
||||
|
||||
self.assertIsNotNone(txn)
|
||||
|
||||
for key, value in expected_txn.items():
|
||||
self.assertEquals(value, txn[key])
|
||||
# TODO: Make expected_txn an Transaction object and ensure there
|
||||
# is a __eq__ for that class.
|
||||
self.assertEquals(expected_txn, txn.__dict__)
|
||||
|
||||
Reference in New Issue
Block a user