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:
Eddie Hebert
2013-03-12 19:14:02 -04:00
parent 085eb040af
commit f7b4df4a09
+1 -1
View File
@@ -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