Advertisement
Guest User

Untitled

a guest
Jan 7th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.62 KB | None | 0 0
  1. import urllib, json
  2. import smtplib
  3.  
  4. initial_investment = 170.07
  5.  
  6. print "====Sticker value total script===="
  7.  
  8.  
  9.  
  10. #Sticker | dAT team (Holo) | Cologne 2014
  11. apiExample = "http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=Sticker%20%7C%20dAT%20team%20(Holo)%20%7C%20Cologne%202014"
  12. url = apiExample
  13. response = urllib.urlopen(url)
  14. data = json.loads(response.read())
  15. dAt = data["lowest_price"]
  16. dAt = dAt[1:]#removing the dollar sign
  17. dAt=float(dAt)*6
  18.  
  19. #print "xooooo"
  20. print "Loading..."
  21.  
  22. #Sticker | Titan | Cologne 2014
  23. apiExample = "http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=Sticker%20%7C%20Titan%20%7C%20Cologne%202014"
  24. url = apiExample
  25. response = urllib.urlopen(url)
  26. data = json.loads(response.read())
  27. titan = data["lowest_price"]
  28. titan = titan[1:]#removing the dollar sign
  29. titan = float(titan)*2
  30.  
  31. #print "xxoooo"
  32.  
  33. #Sticker | Virtus.Pro (Holo) | DreamHack 2014
  34. apiExample = "http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=Sticker%20%7C%20Virtus.Pro%20(Holo)%20%7C%20DreamHack%202014"
  35. url = apiExample
  36. response = urllib.urlopen(url)
  37. data = json.loads(response.read())
  38. virtus = data["lowest_price"]
  39. virtus = virtus[1:]#removing the dollar sign
  40. virtus = float(virtus)*3
  41.  
  42. #print "xxxooo"
  43.  
  44. #Sticker | Team Immunity | Cologne 2015
  45. apiExample = "http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=Sticker%20%7C%20Team%20Immunity%20%7C%20Cologne%202015"
  46. url = apiExample
  47. response = urllib.urlopen(url)
  48. data = json.loads(response.read())
  49. immunity = data["lowest_price"]
  50. immunity = immunity[1:]#removing the dollar sign
  51. immunity = float(immunity)*28
  52.  
  53. #print "xxxxoo"
  54.  
  55. #Sticker | Team eBettle | Cologne 2015
  56. apiExample = "http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=Sticker%20%7C%20Team%20eBettle%20%7C%20Cologne%202015"
  57. url = apiExample
  58. response = urllib.urlopen(url)
  59. data = json.loads(response.read())
  60. ebettle = data["lowest_price"]
  61. ebettle = ebettle[1:]#removing the dollar sign
  62. ebettle = float(ebettle)*42
  63.  
  64. #print "xxxxxo"
  65.  
  66. #Sticker | 3DMAX | Katowice 2015
  67. apiExample = "http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=Sticker%20%7C%203DMAX%20%7C%20Katowice%202015"
  68. url = apiExample
  69. response = urllib.urlopen(url)
  70. data = json.loads(response.read())
  71. threedmax = data["lowest_price"]
  72. threedmax = threedmax[1:]#removing the dollar sign
  73. threedmax = float(threedmax)*10
  74.  
  75. #print "xxxxxx"
  76.  
  77. total_median_price = threedmax+ebettle+immunity+virtus+titan+dAt
  78. total_median_price_string = str(total_median_price)
  79.  
  80.  
  81. file = open("values.txt","r")
  82. previous_median_price = float(file.read())
  83. profit_loss = total_median_price-initial_investment
  84.  
  85. percentageChange = (profit_loss/initial_investment)
  86. percentageChange = "%.2f" % percentageChange
  87. percentageChange = float(percentageChange)*100
  88. percentageChange_string = str(percentageChange)
  89.  
  90.  
  91.  
  92.  
  93. one = "Total value of stickers: $"+total_median_price_string+" ("+percentageChange_string+"% Change from investment)"
  94. two = "Investment in stickers: $"+str(initial_investment)
  95. three = "Total profit/loss: $"+ str(profit_loss)
  96. four = "Difference from previous run: $"+ str(file)
  97. print four
  98. msg = "\n "+one+"\n "+two+"\n "+three
  99.  
  100.  
  101. server = smtplib.SMTP('smtp.gmail.com', 587)
  102. server.starttls()
  103. server.login("alfredvanderheide@gmail.com", "password")
  104.  
  105.  
  106. server.sendmail("alfredvanderheide@gmail.com", "alfredvanderheide@gmail.com", msg)
  107. server.quit()
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120. file = open("values.txt","w")
  121. file.write(total_median_price_string)
  122. file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement