Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib, json
- import smtplib
- initial_investment = 170.07
- print "====Sticker value total script===="
- #Sticker | dAT team (Holo) | Cologne 2014
- apiExample = "http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=Sticker%20%7C%20dAT%20team%20(Holo)%20%7C%20Cologne%202014"
- url = apiExample
- response = urllib.urlopen(url)
- data = json.loads(response.read())
- dAt = data["lowest_price"]
- dAt = dAt[1:]#removing the dollar sign
- dAt=float(dAt)*6
- #print "xooooo"
- print "Loading..."
- #Sticker | Titan | Cologne 2014
- apiExample = "http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=Sticker%20%7C%20Titan%20%7C%20Cologne%202014"
- url = apiExample
- response = urllib.urlopen(url)
- data = json.loads(response.read())
- titan = data["lowest_price"]
- titan = titan[1:]#removing the dollar sign
- titan = float(titan)*2
- #print "xxoooo"
- #Sticker | Virtus.Pro (Holo) | DreamHack 2014
- apiExample = "http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=Sticker%20%7C%20Virtus.Pro%20(Holo)%20%7C%20DreamHack%202014"
- url = apiExample
- response = urllib.urlopen(url)
- data = json.loads(response.read())
- virtus = data["lowest_price"]
- virtus = virtus[1:]#removing the dollar sign
- virtus = float(virtus)*3
- #print "xxxooo"
- #Sticker | Team Immunity | Cologne 2015
- apiExample = "http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=Sticker%20%7C%20Team%20Immunity%20%7C%20Cologne%202015"
- url = apiExample
- response = urllib.urlopen(url)
- data = json.loads(response.read())
- immunity = data["lowest_price"]
- immunity = immunity[1:]#removing the dollar sign
- immunity = float(immunity)*28
- #print "xxxxoo"
- #Sticker | Team eBettle | Cologne 2015
- apiExample = "http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=Sticker%20%7C%20Team%20eBettle%20%7C%20Cologne%202015"
- url = apiExample
- response = urllib.urlopen(url)
- data = json.loads(response.read())
- ebettle = data["lowest_price"]
- ebettle = ebettle[1:]#removing the dollar sign
- ebettle = float(ebettle)*42
- #print "xxxxxo"
- #Sticker | 3DMAX | Katowice 2015
- apiExample = "http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=Sticker%20%7C%203DMAX%20%7C%20Katowice%202015"
- url = apiExample
- response = urllib.urlopen(url)
- data = json.loads(response.read())
- threedmax = data["lowest_price"]
- threedmax = threedmax[1:]#removing the dollar sign
- threedmax = float(threedmax)*10
- #print "xxxxxx"
- total_median_price = threedmax+ebettle+immunity+virtus+titan+dAt
- total_median_price_string = str(total_median_price)
- file = open("values.txt","r")
- previous_median_price = float(file.read())
- profit_loss = total_median_price-initial_investment
- percentageChange = (profit_loss/initial_investment)
- percentageChange = "%.2f" % percentageChange
- percentageChange = float(percentageChange)*100
- percentageChange_string = str(percentageChange)
- one = "Total value of stickers: $"+total_median_price_string+" ("+percentageChange_string+"% Change from investment)"
- two = "Investment in stickers: $"+str(initial_investment)
- three = "Total profit/loss: $"+ str(profit_loss)
- four = "Difference from previous run: $"+ str(file)
- print four
- msg = "\n "+one+"\n "+two+"\n "+three
- server = smtplib.SMTP('smtp.gmail.com', 587)
- server.starttls()
- server.login("alfredvanderheide@gmail.com", "password")
- server.sendmail("alfredvanderheide@gmail.com", "alfredvanderheide@gmail.com", msg)
- server.quit()
- file = open("values.txt","w")
- file.write(total_median_price_string)
- file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement