Skip to content

Conversation

@jhonabreul
Copy link
Collaborator

@jhonabreul jhonabreul commented Mar 27, 2025

Description

This includes multiple changes that improve and fix the security re-addition behavior:

  • Security instances are not re-created:
    • Security instances are re-used from the SecurityManager so state can be tracked
  • Make sure securities are properly marked as non-tradable when removed and tradable when re-added.

Related Issue

Partial fix for #7929

Motivation and Context

Securities can be re-added manually or by being re-selected by any universe, which requires them to be re-initialized, specially if the algorithm is using a custom security initializer.

Requires Documentation Change

How Has This Been Tested?

Regression algorithms

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>

@jhonabreul jhonabreul changed the title Security initialization on re-addition Security re-addition tidy up Apr 4, 2025
@jhonabreul jhonabreul merged commit 1974884 into QuantConnect:master Apr 4, 2025
6 of 8 checks passed
@jhonabreul jhonabreul deleted the bug-7929-security-initialization branch April 4, 2025 20:28
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.

2 participants