Skip to content

SharpeRatioReportElement

QuantConnect.Report.ReportElements.SharpeRatioReportElement

SharpeRatioReportElement(
    name: str,
    key: str,
    backtest: BacktestResult,
    live: LiveResult,
    trading_days_per_year: int,
)

Bases: ReportElement

Class for render the Sharpe Ratio statistic for a report

Estimate the sharpe ratio of the strategy.

Parameters:

Name Type Description Default
name str

Name of the widget

required
key str

Location of injection

required
backtest BacktestResult

Backtest result object

required
live LiveResult

Live result object

required
trading_days_per_year int

The number of trading days per year to get better result of statistics

required

live_result

live_result: LiveResult

Live result object

This codeEntityType is protected.

backtest_result

backtest_result: BacktestResult

Backtest result object

This codeEntityType is protected.

backtest_result_value

backtest_result_value: Optional[float]

Sharpe Ratio from a backtest

name

name: str

Name of this report element

key

key: str

Template key code.

json_key

json_key: str

Normalizes the key into a JSON-friendly key

result

result: Object

Result of the render as an object for serialization to JSON

get_annual_standard_deviation

get_annual_standard_deviation(
    trailing_performance: List[float],
    trading_days_per_year: float,
) -> float

Get annual standard deviation

Parameters:

Name Type Description Default
trailing_performance List[float]

The performance for the last period

required
trading_days_per_year float

The number of trading days per year to get better result of statistics

required

Returns:

Type Description
float

Annual standard deviation.

render

render() -> str

The generated output string to be injected