Kelly-based bankroll management
Last updated
Last updated
The Kelly criterion maximizes the rate of growth of a bankroll subject to random disturbances. ZKasino's bankroll is managed according to the Kelly criterion by establishing a maximum bet a player can place on each game, and thus bet against the bankroll. To calculate this maximum bet, the Kelly fraction has to be found. This is a fraction of the current bankroll to wager. The Kelly fraction changes with the amount of outcomes a game has.
ZKasino uses 1x Kelly ('Kelly criterion') on the frontend and 1.1x Kelly in the contracts to prevent any issues with transactions reverting due to variations in bankroll size.
For games with 2 outcomes the formula is much simpler than for games with more than 2 outcomes.
Coinflip: heads or tails
Dice: roll over or under a specific number
Mines: find a mine (lose) or find no mines (win)
For games with two outcomes, the Kelly criterion establishes that , the optimal fraction of the bankroll that should be allowed to be bet against, is:
where:
is the probability of the casino winning the bet;
is the proportion of the bet lost on a loss;
is the proportion of the bet won on a win.
Plinko: as many outcomes as there are multiplier slots (depends on the amount of rows)
Video Poker: 9 winning hands or no winning hand (10 outcomes)
Slots: 8 winning combinations or no winning combination (9 outcomes)
Rock Paper Scissors: rock, paper, or scissors (3 outcomes)
where:
In practice there will be a slight deviation from 1x/1.1x Kelly for (1) an individual user's max Kelly wager multibets or (2) max Kelly wager bets from different wallets being placed at the same time (~30 second timeframe depending on VRF). When max wager multibets are being lost or when max wagers placed by multiple wallets at the same time are losing, Kelly decreases and the bankroll takes on slightly less risk. When users are winning, Kelly increases and the bankroll takes on slightly more risk.
It is (nearly) impossible for the bankroll to reach the 2x+ Kelly zone where the growth rate starts to be negative. This would require multiple max wager bets to be won in a long row and for some games while hitting the maximum multiplier at the same time or spending an insane amount of money. The probabilities for this to happen are insanely low and considered pretty much impossible. Some of the probabilities are explained below.
To go further into detail, some of the probabilities for reaching 2x+ Kelly will be calculated. All situations assume max Kelly wagers and either one player using multibets or multiple players betting at the same time (~30 second interval depending on VRF).
Let B
be the bankroll balance, k
be the Kelly fraction of a particular game, and M
be the maximum payout multiplier of the same game.
If a player wins the maximum payout multiplier M
n
times in a row, the bankroll decreases by -n*k*(M-1)*B
, and so the new bankroll is (1-n*k*(M-1))*B
.
As a consequence, the new Kelly wager should be:
If the player keeps using the original Kelly wager k*B
, the error in Kelly wager is:
If we want the error to be at most 2
(i.e. using 2x Kelly instead of the real one) then we arrive at a formula for the number of consecutive wins needed such that the player is playing at over 2x Kelly: n = ceil(0.5/(k*(M-1)))
.
Now let's take a couple of examples.
Coin Flip has Kelly fraction k = 0.010204082
, maximum payout multiplier of M = 1.98
, and probability of maximum payout multiplier of p = 0.5
.
A player would need n = ceil(0.5/(1.1*k*(M-1))) = 46
consecutive wins to get to 2x Kelly. This happens with probability p^n*100 = 1.2E-05
. Highly unlikely.
Let's look at the maximum possible multiplier for Dice.
This has Kelly fraction k = 0.00001011
, maximum payout multiplier of M = 990
, and probability of maximum payout multiplier of p = 0.001
.
A player would need n = ceil(0.5/(1.1*k*(M-1))) = 46
consecutive wins to get to 2x Kelly. This happens with probability p^n*100 = 1.00E-136
. So never.
Now let's take the minimum possible multiplier for Dice.
This has Kelly fraction k = 0.23750000
, maximum payout multiplier of M = 1.0421
, and probability of maximum payout multiplier of p = 0.95
.
A player would need n = ceil(0.5/(1.1*k*(M-1))) = 46
consecutive wins to get to 2x Kelly. This happens with probability p^n*100 = 9.45
. This seems high, but in this case the player would have to wager k * n = 10.925
times the bankroll size.
So in short: the highest chance (9.5%) of achieving 2x+ Kelly is done by winning 46 consecutive Dice games (setting 95% win chance each bet) while risking 11 times the size of the whole bankroll while doing so. This a huge amount of money a player would need to be risking and on top of that the player needs to get extremely lucky too.
Kelly wagers work by optimising long term quantity, so it only makes sense to talk about Kelly for the long term. Events that don't happen are often less important. It is extremely unlikely for the bankroll to ever reach 2x+ Kelly where the growth rate is negative. We expect this never to happen.
If it ever would happen, it would happen only temporary for a short time: when an individual player is placing max Kelly wager multibets in one transaction or when other user's max Kelly wager bets are placed at the same time within the ~30 second VRF time frame. On top of that, accepting bets at 2x+ Kelly in the short-term is not a bad thing per se. Only in the long run it would cause negative growth.
In ZKasino's particular case the effects would be negligible. The impact of a loss is not high since the probabilities described above are unlikely and by the time that they've happened the bankroll should have already grown. Thus, the bankroll would still be above the starting value.
For bankroll management ZKasino uses the Kelly criterion to determine max wagers for single bets with 1x Kelly on the frontend and 1.1x Kelly in the contracts.
The max wager is not adjusted for a single user's multibets or multiple users' bets placed at the same time while the VRF request is pending (~30 seconds). This leads to a slight deviation from the intended max wager. When the bankroll is losing in the aforementioned scenarios, the max wager is not decreasing. This leads to a less safe strategy. However, when the bankroll is winning the max wager is also not increasing. This leads to a safer strategy.
Since the bankroll gains the house edge, there is a bias towards winning. This means that on average for max wagers a safer strategy is used compared to the standard Kelly criterion.
The region for negative long-term growth starts at 2x+ Kelly. Reaching this region requires significant losses from the bankroll within a user's multibets or while the VRF request is pending. This is either highly unlikely or extremely expensive. For example, the highest chance (9.5%) of achieving 2x+ Kelly is done through 46 consecutive won Dice games (setting 95% win chance for each bet). A total of 11 times the size of the whole bankroll must be risked at the same time.
Even if 2x+ Kelly would be reached, the concept of a growth rate only makes sense in the "long run". For multibets a lucky player would only have 54 bets remaining and 30 seconds for bets during the pending VRF request can't be considered long-term either. In short: it is impossible to stay in the 2x+ Kelly region where it would become a risk to the bankroll.
Lastly, in practice the average bet size is expected to be lower than the max wager. This results in an even safer strategy.
For games with more than two outcomes, the Kelly criterion does not have a closed-form solution. However, we can find the optimal fraction of the bankroll that should be allowed to be bet against by finding such that:
is the total number of outcomes;
is the probability of outcome ;
is the percentage of bankroll lost to the player in outcome .