Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var initialbet = 25; // how many bits to bet first time 1 bit = 1000 satoshis, 1000 bits = ~$1, 1 BTC = 1,000,000 bits ie: ~$1G
- var increasebet = 1.06; // what bet increase multiplier to use < 1 to reduce bet size, 1 to keep same, > 1 to increase by X multiplier
- var takeprofit = 1900; // what take profit to use*** NOTE *** CRASH OF 19X IN BUSTABIT IS REPRESENTED AS 1900 IN CODE ***
- var takeprofitincrement = 0.9998; // =1 to use original takeprofit on loss, or > 1X for to increase takeprofit on failure, or < 1X to reduce takeprofit on failure
- var entrycriteria = 1690; // to enter the bust has to be below mean *** NOTE *** CRASH OF 18.6X IN BUSTABIT IS REPRESENTED AS 1860 IN CODE ***
- var WaitCriteriaStreak = 22; // how many consecutive bust streaks with crash # < entry criteria are needed before betting starts
- var maxlosingstreakcutoff = 150; // how many losing bets in streak before we stop betting and take the loss from bad streak < takeprofit (set =0 to bet until account is drained)
- var PainTrainFreeRider = 1; // if we hit maxlosingstreakcutoff then wait for =1, =2, =3... consecutive peper bet wins from waitcriteriastreak before betting real bits again
- var median6upperlimit = 1.96; // the highest short term median allowed which bot can still placing bets on *** represented in code using decimal place ie 1.96X ***
- var maxwinners = 100; // how many max winners total across all games before quitting (set 0 to keep playing)
- var maxlosers = 25; // how many losers total across all games before quitting (set 0 to keep playing)
- var resetmaxlosesstreakonwin = 1; // =0 keep counting maxlosses across a winning streak, =1 to reset loss count on each win so it's treated as a new martingale streak
- var ignoreWaitCriteriaStreak = 1; // 0 to use bust streak counting while in betting streak OR use =1 to bet every bust < criteria once first met until maxlosers
- var playwinningstreaks = 0; // =0 do not play winning streaks stop, =1 keep playing winning streaks as long as conditions hold
- var increasebetonwinningstreak = 1; // =1.0 to use standard bet on win, below < 1 to be cautious, or above 1.1X to start living dangerously once in profit, winning streaks use initialbet * this multiplier
- var abortfailedmedians6 = 0; // =0 to only abort failed streaks with maxlosingstreakcutoff counter, set to =1 to abort failed streaks when data model median6 > median6upperlimit as configured in the line above
- var abortfailedentrycriteria = 0; // =0 to only abort failed streaks with maxlosingstreakcutoff counter, set to =1 to abort failed streaks when entrycriteria > last bust as configured above
- var botpriority = 1; // =1 to be first priority bot, =2 second priority bot, =3 third priority bot strategy to execute a bet when running on same account
- // ------------ system initialization section -------------
- var bet = initialbet; // do not change!
- var gamestate = 0; // leave as 0 don't change!
- var takeprofitvar = takeprofit; // leave as 0 don't change!
- var buststriggered = 0; // do not change!
- var streaklosers = 0; // do not change!
- var bust0 = 197; // do not change!
- var bust1 = 197; // do not change!
- var bust2 = 197; // do not change!
- var bust3 = 197; // do not change!
- var bust4 = 197; // do not change!
- var bust5 = 197; // do not change!
- var median6 = 197; // do not change!
- var gameoverman = 0; // do not change!
- var totalwinnings = 0; // do not change!
- var totallosses = 0; // do not change!
- var currentwinners = 0; // do not change!
- var currentlosers = 0; // do not change!
- var netgain = 0; // do not change!
- var winrate = 0; // do not change!
- var profit = 0; // do not change!
- var paperbetting = 0; // do not change!
- var paintrainlength = 0 // do not change!
- var paintrainconfirmations = 0; // do not change!
- // ------------ automated trading algorithm -------------
- engine.on('game_starting', function(info) {
- if ((totalwinnings > 0) && (totallosses > 0)){
- netgain = ((totalwinnings / totallosses ) * 100);
- }
- if ((currentwinners > 0) && (currentlosers > 0)){
- winrate = ((currentwinners/currentlosers)*100);
- }
- if ((currentwinners > 0) && (currentlosers == 0)){
- winrate = 100;
- }
- console.log("Game Starting --- Total Winnings ", totalwinnings, "Bits --- Total Losses ", totallosses, "Bits --- NetGain ", netgain, "% --- Win Count ", currentwinners, "X --- Loss Count ", currentlosers, "X --- Win Rate ", winrate, "%" );
- if ((maxwinners > 0) && (maxwinners == currentwinners)){
- console.log("NO MORE BETTING - Maximum winners limit of ", maxwinners, " reached with ", currentwinners, " winners and ", currentlosers, " losers *** BOT IS STOPPED PLEASE RESTART ***");
- gameoverman = 1;
- };
- if ((maxlosers > 0) && (maxlosers == currentlosers)){
- console.log("NO MORE BETTING - Maximum losers limit of ", maxlosers, " reached with ", currentlosers, " losers and ", currentwinners, " winners. *** BOT IS STOPPED PLEASE RESTART ***");
- gameoverman = 1;
- };
- if (gamestate == 1){
- console.log("Using criteria of ", entrycriteria/100, "X with a WaitCriteriaStreak of ", WaitCriteriaStreak, " with median6 < ", median6upperlimit, "X needed before entering");
- console.log("Setting maxwinners is ", maxwinners, " current winners are ", currentwinners);
- console.log("Setting maxlosers is ", maxlosers, " current losers are ", currentlosers);
- console.log("When a bust comes we increase bet by ", increasebet, "X on loss from initial bet of ", initialbet, " and increase takeprofit by ", takeprofitincrement, "X from takeprofit ", takeprofit/100, "X");
- if ((gameoverman == 0)){
- console.log("Calling placeBet with bet ", bet, " takeprofit ", takeprofitvar/100);
- // start of critical code block
- try {
- // Perform Bot Priority delay to schedule bet placement according to strategy priority
- var now = new Date().getTime();
- while (new Date().getTime() < now + (100*botpriority)){
- // delay for bot priority
- }
- // PAPER TRADING MODE BY DEFAULT -- UNCOMMENT THE BELOW engine.placeBet LINE BY REMOVING // FROM FRONT TO MAKE THE BOT TRADE REAL BITS
- engine.placeBet((Math.round((bet).toFixed(0)))*100, Math.trunc(takeprofitvar), false);
- // PAPER TRADING MODE BY DEFAULT -- UNCOMMENT THE ABOVE engine.placeBet LINE BY REMOVING // FROM FRONT TO MAKE THE BOT TRADE REAL BITS
- gamestate = 2;
- }
- catch(err) {
- console.log("*** Failed to PlaceBet due to game already having started! The best we can do is place same bet next turn, we will do that ***");
- if ( botpriority > 0 ){
- // we are running multiple bots - failure to bet means OTHER bots have already bet - do NOT re-bet
- gamestate = 2;
- } else {
- gamestate = 1;
- }
- }
- finally {
- // end of critical code block
- };
- }
- };
- });
- engine.on('game_crash', function(data) {
- bust5 = bust4;
- bust4 = bust3;
- bust3 = bust2;
- bust2 = bust1;
- bust1 = bust0;
- bust0 = data.game_crash;
- if ( bust0 == 0 ){
- // cleanse the bad data point using 100 instead of 0
- bust0 = 100;
- }
- median6 = (bust5 + bust4 + bust3 + bust2 + bust1 + bust0) / 6;
- let values = [bust5, bust4, bust3, bust2, bust1, bust0];
- values.sort((a, b) => a - b);
- let median = (values[(values.length - 1) >> 1] + values[values.length >> 1]) / 2;
- median6 = Math.trunc(median);
- console.log("Game Crashed at ", data.game_crash/100, " the Median6 is now ", median6/100);
- if (gamestate == 0){
- if(data.game_crash < entrycriteria){
- if (buststriggered < WaitCriteriaStreak){
- buststriggered = buststriggered + 1;
- }
- console.log("Entry criteria of ", entrycriteria/100, " met for ", buststriggered, " busts in a row");
- if (((median6/100)<median6upperlimit)&&((WaitCriteriaStreak == 0) || (buststriggered == WaitCriteriaStreak))){
- console.log("Matched desired bust streak of ", WaitCriteriaStreak, " with entrycriteria ", entrycriteria/100, " while median6 is ", median6/100, " under upperlimit of ", median6upperlimit);
- gamestate = 1;
- buststriggered = 0;
- };
- if ((PainTrainFreeRider > 0)){
- if (paintrainlength > 0){
- paintrainlength = paintrainlength + 1;
- if (paintrainconfirmations == 0){
- console.log("PainTrainFreeRider enabled - PainTrainLength is ", paintrainlength, " with 0 Win Confirmations - Looking for FIRST Win Confirmation until we reach ", PainTrainFreeRider, " total confirmations.");
- paperbetting = 1; // switch to paper betting until we reach PainTrainFreeRider total confirmations
- }
- else if ((paintrainconfirmations > 0) && (paintrainconfirmations == (PainTrainFreeRider-1))){
- console.log("PainTrainFreeRider enabled - PainTrainLength is ", paintrainlength, " with ", paintrainconfirmations, " Win Confirmations - Looking for FINAL Win Confirmation for ", PainTrainFreeRider, " total confirmations.");
- }
- else {
- console.log("PainTrainFreeRider enabled - PainTrainLength is ", paintrainlength, " with ", paintrainconfirmations, " Win Confirmations - Looking for another Win Confirmation until we reach ", PainTrainFreeRider, " total confirmations.");
- }
- }
- }
- }
- else { // if(data.game_crash > (entrycriteria - 1)){
- if ((PainTrainFreeRider > 0)){
- if (paintrainlength == 0){
- // streak of above criteria busts no pain train in effect, take no action
- } else if (paintrainlength > 0){ // reached first bust > criteria since the pain train started
- // check how many confirmations we need before turning off paper betting
- if (paintrainconfirmations == 0){
- console.log("PainTrainFreeRider enabled - PainTrainLength of ", paintrainlength, " has ended! We have 0 Win Confirmations - Now looking for a matching WaitCriteriaStreak of ", WaitCriteriaStreak, " and for FIRST Win Confirmation until we reach ", PainTrainFreeRider, " total confirmations.");
- }
- else if ((paintrainconfirmations > 0) && (paintrainconfirmations == (PainTrainFreeRider-1))){
- console.log("PainTrainFreeRider enabled - PainTrainLength of ", paintrainlength, " has ended! We have ", paintrainconfirmations, " Win Confirmations - Now looking for a matching WaitCriteriaStreak of ", WaitCriteriaStreak, " and for FINAL Win Confirmation for ", PainTrainFreeRider, " total confirmations.");
- }
- else {
- console.log("PainTrainFreeRider enabled - PainTrainLength is ", paintrainlength, " has ended! We have ", paintrainconfirmations, " Win Confirmations - Now looking for a matching WaitCriteriaStreak of ", WaitCriteriaStreak, " and for another Win Confirmation until we reach ", PainTrainFreeRider, " total confirmations.");
- }
- }
- }
- console.log("Crash of ", data.game_crash/100, " was too high to meet criteria of ", entrycriteria/100);
- buststriggered = 0;
- };
- };
- if (gamestate == 2) {
- if(data.game_crash > (takeprofitvar - 1)) {
- currentwinners = currentwinners + 1;
- totalwinnings = totalwinnings + ((bet*(takeprofitvar/100))-bet);
- profit = (bet*(takeprofitvar/100)-bet);
- console.log("We won the game caught in time bust of ", data.game_crash/100, " for takeprofit ", takeprofitvar/100, " on bet ", bet, " for profit of ", profit, "Bits currentwinners are ", currentwinners, " currentlosers are ", currentlosers, " and streaklosers were ", streaklosers);
- takeprofitvar = takeprofit;
- if ((playwinningstreaks == 1) && (ignoreWaitCriteriaStreak == 1) && (data.game_crash < entrycriteria) && (data.game_crash < median6)){
- console.log("Game win was below entrycriteria of ", entrycriteria/100, " and under median6 ", median6/100, " we are still betting and increasing initialbet by ", increasebetonwinningstreak, "X multiplier");
- gamestate = 1;
- bet = initialbet * increasebetonwinningstreak;
- if ( bet < 1 ) {
- bet = 1;
- }
- takeprofitvar = takeprofit;
- if (resetmaxlosesstreakonwin == 1){
- streaklosers = 0;
- }
- } else {
- console.log("Game win was above entrycriteria of ", entrycriteria/100, " and/or above median6 of ", median6/100, ", and/or we do not play winning streaks, and/or we wait for criteria streaks on win. Now we are stopping betting and looking for entry criteria again < median6");
- bet = initialbet;
- if ( bet < 1 ) {
- bet = 1;
- }
- gamestate = 0;
- streaklosers = 0;
- }
- } else {
- //if (data.game_crash < takeprofitvar) {
- totallosses = totallosses + bet;
- bet = bet * increasebet;
- if ( bet < 1 ) {
- bet = 1;
- }
- streaklosers = streaklosers + 1;
- console.log("Failed to win this game due to bust of ", data.game_crash/100, " while wanting takeprofit of ", takeprofitvar/100, " now currentwinners is ", currentwinners, " currentlosers is ", currentlosers, " streaklosers count is ", streaklosers);
- console.log("Increasing bet size by ", increasebet, "X to bet of ", bet, " and increasing by ", takeprofitincrement, "X the takeprofit to ", (takeprofitvar * takeprofitincrement)/100);
- takeprofitvar = takeprofitvar * takeprofitincrement;
- gamestate = 1;
- if (maxlosingstreakcutoff == streaklosers) {
- console.log("Failed to win a game on turn ", streaklosers," when maxlosingstreakcutoff limit is ", maxlosingstreakcutoff, " this streak is a bust we are going back down to initial bet of ", initialbet, " from currentbet of ", bet);
- bet = initialbet;
- if ( bet < 1 ) {
- bet = 1;
- }
- takeprofitvar = takeprofit;
- gamestate = 0;
- streaklosers = 0;
- currentlosers = currentlosers + 1;
- } else if (((abortfailedentrycriteria == 1) && (data.game_crash > entrycriteria)) || ((abortfailedmedians6 == 1) && ((median6/100)> median6upperlimit))) {
- console.log("Failed to win a game on turn ", streaklosers," when median6upperlimit is ", median6upperlimit, " and median6 was ", median6/100, " and/or criteria ", entrycriteria/100, " not met. This streak is a bust we are going back initial bet of ", initialbet, " from currentbet of ", bet, " and returning takeprofit down to ", takeprofit/100 );
- bet = initialbet;
- if ( bet < 1 ) {
- bet = 1;
- }
- takeprofitvar = takeprofit;
- gamestate = 0;
- streaklosers = 0;
- currentlosers = currentlosers + 1;
- };
- };
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment