Permalink
Browse files

pretty big bug: yield statement too indented in `normalized_history_a…

…verages` causing us to calculate the "average" of just one value and use the same date six records at a time. Also using `set()` for prices we are averaging. faster.
  • Loading branch information...
stnbu committed Sep 8, 2018
1 parent 60b40c1 commit 91f95d81538cee224e89237b754d75037086035a
Showing with 3 additions and 3 deletions.
  1. +3 −3 coincharts/data.py
@@ -70,18 +70,18 @@ def normalized_history_averages(self):
)
num_prices = len(self)
while True:
prices = []
prices = set()
for gen in normalized_history_generators:
try:
point = gen.__next__()
# this means we end up using the dt value of the last point we get.
# this shouldn't matter, since they are *supposed* to all be the same.
# the validation of this and other things should be implemented.
dt, price = point
prices.append(price)
prices.add(price)
except StopIteration:
return
yield dt, sum(prices) / num_prices
yield dt, sum(prices) / num_prices
if __name__ == '__main__':

0 comments on commit 91f95d8

Please sign in to comment.