kelly.py 208 B

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