forked from mbithy/Trevel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTrevel.js
More file actions
450 lines (446 loc) · 15.3 KB
/
Copy pathTrevel.js
File metadata and controls
450 lines (446 loc) · 15.3 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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
/* Bot Name: Trevel
* Version: 1.1.5.0
* AI Focus: Binomial Distribution
* Build for: Freebitco.in
* Link: http://freebitco.in/?r=856671
* Author: Mbithy Mbithy
* Link: https://github.com/mbithy
* Notes: This bot may increse your chances of winning (greatly) however I do not guarantee you absolute PROFIT, make sure you have atleast 0.00005000 btc
* Warning: Do not change any variables value unless indicated by a comment! And make sure your internet is fast enough,
* bot will place ghost bets on slow internet which may make you loose. Another fix is increasing the bet interval.
* Also you may tip/send me a few satoshis at: 17i7TUTg4PHC69CSHLLE2mLXQbpwKHBwf4 if you so wish....
* Have fun and remember gambling is a risky adventure.
*/
var _stop = false,
_rolls = 0,
_currentBalance, _maxBet=0, _x = 0,
_maxNumberOfTrails=10000,
_minNumberOfTrials=5000,
_numberOfSuccesses = 0,
_numberOfTrials = 0,
_winPercentage = 52,
_stopOnNumberOfBets = false, //Change this to true if you wish to stop betting after a specific number of bets
_defaultProb=false,
_swap = true,
_betSpeed = 3000,
/** INFO ON _betSpeed
* If you want bets to go faster decrease the value 3000, recomended minimum is 1500 (at 1500 you'll need really fast internet and hope the freebitco.in server responds as fast)
* If you want to go slower increase the value 3000, recomended max is 5000 (only option if you have tortoise internet)
**/
_verbose = false, //Change this to true if you want to know the stats(profit) after each bet
_numberOfBets = 46, //You can change this but keep the number of bets low (<135 but >75) to increse AI accuracy.
_maxNumberOfBets = 50, //max=150
_minNumberOfBets = 50, // min=50
/** Custom Bet Configuration **/
_useCustomConfiguration=true,//Change to true to use your own configuration
_amountToKelly=5, // Change this to set percentage of your full amount to be used in the Kelly Principle (Can not be more than 100)
_useKellyPrinciple=true,//change to false to use martingale
_customMaximumBet=0.00050000,//This is the maximum bet you want placed
_customMinimumBet=0.00000001,//This is the minimum bet you want placed
_customMultiplier=2;// This is the multiplier. the default is 2. INFO: The bet amount will be multiplied by this number incese you loose a bet
var trevel = {
bets: [],
highBetProbability: 0,
lowBetProbability: 0,
highBetCount: 0,
lowBetCount: 0,
lowBetBinomial: 0,
highBetBinomial: 0,
userBalance: 0,
betAmount: 0,
totalWins: 0,
wins: 0,
originalUserBalance: 0,
profit: 0,
totalLoses: 0,
looses: 0,
_nextBet: "",
lowBetWins:0,
lowBetWinsProb:0,
highBetWins:0,
highBetWinsProb:0,
addBet: function(bet, outcome)
{
if(bet === "LB" && outcome === "Win")
{
trevel.bets.push("LO");
trevel.wins++;
trevel.totalWins++;
trevel.lowBetCount++;
trevel.lowBetWins++;
}
if(bet === "LB" && outcome === "Loose")
{
trevel.bets.push("HI");
trevel.looses++;
trevel.totalLoses++;
trevel.highBetCount++;
}
if(bet === "HB" && outcome === "Win")
{
trevel.bets.push("HI");
trevel.wins++;
trevel.totalWins++;
trevel.highBetCount++;
trevel.highBetWins++;
}
if(bet === "HB" && outcome === "Loose")
{
trevel.bets.push("LO");
trevel.looses++;
trevel.totalLoses++;
trevel.lowBetCount++;
}
},
isNumeric: function(n)
{
return !isNaN(parseFloat(n)) && isFinite(n);
},
/* Do NOT touch, EVER! */
BinomialByMultiplication: function(numberOfSuccesses, numberOfTrials, probabilityOnSingleTrial)
{
if(this.isNumeric(probabilityOnSingleTrial) == true)
{
var j1, j2;
if(2 * numberOfSuccesses > numberOfTrials)
{
return(this.BinomialByMultiplication(numberOfTrials - numberOfSuccesses, numberOfTrials, 1 - probabilityOnSingleTrial));
}
var j0 = j1 = j2 = 0;
var binomialProbability = 1.0;
while((j0 < numberOfSuccesses) | (j1 < numberOfSuccesses) | (j2 < numberOfTrials - numberOfSuccesses))
{
if((j0 < numberOfSuccesses) && (binomialProbability < 1))
{
j0++;
binomialProbability *= (numberOfTrials - numberOfSuccesses + j0) / j0;
}
else
{
if(j1 < numberOfSuccesses)
{
j1++;
binomialProbability *= probabilityOnSingleTrial;
}
else
{
j2++;
binomialProbability *= 1 - probabilityOnSingleTrial;
}
}
}
return binomialProbability;
}
else
{
return 1;
}
},
/* End of Do NOT touch, EVER! */
HighBetProbability: function()
{
trevel.highBetProbability = (trevel.highBetCount / (trevel.highBetCount+trevel.lowBetCount)).toFixed(2);
},
LowBetProbability: function()
{
trevel.lowBetProbability = (1- trevel.highBetProbability).toFixed(2);
},
HighBetWinProbability: function()
{
trevel.highBetWinsProb = (trevel.highBetWins/((trevel.highBetCount+trevel.lowBetCount)).toFixed(2));
},
LowBetWinProbability: function()
{
trevel.lowBetWinsProb = (trevel.lowBetWins/((trevel.highBetCount+trevel.lowBetCount)).toFixed(2));
},
resetProbabilities: function()
{
trevel.highBetProbability = 0;
trevel.lowBetProbability = 0;
trevel.lowBetWinsProb = 0;
trevel.highBetWinsProb = 0;
},
getNumberOfSuccesses: function()
{
_numberOfSuccesses = Math.round(((_numberOfBets - _rolls) / 2) + ((_numberOfBets - _rolls) / 10));
//_numberOfSuccesses = Math.round((_winPercentage * _numberOfTrials) / 100) //Win 70% of bets
//_numberOfSuccesses = 100;/*Math.round(((_maxNumberOfTrails - _numberOfTrials) / 2) + ((_maxNumberOfTrails - _numberOfTrials) / 10));*/
},
getNumberOfTrials: function()
{
_numberOfTrials = _numberOfBets - _rolls;
//_numberOfTrials =Math.floor(Math.random() * _numberOfBets) + _numberOfTrials;
//_numberOfTrials =Math.floor(Math.random() * _maxNumberOfTrails) + _minNumberOfTrials;
},
nextBet: function()
{
this.resetProbabilities();
this.HighBetProbability();
this.LowBetProbability();
this.HighBetWinProbability();
this.LowBetWinProbability();
this.getNumberOfTrials();
this.getNumberOfSuccesses();
if(_defaultProb == false)
{
trevel.lowBetBinomial = (this.BinomialByMultiplication(_numberOfSuccesses, _numberOfTrials, trevel.lowBetProbability)).toFixed(18);
trevel.highBetBinomial = (this.BinomialByMultiplication(_numberOfSuccesses, _numberOfTrials, trevel.highBetProbability)).toFixed(18);
}
else
{
trevel.lowBetBinomial = (this.BinomialByMultiplication(_numberOfSuccesses, _numberOfTrials, 0.475)).toFixed(18);
trevel.highBetBinomial = (this.BinomialByMultiplication(_numberOfSuccesses, _numberOfTrials, 0.475)).toFixed(18);
}
if(trevel.lowBetBinomial > trevel.highBetBinomial)
{
trevel._nextBet = "LB"; //place low bet when probability of winning on low is high
}
else if(trevel.lowBetBinomial < trevel.highBetBinomial)
{
trevel._nextBet = "HB"; //place high bet when probability of winning on high is high
}
else
{
if(_swap == true)
{
if(trevel.highBetProbability>trevel.lowBetProbability)
{
trevel._nextBet = "HB";
}
else if(trevel.highBetProbability<trevel.lowBetProbability)
{
trevel._nextBet = "LB";
}
else
{
if(trevel._nextBet === "HB")
{
trevel._nextBet = "LB"; //if the probabilities are equal and the previous bet was high, place low bet
}
else
{
trevel._nextBet = "HB"; //if the probabilities are equal and the previous bet was low, place high bet
}
}
}
}
}
};
resetArray = function() //keeps the data relevant.
{
trevel.bets = [];
trevel.lowBetCount = 0;
trevel.highBetCount = 0;
trevel.wins = 0;
trevel.looses = 0;
_rolls = 0;
randomNumberOfBets(_maxNumberOfBets, _minNumberOfBets);
trevel.lowBetWins=0;
trevel.highBetWins=0;
};
setOriginalUserBalance = function()
{
trevel.originalUserBalance = parseFloat($('#balance').html());
stop = false;
};
setCurrentUserBalance = function()
{
trevel.userBalance = parseFloat($('#balance').html());
};
getProfit = function()
{
setCurrentUserBalance();
trevel.profit = (trevel.userBalance - trevel.originalUserBalance).toFixed(8);
};
placeHighBet = function()
{
$('#double_your_btc_bet_hi_button').click();
};
placeLowBet = function()
{
$('#double_your_btc_bet_lo_button').click();
};
setOutcomes = function(bet)
{
if($('#double_your_btc_bet_lose').html() !== '')
{
trevel.addBet(bet, "Loose");
}
else
{
trevel.addBet(bet, "Win");
}
};
stopBetting = function()
{
_stop = true;
}
randomNumberOfBets = function(max, min)
{
_numberOfBets = Math.floor(Math.random() * max) + min;
}
calculateMaxBet = function()
{
setCurrentUserBalance();
_maxBet = ((trevel.userBalance * _amountToKelly) / 100).toFixed(8);
}
doubleOrNothing = function()
{
calculateMaxBet();
if($('#double_your_btc_bet_lose').html() !== '' && parseFloat($('#double_your_btc_stake').val()) * 2 < _maxBet)
{
$('#double_your_btc_2x').click();
}
else
{
$('#double_your_btc_min').click();
}
}
doubleOrNothingCustomConfiguration = function()
{
if(_useKellyPrinciple == false)
{
if($('#double_your_btc_bet_lose').html() !== '' && parseFloat($('#double_your_btc_stake').val()) * _customMultiplier < _customMaximumBet)
{
var elem = document.getElementById("double_your_btc_stake");
elem.value = (parseFloat($('#double_your_btc_stake').val()) * _customMultiplier).toFixed(8);
}
else
{
var elem = document.getElementById("double_your_btc_stake");
elem.value = _customMinimumBet;
}
}
else
{
setCurrentUserBalance();
var betAmount = 0;
var elem2 = document.getElementById("double_your_btc_payout_multiplier");
var currMulty = elem2.value;
if(trevel._nextBet === "HB")
{
betAmount = (((trevel.userBalance * _amountToKelly)/100) * ((trevel.highBetWinsProb * currMulty - 1))/(currMulty - 1)).toFixed(8);
console.log(betAmount);
if(betAmount > 0 && betAmount < trevel.userBalance && trevel.bets.length > 15)
{
//console.log(betAmount);
var elem3 = document.getElementById("double_your_btc_stake");
elem3.value = betAmount;
}
else
{
/*var elem4 = document.getElementById("double_your_btc_stake");
elem4.value = _customMinimumBet;*/
doubleOrNothing();
}
}
else
{
betAmount = (((trevel.userBalance * _amountToKelly)/100) * ((trevel.lowBetWinsProb * currMulty - 1))/(currMulty - 1)).toFixed(8);
console.log(betAmount);
if(betAmount > 0 && betAmount < trevel.userBalance && trevel.bets.length > 15)
{
//console.log(betAmount);
var elem3 = document.getElementById("double_your_btc_stake");
elem3.value = betAmount;
}
else
{
/*var elem4 = document.getElementById("double_your_btc_stake");
elem4.value = _customMinimumBet;*/
doubleOrNothing();
}
}
}
}
logInfomation = function(isStopped)
{
if(isStopped == true)
{
console.log("Betting Stopped. Your profit is: " + trevel.profit);
console.log("In this round You have won " + trevel.wins + " bets and lost " + trevel.looses + " bets. Total bets placed are: " + (trevel.wins + trevel.looses));
console.log("In total You have won " + trevel.totalWins + " bets and lost " + trevel.totalLoses + " bets. Total bets placed are: " + (trevel.totalWins + trevel.totalLoses));
console.log("You have a " + (trevel.totalWins / (trevel.totalWins + trevel.totalLoses)).toFixed(2) + " probability of winning with Trevel.");
}
else
{
console.log("Current bets profit is: " + trevel.profit);
console.log("In this round You have won " + trevel.wins + " bets and lost " + trevel.looses + " bets. Total bets placed are: " + (trevel.wins + trevel.looses));
console.log("In total You have won " + trevel.totalWins + " bets and lost " + trevel.totalLoses + " bets. Total bets placed are: " + (trevel.totalWins + trevel.totalLoses));
console.log("You have a " + (trevel.wins / (trevel.wins + trevel.looses)).toFixed(2) + " probability of winning.");
}
}
placeRoll = function()
{
setTimeout(rollDice, (_betSpeed) + Math.round(Math.random() * 1000));
}
rollDice = function()
{
if(_x === 0)
{
console.log("Betting Begun...");
_x++;
}
trevel.nextBet();
if(_useCustomConfiguration==true)
{
doubleOrNothingCustomConfiguration();
}
else
{
doubleOrNothing();
}
getProfit();
if(_verbose == true)
{
console.log("Profit: " + trevel.profit);
/*console.log("Number of Trails: "+ _numberOfTrials);
console.log("High Bet Probability was: "+trevel.highBetProbability+ " While low bet Probability was: "+trevel.lowBetProbability);
console.log("High Bet Binomial was: "+trevel.highBetBinomial+ " While low bet Binomial was: "+trevel.lowBetBinomial);*/
if(_defaultProb==true)
{
console.log("Using _defaultProb i.e 0.475")
}
else
{
console.log("Using computed probabilities above.")
}
}
if(trevel._nextBet === "HB")
{
placeHighBet();
setOutcomes("HB");
}
else
{
placeLowBet();
setOutcomes("LB");
}
_rolls++;
if(_stop == false)
{
if(trevel.bets.length >= _numberOfBets)
{
if(_stopOnNumberOfBets === true)
{
logInfomation(true);
}
else
{
logInfomation();
placeRoll();
}
resetArray();
}
else
{
placeRoll();
}
}
else
{
logInfomation(true);
}
};
setOriginalUserBalance();
rollDice();