Simulators

Simulators are classes that take in a bankroll and a strategy and apply that strategy to a situation. They can be used to evaluate the efficacy of strategies in certain domains.

Repeated Binary Simulator

class keeks.simulators.repeated_binary.RepeatedBinarySimulator(payoff, loss, transaction_costs, probability, trials=1000)[source]

Bases: object

Simulator for binary betting strategies with a fixed probability.

This simulator uses the same probability for each trial, simulating repeated bets on events with identical odds.

Parameters:
  • payoff (float) – The amount won per unit bet on a successful outcome.

  • loss (float) – The amount lost per unit bet on an unsuccessful outcome.

  • transaction_costs (float) – The fixed cost per transaction, regardless of outcome.

  • probability (float) – The fixed probability of a successful outcome for all trials.

  • trials (int, default=1000) – The number of betting trials to simulate.

evaluate_strategy(strategy, bankroll)[source]

Evaluate a betting strategy over multiple trials with fixed probability.

For each trial, the strategy is evaluated with the fixed probability, and the bankroll is updated based on the outcome.

Parameters:
  • strategy (BaseStrategy) – The betting strategy to evaluate.

  • bankroll (BankRoll) – The bankroll to use for the simulation.

Returns:

The bankroll object is updated in-place with the results of the simulation.

Return type:

None

Random Binary Simulator

class keeks.simulators.random_binary.RandomBinarySimulator(payoff, loss, transaction_costs, trials=1000, stdev=0.1)[source]

Bases: object

Simulator for binary betting strategies with random probabilities.

This simulator generates random probabilities for each trial, centered around 0.5 with a configurable standard deviation. It evaluates a betting strategy against these random probabilities and updates the bankroll accordingly.

Parameters:
  • payoff (float) – The amount won per unit bet on a successful outcome.

  • loss (float) – The amount lost per unit bet on an unsuccessful outcome.

  • transaction_costs (float) – The fixed cost per transaction, regardless of outcome.

  • trials (int, default=1000) – The number of betting trials to simulate.

  • stdev (float, default=0.1) – The standard deviation of the normal distribution used to generate probabilities.

evaluate_strategy(strategy, bankroll)[source]

Evaluate a betting strategy over multiple trials.

For each trial, a random probability is generated, the strategy is evaluated with this probability, and the bankroll is updated based on the outcome.

Parameters:
  • strategy (BaseStrategy) – The betting strategy to evaluate.

  • bankroll (BankRoll) – The bankroll to use for the simulation.

Returns:

The bankroll object is updated in-place with the results of the simulation.

Return type:

None

Random Uncertain Binary Simulator

class keeks.simulators.random_uncertain_binary.RandomUncertainBinarySimulator(payoff, loss, transaction_costs, trials=1000, stdev=0.1, uncertainty_stdev=0.05)[source]

Bases: object

Simulator for binary betting strategies with random probabilities and uncertainty.

This simulator generates random probabilities for each trial, centered around 0.5 with a configurable standard deviation. It adds an additional uncertainty factor to the actual outcome probability, simulating imperfect information.

Parameters:
  • payoff (float) – The amount won per unit bet on a successful outcome.

  • loss (float) – The amount lost per unit bet on an unsuccessful outcome.

  • transaction_costs (float) – The fixed cost per transaction, regardless of outcome.

  • trials (int, default=1000) – The number of betting trials to simulate.

  • stdev (float, default=0.1) – The standard deviation of the normal distribution used to generate probabilities.

  • uncertainty_stdev (float, default=0.05) – The standard deviation of the normal distribution used to add uncertainty to the actual outcome probability.

evaluate_strategy(strategy, bankroll)[source]

Evaluate a betting strategy over multiple trials with uncertainty.

For each trial, a random probability is generated, the strategy is evaluated with this probability, but the actual outcome is determined by the probability plus a random uncertainty factor.

Parameters:
  • strategy (BaseStrategy) – The betting strategy to evaluate.

  • bankroll (BankRoll) – The bankroll to use for the simulation.

Returns:

The bankroll object is updated in-place with the results of the simulation.

Return type:

None