-
-
Notifications
You must be signed in to change notification settings - Fork 49.2k
Adds exponential moving average algorithm #10273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
a33bc05
acdc0a2
1ce781f
7b09aeb
040379f
6edf6e5
68c4bb8
ce8ecce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,75 @@ | ||||||
| """ | ||||||
| Calculates exponential moving average (EMA) on the series of numbers | ||||||
| Wikipedia Reference: https://en.wikipedia.org/wiki/Exponential_smoothing | ||||||
| Reference: https://www.investopedia.com/terms/e/ema.asp#toc-what-is-an-exponential-moving-average-ema | ||||||
|
||||||
| Reference: https://www.investopedia.com/terms/e/ema.asp#toc-what-is-an-exponential-moving-average-ema | |
| https://www.investopedia.com/terms/e/ema.asp#toc-what-is-an-exponential-moving-average-ema |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just plain series is fine.
| series_generator: Iterator[float], window_size: int | |
| series: Iterator[float], window_size: int |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just easier to read...
| >>> list(exponential_moving_average((ele for ele in [2, 5, 3, 8.2, 6, 9, 10]), 3)) | |
| >>> list(exponential_moving_average(iter([2, 5, 3, 8.2, 6, 9, 10]), 3)) |
cclauss marked this conversation as resolved.
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| t = 0 | |
| timestamp = 0 |
Or maybe even better, ticks.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| st = None | |
| st = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As there is no test file in this pull request nor any test function or class in the file financial/exponential_moving_average.py, please provide doctest for the function test_gen_func
Please provide return type hint for the function: test_gen_func. If the function does not return a value, please provide the type hint as: def function() -> None:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Active tense