PainStaking v0.4.0 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 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

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.

staking_options :: [bankroll: number, independent: boolean]

A keyword list which configures optional parameters for staking calculators

  • bankroll is the total amount available for wagering, defaults to 100.
  • independent chooses between mutually exclusive and independent simultaneous events, defaults to false
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(mutually_exclusives, opts \\ [])

Specs

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

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

The optional bankroll 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.

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 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

The return values will be tagged with the provided edge descriptions

kelly(edges, opts \\ [])

Specs

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

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

Returns {:ok, list of amounts to wager on each}. The list will be sorted in expectation order.

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

Specs

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

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

edges is a list of simultaneous events iter is the number of simulation iterations to run, defaults to 100

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

zeroed(n, acc)