agentleFS
ruujOnChainruujOnChain/HedgeFund-Skills/skills/validation/SKILL.md

validation

Skill17 starsChanged 6 days agoMITView on GitHub

Tests whether a backtest result reflects skill or the luck of trying many variations, using the probabilistic Sharpe ratio and the deflated Sharpe ratio, which adjust for track length, skewness, fat tails, and the number of trials. Use when asked whether a backtest or Sharpe ratio is real, significant, overfit, or worth trusting, or how long a track record needs to be.

20 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use testing.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • NVIDIASkill

    testing

    Run Python and Rust tests for physicsnemo-curator using uv + pytest with coverage reporting via pytest-cov, and cargo-nextest for Rust tests. Includes benchmark workflows with pytest-benchmark and criterion.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 20 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read the JSON. If passed is false, report the failed check and stop.

    line 36

“Common” is measured: kept by at least 6 in 10 of the 20 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Strategy validation

Answers one question: is this backtest result real? Uses the probabilistic Sharpe ratio (Bailey and López de Prado, 2012) and the deflated Sharpe ratio (Bailey and López de Prado, 2014). Every number comes from scripts/psr_dsr.py.

Inputs

  • returns.csv: a date column, then periodic returns of the selected strategy (net of costs, excess of cash if available). Complete, no gaps.
  • The number of trials: every variation tested on the way to this result, including parameter sets, universes, and rules that were discarded. This input is required. If the user does not know it, ask for their best honest count and state it in the answer.
  • The dispersion of results across trials, one of:
    • the returns of all trials (--trial-returns), or
    • their per period Sharpe ratios (--trial-sharpes), or
    • the variance of per period Sharpe ratios (--sr-variance) together with --trials.

Procedure

  1. Confirm the selected strategy, the return frequency, and the number of trials.
  2. Run the validation:
    python scripts/psr_dsr.py --returns returns.csv --column STRAT \
      --trial-returns all_trials.csv --periods-per-year 252
    or, without trial returns:
    python scripts/psr_dsr.py --returns returns.csv --column STRAT --trials 40 --sr-variance 0.0004
  3. Read the JSON. If passed is false, report the failed check and stop.
  4. Report the Sharpe ratio, PSR, the threshold SR0, DSR, and whether DSR clears the confidence level.

Checks

  • At least 60 observations.
  • The trial count is at least the number of trials supplied.
  • The variance term in the PSR formula is positive.

Output

results.sharpe_per_period, results.sharpe_annualized, skewness, kurtosis (3 for normal returns), psr against the benchmark, sr0_per_period and sr0_annualized (the Sharpe ratio the best of N trials would reach by chance), dsr, passes, and min_track_record_length in periods, plus checks and passed.

Explaining the result

  • Lead with DSR: the probability that the true Sharpe ratio exceeds what the best of N luckless trials would show. A DSR of 0.95 or more clears the default bar.
  • Compare the annualized Sharpe with the annualized SR0, so the reader sees how high the bar was raised by the search.
  • Negative skew and fat tails lower PSR and DSR for the same Sharpe ratio. Say so when they matter.
  • Minimum track record length is the number of periods needed for DSR to reach the confidence level at the current Sharpe ratio.
  • A failing DSR does not prove the idea is wrong. It shows the evidence is not yet strong enough given the search behind it.

For formulas and conventions, see references/methodology.md.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.