This repository was archived by the owner on Nov 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy path2xTimedChasing.js
More file actions
177 lines (163 loc) · 6.5 KB
/
2xTimedChasing.js
File metadata and controls
177 lines (163 loc) · 6.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
var config = {
baseBet: { value: 100, type: 'balance', label: 'Base bet' },
redStreakToWait: { value: 10, type: 'text', label: 'Red games to wait before making a bet' },
minutesOrGames: {
value: 'minutes', type: 'radio', label: 'Minutes or games',
options:{
minutes: { value: 15, type: 'text', label: 'Minutes to bet after a streak'},
games: { value: 50, type: 'text', label: 'Games to bet after a streak'}
}
}
}
//2x chasing script by @Cannonball
//Feel free to tip, as is it a free script
//Also feel free to ping me if you got questions
//Will bet after the input streak to bet during the input minutes OR during the input games
//->Will wait for the red streak (from input)
//-->Will double the bet every game lost
//Has a history feature, will check the current number of red games when starting the script to bet accordingly
//Has a simulation feature, will calculate how many games without green you can handle before busting your bankroll
//Has logging functionalities, press F12
var biggestBet = 0;
var currentRedStreak = InitialRedStreak();
var gamesTheBotCanHandle = CalculateBotSafeness(config.baseBet.value, config.redStreakToWait.value);
var userProfitInSatoshis = 0;
var numberOf2xCashedOut = 0;
var currentBetInSatoshis = config.baseBet.value;
var isBettingNow = false;
var gamesToBeSafy = 25;
var minutesLeft = 0;
var gamesLeft = 0;
var startingStreakDate = null;
var redStreakOverLimit = null;
var wonLastGame = true;
log('FIRST LAUNCH | WELCOME!');
log('Bot safety check :');
log('-> You can manage to loose a ' + gamesTheBotCanHandle + ' red streak.');
log('-> The maximum bet would be: ' + biggestBet/100 + ' bits.');
log('-> We do assume 25 games is the maximum streak without 2x so...');
if (gamesTheBotCanHandle >= gamesToBeSafy) {
log('--> It looks safe with your parameters, let\'s go!');
} else {
log('--> Please stay around, it\'s not really safe with your parameters, chances to bust are quite high...');
}
log('There is a streak of ' + currentRedStreak + " red games now.");
engine.on('GAME_STARTING', function () {
log('');
log('NEW GAME')
log('Games since no 2x: ' + currentRedStreak + '. You can handle: ' + gamesTheBotCanHandle + ' games without 2x.');
log('Actual profit using the script: ' + userProfitInSatoshis / 100 + ' bits. Got ' + numberOf2xCashedOut + ' times 2x.');
if (redStreakOverLimit || minutesLeft > 0 || gamesLeft > 0 || !wonLastGame) {
//do place bet
let nowDate = Date.now();
if((minutesLeft == 0 && gamesLeft == 0) && wonLastGame){
registerDateOrGames(nowDate);
}
updateMinutesLeftOrGames(nowDate);
if(minutesLeft > 0 || gamesLeft > 0 || !wonLastGame){
if(minutesLeft > 0 && gamesLeft == 0){
log('Will continue to bet for the next ' + minutesLeft + ' minutes.');
}else{
log('Will continue to bet for the next ' + gamesLeft + ' games.');
}
engine.bet(currentBetInSatoshis, 2);
let currentBetInBits = currentBetInSatoshis / 100;
let wantedProfit = currentBetInBits + (userProfitInSatoshis / 100);
log('Betting ' + currentBetInBits + ' right now, looking for ' + wantedProfit + ' bits total profit.');
isBettingNow = true;
}else{
isBettingNow = false;
}
} else {
isBettingNow = false;
let calculatedGamesToWait = config.redStreakToWait.value - currentRedStreak;
if (calculatedGamesToWait < 1) {
log('Will begin to bet shortly');
} else {
log('Waiting for ' + calculatedGamesToWait + ' more games with no 2x');
}
}
})
engine.on('GAME_ENDED', function () {
let gameInfos = engine.history.first();
wonLastGame = true;
if (isBettingNow) {
if (!gameInfos.cashedAt) {
wonLastGame = false;
userProfitInSatoshis -= currentBetInSatoshis;
currentBetInSatoshis *= 2;
} else if (gameInfos.cashedAt) {
numberOf2xCashedOut++;
userProfitInSatoshis = userProfitInSatoshis + currentBetInSatoshis;
currentBetInSatoshis = config.baseBet.value;
}
}
if (gameInfos.bust > 2) {
redStreakOverLimit = false;
if(currentRedStreak >= config.redStreakToWait.value){
redStreakOverLimit = true;
}
currentRedStreak = 0;
} else {
currentRedStreak++;
}
log('END GAME');
})
function CalculateBotSafeness(baseBetForBot, gamesToWaitForBot) {
//15:41 Cannonball: !streak < 2
//15:41 Shiba: Seen 20 streak in games #2684941 - #2684960: 1.07x, 1.31x, 1.64x, 1.27x, 1x, 1.14x, 1.81x, 1.52x... (178,392 games ago, 1M 15d 11h 48m 19s ago)
//Let's assume if we can handle 25 games, we're safe
//And let's simulate
let totalGames = gamesToWaitForBot;
let brInSatoshis = userInfo.balance;
let nextBet = baseBetForBot;
let broken = false;
let totalBet = 0;
while (!broken) {
brInSatoshis -= nextBet;
totalGames++;
totalBet += nextBet;
biggestBet = nextBet;
nextBet *= 2;
if (nextBet > brInSatoshis) {
broken = true;
}
}
return totalGames;
}
function InitialRedStreak() {
let gamesArray = engine.history.toArray();
let generatedRedStreak = 0;
for (var i = 0; i < gamesArray.length; i++) {
if (gamesArray[i].bust >= 2) {
break;
}
generatedRedStreak++;
}
return generatedRedStreak;
}
function updateMinutesLeftOrGames(currentDate){
if(config.minutesOrGames.value === "minutes"){
if(startingStreakDate && minutesLeft > 0){
minutesLeft = config.minutesOrGames.options.minutes.value - Math.floor(((currentDate - startingStreakDate) / 1000) / 60);
}
if(minutesLeft == 0){
startingStreakDate = null;
}
}else if(config.minutesOrGames.value === "games"){
if(gamesLeft > 0){
gamesLeft--;
}
}
}
function registerDateOrGames(currentDate){
if(config.minutesOrGames.value === "minutes"){
if(!startingStreakDate){
startingStreakDate = currentDate;
minutesLeft = config.minutesOrGames.options.minutes.value;
}
}else if(config.minutesOrGames.value === "games"){
gamesLeft = config.minutesOrGames.options.games.value;
gamesLeft++; //+1 here is for a fix. updateMinutesLeftOrGames will be called right after this function, so it will remove this +1 right after
}
}