mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-07 23:57:40 +08:00
BUG: Fix div by 0 error due to changed return type.
When calculate_positions_value used np.dot, the return type was a np.float64. Which allows the use of 0.0 in division to not raise an exception. Fix by expliciting creating an np.float64 with 0 value.
This commit is contained in:
@@ -351,7 +351,7 @@ class PerformancePeriod(object):
|
||||
|
||||
def calculate_positions_value(self):
|
||||
if len(self.position_values) == 0:
|
||||
return 0
|
||||
return np.float64(0)
|
||||
|
||||
return sum(self.position_values)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user