Guest User

Martingale Betting Script

a guest
Jul 29th, 2013
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.72 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. #  run.py
  5. #  
  6. #  Copyright 2013 [mad]Berry <[email protected]>
  7. #  
  8. #  This program is free software; you can redistribute it and/or modify
  9. #  it under the terms of the GNU General Public License as published by
  10. #  the Free Software Foundation; either version 2 of the License, or
  11. #  (at your option) any later version.
  12. #  
  13. #  This program is distributed in the hope that it will be useful,
  14. #  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. #  GNU General Public License for more details.
  17. #  
  18. #  You should have received a copy of the GNU General Public License
  19. #  along with this program; if not, write to the Free Software
  20. #  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  21. #  MA 02110-1301, USA.
  22. #  
  23. #
  24.  
  25. ### Please send donations to:
  26. #btc: 1Q2QDC78uaGgkm4r3G5YzZSriPv7KMUuQU
  27. #ltc: Lb5TUyhdUtqsExLmiyqCLAiBZUrs8mEYze
  28. # Thanks.  
  29.  
  30. import urllib2,urllib,os,simplejson, random
  31.  
  32. # Variables used to run the script
  33.  
  34. user='' #userid from the site
  35. password = '' #password from the site
  36. less_than_min = 32768 #Bet less than "offset"
  37. less_than_max = 32768
  38. '''
  39. 64000 = 97.7%    odds wins  1.013x
  40. 60000 = 91.6%    odds wins  1.081x
  41. 55000 = 83.9%    odds wins  1.179x
  42. 32768 = 50.0%    odds wins  1.98x
  43. 16384 = 25.0%    odds wins  3.96x
  44. 7000 = 10.7%    odds wins  9.268x
  45. 2400 = 3.66%    odds wins    27.03x
  46. 1000 = 1.53%    odds wins    64.88x
  47.    1 = 0.00153% odds wins 64880x
  48. '''
  49. max_bet = 200 # Maximum bet 4000=0.00004 || Not used yet
  50. min_bet = 1000 # Minimum bet can't be lower then 1000=0.00001
  51. max_loss = 10000 # stop after X losses
  52. rate_limit = 0 #Rate limit in seconds, currently 1 bet per 10 sec.
  53.  
  54. #--Any changes below this line might break the script--
  55.  
  56. __prog__ = "coinroll.it automated gambling script"
  57. __scriptname__ = "run.py"
  58. __author__ = "[mad]Berry"
  59. __date__ = "$May 07, 2013 17:10:45 PM$"
  60. __version__ = "1.0.04"
  61.  
  62. class Error(Exception):
  63.     pass
  64.  
  65. def pause(n, post=False):
  66.     import time, sys
  67.     if post:
  68.         print "Start : %s" % time.ctime()
  69.     while n != 0:
  70.         time.sleep(1)
  71.         sys.stdout.write("Sleeping for: %d   \r" % (n) )
  72.         sys.stdout.flush()
  73.         n = n -1
  74.     print "     "
  75.  
  76. def call(api_url, **kwargs):
  77.     try:
  78.         baseurl = 'https://coinroll.it/'
  79.         api_url = baseurl + api_url
  80.         data = urllib.urlencode(kwargs) #({'user': user, 'password': password})
  81.         header = {
  82.         "Content-type": "application/x-www-form-urlencoded",
  83.         "User-Agent" : "Coinroll Martingale by "+__author__+" Version "+ __version__
  84.                 }
  85.         req = urllib2.Request(api_url, data, header)
  86.         response = urllib2.urlopen(req)
  87.         result = response.read()
  88.         result = simplejson.loads(result)
  89.         if 'error' in result:
  90.         # An error occurred; raise an exception
  91.             raise Error({'message': result['error']})
  92.             exit(1)
  93.         return result
  94.     except Exception, e:
  95.         print e.args[0]['message']
  96.         exit(1)
  97.  
  98. def firstrun():
  99.     print 'Loading first run procedures'
  100.     if os.path.isfile('cred.txt'):
  101.         print 'Success we already have credentials'
  102.         file = open('cred.txt','r')
  103.         address = file.read()
  104.         file.close()
  105.         print address
  106.         pass
  107.     else:
  108.         result = call('deposit/', user=user, password=password)
  109.         file = open('cred.txt','w')
  110.         file.write(result['address'])
  111.         print 'Send a deposit to:', result['address'], 'to create the new account'
  112.         file.close()
  113.  
  114. def main():
  115.     resultloss = call('getbalance', user=user, password=password)  ##get balance from api
  116.     initial_loss = resultloss['bets'] - resultloss['wins']
  117.     initial_wins = resultloss['wins']
  118.     less_than = random.randint(less_than_min,less_than_max)
  119.     bet = random.randint(min_bet,max_bet)
  120.     while True:  #start bet loop
  121.             resultloss = call('getbalance', user=user, password=password)
  122.             losses = resultloss['bets'] - resultloss['wins']
  123.             if (resultloss['balance'] <= 0):
  124.                 exit('Reached 300 time to quit')
  125.             elif (resultloss['balance'] >= 400):
  126.                 exit('Reached 4500 GOOD time to quit')
  127.             #print resultloss
  128.             if (losses >= max_loss):
  129.                 max_lost = initial_loss+max_loss
  130.                 #print max_lost
  131.             else:
  132.                 max_lost = max_loss
  133.             if (losses == max_lost):
  134.                 print 'Lost to much exiting'
  135.                 break;
  136.             else:
  137.                 result = call('bet',user=user, password=password, lessthan=less_than,amount=bet)
  138.                 if (result['win'] == True):
  139.                     print "Won! With {2} at {1}  \nPlacing another bet I will stop after {0} losses".format(max_loss,less_than, bet)
  140.                 else:
  141.                     print "LOST! With {2} at {1}  \nPlacing another bet I will stop after {0} losses".format(max_loss,less_than, bet)
  142.                 less_than = random.randint(less_than_min,less_than_max)
  143.                 bet = random.randint(min_bet,max_bet)
  144.             pause(rate_limit)            
  145.     return 0
  146.  
  147. if __name__ == '__main__':
  148.     import logging
  149.     import optparse
  150.     parser = optparse.OptionParser(version= __prog__ + " " + __version__ + "\nDeveloped by: " + __author__)
  151.     parser.add_option("-n", "--new", action="store_true", dest="new",
  152.             help=("Add a new account, your address will be added to cred.txt"))
  153.     (options, args) = parser.parse_args()
  154.     if options.new == True:
  155.         firstrun()
  156.     else:
  157.         try:
  158.             main()
  159.         except KeyboardInterrupt:
  160.             exit("Bye Bye")
Advertisement
Add Comment
Please, Sign In to add comment