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

Refactor Correlation and beta indicators #8485

Conversation

JosueNina
Copy link
Contributor

@JosueNina JosueNina commented Dec 27, 2024

Description

This PR fixes a bug in the Correlation indicator. It now performs a fill-forward of the Correlation value, ensuring that the calculation is correctly updated when sufficient data is available. Additionally, the refactor introduces a base class for dual-symbol indicators, improving maintainability and scalability for indicators like Beta and Correlation. Unit tests have been updated to reflect these changes, and a new regression test has been added to verify the correct handling of last computed values.

Related Issue

Closes #8424

Motivation and Context

This change simplifies the management of dual-symbol indicators by refactoring them into a base class. It reduces code duplication and improves maintainability. The new regression test ensures the correct handling of last computed values.

Requires Documentation Change

No documentation change required.

How Has This Been Tested?

The changes have been tested using unit tests and a regression test. The unit tests validate the refactored logic, while the regression test ensures that the last computed values for Beta and Correlation are handled correctly.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Refactor (non-breaking change which improves implementation)
  • Performance (non-breaking change which improves performance. Please add associated performance test and results)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Non-functional change (xml comments/documentation/etc)

Checklist:

  • My code follows the code style of this project.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My branch follows the naming convention bug-<issue#>-<description> or feature-<issue#>-<description>

- Created a base class to handle indicators with dual-symbol
  functionality.
- Refactored the Beta and Correlation indicators to inherit from the new
  base class.
- Updated unit tests.
- Added a new regression test to validate the latest computed value.
@JosueNina JosueNina changed the title WIP: Refactor Correlation Indicator Refactor Correlation and beta indicators Dec 30, 2024
@JosueNina JosueNina force-pushed the bug-8424-correlation-prev-value-lost branch from f71b075 to 7f666b6 Compare December 30, 2024 22:00
@JosueNina JosueNina force-pushed the bug-8424-correlation-prev-value-lost branch from 0c6afd8 to 1ad35dd Compare December 31, 2024 09:30
Copy link
Member

@Martin-Molinero Martin-Molinero left a comment

Choose a reason for hiding this comment

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

Thank you!

@Martin-Molinero Martin-Molinero merged commit f3ea223 into QuantConnect:master Jan 2, 2025
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants