
Sizing
- 14 installs
- 610 repo stars
- Updated June 26, 2026
- alsk1992/cloddsbot
Sizing is a Claude Code skill for the clodds bot that calculates optimal position sizes using the Kelly criterion and bankroll management.
About
Sizing is a clodds skill that calculates optimal position sizes using the Kelly criterion, fractional Kelly, and portfolio-level allocation. Developers use it to compute how much of a bankroll to bet given a market price, probability estimate, and edge, with conservative fractions and exposure caps. It matters for disciplined bankroll management in prediction-market and crypto trading.
- Kelly, fractional Kelly, and multi-outcome position sizing for prediction markets
- Edge calculation and confidence-adjusted sizing against a bankroll
- Risk-based sizing with max-position and total-exposure limits
Sizing by the numbers
- 14 all-time installs (skills.sh)
- Ranked #752 of 1,106 Finance & Trading skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
sizing capabilities & compatibility
- Capabilities
- position sizing · edge calculation · risk management
- Use cases
- trading
- Pricing
- Free
What sizing says it does
Calculate optimal position sizes using Kelly criterion, fractional Kelly, and portfolio-level allocation.
f* = (p * b - q) / b
npx skills add https://github.com/alsk1992/cloddsbot --skill sizingAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 14 |
|---|---|
| repo stars | ★ 610 |
| Last updated | June 26, 2026 |
| Repository | alsk1992/cloddsbot ↗ |
What it does
Compute Kelly-based position sizes and edge for a bet given market price, probability, and bankroll.
Who is it for?
Traders who want disciplined Kelly-based bet sizing and edge estimation against a bankroll.
Skip if: Users who want automated order execution rather than sizing math.
When should I use this skill?
You need to know how much to bet given a probability estimate, market price, and bankroll.
What you get
You get an optimal bet size, edge, and expected value for a given market and bankroll.
- kelly position size
- edge and EV
- risk-based size
By the numbers
- 4 Kelly fraction tiers (full, half, quarter, tenth)
- 4 edge thresholds guiding size
Files
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 weightsEdge 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
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
// 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
// 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
// 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
// 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
// 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
// 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
// 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
| Fraction | Risk Level | Use Case |
|---|---|---|
| Full (1.0) | Aggressive | Mathematical optimum, high variance |
| Half (0.5) | Moderate | Most traders, good balance |
| Quarter (0.25) | Conservative | New traders, uncertain edges |
| Tenth (0.1) | Very Safe | Learning, small edges |
---
Edge Requirements
| Edge | Recommendation |
|---|---|
| < 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
/**
* Sizing CLI Skill
*
* Commands:
* /sizing <edge%> <winrate%> - Calculate Kelly position size
* /sizing config - Show sizing config
* /sizing set <param> <value> - Update config
*/
import type { KellyConfig } from '../../../trading/kelly';
let calcConfig: KellyConfig = {
baseMultiplier: 0.25,
maxKelly: 0.25,
minKelly: 0.01,
lookbackTrades: 20,
maxDrawdown: 0.15,
drawdownReduction: 0.5,
};
async function execute(args: string): Promise<string> {
const parts = args.trim().split(/\s+/);
const cmd = parts[0]?.toLowerCase() || 'help';
try {
const { simpleKelly, createDynamicKellyCalculator } = await import('../../../trading/kelly');
switch (cmd) {
case 'config': {
const calculator = createDynamicKellyCalculator(1000, calcConfig);
const state = calculator.getState();
let output = '**Position Sizing Config**\n\n';
output += `Method: Dynamic Kelly\n`;
output += `Base multiplier: ${calcConfig.baseMultiplier}\n`;
output += `Max Kelly fraction: ${calcConfig.maxKelly}\n`;
output += `Min Kelly fraction: ${calcConfig.minKelly}\n`;
output += `Lookback trades: ${calcConfig.lookbackTrades}\n`;
output += `Max drawdown: ${((calcConfig.maxDrawdown ?? 0.15) * 100).toFixed(0)}%\n`;
output += `Drawdown reduction: ${calcConfig.drawdownReduction}x\n`;
output += `\n**Current State**\n`;
output += `Bankroll: $${state.bankroll.toFixed(2)}\n`;
output += `Peak: $${state.peakBankroll.toFixed(2)}\n`;
output += `Drawdown: ${(state.currentDrawdown * 100).toFixed(1)}%\n`;
output += `Win rate (recent): ${(state.recentWinRate * 100).toFixed(0)}%\n`;
output += `Win streak: ${state.winStreak} | Loss streak: ${state.lossStreak}`;
return output;
}
case 'set': {
const param = parts[1];
const value = parts[2];
if (!param || !value) return 'Usage: /sizing set <multiplier|max-kelly|min-kelly|lookback|max-drawdown> <value>';
const num = parseFloat(value);
if (isNaN(num)) return 'Value must be a number.';
switch (param) {
case 'multiplier':
calcConfig.baseMultiplier = num;
break;
case 'max-kelly':
calcConfig.maxKelly = num;
break;
case 'min-kelly':
calcConfig.minKelly = num;
break;
case 'lookback':
calcConfig.lookbackTrades = Math.round(num);
break;
case 'max-drawdown':
calcConfig.maxDrawdown = num / 100;
break;
default:
return `Unknown param: ${param}\nAvailable: multiplier, max-kelly, min-kelly, lookback, max-drawdown`;
}
return `Sizing ${param} set to ${value}.`;
}
case 'help':
return helpText();
default: {
const edge = parseFloat(parts[0]);
const winRate = parseFloat(parts[1]);
const bankroll = parts[2] !== undefined ? parseFloat(parts[2]) : 1000;
if (isNaN(edge) || isNaN(winRate) || isNaN(bankroll)) {
return 'Usage: /sizing <edge%> <winrate%> [bankroll]\n\nExample: /sizing 5 60 10000';
}
const edgeFraction = edge / 100;
const kelly = simpleKelly(edgeFraction, winRate / 100, calcConfig.baseMultiplier);
const size = kelly * bankroll;
// Also get dynamic recommendation
const calculator = createDynamicKellyCalculator(bankroll, calcConfig);
const dynamic = calculator.calculate(edgeFraction, winRate / 100);
let output = '**Position Sizing**\n\n';
output += `Edge: ${edge}%\n`;
output += `Win rate: ${winRate}%\n`;
output += `Bankroll: $${bankroll.toLocaleString()}\n\n`;
output += `**Simple Kelly**\n`;
output += ` Fraction: ${(kelly * 100).toFixed(2)}%\n`;
output += ` Size: **$${size.toFixed(2)}**\n\n`;
output += `**Dynamic Kelly**\n`;
output += ` Fraction: ${(dynamic.kelly * 100).toFixed(2)}%\n`;
output += ` Size: **$${dynamic.positionSize.toFixed(2)}**\n`;
output += ` Confidence: ${(dynamic.confidence * 100).toFixed(0)}%\n`;
if (dynamic.adjustments.length > 0) {
output += ` Adjustments:\n`;
for (const adj of dynamic.adjustments) {
output += ` - ${adj.reason} (${adj.multiplier.toFixed(2)}x)\n`;
}
}
if (dynamic.warnings.length > 0) {
output += ` Warnings: ${dynamic.warnings.join(', ')}`;
}
return output;
}
}
} catch (error) {
return `Sizing error: ${error instanceof Error ? error.message : String(error)}`;
}
}
function helpText(): string {
return `**Sizing Commands**
/sizing <edge%> <winrate%> - Calculate Kelly size
/sizing <edge%> <winrate%> <bank> - With specific bankroll
/sizing config - Show sizing config + state
/sizing set <param> <value> - Update config
Params: multiplier, max-kelly, min-kelly, lookback, max-drawdown
Example: /sizing 5 60 (5% edge, 60% win rate)
Example: /sizing 3 55 10000 (with $10k bankroll)`;
}
export default {
name: 'sizing',
description: 'Dynamic Kelly criterion position sizing with drawdown adjustments',
commands: ['/sizing', '/kelly-size'],
handle: execute,
};
Related skills
FAQ
What Kelly fractions are recommended?
Half Kelly for most traders, quarter Kelly for conservative or uncertain edges; full Kelly has high variance.
What edge is worth trading?
Under 2% edge the docs say do not trade; 2-5% small size, 5-10% normal size, 10%+ larger after verifying.