Advertisement
Guest User

Untitled

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