Skip to content

MaximumDrawdownPercentPortfolio

QuantConnect.Algorithm.Framework.Risk.MaximumDrawdownPercentPortfolio

MaximumDrawdownPercentPortfolio(
    maximum_drawdown_percent: float = 0.05,
    is_trailing: bool = False,
)

Bases: RiskManagementModel

Provides an implementation of IRiskManagementModel that limits the drawdown of the portfolio to the specified percentage. Once this is triggered the algorithm will need to be manually restarted.

Initializes a new instance of the MaximumDrawdownPercentPortfolio class

Parameters:

Name Type Description Default
maximum_drawdown_percent float

The maximum percentage drawdown allowed for algorithm portfolio compared with starting value, defaults to 5% drawdown

0.05
is_trailing bool

If "false", the drawdown will be relative to the starting value of the portfolio. If "true", the drawdown will be relative the last maximum portfolio value

False

manage_risk

manage_risk(
    algorithm: QCAlgorithm, targets: List[IPortfolioTarget]
) -> Iterable[IPortfolioTarget]

Manages the algorithm's risk at each time step

Parameters:

Name Type Description Default
algorithm QCAlgorithm

The algorithm instance

required
targets List[IPortfolioTarget]

The current portfolio targets to be assessed for risk

required

on_securities_changed

on_securities_changed(
    algorithm: QCAlgorithm, changes: SecurityChanges
) -> None

Event fired each time the we add/remove securities from the data feed

Parameters:

Name Type Description Default
algorithm QCAlgorithm

The algorithm instance that experienced the change in securities

required
changes SecurityChanges

The security additions and removals from the algorithm

required