Problem Description
Solution
To run your trading algorithm on an older version of the LEAN engine in QuantConnect, you can use the LEAN Version selector located in your project settings. This is particularly useful if you need to delay migration to newer API standards (such as the PEP8 migration) or if your strategy relies on specific behaviors of previous builds.
Steps to Select an Older LEAN Version
- Open Your Project: Navigate to the specific project you wish to configure in the QuantConnect IDE.
- Access Project Panel: Look for the project configuration panel (usually on the right side of the IDE).
- Locate LEAN Engine Section: Find the section labeled "LEAN Engine".
- Select Version: Click on the selector and choose the specific version you require.
- To use the pre-PEP8 Python API (the old API format), select "master v16356".
- New projects default to the master branch (v16357+), which uses PEP8 formatting.
Important Considerations
- Migration Window: QuantConnect typically keeps older versions available for a limited time (e.g., one month after a major update) to allow users to migrate their strategies.
- Default Behavior: By default, all new projects are created on the latest master branch of LEAN.
- Breaking Changes: Using an older version can help resolve immediate errors caused by name conflicts (e.g.,
self.securitiesvsself.Securities) introduced in newer updates, but it is recommended to update your code to the latest standards eventually.
Q&A
Q: Why would I need to select an older LEAN version?
A: You might select an older version to maintain compatibility with legacy code that has not yet been updated to match recent API changes, such as the Python PEP8 migration which introduced snake_case naming conventions.
Q: What is the specific version number for the pre-PEP8 LEAN engine?
A: The version that supports the old API format before the PEP8 migration is master v16356.
Q: Does changing the LEAN version affect all my projects?
A: No, the LEAN Engine setting is configured on a per-project basis. You must change the setting individually for each project you wish to run on an older engine.
Q: What happens if I create a new project without changing settings?
A: New projects automatically use the latest master branch of LEAN (v16357+), which enforces the newest API standards and formatting.