SHOW:
|
|
- or go back to the newest paste.
| 1 | 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 | |
| 2 | 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 | |
| 3 | var takeprofit = 1900; // what take profit to use*** NOTE *** CRASH OF 19X IN BUSTABIT IS REPRESENTED AS 1900 IN CODE *** | |
| 4 | 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 | |
| 5 | 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 *** | |
| 6 | var WaitCriteriaStreak = 22; // how many consecutive bust streaks with crash # < entry criteria are needed before betting starts | |
| 7 | 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) | |
| 8 | var PainTrainFreeRider = 1; // if we hit maxlosingstreakcutoff then wait for =1, =2, =3... consecutive peper bet wins from waitcriteriastreak before betting real bits again | |
| 9 | 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 *** | |
| 10 | var maxwinners = 100; // how many max winners total across all games before quitting (set 0 to keep playing) | |
| 11 | var maxlosers = 25; // how many losers total across all games before quitting (set 0 to keep playing) | |
| 12 | 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 | |
| 13 | 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 | |
| 14 | var playwinningstreaks = 0; // =0 do not play winning streaks stop, =1 keep playing winning streaks as long as conditions hold | |
| 15 | 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 | |
| 16 | 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 | |
| 17 | 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 | |
| 18 | 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 | |
| 19 | ||
| 20 | // ------------ system initialization section ------------- | |
| 21 | var bet = initialbet; // do not change! | |
| 22 | var gamestate = 0; // leave as 0 don't change! | |
| 23 | var takeprofitvar = takeprofit; // leave as 0 don't change! | |
| 24 | var buststriggered = 0; // do not change! | |
| 25 | var streaklosers = 0; // do not change! | |
| 26 | var bust0 = 197; // do not change! | |
| 27 | var bust1 = 197; // do not change! | |
| 28 | var bust2 = 197; // do not change! | |
| 29 | var bust3 = 197; // do not change! | |
| 30 | var bust4 = 197; // do not change! | |
| 31 | var bust5 = 197; // do not change! | |
| 32 | var median6 = 197; // do not change! | |
| 33 | var gameoverman = 0; // do not change! | |
| 34 | var totalwinnings = 0; // do not change! | |
| 35 | var totallosses = 0; // do not change! | |
| 36 | var currentwinners = 0; // do not change! | |
| 37 | var currentlosers = 0; // do not change! | |
| 38 | var netgain = 0; // do not change! | |
| 39 | var winrate = 0; // do not change! | |
| 40 | var profit = 0; // do not change! | |
| 41 | var paperbetting = 0; // do not change! | |
| 42 | var paintrainlength = 0 // do not change! | |
| 43 | var paintrainconfirmations = 0; // do not change! | |
| 44 | ||
| 45 | // ------------ automated trading algorithm ------------- | |
| 46 | engine.on('game_starting', function(info) {
| |
| 47 | if ((totalwinnings > 0) && (totallosses > 0)){
| |
| 48 | netgain = ((totalwinnings / totallosses ) * 100); | |
| 49 | } | |
| 50 | if ((currentwinners > 0) && (currentlosers > 0)){
| |
| 51 | winrate = ((currentwinners/currentlosers)*100); | |
| 52 | } | |
| 53 | if ((currentwinners > 0) && (currentlosers == 0)){
| |
| 54 | winrate = 100; | |
| 55 | } | |
| 56 | 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, "%" );
| |
| 57 | if ((maxwinners > 0) && (maxwinners == currentwinners)){
| |
| 58 | console.log("NO MORE BETTING - Maximum winners limit of ", maxwinners, " reached with ", currentwinners, " winners and ", currentlosers, " losers *** BOT IS STOPPED PLEASE RESTART ***");
| |
| 59 | gameoverman = 1; | |
| 60 | }; | |
| 61 | if ((maxlosers > 0) && (maxlosers == currentlosers)){
| |
| 62 | console.log("NO MORE BETTING - Maximum losers limit of ", maxlosers, " reached with ", currentlosers, " losers and ", currentwinners, " winners. *** BOT IS STOPPED PLEASE RESTART ***");
| |
| 63 | gameoverman = 1; | |
| 64 | }; | |
| 65 | if (gamestate == 1){
| |
| 66 | console.log("Using criteria of ", entrycriteria/100, "X with a WaitCriteriaStreak of ", WaitCriteriaStreak, " with median6 < ", median6upperlimit, "X needed before entering");
| |
| 67 | console.log("Setting maxwinners is ", maxwinners, " current winners are ", currentwinners);
| |
| 68 | console.log("Setting maxlosers is ", maxlosers, " current losers are ", currentlosers);
| |
| 69 | 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");
| |
| 70 | if ((gameoverman == 0)){
| |
| 71 | console.log("Calling placeBet with bet ", bet, " takeprofit ", takeprofitvar/100);
| |
| 72 | // start of critical code block | |
| 73 | try {
| |
| 74 | // Perform Bot Priority delay to schedule bet placement according to strategy priority | |
| 75 | var now = new Date().getTime(); | |
| 76 | while (new Date().getTime() < now + (100*botpriority)){
| |
| 77 | // delay for bot priority | |
| 78 | } | |
| 79 | ||
| 80 | // PAPER TRADING MODE BY DEFAULT -- UNCOMMENT THE BELOW engine.placeBet LINE BY REMOVING // FROM FRONT TO MAKE THE BOT TRADE REAL BITS | |
| 81 | engine.placeBet((Math.round((bet).toFixed(0)))*100, Math.trunc(takeprofitvar), false); | |
| 82 | // PAPER TRADING MODE BY DEFAULT -- UNCOMMENT THE ABOVE engine.placeBet LINE BY REMOVING // FROM FRONT TO MAKE THE BOT TRADE REAL BITS | |
| 83 | gamestate = 2; | |
| 84 | } | |
| 85 | catch(err) {
| |
| 86 | 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 ***");
| |
| 87 | if ( botpriority > 0 ){
| |
| 88 | // we are running multiple bots - failure to bet means OTHER bots have already bet - do NOT re-bet | |
| 89 | gamestate = 2; | |
| 90 | } else {
| |
| 91 | gamestate = 1; | |
| 92 | } | |
| 93 | } | |
| 94 | finally {
| |
| 95 | // end of critical code block | |
| 96 | }; | |
| 97 | } | |
| 98 | }; | |
| 99 | }); | |
| 100 | ||
| 101 | engine.on('game_crash', function(data) {
| |
| 102 | bust5 = bust4; | |
| 103 | bust4 = bust3; | |
| 104 | bust3 = bust2; | |
| 105 | bust2 = bust1; | |
| 106 | bust1 = bust0; | |
| 107 | bust0 = data.game_crash; | |
| 108 | if ( bust0 == 0 ){
| |
| 109 | // cleanse the bad data point using 100 instead of 0 | |
| 110 | bust0 = 100; | |
| 111 | } | |
| 112 | median6 = (bust5 + bust4 + bust3 + bust2 + bust1 + bust0) / 6; | |
| 113 | let values = [bust5, bust4, bust3, bust2, bust1, bust0]; | |
| 114 | values.sort((a, b) => a - b); | |
| 115 | let median = (values[(values.length - 1) >> 1] + values[values.length >> 1]) / 2; | |
| 116 | median6 = Math.trunc(median); | |
| 117 | ||
| 118 | console.log("Game Crashed at ", data.game_crash/100, " the Median6 is now ", median6/100);
| |
| 119 | if (gamestate == 0){
| |
| 120 | if(data.game_crash < entrycriteria){
| |
| 121 | if (buststriggered < WaitCriteriaStreak){
| |
| 122 | buststriggered = buststriggered + 1; | |
| 123 | } | |
| 124 | console.log("Entry criteria of ", entrycriteria/100, " met for ", buststriggered, " busts in a row");
| |
| 125 | if (((median6/100)<median6upperlimit)&&((WaitCriteriaStreak == 0) || (buststriggered == WaitCriteriaStreak))){
| |
| 126 | console.log("Matched desired bust streak of ", WaitCriteriaStreak, " with entrycriteria ", entrycriteria/100, " while median6 is ", median6/100, " under upperlimit of ", median6upperlimit);
| |
| 127 | gamestate = 1; | |
| 128 | buststriggered = 0; | |
| 129 | }; | |
| 130 | if ((PainTrainFreeRider > 0)){
| |
| 131 | if (paintrainlength > 0){
| |
| 132 | paintrainlength = paintrainlength + 1; | |
| 133 | if (paintrainconfirmations == 0){
| |
| 134 | console.log("PainTrainFreeRider enabled - PainTrainLength is ", paintrainlength, " with 0 Win Confirmations - Looking for FIRST Win Confirmation until we reach ", PainTrainFreeRider, " total confirmations.");
| |
| 135 | paperbetting = 1; // switch to paper betting until we reach PainTrainFreeRider total confirmations | |
| 136 | } | |
| 137 | else if ((paintrainconfirmations > 0) && (paintrainconfirmations == (PainTrainFreeRider-1))){
| |
| 138 | console.log("PainTrainFreeRider enabled - PainTrainLength is ", paintrainlength, " with ", paintrainconfirmations, " Win Confirmations - Looking for FINAL Win Confirmation for ", PainTrainFreeRider, " total confirmations.");
| |
| 139 | } | |
| 140 | else {
| |
| 141 | console.log("PainTrainFreeRider enabled - PainTrainLength is ", paintrainlength, " with ", paintrainconfirmations, " Win Confirmations - Looking for another Win Confirmation until we reach ", PainTrainFreeRider, " total confirmations.");
| |
| 142 | } | |
| 143 | } | |
| 144 | } | |
| 145 | } | |
| 146 | else { // if(data.game_crash > (entrycriteria - 1)){
| |
| 147 | if ((PainTrainFreeRider > 0)){
| |
| 148 | if (paintrainlength == 0){
| |
| 149 | // streak of above criteria busts no pain train in effect, take no action | |
| 150 | } else if (paintrainlength > 0){ // reached first bust > criteria since the pain train started
| |
| 151 | // check how many confirmations we need before turning off paper betting | |
| 152 | if (paintrainconfirmations == 0){
| |
| 153 | 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.");
| |
| 154 | } | |
| 155 | else if ((paintrainconfirmations > 0) && (paintrainconfirmations == (PainTrainFreeRider-1))){
| |
| 156 | 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.");
| |
| 157 | } | |
| 158 | else {
| |
| 159 | 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.");
| |
| 160 | } | |
| 161 | ||
| 162 | } | |
| 163 | } | |
| 164 | console.log("Crash of ", data.game_crash/100, " was too high to meet criteria of ", entrycriteria/100);
| |
| 165 | buststriggered = 0; | |
| 166 | }; | |
| 167 | }; | |
| 168 | if (gamestate == 2) {
| |
| 169 | if(data.game_crash > (takeprofitvar - 1)) {
| |
| 170 | currentwinners = currentwinners + 1; | |
| 171 | totalwinnings = totalwinnings + ((bet*(takeprofitvar/100))-bet); | |
| 172 | profit = (bet*(takeprofitvar/100)-bet); | |
| 173 | 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);
| |
| 174 | takeprofitvar = takeprofit; | |
| 175 | if ((playwinningstreaks == 1) && (ignoreWaitCriteriaStreak == 1) && (data.game_crash < entrycriteria) && (data.game_crash < median6)){
| |
| 176 | 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");
| |
| 177 | gamestate = 1; | |
| 178 | bet = initialbet * increasebetonwinningstreak; | |
| 179 | if ( bet < 1 ) {
| |
| 180 | bet = 1; | |
| 181 | } | |
| 182 | takeprofitvar = takeprofit; | |
| 183 | if (resetmaxlosesstreakonwin == 1){
| |
| 184 | streaklosers = 0; | |
| 185 | } | |
| 186 | } else {
| |
| 187 | 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");
| |
| 188 | bet = initialbet; | |
| 189 | if ( bet < 1 ) {
| |
| 190 | bet = 1; | |
| 191 | } | |
| 192 | gamestate = 0; | |
| 193 | streaklosers = 0; | |
| 194 | } | |
| 195 | } else {
| |
| 196 | //if (data.game_crash < takeprofitvar) {
| |
| 197 | totallosses = totallosses + bet; | |
| 198 | bet = bet * increasebet; | |
| 199 | if ( bet < 1 ) {
| |
| 200 | bet = 1; | |
| 201 | } | |
| 202 | streaklosers = streaklosers + 1; | |
| 203 | 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);
| |
| 204 | console.log("Increasing bet size by ", increasebet, "X to bet of ", bet, " and increasing by ", takeprofitincrement, "X the takeprofit to ", (takeprofitvar * takeprofitincrement)/100);
| |
| 205 | takeprofitvar = takeprofitvar * takeprofitincrement; | |
| 206 | gamestate = 1; | |
| 207 | if (maxlosingstreakcutoff == streaklosers) {
| |
| 208 | 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);
| |
| 209 | bet = initialbet; | |
| 210 | if ( bet < 1 ) {
| |
| 211 | bet = 1; | |
| 212 | } | |
| 213 | takeprofitvar = takeprofit; | |
| 214 | gamestate = 0; | |
| 215 | streaklosers = 0; | |
| 216 | currentlosers = currentlosers + 1; | |
| 217 | } else if (((abortfailedentrycriteria == 1) && (data.game_crash > entrycriteria)) || ((abortfailedmedians6 == 1) && ((median6/100)> median6upperlimit))) {
| |
| 218 | 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 );
| |
| 219 | bet = initialbet; | |
| 220 | if ( bet < 1 ) {
| |
| 221 | bet = 1; | |
| 222 | } | |
| 223 | takeprofitvar = takeprofit; | |
| 224 | gamestate = 0; | |
| 225 | streaklosers = 0; | |
| 226 | currentlosers = currentlosers + 1; | |
| 227 | }; | |
| 228 | }; | |
| 229 | }; | |
| 230 | }); |