Parcourir la source

Add Kelly stake

betbetter il y a 3 jours
Parent
commit
8ea0c392ef
1 fichiers modifiés avec 5 ajouts et 0 suppressions
  1. 5 0
      kelly.py

+ 5 - 0
kelly.py

@@ -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)