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

sizing

Skill17 starsChanged 6 days agoMITView on GitHub

Turns an expected return and a risk estimate into a position size using fractional Kelly, a volatility target, and a maximum weight. Use when asked how large a position should be, how to size or scale a strategy, what the Kelly fraction is, or how to bring a position to a target volatility.

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. flightctl/ai-workflows★ 10same name
    2. y0n1n1/financial-skills★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository5 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    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 34

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

Position sizing

Answers one question: how large should this position be? Combines the Kelly criterion (Kelly, 1956) with volatility targeting. Every number comes from scripts/size.py.

Inputs

  • mu: annual expected return in excess of cash, as a decimal. This is the user's own estimate. Never supply one yourself; if it is missing, ask.
  • Risk, one of:
    • sigma: annual volatility as a decimal, or
    • a returns file (date column, then simple returns) plus the column to use. Daily data is assumed; set --periods-per-year otherwise.
  • Optional: Kelly fraction (default 0.5), target volatility for the position, maximum absolute weight (default 1.0).

Procedure

  1. Confirm mu, its horizon (annual), and that it is in excess of cash.
  2. Run the sizing:
    python scripts/size.py --mu 0.06 --sigma 0.25 --kelly-fraction 0.5 --target-vol 0.10
    or estimate sigma from history:
    python scripts/size.py --mu 0.06 --returns returns.csv --column XYZ --halflife 63 --target-vol 0.10
  3. Read the JSON. If passed is false, report the failed check and stop.
  4. Report the weight, which constraint set it, and the inputs behind it.

Checks

  • The full Kelly fraction satisfies its closed form, mu = f* sigma squared.
  • The weight respects the maximum weight.
  • Position volatility does not exceed the target, when one is given.

Output

results.weight (signed fraction of capital), results.binding_constraint (kelly, target_vol, or max_weight), full_kelly, fractional_kelly, vol_target_weight, position_volatility, expected_growth, and share_of_max_growth, plus checks and passed.

Explaining the result

  • Lead with the weight and the constraint that set it. Kelly sizes the conviction; the volatility target and maximum weight cap the risk.
  • Half Kelly earns three quarters of the maximum growth rate with half the volatility of full Kelly, which is why fractional Kelly is the default when mu is uncertain.
  • The result is only as good as mu. Show how the weight changes if mu is half as large; rerun the script for that case rather than estimating it.
  • This sizes one position in isolation. For a portfolio, use the risk skill to see how the position changes total risk.

For the mathematics, 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.