Lean
Lean copied to clipboard
Feature issue#4581 Maximum Drawdown Recovery Time.
Description
This PR introduces a new statistic to measure the Maximum Drawdown Recovery Time.
Key changes:
- Implemented
MaxDrawdownRecoveryTime
function to calculate the longest recovery time from maximum drawdowns. In the case where there are multiple maximum drawdowns, the longest recovery time is returned. - Added
DrawdownPercentDrawdownDatesHighValue
function to consolidate theDrawdownPercent
function andMaxDrawdownRecoveryTime
function, to avoid duplicate code. - Added new DTO
DrawdownDrawdownDatesHighValueDTO
to avoid using tuples inDrawdownPercentDrawdownDatesHighValue
. - Integrated the new statistic into the existing performance metrics suite.
- Added unit tests.
Questions
- Do we need to implement a ReportElement? I was thinking no because there is already a report element for
DrawdownPercent
and the user could easily see where the maximum drawdown occured. - In the case when there is no drawdown, do we want a special value returned?
Related Issue
Motivation and Context
Requires Documentation Change
Potentially
- https://www.quantconnect.com/docs/v2/cloud-platform/backtesting/results/
How Has This Been Tested?
Unit tests.
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)
- [X] 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:
- [X] My code follows the code style of this project.
- [X] I have read the CONTRIBUTING document.
- [X] I have added tests to cover my changes.
- [X] All new and existing tests passed.
- [X] My branch follows the naming convention
bug-<issue#>-<description>
orfeature-<issue#>-<description>