mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-03 14:00:11 +08:00
MAINT: More slippage comparison changes for floating point.
Continues conversion of floating point comparisons in slippage to use numpy's allclose.
This commit is contained in:
@@ -36,7 +36,7 @@ def transact_stub(slippage, commission, event, open_orders):
|
||||
with Processor(inject_algo_dt).threadbound():
|
||||
|
||||
transaction = slippage.simulate(event, open_orders)
|
||||
if transaction and transaction.amount != 0:
|
||||
if transaction and np.allclose(transaction.amount, 0):
|
||||
direction = abs(transaction.amount) / transaction.amount
|
||||
per_share, total_commission = commission.calculate(transaction)
|
||||
transaction.price = transaction.price + (per_share * direction)
|
||||
|
||||
Reference in New Issue
Block a user