Skip to content

Commit 6edf6e5

Browse files
committed
Resolved mypy type error
1 parent 040379f commit 6edf6e5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: financial/exponential_moving_average.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ def exponential_moving_average(
4343
t = 0
4444

4545
# Exponential average at timestamp t
46-
st = None
46+
st = 0.0
4747

4848
for xt in series_generator:
4949
if t <= window_size:
5050
# Assigning simple moving average till the window_size for the first time
5151
# is reached
52-
st = float(xt) if st is None else (st + xt) * 0.5
52+
st = float(xt) if t == 0 else (st + xt) * 0.5
5353
else:
5454
# Calculating exponential moving average based on current timestamp data
5555
# point and previous exponential average value

0 commit comments

Comments
 (0)