mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-14 11:15:09 +08:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user