Forked from dsetzer/gist:d97a5f80e7f53cb27cb82ab3049c1a50
Created
August 18, 2019 04:11
-
-
Save BitChop/78ccb93ec724d482bb402d2899fc3162 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/** | |
* purzi's Martingale bot V0.1 | |
*/ | |
const baseBet = 200 // how many satoshis to bet initially | |
const target = 2.75 // target multiplier | |
const betMultiplier = 1.7 // what to multiply the bet size by when we lose a wager | |
const maxBet = 200000 // Maximum bet in satoshis | |
var bet | |
let lossCount = 0 | |
this.log(`Starting martingale with a base bet of ${baseBet} satoshis.`) | |
while (lossCount < 3) | |
{ | |
// make the bet and wait for the result | |
const { multiplier } = await this.bet(betSize(lossCount), betMultiplier) | |
if (multiplier < target) | |
{ // loss | |
if(bet >= maxBet) | |
{ | |
lossCount = 0 | |
this.log(`Cut our losses and run!`) | |
} | |
else | |
{ | |
lossCount++ | |
this.log(`Lost bet. Multiplying bet size by ${betMultiplier} for new bet size of ${betSize(lossCount)} satoshis.`) | |
} | |
} | |
else | |
{ // win | |
lossCount = 0 | |
this.log(`Won bet. Setting bet size to ${baseBet} satoshis.`) | |
} | |
} | |
function betSize(lossCount) | |
{ | |
bet = baseBet * Math.pow(betMultiplier, lossCount) | |
return bet > maxBet ? maxBet : Math.round(bet / 100) * 100 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment