Skip to content
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

fixing NaNs issue on KAMA #303

Merged
merged 1 commit into from Aug 23, 2022
Merged

fixing NaNs issue on KAMA #303

merged 1 commit into from Aug 23, 2022

Conversation

yarimiz
Copy link
Contributor

@yarimiz yarimiz commented Aug 18, 2022

This PR is to fix a bug causing KAMA to be NaN if no a given stock close price did not change for more than the KAMA window size.

The bug is caused because efficiency ratio is NaN in such cases, instead of 0.
The solution is to use np.divide to calculate ER as er_num / er_den except for cases er_num == 0, then 0

@yarimiz
Copy link
Contributor Author

yarimiz commented Aug 18, 2022

@bukosabino can this be merged please?

Copy link
Owner

@bukosabino bukosabino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

Thanks @yarimiz

@bukosabino bukosabino merged commit 04f9cff into bukosabino:master Aug 23, 2022
@bukosabino bukosabino mentioned this pull request Aug 23, 2022
@bukosabino
Copy link
Owner

The PR fixes the next issues:

#258

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants