View difference between Paste ID: RQBiRxqz and SbzAUnh1
SHOW: | | - or go back to the newest paste.
1-
/**
1+
/**
2-
 * purzi's Martingale bot V0.1
2+
 * purzi's Martingale bot V0.1
3-
 */
3+
 */
4-
4+
5-
const baseBet = 200    // how many satoshis to bet initially
5+
const baseBet = 200    // how many satoshis to bet initially
6-
const target = 2.75     // target multiplier
6+
const target = 2.75     // target multiplier
7-
const betMultiplier = 1.7 // what to multiply the bet size by when we lose a wager
7+
const betMultiplier = 1.7 // what to multiply the bet size by when we lose a wager
8-
const maxBet = 200000	// Maximum bet in satoshis
8+
const maxBet = 200000	// Maximum bet in satoshis
9-
9+
10-
var bet
10+
var bet
11-
11+
12-
let lossCount = 0
12+
let lossCount = 0
13-
13+
14-
this.log(`Starting martingale with a base bet of ${baseBet} satoshis.`)
14+
this.log(`Starting martingale with a base bet of ${baseBet} satoshis.`)
15-
15+
16-
while (lossCount < 3)
16+
while (lossCount < 3)
17-
{
17+
{
18-
  // make the bet and wait for the result
18+
  // make the bet and wait for the result
19-
  const { multiplier } = await this.bet(betSize(lossCount), betMultiplier)
19+
  const { multiplier } = await this.bet(betSize(lossCount), betMultiplier)
20-
20+
21-
  if (multiplier < target)
21+
  if (multiplier < target)
22-
  { // loss
22+
  { // loss
23-
  	if(bet >= maxBet)
23+
  	if(bet >= maxBet)
24-
  	{
24+
  	{
25-
  		lossCount = 0
25+
  		lossCount = 0
26-
  		this.log(`Cut our losses and run!`)
26+
  		this.log(`Cut our losses and run!`)
27-
  	}
27+
  	}
28-
  	else
28+
  	else
29-
  	{
29+
  	{
30-
    	lossCount++
30+
    	lossCount++
31-
    	this.log(`Lost bet. Multiplying bet size by ${betMultiplier} for new bet size of ${betSize(lossCount)} satoshis.`)
31+
    	this.log(`Lost bet. Multiplying bet size by ${betMultiplier} for new bet size of ${betSize(lossCount)} satoshis.`)
32-
    }
32+
    }
33-
  }
33+
  }
34-
  else
34+
  else
35-
  { // win
35+
  { // win
36-
    lossCount = 0
36+
    lossCount = 0
37-
    this.log(`Won bet. Setting bet size to ${baseBet} satoshis.`)
37+
    this.log(`Won bet. Setting bet size to ${baseBet} satoshis.`)
38-
  }
38+
  }
39
}
40-
40+
41-
function betSize(lossCount)
41+
function betSize(lossCount)
42-
{
42+
{
43-
  bet = baseBet * Math.pow(betMultiplier, lossCount)
43+
  bet = baseBet * Math.pow(betMultiplier, lossCount)
44-
44+
45-
  return bet > maxBet ? maxBet : Math.round(bet / 100) * 100
45+
  return bet > maxBet ? maxBet : Math.round(bet / 100) * 100
46-
46+
47
}