Last active
November 11, 2019 18:02
-
-
Save invkrh/49000105914d1fbd5d931c978796c849 to your computer and use it in GitHub Desktop.
Useful code for calculate bet size
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def kellyFactor(pWin: Double, odd: Double) = { | |
(pWin * odd - 1) / (odd - 1) | |
} | |
def betSize( | |
bankroll: Double, | |
minOdd: Double, | |
odd: Double) = { | |
val pWin = 1.02 / minOdd | |
val kf = kellyFactor(pWin, odd) | |
val left = (0.75 / 100 + kf * (odd / minOdd - 1)) / (odd - 1) | |
val right = 2d / 100 / (odd - 1) | |
// println(s"$left <> $right") | |
val size = math.min(left, right) | |
bankroll * size | |
} | |
Seq(3d -> 9.2, 3.1 -> 11d, 3.2 -> 14d, 3.3 -> 17d, 3.4 -> 20d).map { | |
case (odd, bet) => | |
val newBet = betSize(2500d, 2.979, odd) | |
println(newBet -> bet) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment