mirror of
https://github.com/wassname/catalyst.git
synced 2026-10-28 12:51:29 +08:00
Changes test factory to use Event instead of ndict.
As more sources are moving off of ndict, changing the factory to use Event, so that when testing we are exercising use of Event.
This commit is contained in:
1 parent
59dbffb3aa
commit
799a357d98
2 files changed
+5
-2
No files matched your search
@@ -50,5 +50,8 @@ class Event(object):
|
||||
def __eq__(self, other):
|
||||
return self.__dict__ == other.__dict__
|
||||
|
||||
def __contains__(self, name):
|
||||
return name in self.__dict__
|
||||
|
||||
def __repr__(self):
|
||||
return "Event({0})".format(self.__dict__)
|
||||
@@ -30,7 +30,7 @@ from datetime import datetime, timedelta
|
||||
|
||||
import zipline.finance.risk as risk
|
||||
from zipline.utils.date_utils import tuple_to_date
|
||||
from zipline.utils.protocol_utils import ndict
|
||||
from zipline.protocol import Event
|
||||
from zipline.sources import (SpecificEquityTrades,
|
||||
DataFrameSource,
|
||||
DataPanelSource)
|
||||
@@ -144,7 +144,7 @@ def create_trade_history(sid, prices, amounts, interval, trading_calendar,
|
||||
|
||||
|
||||
def create_txn(sid, price, amount, datetime):
|
||||
txn = ndict({
|
||||
txn = Event({
|
||||
'sid': sid,
|
||||
'amount': amount,
|
||||
'dt': datetime,
|
||||
|
||||
Reference in new issue
Block a user