mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-11 09:48:25 +08:00
Moves slippage transactions off of ndict.
So that the datatype is unique.
This commit is contained in:
@@ -549,7 +549,7 @@ class PerformancePeriod(object):
|
||||
|
||||
# we want the key to be absent, not just empty
|
||||
if self.keep_transactions:
|
||||
transactions = [x.as_dict() for x in self.processed_transactions]
|
||||
transactions = [x.__dict__ for x in self.processed_transactions]
|
||||
rval['transactions'] = transactions
|
||||
|
||||
return rval
|
||||
|
||||
@@ -19,8 +19,6 @@ import math
|
||||
|
||||
from functools import partial
|
||||
|
||||
from zipline.utils.protocol_utils import ndict
|
||||
|
||||
from logbook import Processor
|
||||
|
||||
|
||||
@@ -48,6 +46,16 @@ def transact_partial(slippage, commission):
|
||||
return partial(transact_stub, slippage, commission)
|
||||
|
||||
|
||||
class Transaction(object):
|
||||
|
||||
def __init__(self, initial_values=None):
|
||||
if initial_values:
|
||||
self.__dict__ = initial_values
|
||||
|
||||
def __getitem__(self, name):
|
||||
return self.__dict__[name]
|
||||
|
||||
|
||||
def create_transaction(sid, amount, price, dt):
|
||||
|
||||
txn = {
|
||||
@@ -57,7 +65,7 @@ def create_transaction(sid, amount, price, dt):
|
||||
'price': price,
|
||||
}
|
||||
|
||||
transaction = ndict(txn)
|
||||
transaction = Transaction(txn)
|
||||
return transaction
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user