Sizing logo

Sizing

CommunityPopular
alsk1992
sizing

Position sizing with Kelly criterion and bankroll management

Overview

Publisheralsk1992
RepositoryCloddsBot
Skill namesizing
Stars
3K
Forks
353
Bundled files
1
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by alsk1992 on GitHub. Read the source before you install it.

Installation

Install the Sizing AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/alsk1992/CloddsBot/tree/main/src/skills/bundled/sizing
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/alsk1992/CloddsBot.git /tmp/CloddsBot
mkdir -p .claude/skills
cp -r /tmp/CloddsBot/src/skills/bundled/sizing .claude/skills/sizing
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Sizing in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Sizing on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Sizing is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Sizing - Complete API Reference

Calculate optimal position sizes using Kelly criterion, fractional Kelly, and portfolio-level allocation.


Chat Commands

Kelly Calculator

/kelly 0.45 0.55 10000              Market price, your prob, bankroll
/kelly "Trump 2028" 0.55 --bank 10k Calculate for specific market
/kelly --half 0.45 0.55 10000       Half Kelly (safer)
/kelly --quarter 0.45 0.55 10000    Quarter Kelly (conservative)

Position Sizing

/size 10000 --risk 2%               Size for 2% risk per trade
/size 10000 --max-position 25%      Max 25% in single position
/size portfolio --rebalance         Rebalance to target weights

Edge Calculation

/edge 0.45 0.55                     Calculate edge (prob - price)
/edge "Trump 2028" --estimate 0.55  Edge vs market price

TypeScript API Reference

Create Sizing Calculator

typescript
import { createSizingCalculator } from 'clodds/sizing';

const sizing = createSizingCalculator({
  // Bankroll
  bankroll: 10000,

  // Kelly fraction (1 = full, 0.5 = half)
  kellyFraction: 0.5,

  // Limits
  maxPositionPercent: 25,
  maxTotalExposure: 80,
});

Basic Kelly

typescript
// Binary outcome (YES/NO market)
const size = sizing.kelly({
  marketPrice: 0.45,        // Current price
  estimatedProb: 0.55,      // Your probability estimate
  bankroll: 10000,
});

console.log(`Optimal bet: $${size.optimalSize}`);
console.log(`Edge: ${size.edge}%`);
console.log(`Kelly %: ${size.kellyPercent}%`);
console.log(`Expected value: $${size.expectedValue}`);

Fractional Kelly

typescript
// Half Kelly (recommended for most traders)
const halfKelly = sizing.kelly({
  marketPrice: 0.45,
  estimatedProb: 0.55,
  bankroll: 10000,
  fraction: 0.5,  // Half Kelly
});

// Quarter Kelly (very conservative)
const quarterKelly = sizing.kelly({
  marketPrice: 0.45,
  estimatedProb: 0.55,
  bankroll: 10000,
  fraction: 0.25,
});

console.log(`Full Kelly: $${sizing.kelly({...}).optimalSize}`);
console.log(`Half Kelly: $${halfKelly.optimalSize}`);
console.log(`Quarter Kelly: $${quarterKelly.optimalSize}`);

Multi-Outcome Kelly

typescript
// For markets with 3+ outcomes
const multiKelly = sizing.kellyMultiOutcome({
  outcomes: [
    { name: 'Trump', price: 0.35, estimatedProb: 0.40 },
    { name: 'DeSantis', price: 0.25, estimatedProb: 0.20 },
    { name: 'Haley', price: 0.15, estimatedProb: 0.15 },
    { name: 'Other', price: 0.25, estimatedProb: 0.25 },
  ],
  bankroll: 10000,
  fraction: 0.5,
});

for (const alloc of multiKelly.allocations) {
  console.log(`${alloc.name}: $${alloc.size} (${alloc.percent}%)`);
}

Portfolio-Level Kelly

typescript
// Optimal allocation across multiple markets
const portfolio = sizing.kellyPortfolio({
  positions: [
    { market: 'Trump 2028', price: 0.45, prob: 0.55 },
    { market: 'Fed Rate Cut', price: 0.60, prob: 0.70 },
    { market: 'BTC > 100k', price: 0.30, prob: 0.40 },
  ],
  bankroll: 10000,
  correlations: correlationMatrix,  // Optional
  fraction: 0.5,
});

console.log('Optimal Portfolio:');
for (const pos of portfolio.positions) {
  console.log(`  ${pos.market}: $${pos.size}`);
}
console.log(`Total exposure: ${portfolio.totalExposure}%`);

Confidence-Adjusted Sizing

typescript
// Reduce size when less confident
const size = sizing.kellyWithConfidence({
  marketPrice: 0.45,
  estimatedProb: 0.55,
  confidence: 0.7,  // 70% confident in estimate
  bankroll: 10000,
});

// Size is reduced proportionally to confidence
console.log(`Confidence-adjusted size: $${size.optimalSize}`);

Edge Calculation

typescript
// Calculate edge
const edge = sizing.calculateEdge({
  marketPrice: 0.45,
  estimatedProb: 0.55,
});

console.log(`Edge: ${edge.edgePercent}%`);
console.log(`EV per dollar: $${edge.evPerDollar}`);
console.log(`Implied odds: ${edge.impliedOdds}`);
console.log(`True odds: ${edge.trueOdds}`);

Risk-Based Sizing

typescript
// Size based on risk per trade
const size = sizing.riskBased({
  bankroll: 10000,
  riskPercent: 2,     // Risk 2% per trade
  stopLossPercent: 10, // 10% stop loss
});

console.log(`Position size: $${size.positionSize}`);
console.log(`Max loss: $${size.maxLoss}`);

Kelly Fractions

FractionRisk LevelUse Case
Full (1.0)AggressiveMathematical optimum, high variance
Half (0.5)ModerateMost traders, good balance
Quarter (0.25)ConservativeNew traders, uncertain edges
Tenth (0.1)Very SafeLearning, small edges

Edge Requirements

EdgeRecommendation
< 2%Don't trade
2-5%Small size (quarter Kelly)
5-10%Normal size (half Kelly)
10%+Larger size, verify edge

Formulas

Kelly Formula

f* = (p * b - q) / b

Where:
f* = fraction of bankroll to bet
p = probability of winning
q = probability of losing (1 - p)
b = odds received (1/price - 1)

Edge Formula

Edge = Estimated Prob - Market Price
EV = Edge * Bet Size

Best Practices

  1. Use fractional Kelly — Full Kelly has too much variance
  2. Be conservative on edge — Overconfidence kills accounts
  3. Account for correlation — Don't over-expose to same theme
  4. Set max position — Never more than 25% in one market
  5. Reassess regularly — Edge changes as prices move

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Sizing AI skill do?

Position sizing with Kelly criterion and bankroll management

Why use Sizing on TypingMind?

Because you install it once and use it with any model. Sizing is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Sizing in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/alsk1992/CloddsBot/tree/main/src/skills/bundled/sizing. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Sizing?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Sizing?

As many as you like. As long as a model supports skills, you can use Sizing with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Sizing AI skill free?

Yes. It is published on GitHub by alsk1992 under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