Skip to content
New: Star-import, signal unraveling, Python 3.12 support, and more

# qs_adapter module

Adapter class for QuantStats.

Note

Accessors do not utilize caching.

We can access the adapter from `ReturnsAccessor`:

    >>> from vectorbtpro import *
    >>> import quantstats as qs

    >>> np.random.seed(42)
    >>> rets = pd.Series(np.random.uniform(-0.1, 0.1, size=(100,)))
    >>> bm_returns = pd.Series(np.random.uniform(-0.1, 0.1, size=(100,)))

    >>> rets.vbt.returns.qs.r_squared(benchmark=bm_returns)
    0.0011582111228735541

Which is the same as:

    >>> qs.stats.r_squared(rets, bm_returns)

So why not just using `qs.stats`?

First, we can define all parameters such as benchmark returns once and avoid passing them repeatedly to every function. Second, vectorbt automatically translates parameters passed to `ReturnsAccessor` for the use in quantstats.

    >>> # Defaults that vectorbt understands
    >>> ret_acc = rets.vbt.returns(
    ...     bm_returns=bm_returns,
    ...     freq='d',
    ...     year_freq='365d',
    ...     defaults=dict(risk_free=0.001)
    ... )

    >>> ret_acc.qs.r_squared()
    0.0011582111228735541

    >>> ret_acc.qs.sharpe()
    -1.9158923252075455

    >>> # Defaults that only quantstats understands
    >>> qs_defaults = dict(
    ...     benchmark=bm_returns,
    ...     periods=365,
    ...     rf=0.001
    ... )
    >>> ret_acc_qs = rets.vbt.returns.qs(defaults=qs_defaults)

    >>> ret_acc_qs.r_squared()
    0.0011582111228735541

    >>> ret_acc_qs.sharpe()
    -1.9158923252075455

The adapter automatically passes the returns to the particular function. It also merges the defaults defined in the settings, the defaults passed to `ReturnsAccessor`, and the defaults passed to QSAdapter itself, and matches them with the argument names listed in the function's signature.

For example, the `periods` argument defaults to the annualization factor `ReturnsAccessor.ann_factor`, which itself is based on the `freq` argument. This makes the results produced by quantstats and vectorbt at least somewhat similar.

    >>> vbt.settings.wrapping['freq'] = 'h'
    >>> vbt.settings.returns['year_freq'] = '365d'

    >>> rets.vbt.returns.sharpe_ratio()  # ReturnsAccessor
    -9.38160953971508

    >>> rets.vbt.returns.qs.sharpe()  # quantstats via QSAdapter
    -9.38160953971508

We can still override any argument by overriding its default or by passing it directly to the function:

    >>> rets.vbt.returns.qs(defaults=dict(periods=252)).sharpe()
    -1.5912029345745982

    >>> rets.vbt.returns.qs.sharpe(periods=252)
    -1.5912029345745982

    >>> qs.stats.sharpe(rets)
    -1.5912029345745982

## attach_qs_methods function

    attach_qs_methods(
        cls,
        replace_signature=True
    )

Class decorator to attach quantstats methods.

## QSAdapter class

    QSAdapter(
        returns_acc,
        defaults=None,
        **kwargs
    )

Adapter class for quantstats.

Superclasses

- Cacheable
- Chainable
- Comparable
- Configured
- HasSettings
- Pickleable
- Prettified

Inherited members

- Cacheable.get_ca_setup()
- Chainable.pipe()
- Configured.config
- Configured.copy()
- Configured.equals()
- Configured.get_writeable_attrs()
- Configured.prettify()
- Configured.rec_state
- Configured.replace()
- Configured.resolve_merge_kwargs()
- Configured.update_config()
- HasSettings.get_path_setting()
- HasSettings.get_path_settings()
- HasSettings.get_setting()
- HasSettings.get_settings()
- HasSettings.has_path_setting()
- HasSettings.has_path_settings()
- HasSettings.has_setting()
- HasSettings.has_settings()
- HasSettings.reset_settings()
- HasSettings.resolve_setting()
- HasSettings.resolve_settings_paths()
- HasSettings.set_settings()
- Pickleable.decode_config()
- Pickleable.decode_config_node()
- Pickleable.dumps()
- Pickleable.encode_config()
- Pickleable.encode_config_node()
- Pickleable.file_exists()
- Pickleable.getsize()
- Pickleable.load()
- Pickleable.loads()
- Pickleable.modify_state()
- Pickleable.resolve_file_path()
- Pickleable.save()

