Last active
April 18, 2019 01:40
-
-
Save ruzli/5392893eb9109c2a1396109e359238c0 to your computer and use it in GitHub Desktop.
Martingale with payout 1.5x and bet multiplier 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const baseBet = 100 // how many satoshis to bet initially | |
const target = 1.50 // target multiplier | |
const betMultiplier = 3 // what to multiply the bet size by when we lose a wager | |
const sleepTime = 300 // Ms - milliseconds to pause between bets | |
let lossCount = 0 | |
this.log(`Starting half target script, balance ${this.balance / 100} bits.`) | |
while (true) { | |
const { multiplier } = await this.bet(betSize(lossCount), target) | |
await sleep(sleepTime) | |
if (multiplier < target) { // [LOSS] | |
lossCount++ | |
this.log(`Lost bet. Multiplying bet size by ${betMultiplier} for new bet size of ${betSize(lossCount)} satoshis.`) | |
} else { // [WON] | |
lossCount = 0 | |
this.log(`Won bet. Setting bet size to ${baseBet} satoshis.`) | |
} | |
} | |
function betSize(lossCount) { | |
const bet = baseBet * Math.pow(betMultiplier, lossCount) | |
return Math.round(bet / 100) * 100 | |
} | |
function sleep(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment