Skip to content

Instantly share code, notes, and snippets.

@BitChop
Forked from dsetzer/bet-utils.js
Created August 18, 2019 04:10
Show Gist options
  • Save BitChop/ec47628eb7e7b9460ad75da7d6654f41 to your computer and use it in GitHub Desktop.
Save BitChop/ec47628eb7e7b9460ad75da7d6654f41 to your computer and use it in GitHub Desktop.
A few martingale oriented inverse utility functions.
const getBaseBetFromCurrent = (wager, multi, streak) => (wager / (multi ^ streak));
const getBetSizeForStreak = (base, multi, streak) => (base * (multi ^ streak));
const getStreakSizeFromBet = (base, wager, multi) => (Math.log(wager / base) / Math.log(multi));
const getPrevBetFromLastBet = (wager, multi) => (wager / multi);
const getBetMultiFromPrevBet = (wager, prev) => (wager / prev);
const getBetMultiForPayout = (payout) => (payout / (payout - 1));
const getPayoutFromBetMulti = (multi) => (multi / (multi - 1));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment