commit 1804bb542af709a44ac609ad6c5ed3c2a53fbd56 Author: root Date: Thu Mar 23 04:20:57 2017 +0000 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9e6b947 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.pyc +userpw.py +cachedCMC.txt diff --git a/README.md b/README.md new file mode 100644 index 0000000..c63d3ee --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +A ticker for top coinmarketcap listings based on the ethtrader-ticker project. diff --git a/cmc.py b/cmc.py new file mode 100644 index 0000000..a230f8f --- /dev/null +++ b/cmc.py @@ -0,0 +1,18 @@ +import requests + +cmcurl = 'https://api.coinmarketcap.com/v1/ticker?limit=10' + +def getcmc(): + ticker_string = '' + try: + r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit=10') + j = r.json() + with open('cachedCMC.txt', 'w') as f: + f.write(r.text) + except: + print("Failed to get CMC via API") + with open('cachedCMC.txt', 'r') as f: + j = f.read().json() + for i in j: + ticker_string += "|{}|${}|B{}".format(i['symbol'], i['price_usd'], i['price_btc']) + return ticker_string diff --git a/img/coins/augur.png b/img/coins/augur.png new file mode 100644 index 0000000..97fbcf4 Binary files /dev/null and b/img/coins/augur.png differ diff --git a/img/coins/bitcoin.png b/img/coins/bitcoin.png new file mode 100644 index 0000000..d2da9cd Binary files /dev/null and b/img/coins/bitcoin.png differ diff --git a/img/coins/dash.png b/img/coins/dash.png new file mode 100644 index 0000000..f94c7e8 Binary files /dev/null and b/img/coins/dash.png differ diff --git a/img/coins/ethereum-classic.png b/img/coins/ethereum-classic.png new file mode 100644 index 0000000..4087aa4 Binary files /dev/null and b/img/coins/ethereum-classic.png differ diff --git a/img/coins/ethereum.png b/img/coins/ethereum.png new file mode 100644 index 0000000..0b2f4c3 Binary files /dev/null and b/img/coins/ethereum.png differ diff --git a/img/coins/golem-network-tokens.png b/img/coins/golem-network-tokens.png new file mode 100644 index 0000000..e447926 Binary files /dev/null and b/img/coins/golem-network-tokens.png differ diff --git a/img/coins/litecoin.png b/img/coins/litecoin.png new file mode 100644 index 0000000..767277b Binary files /dev/null and b/img/coins/litecoin.png differ diff --git a/img/coins/maidsafecoin.png b/img/coins/maidsafecoin.png new file mode 100644 index 0000000..c8c1557 Binary files /dev/null and b/img/coins/maidsafecoin.png differ diff --git a/img/coins/monero.png b/img/coins/monero.png new file mode 100644 index 0000000..f6ddae3 Binary files /dev/null and b/img/coins/monero.png differ diff --git a/img/coins/nem.png b/img/coins/nem.png new file mode 100644 index 0000000..8319039 Binary files /dev/null and b/img/coins/nem.png differ diff --git a/img/coins/ripple.png b/img/coins/ripple.png new file mode 100644 index 0000000..555d489 Binary files /dev/null and b/img/coins/ripple.png differ diff --git a/img/coins/tether.png b/img/coins/tether.png new file mode 100644 index 0000000..ea435d6 Binary files /dev/null and b/img/coins/tether.png differ diff --git a/img/coins/zcash.png b/img/coins/zcash.png new file mode 100644 index 0000000..f371937 Binary files /dev/null and b/img/coins/zcash.png differ diff --git a/img/cryptocurrencies-bg.jpg b/img/cryptocurrencies-bg.jpg new file mode 100644 index 0000000..33f88c5 Binary files /dev/null and b/img/cryptocurrencies-bg.jpg differ diff --git a/img/image-flair.png b/img/image-flair.png new file mode 100644 index 0000000..118a382 Binary files /dev/null and b/img/image-flair.png differ diff --git a/main.py b/main.py new file mode 100644 index 0000000..2b174cc --- /dev/null +++ b/main.py @@ -0,0 +1,30 @@ +import reddit +import cmc + +prawer = reddit.prawer() +prawer.r.login(reddit.username, reddit.password) + +sub = prawer.r.get_subreddit('xdn') +ss = sub.get_stylesheet() + +ticker_text = cmc.getcmc() + +ss_text = """ +#header { +background-repeat: repeat; +-webkit-animation: banner 300s infinite linear; +animation: banner 300s infinite linear; + } + +@-webkit-keyframes banner { +from { background-position: 0 0px; } +to { background-position: -5402px 500px; } +} +@keyframes banner { +from { background-position: 0 0px; } +to { background-position: -5402px 0px; } +} +""" + +sub.set_stylesheet(ss_text) +print(sub.title) diff --git a/reddit.py b/reddit.py new file mode 100644 index 0000000..446178f --- /dev/null +++ b/reddit.py @@ -0,0 +1,9 @@ +import praw +from userpw import * + +class prawer: + def __init__(self): + self.r = praw.Reddit(client_id=client_id, client_secret=client_secret, + username=username, password=password, + user_agent=user_agent) +