@@ -0,0 +1,5 @@
+def kelly_fraction(decimal_price, chance, scale=0.5):
+ """Fraction of bankroll; scale=0.5 is half Kelly."""
+ b = decimal_price - 1
+ f = (b * chance - (1 - chance)) / b
+ return max(0.0, f * scale)