PainStaking v0.0.3 PainStaking

Calculate stakes in advantage betting situations

Summary

Types

A tuple which represents a supposed advantage wagering situation

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

Determine the amount to stake on a single advantage situation based on the estimated edge and the Kelly Criterion

Types

edge :: {wager_price, wager_price}

A tuple which represents a supposed advantage wagering situation.

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

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.

kelly_size(bankroll, advantage)

Specs

kelly_size(number, edge) ::
  {:ok, float} |
  {:error, String.t}

Determine the amount to stake on a single advantage situation 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

Successful return: {:ok, amount to wager}