### adjusted_sortino method

    QSAdapter.adjusted_sortino(
        *,
        column=None,
        rf=0,
        periods=252,
        annualize=True,
        smart=False
    )

See `quantstats.stats.adjusted_sortino`.

### aggregate_returns method

    QSAdapter.aggregate_returns(
        *,
        column=None,
        period=None,
        compounded=True
    )

See `quantstats.utils.aggregate_returns`.

### autocorr_penalty method

    QSAdapter.autocorr_penalty(
        *,
        column=None,
        prepare_returns=False
    )

See `quantstats.stats.autocorr_penalty`.

### avg_loss method

    QSAdapter.avg_loss(
        *,
        column=None,
        aggregate=None,
        compounded=True,
        prepare_returns=True
    )

See `quantstats.stats.avg_loss`.

### avg_return method

    QSAdapter.avg_return(
        *,
        column=None,
        aggregate=None,
        compounded=True,
        prepare_returns=True
    )

See `quantstats.stats.avg_return`.

### avg_win method

    QSAdapter.avg_win(
        *,
        column=None,
        aggregate=None,
        compounded=True,
        prepare_returns=True
    )

See `quantstats.stats.avg_win`.

### basic_report method

    QSAdapter.basic_report(
        *,
        column=None,
        benchmark=None,
        rf=0.0,
        grayscale=False,
        figsize=(8, 5),
        display=True,
        compounded=True,
        periods_per_year=252,
        match_dates=False
    )

See `quantstats.reports.basic`.

### best method

    QSAdapter.best(
        *,
        column=None,
        aggregate=None,
        compounded=True,
        prepare_returns=True
    )

See `quantstats.stats.best`.

### cagr method

    QSAdapter.cagr(
        *,
        column=None,
        rf=0.0,
        compounded=True
    )

See `quantstats.stats.cagr`.

### calmar method

    QSAdapter.calmar(
        *,
        column=None,
        prepare_returns=True
    )

See `quantstats.stats.calmar`.

### common_sense_ratio method

    QSAdapter.common_sense_ratio(
        *,
        column=None,
        prepare_returns=True
    )

See `quantstats.stats.common_sense_ratio`.

### comp method

    QSAdapter.comp(
        *,
        column=None
    )

See `quantstats.stats.comp`.

### compare method

    QSAdapter.compare(
        *,
        column=None,
        benchmark,
        aggregate=None,
        compounded=True,
        round_vals=None,
        prepare_returns=True
    )

See `quantstats.stats.compare`.

### compsum method

    QSAdapter.compsum(
        *,
        column=None
    )

See `quantstats.stats.compsum`.

### conditional_value_at_risk method

    QSAdapter.conditional_value_at_risk(
        *,
        column=None,
        sigma=1,
        confidence=0.95,
        prepare_returns=True
    )

See `quantstats.stats.conditional_value_at_risk`.

### consecutive_losses method

    QSAdapter.consecutive_losses(
        *,
        column=None,
        aggregate=None,
        compounded=True,
        prepare_returns=True
    )

See `quantstats.stats.consecutive_losses`.

### consecutive_wins method

    QSAdapter.consecutive_wins(
        *,
        column=None,
        aggregate=None,
        compounded=True,
        prepare_returns=True
    )

See `quantstats.stats.consecutive_wins`.

### cpc_index method

    QSAdapter.cpc_index(
        *,
        column=None,
        prepare_returns=True
    )

See `quantstats.stats.cpc_index`.

### cvar method

    QSAdapter.cvar(
        *,
        column=None,
        sigma=1,
        confidence=0.95,
        prepare_returns=True
    )

See `quantstats.stats.cvar`.

### defaults property

Defaults for QSAdapter.

Merges `defaults` from qs_adapter, `returns_acc.defaults` (with adapted naming), and `defaults` from QSAdapter.

### defaults_mapping property

Common argument names in quantstats mapped to `ReturnsAccessor.defaults`.

### distribution method

    QSAdapter.distribution(
        *,
        column=None,
        compounded=True,
        prepare_returns=True
    )

See `quantstats.stats.distribution`.

### expected_return method

    QSAdapter.expected_return(
        *,
        column=None,
        aggregate=None,
        compounded=True,
        prepare_returns=True
    )

See `quantstats.stats.expected_return`.

### expected_shortfall method

    QSAdapter.expected_shortfall(
        *,
        column=None,
        sigma=1,
        confidence=0.95
    )

See `quantstats.stats.expected_shortfall`.

### exponential_stdev method

    QSAdapter.exponential_stdev(
        *,
        column=None,
        window=30,
        is_halflife=False
    )

See `quantstats.utils.exponential_stdev`.

### exposure method

    QSAdapter.exposure(
        *,
        column=None,
        prepare_returns=True
    )

See `quantstats.stats.exposure`.

### full_report method

    QSAdapter.full_report(
        *,
        column=None,
        benchmark=None,
        rf=0.0,
        grayscale=False,
        figsize=(8, 5),
        display=True,
        compounded=True,
        periods_per_year=252,
        match_dates=False
    )

See `quantstats.reports.full`.

### gain_to_pain_ratio method

    QSAdapter.gain_to_pain_ratio(
        *,
        column=None,
        rf=0,
        resolution='D'
    )

See `quantstats.stats.gain_to_pain_ratio`.

### greeks method

    QSAdapter.greeks(
        *,
        column=None,
        benchmark,
        periods=252.0,
        prepare_returns=True
    )

See `quantstats.stats.greeks`.

### group_returns method

    QSAdapter.group_returns(
        *,
        column=None,
        groupby,
        compounded=False
    )

See `quantstats.utils.group_returns`.

### html_report method

    QSAdapter.html_report(
        *,
        column=None,
        benchmark=None,
        rf=0.0,
        grayscale=False,
        title='Strategy Tearsheet',
        output=None,
        compounded=True,
        periods_per_year=252,
        download_filename='quantstats-tearsheet.html',
        figfmt='svg',
        template_path=None,
        match_dates=False,
        **kwargs
    )

See `quantstats.reports.html`.

### implied_volatility method

    QSAdapter.implied_volatility(
        *,
        column=None,
        periods=252,
        annualize=True
    )

See `quantstats.stats.implied_volatility`.

### information_ratio method

    QSAdapter.information_ratio(
        *,
        column=None,
        benchmark,
        prepare_returns=True
    )

See `quantstats.stats.information_ratio`.

### kelly_criterion method

    QSAdapter.kelly_criterion(
        *,
        column=None,
        prepare_returns=True
    )

See `quantstats.stats.kelly_criterion`.

### kurtosis method

    QSAdapter.kurtosis(
        *,
        column=None,
        prepare_returns=True
    )

See `quantstats.stats.kurtosis`.

### log_returns method

    QSAdapter.log_returns(
        *,
        column=None,
        rf=0.0,
        nperiods=None
    )

See `quantstats.utils.log_returns`.

### make_index method

    QSAdapter.make_index(
        *,
        column=None,
        rebalance='1M',
        period='max',
        returns=None,
        match_dates=False
    )

See `quantstats.utils.make_index`.

### make_portfolio method

    QSAdapter.make_portfolio(
        *,
        column=None,
        start_balance=100000.0,
        mode='comp',
        round_to=None
    )

See `quantstats.utils.make_portfolio`.

### metrics_report method

    QSAdapter.metrics_report(
        *,
        column=None,
        benchmark=None,
        rf=0.0,
        display=True,
        mode='basic',
        sep=False,
        compounded=True,
        periods_per_year=252,
        prepare_returns=True,
        match_dates=False,
        **kwargs
    )

See `quantstats.reports.metrics`.

### monthly_returns method

    QSAdapter.monthly_returns(
        *,
        column=None,
        eoy=True,
        compounded=True,
        prepare_returns=True
    )

See `quantstats.stats.monthly_returns`.

### omega method

    QSAdapter.omega(
        *,
        column=None,
        rf=0.0,
        required_return=0.0,
        periods=252
    )

See `quantstats.stats.omega`.

### outlier_loss_ratio method

    QSAdapter.outlier_loss_ratio(
        *,
        column=None,
        quantile=0.01,
        prepare_returns=True
    )

See `quantstats.stats.outlier_loss_ratio`.

### outlier_win_ratio method

    QSAdapter.outlier_win_ratio(
        *,
        column=None,
        quantile=0.99,
        prepare_returns=True
    )

See `quantstats.stats.outlier_win_ratio`.

### outliers method

    QSAdapter.outliers(
        *,
        column=None,
        quantile=0.95
    )

See `quantstats.stats.outliers`.

### payoff_ratio method

    QSAdapter.payoff_ratio(
        *,
        column=None,
        prepare_returns=True
    )

See `quantstats.stats.payoff_ratio`.

### plot_daily_returns method

    QSAdapter.plot_daily_returns(
        *,
        column=None,
        grayscale=False,
        figsize=(10, 4),
        fontname='Arial',
        lw=0.5,
        log_scale=False,
        ylabel='Returns',
        subtitle=True,
        savefig=None,
        show=True,
        prepare_returns=True
    )

See `quantstats.plots.daily_returns`.

### plot_distribution method

    QSAdapter.plot_distribution(
        *,
        column=None,
        fontname='Arial',
        grayscale=False,
        ylabel=True,
        figsize=(10, 6),
        subtitle=True,
        compounded=True,
        savefig=None,
        show=True,
        prepare_returns=True
    )

See `quantstats.plots.distribution`.

### plot_drawdown method

    QSAdapter.plot_drawdown(
        *,
        column=None,
        grayscale=False,
        figsize=(10, 5),
        fontname='Arial',
        lw=1,
        log_scale=False,
        match_volatility=False,
        compound=False,
        ylabel='Drawdown',
        resample=None,
        subtitle=True,
        savefig=None,
        show=True
    )

See `quantstats.plots.drawdown`.

### plot_drawdowns_periods method

    QSAdapter.plot_drawdowns_periods(
        *,
        column=None,
        periods=5,
        lw=1.5,
        log_scale=False,
        fontname='Arial',
        grayscale=False,
        figsize=(10, 5),
        ylabel=True,
        subtitle=True,
        compounded=True,
        savefig=None,
        show=True,
        prepare_returns=True
    )

See `quantstats.plots.drawdowns_periods`.

### plot_earnings method

    QSAdapter.plot_earnings(
        *,
        column=None,
        start_balance=100000.0,
        mode='comp',
        grayscale=False,
        figsize=(10, 6),
        title='Portfolio Earnings',
        fontname='Arial',
        lw=1.5,
        subtitle=True,
        savefig=None,
        show=True
    )

See `quantstats.plots.earnings`.

### plot_histogram method

    QSAdapter.plot_histogram(
        *,
        column=None,
        resample='M',
        fontname='Arial',
        grayscale=False,
        figsize=(10, 5),
        ylabel=True,
        subtitle=True,
        compounded=True,
        savefig=None,
        show=True,
        prepare_returns=True
    )

See `quantstats.plots.histogram`.

### plot_log_returns method

    QSAdapter.plot_log_returns(
        *,
        column=None,
        benchmark=None,
        grayscale=False,
        figsize=(10, 5),
        fontname='Arial',
        lw=1.5,
        match_volatility=False,
        compound=True,
        cumulative=True,
        resample=None,
        ylabel='Cumulative Returns',
        subtitle=True,
        savefig=None,
        show=True,
        prepare_returns=True
    )

See `quantstats.plots.log_returns`.

### plot_monthly_heatmap method

    QSAdapter.plot_monthly_heatmap(
        *,
        column=None,
        annot_size=10,
        figsize=(10, 5),
        cbar=True,
        square=False,
        compounded=True,
        eoy=False,
        grayscale=False,
        fontname='Arial',
        ylabel=True,
        savefig=None,
        show=True
    )

See `quantstats.plots.monthly_heatmap`.

### plot_monthly_returns method

    QSAdapter.plot_monthly_returns(
        *,
        column=None,
        annot_size=10,
        figsize=(10, 5),
        cbar=True,
        square=False,
        compounded=True,
        eoy=False,
        grayscale=False,
        fontname='Arial',
        ylabel=True,
        savefig=None,
        show=True
    )

See `quantstats.plots.monthly_returns`.

### plot_returns method

    QSAdapter.plot_returns(
        *,
        column=None,
        benchmark=None,
        grayscale=False,
        figsize=(10, 6),
        fontname='Arial',
        lw=1.5,
        match_volatility=False,
        compound=True,
        cumulative=True,
        resample=None,
        ylabel='Cumulative Returns',
        subtitle=True,
        savefig=None,
        show=True,
        prepare_returns=True
    )

See `quantstats.plots.returns`.

### plot_rolling_beta method

    QSAdapter.plot_rolling_beta(
        *,
        column=None,
        benchmark,
        window1=126,
        window1_label='6-Months',
        window2=252,
        window2_label='12-Months',
        lw=1.5,
        fontname='Arial',
        grayscale=False,
        figsize=(10, 3),
        ylabel=True,
        subtitle=True,
        savefig=None,
        show=True,
        prepare_returns=True
    )

See `quantstats.plots.rolling_beta`.

### plot_rolling_sharpe method

    QSAdapter.plot_rolling_sharpe(
        *,
        column=None,
        benchmark=None,
        rf=0.0,
        period=126,
        period_label='6-Months',
        periods_per_year=252,
        lw=1.25,
        fontname='Arial',
        grayscale=False,
        figsize=(10, 3),
        ylabel='Sharpe',
        subtitle=True,
        savefig=None,
        show=True
    )

See `quantstats.plots.rolling_sharpe`.

### plot_rolling_sortino method

    QSAdapter.plot_rolling_sortino(
        *,
        column=None,
        benchmark=None,
        rf=0.0,
        period=126,
        period_label='6-Months',
        periods_per_year=252,
        lw=1.25,
        fontname='Arial',
        grayscale=False,
        figsize=(10, 3),
        ylabel='Sortino',
        subtitle=True,
        savefig=None,
        show=True
    )

See `quantstats.plots.rolling_sortino`.

### plot_rolling_volatility method

    QSAdapter.plot_rolling_volatility(
        *,
        column=None,
        benchmark=None,
        period=126,
        period_label='6-Months',
        periods_per_year=252,
        lw=1.5,
        fontname='Arial',
        grayscale=False,
        figsize=(10, 3),
        ylabel='Volatility',
        subtitle=True,
        savefig=None,
        show=True
    )

See `quantstats.plots.rolling_volatility`.

### plot_snapshot method

    QSAdapter.plot_snapshot(
        *,
        column=None,
        grayscale=False,
        figsize=(10, 8),
        title='Portfolio Summary',
        fontname='Arial',
        lw=1.5,
        mode='comp',
        subtitle=True,
        savefig=None,
        show=True,
        log_scale=False
    )

See `quantstats.plots.snapshot`.

### plot_yearly_returns method

    QSAdapter.plot_yearly_returns(
        *,
        column=None,
        benchmark=None,
        fontname='Arial',
        grayscale=False,
        hlw=1.5,
        hlcolor='red',
        hllabel='',
        match_volatility=False,
        log_scale=False,
        figsize=(10, 5),
        ylabel=True,
        subtitle=True,
        compounded=True,
        savefig=None,
        show=True,
        prepare_returns=True
    )

See `quantstats.plots.yearly_returns`.

### plots_report method

    QSAdapter.plots_report(
        *,
        column=None,
        benchmark=None,
        grayscale=False,
        figsize=(8, 5),
        mode='basic',
        compounded=True,
        periods_per_year=252,
        prepare_returns=True,
        match_dates=False
    )

See `quantstats.reports.plots`.

### profit_factor method

    QSAdapter.profit_factor(
        *,
        column=None,
        prepare_returns=True
    )

See `quantstats.stats.profit_factor`.

### profit_ratio method

    QSAdapter.profit_ratio(
        *,
        column=None,
        prepare_returns=True
    )

See `quantstats.stats.profit_ratio`.

### r2 method

    QSAdapter.r2(
        *,
        column=None,
        benchmark
    )

See `quantstats.stats.r2`.

### r_squared method

    QSAdapter.r_squared(
        *,
        column=None,
        benchmark,
        prepare_returns=True
    )

See `quantstats.stats.r_squared`.

### rar method

    QSAdapter.rar(
        *,
        column=None,
        rf=0.0
    )

See `quantstats.stats.rar`.

### recovery_factor method

    QSAdapter.recovery_factor(
        *,
        column=None,
        prepare_returns=True
    )

See `quantstats.stats.recovery_factor`.

### remove_outliers method

    QSAdapter.remove_outliers(
        *,
        column=None,
        quantile=0.95
    )

See `quantstats.stats.remove_outliers`.

### returns_acc property

Returns accessor.

### risk_of_ruin method

    QSAdapter.risk_of_ruin(
        *,
        column=None,
        prepare_returns=True
    )

See `quantstats.stats.risk_of_ruin`.

### risk_return_ratio method

    QSAdapter.risk_return_ratio(
        *,
        column=None,
        prepare_returns=True
    )

See `quantstats.stats.risk_return_ratio`.

### rolling_greeks method

    QSAdapter.rolling_greeks(
        *,
        column=None,
        benchmark,
        periods=252,
        prepare_returns=True
    )

See `quantstats.stats.rolling_greeks`.

### rolling_sharpe method

    QSAdapter.rolling_sharpe(
        *,
        column=None,
        rf=0.0,
        rolling_period=126,
        annualize=True,
        periods_per_year=252,
        prepare_returns=True
    )

See `quantstats.stats.rolling_sharpe`.

### rolling_sortino method

    QSAdapter.rolling_sortino(
        *,
        column=None,
        rf=0,
        rolling_period=126,
        annualize=True,
        periods_per_year=252,
        **kwargs
    )

See `quantstats.stats.rolling_sortino`.

### rolling_volatility method

    QSAdapter.rolling_volatility(
        *,
        column=None,
        rolling_period=126,
        periods_per_year=252,
        prepare_returns=True
    )

See `quantstats.stats.rolling_volatility`.

### ror method

    QSAdapter.ror(
        *,
        column=None
    )

See `quantstats.stats.ror`.

### serenity_index method

    QSAdapter.serenity_index(
        *,
        column=None,
        rf=0
    )

See `quantstats.stats.serenity_index`.

### sharpe method

    QSAdapter.sharpe(
        *,
        column=None,
        rf=0.0,
        periods=252,
        annualize=True,
        smart=False
    )

See `quantstats.stats.sharpe`.

### skew method

    QSAdapter.skew(
        *,
        column=None,
        prepare_returns=True
    )

See `quantstats.stats.skew`.

### smart_sharpe method

    QSAdapter.smart_sharpe(
        *,
        column=None,
        rf=0.0,
        periods=252,
        annualize=True
    )

See `quantstats.stats.smart_sharpe`.

### smart_sortino method

    QSAdapter.smart_sortino(
        *,
        column=None,
        rf=0,
        periods=252,
        annualize=True
    )

See `quantstats.stats.smart_sortino`.

### sortino method

    QSAdapter.sortino(
        *,
        column=None,
        rf=0,
        periods=252,
        annualize=True,
        smart=False
    )

See `quantstats.stats.sortino`.

### tail_ratio method

    QSAdapter.tail_ratio(
        *,
        column=None,
        cutoff=0.95,
        prepare_returns=True
    )

See `quantstats.stats.tail_ratio`.

### to_drawdown_series method

    QSAdapter.to_drawdown_series(
        *,
        column=None
    )

See `quantstats.stats.to_drawdown_series`.

### to_excess_returns method

    QSAdapter.to_excess_returns(
        *,
        column=None,
        rf,
        nperiods=None
    )

See `quantstats.utils.to_excess_returns`.

### to_log_returns method

    QSAdapter.to_log_returns(
        *,
        column=None,
        rf=0.0,
        nperiods=None
    )

See `quantstats.utils.to_log_returns`.

### to_prices method

    QSAdapter.to_prices(
        *,
        column=None,
        base=100000.0
    )

See `quantstats.utils.to_prices`.

### treynor_ratio method

    QSAdapter.treynor_ratio(
        *,
        column=None,
        benchmark,
        periods=252.0,
        rf=0.0
    )

See `quantstats.stats.treynor_ratio`.

### ulcer_index method

    QSAdapter.ulcer_index(
        *,
        column=None
    )

See `quantstats.stats.ulcer_index`.

### ulcer_performance_index method

    QSAdapter.ulcer_performance_index(
        *,
        column=None,
        rf=0
    )

See `quantstats.stats.ulcer_performance_index`.

### upi method

    QSAdapter.upi(
        *,
        column=None,
        rf=0
    )

See `quantstats.stats.upi`.

### value_at_risk method

    QSAdapter.value_at_risk(
        *,
        column=None,
        sigma=1,
        confidence=0.95,
        prepare_returns=True
    )

See `quantstats.stats.value_at_risk`.

### var method

    QSAdapter.var(
        *,
        column=None,
        sigma=1,
        confidence=0.95,
        prepare_returns=True
    )

See `quantstats.stats.var`.

### volatility method

    QSAdapter.volatility(
        *,
        column=None,
        periods=252,
        annualize=True,
        prepare_returns=True
    )

See `quantstats.stats.volatility`.

### win_loss_ratio method

    QSAdapter.win_loss_ratio(
        *,
        column=None,
        prepare_returns=True
    )

See `quantstats.stats.win_loss_ratio`.

### win_rate method

    QSAdapter.win_rate(
        *,
        column=None,
        aggregate=None,
        compounded=True,
        prepare_returns=True
    )

See `quantstats.stats.win_rate`.

### worst method

    QSAdapter.worst(
        *,
        column=None,
        aggregate=None,
        compounded=True,
        prepare_returns=True
    )

See `quantstats.stats.worst`.

#### Cookie consent

We use cookies to recognize your repeated visits and preferences, as well as to measure the effectiveness of our documentation and whether users find what they're searching for. With your consent, you're helping us to make our documentation better.

- Google Analytics
- GitHub

Manage settings