Deflated Sharpe ratio calculator

Compute the probabilistic Sharpe ratio, the minimum track record length and the deflated Sharpe ratio from per-period inputs. The calculation runs in your browser, and the inputs stay on your device.

Calculator

Enter each figure per period: one period is the interval of one return in the track record, such as a day or a month. The default inputs are the worked example of the DSR paper.

Track record, per period

Mean return divided by the standard deviation of returns, both over one period.

Count of returns in the track record, at least 2.

Normal returns have a skewness of 0.

Raw kurtosis: 3 for normal returns. Add 3 to an excess kurtosis.

252 or 250 for daily returns, 52 for weekly, 12 for monthly. Used for the annual figures.

Benchmark and confidence

With SR* = 0, the PSR is the probability of a positive true Sharpe ratio.

Strictly between 0.5 and 1, for example 0.95.

Trials

Count of strategy variants tried, discarded ones included, at least 1.

A short note on where N comes from, such as the size of the grid in your run log. It is printed with the results and carried by the shared link.

The variance of the per-period Sharpe ratios across your own trials. The default 0.002 is the paper's 0.5 per year at 250 periods. Left empty, V = 1/T: the dispersion of Sharpe ratios estimated on T independent returns with a true Sharpe ratio of 0.

Convert from annual figures

SR per period = annual SR / sqrt(periods per year). V per period = annual V / periods per year.

Results

Annual Sharpe ratio, SR · sqrt(periods per year)
2.5000
PSR at the benchmark SR*
0.999997
MinTRL, in observations
166.64
MinTRL, rounded up to the next observation
167
MinTRL, in years
0.67
Standard deviation of the trials' Sharpe ratios, σ(SR) = sqrt(V), per period
0.0447
σ(SR) per year, σ(SR) · sqrt(periods per year)
0.7071
SR0, the expected maximum Sharpe ratio of N trials with no skill, per period
0.1132
DSR, the PSR at the benchmark SR0
0.9004

Assumptions behind the DSR

Null dispersion V
Null dispersion from the entered V: 0.002 per period.
Number of trials
Deflated for N = 100 declared trials.
How N was counted
not stated
Version of the method
1

Link to these inputs

The link carries the numbers in the fields above, the note on N and the version of the method in its address. It holds no return series.

Sensitivity of the DSR to N

The curve holds SR, T, skewness, kurtosis and V at the values entered above and computes the DSR for N from 1 to 10,000 on a log scale, or up to the next power of ten above a larger entered N. The marked point is the entered N. The table and the CSV file carry the same points as numbers.

DSR against the number of trials N, from 1 to 10,000, log scale00.250.50.7511101001k10kNumber of trials N, log scaleDSR

With the inputs above and V = 0.002 per period, the DSR is 0.999997 at N = 1, 0.9004 at the entered N = 100 (the marked point), and 0.3389 at N = 10,000. SR0 rises with N, so the DSR falls as N grows.

DSR at selected N, with the other inputs fixed
NSR0 per periodDSR
10.00000.999997
20.02320.9999
50.05330.9986
100.07040.9939
200.08500.9816
500.10180.9462
100 (entered)0.11320.9004
2000.12370.8374
5000.13650.7314
1,0000.14560.6399
2,0000.15420.5449
5,0000.16490.4229
10,0000.17270.3389

Download the 103 points of the curve as CSV

Formulas

SR is the mean of the returns divided by their standard deviation, over one period. The annual figure multiplies it by the square root of the periods per year, which assumes returns independent from one period to the next.

SR = mean(r) / std(r)
annual SR = SR · sqrt(periods per year)

The probabilistic Sharpe ratio (PSR) is Eq. 11 of Bailey and López de Prado (2012). γ3 is the skewness of returns and γ4 their raw kurtosis.

PSR(SR*) = Φ( (SR − SR*) · sqrt(T − 1) / sqrt(1 − γ3 · SR + (γ4 − 1) / 4 · SR²) )

The minimum track record length (MinTRL) is Eq. 13 of the same paper. It gives the number of observations at which the PSR reaches the confidence level.

MinTRL = 1 + (1 − γ3 · SR + (γ4 − 1) / 4 · SR²) · (Φ⁻¹(confidence) / (SR − SR*))²

The deflated Sharpe ratio (DSR) is Eq. 2 of Bailey and López de Prado (2014): the PSR at a benchmark SR0. SR0 is the expected maximum Sharpe ratio of N independent trials with no skill, whose Sharpe ratios have variance V.

SR0 = sqrt(V) · ((1 − γ) · Φ⁻¹(1 − 1/N) + γ · Φ⁻¹(1 − 1/(N·e))),   γ ≈ 0.5772
DSR = PSR(SR0)

Here γ is the Euler-Mascheroni constant and e is Euler's number. With N = 1, no selection takes place: the calculator sets SR0 = 0, the DSR equals the PSR at SR* = 0, and the assumptions line for N reads "PSR only; no trial-count deflation."

V is an assumption about your search. Left empty, V takes the value 1/T. Under the null of the DSR each trial has a true Sharpe ratio of 0, and with independent returns the variance of a Sharpe ratio estimated on T returns approaches 1/T as T grows, for any skewness and kurtosis: the variance factor of the PSR equals 1 at SR = 0. This default leaves out any spread of true skill across trials, and the variance measured across your own trials replaces it. The assumptions under the results state which V the DSR used.

SR0 grows with sqrt(V), so the calculator prints σ(SR) = sqrt(V) next to the results, per period and per year.

Kurtosis must be at least 1 + skewness² for any distribution. A smaller value usually means an excess kurtosis entered as raw kurtosis.

Φ follows West (2005), within 1e-15 in absolute error. Φ⁻¹ follows algorithm AS 241 of Wichura (1988), within 1e-15 in relative error. Both bounds come from tests against the Python 3.12 standard library.

Worked example from the DSR paper

The example of Bailey and López de Prado (2014, pp. 9-10) is a strategy with an annual Sharpe ratio of 2.5. It is measured on 1,250 daily returns, five years at 250 a year.

Its returns have skewness −3 and kurtosis 10. It is the best of N = 100 trials, whose annual Sharpe ratios have a variance of 0.5.

SR  = 2.5 / sqrt(250) = 0.1581 per period
V   = 0.5 / 250 = 0.002, σ(SR) = 0.0447 per period (0.7071 per year)
SR0 = 0.1132 per period (1.7894 per year)
DSR = PSR(SR0) = 0.9004

The default inputs of the calculator are this example, and its DSR of 0.9004 is the value printed in the paper.

With N = 46 trials the DSR is 0.9505. From N = 47 it falls under 0.95, at 0.9494.

With normal returns (skewness 0, kurtosis 3), the DSR stays above 0.95 up to N = 88, at 0.9505. N = 89 gives 0.9498.

For MinTRL, take an annual Sharpe ratio of 2 against an annual benchmark of 1, with normal returns and 95% confidence. At 252 or 250 periods a year, MinTRL is 2.73 years.

Continue reading

Source on GitHubstochastly-calculators · MIT