Uses numpy.dot instead numpy.vdot to calculate positions value.

Since the position amount and price ndarrays are one dimensional
and use real numbers, we do not need the overhead of the extra
case handling provided by numpy.vdot, which comes at a cost of
performance.

With thanks to @jlowin, for pointing out the better fit of numpy.dot.
This commit is contained in:
Eddie Hebert
2013-01-16 11:38:37 -05:00
parent 018ac67966
commit 65138fbceb
+1 -1
View File
@@ -508,7 +508,7 @@ class PerformancePeriod(object):
return int(base * round(float(x) / base))
def calculate_positions_value(self):
return np.vdot(self._position_amounts, self._position_last_sale_prices)
return np.dot(self._position_amounts, self._position_last_sale_prices)
def update_last_sale(self, event):
is_trade = event.type == zp.DATASOURCE_TYPE.TRADE