Last active
August 18, 2019 04:11
-
-
Save dsetzer/a4cff8558038415eb302f7e35ded2025 to your computer and use it in GitHub Desktop.
bustadice fastbet chase script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /******** SETTINGS ********/ | |
| const BASE_WAGER = 100; // Initial lowest possible bet to start with (Satoshis) | |
| const BASE_TARGET = 500.00; // Target payout to chase for (Actual payout format 2.00x = 2.00) | |
| const AUTO_MULTIPLE = false; // Auto calculate and override BET_MULTIPLE for BASE_TARGET. | |
| const BET_MULTIPLE = 1.002; // Multiply bet by this value (1 = no increase) after each loss. | |
| const BET_INCREASE = 0; // Increase bet by this flat amount after each loss. (Satoshis) | |
| const RESET_ON_HIT = true; // Returns to base bet after hitting target payout. | |
| const STOP_ON_HIT = true; // Stop the script after hitting target payout. | |
| const STOP_ON_PROFIT = false; | |
| const STOP_PROFIT = 30000; // Stop the script when profits reach this amount. (Bits amount) | |
| /****** ADV SETTINGS ******/ | |
| const DEBUG_LOGS = true; | |
| const DEBUG_MODE = false; | |
| const QUEUE_SIZE = 100; // Adjusts bet concurrency. Keep it below 200. Don't be a hero.. | |
| /**************************/ | |
| //const cl = console.log | |
| //console.log = function () { if (DEBUG_LOGS) cl.apply(this, arguments) } | |
| let betCount = 0; | |
| let totalOut = 0; | |
| let totalIn = 0; | |
| let ourProfits = 0; | |
| let queue = new Array(QUEUE_SIZE); | |
| let pending = new Array(QUEUE_SIZE); | |
| let running = true; | |
| let betCap = 0; | |
| const betMultiple = AUTO_MULTIPLE ? getMultiple(`${BASE_TARGET*100}`) : BET_MULTIPLE; | |
| console.log(`Bet multiple for ${BASE_TARGET}x is ${betMultiple} * wager on loss.`) | |
| while (running) { | |
| const startTime = Date.now(); | |
| queue = pending; | |
| pending = []; | |
| let bet = null, | |
| curCap = 100; | |
| for (let i = 0; i < QUEUE_SIZE; i++) { | |
| if (!queue[i]) { | |
| bet = getWager(totalOut); | |
| queue.push(DEBUG_MODE ? this.skip() : this.bet(bet.value, bet.target)); | |
| betCount++; | |
| totalOut++; | |
| console.log(`Inserted bet into queue slot [${bet.value/100}bits @ ${bet.target}x] Bet ID ${totalOut}`); | |
| curCap -= (QUEUE_SIZE / 100) | |
| } | |
| } | |
| console.log(`Queue cycle at ${curCap}% capacity`); | |
| let context = this; | |
| await Promise.all(queue.map(p => p.catch(e => e))).then(async (results) => { await results.forEach(async (result) => await doResult(context, result)) }); | |
| //queue = []; | |
| await sleep(100); | |
| // TODO: Output stats and info at the end of each cycle instead of per bet | |
| } | |
| function getMultiple(target) { | |
| ((`${target}`).includes('.') || target < 100) ? target = Math.round(target * 100): null; | |
| let d = (`${target}`).length - 1; | |
| return (((Math.ceil((1 / (1 - (Math.ceil(((100 / 101) * (99 / (((target * 1) / 100) * 100 - 1))) * (Math.pow(10, d)))) / (Math.pow(10, d)))) * (Math.pow(100, (d - 1)))) / (Math.pow(100, (d - 1)))).toFixed(d)) / 1) | |
| } | |
| function getWager(totalOut) { | |
| const wager = Math.round(((BASE_WAGER * Math.pow(betMultiple, totalOut)) + (BET_INCREASE * totalOut)) / 100) * 100; | |
| return ({ value: wager, target: BASE_TARGET }); | |
| } | |
| async function doResult(context, result) { | |
| totalIn++; | |
| if (!DEBUG_MODE) { | |
| if (result.multiplier < result.target) { | |
| ourProfits -= result.value; | |
| } else { | |
| ourProfits += (result.value * result.target) - result.value | |
| console.log(`Won. Profits at ${ourProfits/100}, next bet ${result.value/100} bits @ ${result.target}x`); | |
| if (STOP_ON_HIT) { | |
| console.log(`Stopping after hitting target`) | |
| running = false; | |
| } else if (STOP_ON_PROFIT && (ourProfits / 100) >= STOP_PROFIT) { | |
| console.log(`Stopping after reaching ${ourProfits / 100} bits profits`) | |
| running = false; | |
| } | |
| if (RESET_ON_HIT) { | |
| totalOut = 0; | |
| } | |
| } | |
| console.log(`Current Chase Bets IN/OUT ${totalIn}/${totalOut} | Total Bets ${betCount}`); | |
| } | |
| } | |
| function sleep(ms) { | |
| return new Promise(resolve => setTimeout(resolve, ms)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment