Skip to content

Commit

Permalink
BUG: Fix div by 0 error due to changed return type.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Eddie Hebert committed Feb 20, 2015
1 parent f101787 commit 1ff5acb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion zipline/finance/performance/period.py
Expand Up @@ -351,7 +351,7 @@ def position_values(self):

def calculate_positions_value(self):
if len(self.position_values) == 0:
return 0
return np.float64(0)

return sum(self.position_values)

Expand Down

0 comments on commit 1ff5acb

Please sign in to comment.