PainStaking v0.0.7 PainStaking

Calculate stakes in advantage betting situations

Summary

Types

A tuple which represents a supposed advantage wagering situation

A number tagged with a description to make collating results easier

A keyword list with a single pair. The key should be one of the atoms for a supported odds format from Exoddic. The value should be a supported way for expressing the odds for that key

Functions

Determine how much to bet on each of a set of mutually exclusive outcomes in an arbitrage situation

Get the mathematical expectations for a list of supposed edges

Determine the amount to stake on advantage situations based on the estimated edge and the Kelly Criterion

Simulate a repeated edge situation and see the average amount won

Types

edge :: {String.t, wager_price, wager_price}

A tuple which represents a supposed advantage wagering situation.

The first element is an edge description The second element is the estimate of the fair (or actual) odds of winning. The third element is the odds offered by the counter-party to the wager.

tagged_number :: {String.t, number}

A number tagged with a description to make collating results easier.

wager_price :: [{:atom, number | String.t}]

A keyword list with a single pair. The key should be one of the atoms for a supported odds format from Exoddic. The value should be a supported way for expressing the odds for that key.

Examples:

  • Probability: [prob: 0.50]
  • Moneyline: [us: "+120"]
  • Decimal: [eu: 2.25]
  • Traditional: [uk: "4/1"]

Functions

arb_size(max_outlay, mutually_exclusives)

Specs

arb_size(number, [wager_price]) ::
  {:ok, [float], float} |
  {:error, String.t}

Determine how much to bet on each of a set of mutually exclusive outcomes in an arbitrage situation.

max_outlay is the maximum available to stake on this set of outcomes. The smaller the arbitrage, the closer your outlay will be to this number.

mutually_exclusives is a list of mutually exclusive outcomes and the odds offered on each.

Successful return: {:ok, [stake on each outcome], expected profit}

The payouts may not all be exactly max_outlay because of rounding to the nearest cent. This may cause a slight variation in the expected profit.

ev_loop(list, acc)
ev_per_unit(edges)

Specs

ev_per_unit([edge]) :: {:ok, [tagged_number]}

Get the mathematical expectations for a list of supposed edges

An edge which turns out to be a losing proposition will have an EV below 1.

The return values will be tagged with the provided edge descriptions

kelly_size(bankroll, advantages)

Specs

kelly_size(number, [edge]) :: {:ok, [tagged_number]}

Determine the amount to stake on advantage situations based on the estimated edge and the Kelly Criterion

bankroll is the total amount available for wagering advantage is a description of the situation as an edge

Returns {:ok, list of amounts to wager on each}. Note that these are not properly scaled as simultaneous events. In the single edge situation, the results will be correct.

Improvements to this algorithm are coming soon.

sim_win_for(bankroll, edges, iter)

Specs

sim_win_for(number, [edge], non_neg_integer) :: float

Simulate a repeated edge situation and see the average amount won.

bankroll is the starting bankroll when the bets are placed edges is a list of simultaneous events iter is the number of simulation iterations to run

Returns the average win, assuming wagers are staked according to the kelly_size