mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-25 13:10:33 +08:00
MAINT: Uses copysign to extract direction of order.
Instead of using division of the amount by itself to extract the direction, uses math's copysign. Should be almost functionally equivalent, but copysign won't have a possible floating point error leading the direction to not be exactly 1.
This commit is contained in:
@@ -108,7 +108,7 @@ class VolumeShareSlippage(object):
|
||||
open_amount = order.amount - order.filled
|
||||
|
||||
if(open_amount != 0):
|
||||
direction = open_amount / math.fabs(open_amount)
|
||||
direction = math.copysign(1, open_amount)
|
||||
else:
|
||||
direction = 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user