Skip to content

Instantly share code, notes, and snippets.

@dsetzer
Last active August 18, 2019 04:11
Show Gist options
  • Save dsetzer/442b9aef98f3486340ded62579cccbf0 to your computer and use it in GitHub Desktop.
Save dsetzer/442b9aef98f3486340ded62579cccbf0 to your computer and use it in GitHub Desktop.
let betCount = 0, totalOut = 0, totalIn = 0;
let queue = new Array(200);
const doResult = async function (context, result) {
totalIn++;
console.log(`Current Bets ${totalIn} IN / ${totalOut} OUT / ${betCount} TOTAL`);
}
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
while (true) {
const cycleStart = Date.now();
for (let i = 0; i < 200; i++) {
queue[i] = context.bet(100, 1.98)
betCount++
totalOut++
}
const genTime = Date.now();
await Promise.all(queue.map(p => p.catch(e => e))).then(async (results) => { await results.forEach(result => doResult(this, result)) });
await sleep(10);
const cycleEnd = Date.now();
console.log(`Cycle efficiency 200 bets at ${(genTime-startTime)}ms for ${(200 / (genTime - startTime)) * 1000}/sec + ${cycleEnd - genTime}ms for ${(200 / (cycleEnd - genTime)) * 1000}/sec`)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment