Rudimentary code for Kelly criterion betting
Jun 17, 2025

#Program and variables

print("This is a Kelly-crietrion based bet calculator")

mana = float(input("Enter the amount of mana you have: "))

odds = float(input("Enter your estimation of the actual market probability between 0 to 1(average): "))

resolution = int(input("Enter what you think the market will resolve (which direction you are betting), 0 for no and 1 for yes: "))

profits = float(input("Enter the ratio of shares to mana when you bet the market up/down to your estimation as a decimal MINUS 1 (e.g. 100 mana for 500 shares is (500/100)-1 = 5-1 = 4): "))

leverage = float(input("Enter the leverage on Kelly (e.g. If you want to be conservative, you can bet half of Kelly suggestion, or if you want to be agressive, you can bet double): "))

#Validity-of-answers

if odds > 1 or odds < 0:

print("Invalid. Please try again")

elif mana < 0:

print("Invalid. Please try again")

elif profits < 0:

print("Invalid. Please try again")

#Calculation

if resolution == 1:

amount = (((profits*odds)-(1-odds))/profits)*mana*leverage

else:

amount = (((profits*(1-odds))-odds)/profits)*mana*leverage

print(f"You should bet {amount}")

This is Python. If anybody has a way to implement this as a website in HTML, please tell me

@100Anonymous Ever try PyScript? I've been meaning to.

@BoltonBailey that's exactly what I did! See here

© Manifold Markets, Inc.TermsPrivacy