The Probabilistic Sharpe Ratio (PSR) is the probability that the true (population) Sharpe ratio exceeds benchmark_sharpe_ratio, folding the skewness and (non-excess) kurtosis of the underlying returns into the standard error of the Sharpe ratio so that a short, lumpy sample no longer looks more convincing than it is:

\[\operatorname{PSR}(\text{SR} \cdot) = \Phi((\text{SR̂} - \text{SR} \cdot) \cdot \sqrt{n - 1} / \sqrt{1 - \text{γ₃} \cdot \text{SR̂} + ((\text{γ₄} - 1) / 4) \cdot \text{SR̂} ^{2}})\]

In the Finance Toolkit this is get_sharpe_ratio with method="probabilistic"; the Sharpe Ratio page has the function’s full description.

Probabilistic Sharpe Ratio (PSR) in Python

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_sharpe_ratio as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["SPY", "TLT", "GLD", "BTCUSD"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
    benchmark_ticker=None,
)

toolkit.performance.get_sharpe_ratio(method="probabilistic")

Which returns:

Date SPY TLT GLD BTCUSD
2021 0.9751 0.3584 0.3016 0.7363
2022 0.2047 0.0321 0.4346 0.116
2023 0.939 0.512 0.7505 0.9511
2024 0.9277 0.2083 0.9094 0.9221
2025 0.7707 0.5236 0.9876 0.4249

Parameters

get_sharpe_ratio accepts the following parameters.

ParameterTypeDescriptionExample
periodstrThe period to use for the calculation. Defaults to “quarterly” if the Toolkit is initialised with quarterly=True, otherwise “yearly”."quarterly"
rollingintThe rolling period to use for the calculation. If you select period = ‘monthly’ and set rolling to 12 you obtain the rolling 12-month Sharpe Ratio.4
methodstrWhich Sharpe ratio to calculate, one of “standard”, “lo”, “adjusted”, “probabilistic” or “deflated”, as described above. Defaults to “standard”."probabilistic"
benchmark_sharpe_ratiofloatThe hypothesized or benchmark Sharpe ratio (SR*) to test the observed Sharpe ratio against. Only used when method=”probabilistic”. Defaults to 0.0, i.e. testing whether the strategy has any skill at all above doing nothing.0.5
trials_windowintThe window size of the auxiliary rolling Sharpe ratio series that approximates Var[SR_trials] and the default n_trials, see above. Only used when method=”deflated”. It counts observations of the returns the Sharpe ratio is computed from: daily (or intraday) observations for the Sharpe ratio per period, and observations of period when rolling is set. Defaults to None, which uses the median number of observations per period (so each trial spans about one period) for the Sharpe ratio per period, and half of the available return history for a rolling Sharpe ratio so that enough overlapping windows exist regardless of period or date range.8
n_trialsintThe number of independent (or effectively independent) strategy variations, parameter combinations, or lookback windows tried before arriving at the reported Sharpe ratio. Only used when method=”deflated”. Defaults to None, which falls back to the number of valid values in the auxiliary rolling Sharpe ratio series described above. Pass this explicitly whenever the actual number of trials is known.20
lagsintThe number of autocorrelation lags in Lo’s η(q). Only used when method=”lo”. Defaults to None, which uses the Newey and West (1994) rule floor(4 * (n / 100)^(2/9)) on the n observations (4 for a year of daily returns), capped at q − 1.2
roundingint | NoneThe number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise).2
growthboolWhether to calculate the growth of the ratios. Defaults to False.True
lagint | list[int]The lag to use for the growth calculation. Defaults to 1.4
standardizeboolWhether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.True
annualizeboolWhether to annualize the Sharpe ratio, multiplying it by the square root of the number of observations in a year: 252 for the daily returns within each period, 252 times the median number of bars per day for the intraday returns within a day (period=”daily” with an intraday_period), or the periods in a year for a rolling Sharpe ratio (e.g. 12 for monthly). Only for method=”standard” and “adjusted”, since the probabilistic and deflated methods return probabilities; method=”lo” is annualized either way. Defaults to False.True
show_columnsstr | list[str] | NoneThe columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column.None, which keeps every column
Share