소스 검색

Add Kelly stake

betbetter 3 일 전
부모
커밋
8ea0c392ef
1개의 변경된 파일과 5개의 추가작업 그리고 0개의 파일을 삭제
  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)