BUG: Fixes check reversal in slippage transact_stub.

Previous commit accidentally flipped the check when converting
to use `allclose`.
This commit is contained in:
Eddie Hebert
2013-03-12 20:34:16 -04:00
parent 2bf285b084
commit 43fac333a1
+2 -2
View File
@@ -36,8 +36,8 @@ def transact_stub(slippage, commission, event, open_orders):
with Processor(inject_algo_dt).threadbound():
transaction = slippage.simulate(event, open_orders)
if transaction and np.allclose(transaction.amount, 0):
direction = abs(transaction.amount) / transaction.amount
if transaction and not np.allclose(transaction.amount, 0):
direction = math.copysign(1, transaction.amount)
per_share, total_commission = commission.calculate(transaction)
transaction.price = transaction.price + (per_share * direction)
transaction.commission = total_commission