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

Use returns for correlations in hcorr #1925

Merged
merged 6 commits into from
Jun 10, 2022

Conversation

stkerr
Copy link
Contributor

@stkerr stkerr commented Jun 9, 2022

Description

This PR adds a new flag, -t r, to the hcorr command to cause it to do correlations based on daily returns calculated from adjusted close data. This is useful because correlations of returns can be more useful than correlations between candlestick price values in some cases.

image

How has this been tested?

Pytests all pass and several different tickers were tried. Hand verification was done to ensure that the correlation was correctly being calculated from the right offsets.

image

  • Please describe the tests that you ran to verify your changes.
  • Provide instructions so we can reproduce.
  • Please also list any relevant details for your test configuration.

Checklist:

Others

  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • My code passes all the checks pylint, flake8, black, ... To speed up development you should run pre-commit install.
  • New and existing unit tests pass locally with my changes. You can test this locally using pytest tests/....

@stkerr stkerr marked this pull request as ready for review June 10, 2022 00:53
@stkerr
Copy link
Contributor Author

stkerr commented Jun 10, 2022

@DidierRLopes @jmaslek this PR adds a new flag to hcorr to calculate correlations based off of daily return percentages from adjusted close. Can you review? Thanks!

@jmaslek jmaslek added the enhancement Enhancement label Jun 10, 2022
@jmaslek jmaslek merged commit 1584638 into OpenBB-finance:main Jun 10, 2022
@DidierRLopes
Copy link
Collaborator

Nice feature! Thank you @stkerr 🙌

@stkerr stkerr deleted the stkerr-returns-for-correlations branch June 10, 2022 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants