PainStaking (PainStaking v1.0.3)

View Source

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

@type edge() :: {String.t(), wager_price(), wager_price()}

A tuple which represents a supposed advantage wagering situation.

  • a proposition description
  • the estimate of the fair (or actual) odds of winning
  • the odds offered by the counter-party to the wager

staking_options()

@type staking_options() :: [bankroll: number(), independent: boolean()]

A keyword list which configures optional parameters for staking calculators

  • bankroll: the total amount available for wagering; defaults to 100
  • independent: independent or mutually-exclusive simultaneous events; defaults to false

tagged_number()

@type tagged_number() :: {String.t(), number()}

A tuple with a description and number

Primarily used to make it easier to collate results.

wager_price()

@type 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 \\ [])

@spec 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 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 \\ [])

@spec 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 bankroll

kelly(edges, opts \\ [])

@spec 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 \\ [])

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

Simulate a repeated edge situation for the average amount won

iterations sets the number of simulated outcomes