mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-30 15:52:52 +08:00
BUG: Fixes check reversal in slippage transact_stub.
Previous commit accidentally flipped the check when converting to use `allclose`.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user