def _calculate(self, period):
data = list(self.loadTradesForPeriod(period))
if len(data) == 0:
raise InsufficientDataError()
values = np.fromiter(map(attrgetter('price'), data), np.float, len(data))
weights = np.fromiter(map(attrgetter('volume'), data), np.float, len(data))
mean, std = weighted_avg_and_std(values, weights)
return (mean,)
评论列表
文章目录