PainStaking v0.4.7 PainStaking

Calculate stakes in advantage betting situations

Summary

Types

A tuple which represents a supposed advantage wagering situation

A keyword list which configures optional parameters for staking calculators

A tuple with a description and number

A keyword list with a single pair

Functions

How much to stake in an arbitrage situation

The mathematical expectations for a list of supposed edges

How much to stake on advantage situations based on the Kelly Criterion

Simulate a repeated edge situation for the average amount won

Types

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

A tuple which represents a supposed advantage wagering situation.

The elements, in order:

  • an edge description
  • the estimate of the fair (or actual) odds of winning
  • the odds offered by the counter-party to the wager
staking_options :: [bankroll: number, independent: boolean]

A keyword list which configures optional parameters for staking calculators

The keywords are:

  • bankroll: the total amount available for wagering; defaults to 100
  • independent: independent or mutually-exclusive simultaneous events; defaults to false
tagged_number :: {String.t, number}

A tuple with a description and number

Primarily used to make it easier to collate results.

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 an appropriate representation for that key.

Examples:

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

Functions

arb(edges, opts \\ [])

Specs

arb([edge], staking_options) ::
  {:ok, [tagged_number], float} |
  {:error, String.t}

How much to stake in an arbitrage situation.

The bankroll option can be used to set the maximum amount available to bet on these outcomes. The smaller the arbitrage, the closer your outlay will be to this number.

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

ev(edges, opts \\ [])

Specs

ev([edge], staking_options) :: {:ok, [tagged_number]}

The mathematical expectations for a list of supposed edges

A losing proposition will have an EV below the supplied bankroll option

kelly(edges, opts \\ [])

Specs

kelly([edge], staking_options) ::
  {:ok, [tagged_number]} |
  {:error, String.t}

How much to stake on advantage situations based on the Kelly Criterion

The output list may be in a different order or have fewer elements than the input list. Mutually exclusive bets are staked as if they were not simultaneous. This leads to over-betting. The difference is negligible on small sets of wagers.

sim_win(edges, iterations \\ 100, opts \\ [])

Specs

sim_win([edge], non_neg_integer, staking_options) ::
  {:ok, float} |
  {:error, String.t}

Simulate a repeated edge situation for the average amount won

iterations controls the number of simulation iterations run