Advertisement
Guest User

Untitled

a guest
Jul 12th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. var config = {
  2. baseBet: { label: "Base bet", type: "balance", value: 100 }, // how many satoshis to bet initially
  3. target: { label: "Target", type: "multiplier", value: 5 }, // target multiplier
  4. betMultiplier: { label: "Bet multiplier", type: "multiplier", value: 1.3 } // what to multiply the bet size by when we lose a wager
  5. }
  6.  
  7.  
  8. let lossCount = 0
  9. this.log(`Starting martingale with a base bet of ${config.baseBet.value} satoshis.`)
  10.  
  11. while (true) {
  12. // make the bet and wait for the result
  13. const { multiplier } = await this.bet(betSize(lossCount), config.target.value)
  14.  
  15. if (multiplier < config.target.value) { // loss
  16. lossCount++
  17. this.log(`Lost bet. Multiplying bet size by ${config.betMultiplier.value} for new bet size of ${betSize(lossCount)} satoshis.`)
  18. } else { // win
  19. lossCount = 0
  20. this.log(`Won bet. Setting bet size to ${config.baseBet.value} satoshis.`)
  21. }
  22. }
  23.  
  24. function betSize(lossCount) {
  25. const bet = config.baseBet.value * Math.pow(config.betMultiplier.value, lossCount)
  26. return Math.round(bet / 100) * 100
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement