Skip to content

PortfolioStatistics

QuantConnect.Statistics.PortfolioStatistics

PortfolioStatistics(
    profit_loss: SortedDictionary[datetime, float],
    equity: SortedDictionary[datetime, float],
    portfolio_turnover: SortedDictionary[datetime, float],
    list_performance: List[float],
    list_benchmark: List[float],
    starting_capital: float,
    risk_free_interest_rate_model: IRiskFreeInterestRateModel,
    trading_days_per_year: int,
    win_count: Optional[int] = None,
    loss_count: Optional[int] = None,
)
PortfolioStatistics()

Bases: Object

The PortfolioStatistics class represents a set of statistics calculated from equity and benchmark samples

Initializes a new instance of the PortfolioStatistics class

Parameters:

Name Type Description Default
profit_loss Optional[SortedDictionary[datetime, float]]

Trade record of profits and losses

None
equity Optional[SortedDictionary[datetime, float]]

The list of daily equity values

None
portfolio_turnover Optional[SortedDictionary[datetime, float]]

The algorithm portfolio turnover

None
list_performance Optional[List[float]]

The list of algorithm performance values

None
list_benchmark Optional[List[float]]

The list of benchmark values

None
starting_capital Optional[float]

The algorithm starting capital

None
risk_free_interest_rate_model Optional[IRiskFreeInterestRateModel]

The risk free interest rate model to use

None
trading_days_per_year Optional[int]

The number of trading days per year

None
win_count Optional[Optional[int]]

The number of wins, including ITM options with profit_loss less than 0.

None
loss_count Optional[Optional[int]]

The number of losses

None

average_win_rate

average_win_rate: float

The average rate of return for winning trades

average_loss_rate

average_loss_rate: float

The average rate of return for losing trades

profit_loss_ratio

profit_loss_ratio: float

The ratio of the average win rate to the average loss rate

win_rate

win_rate: float

The ratio of the number of winning trades to the total number of trades

loss_rate

loss_rate: float

The ratio of the number of losing trades to the total number of trades

expectancy

expectancy: float

The expected value of the rate of return

start_equity

start_equity: float

Initial Equity Total Value

end_equity

end_equity: float

Final Equity Total Value

compounding_annual_return

compounding_annual_return: float

Annual compounded returns statistic based on the final-starting capital and years.

drawdown

drawdown: float

Drawdown maximum percentage.

total_net_profit

total_net_profit: float

The total net profit percentage.

sharpe_ratio

sharpe_ratio: float

Sharpe ratio with respect to risk free rate: measures excess of return per unit of risk.

probabilistic_sharpe_ratio

probabilistic_sharpe_ratio: float

Probabilistic Sharpe Ratio is a probability measure associated with the Sharpe ratio. It informs us of the probability that the estimated Sharpe ratio is greater than a chosen benchmark

sortino_ratio

sortino_ratio: float

Sortino ratio with respect to risk free rate: measures excess of return per unit of downside risk.

alpha

alpha: float

Algorithm "Alpha" statistic - abnormal returns over the risk free rate and the relationshio (beta) with the benchmark returns.

beta

beta: float

Algorithm "beta" statistic - the covariance between the algorithm and benchmark performance, divided by benchmark's variance

annual_standard_deviation

annual_standard_deviation: float

Annualized standard deviation

annual_variance

annual_variance: float

Annualized variance statistic calculation using the daily performance variance and trading days per year.

information_ratio

information_ratio: float

Information ratio - risk adjusted return

tracking_error

tracking_error: float

Tracking error volatility (TEV) statistic - a measure of how closely a portfolio follows the index to which it is benchmarked

treynor_ratio

treynor_ratio: float

Treynor ratio statistic is a measurement of the returns earned in excess of that which could have been earned on an investment that has no diversifiable risk

portfolio_turnover

portfolio_turnover: float

The average Portfolio Turnover

value_at_risk_99

value_at_risk_99: float

The 1-day VaR for the portfolio, using the Variance-covariance approach. Assumes a 99% confidence level, 1 year lookback period, and that the returns are normally distributed.

value_at_risk_95

value_at_risk_95: float

The 1-day VaR for the portfolio, using the Variance-covariance approach. Assumes a 95% confidence level, 1 year lookback period, and that the returns are normally distributed.

drawdown_recovery

drawdown_recovery: int

The recovery time of the maximum drawdown.