From 1575867b40fe110979cac689aa602fb78f8edbda Mon Sep 17 00:00:00 2001 From: Eddie Hebert Date: Fri, 1 Nov 2013 16:10:19 -0400 Subject: [PATCH] STY: Use named args for Transaction object creation. Instead of creating and passing a dict of the object values, use named args directly. --- zipline/finance/slippage.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/zipline/finance/slippage.py b/zipline/finance/slippage.py index 0224a5ce..ae77ce29 100644 --- a/zipline/finance/slippage.py +++ b/zipline/finance/slippage.py @@ -141,15 +141,14 @@ def create_transaction(event, order, price, amount): if amount_magnitude < 1: raise Exception("Transaction magnitude must be at least 1.") - txn = { - 'sid': event.sid, - 'amount': int(amount), - 'dt': event.dt, - 'price': price, - 'order_id': order.id - } + transaction = Transaction( + sid=event.sid, + amount=int(amount), + dt=event.dt, + price=price, + order_id=order.id + ) - transaction = Transaction(**txn) return transaction