Initial commit
@@ -0,0 +1,3 @@
|
||||
*.pyc
|
||||
userpw.py
|
||||
cachedCMC.txt
|
||||
@@ -0,0 +1 @@
|
||||
A ticker for top coinmarketcap listings based on the ethtrader-ticker project.
|
||||
@@ -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
|
||||
|
After Width: | Height: | Size: 516 B |
|
After Width: | Height: | Size: 982 B |
|
After Width: | Height: | Size: 518 B |
|
After Width: | Height: | Size: 670 B |
|
After Width: | Height: | Size: 304 B |
|
After Width: | Height: | Size: 439 B |
|
After Width: | Height: | Size: 350 B |
|
After Width: | Height: | Size: 837 B |
|
After Width: | Height: | Size: 802 B |
|
After Width: | Height: | Size: 875 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 404 B |
|
After Width: | Height: | Size: 788 B |
|
After Width: | Height: | Size: 153 KiB |
|
After Width: | Height: | Size: 40 KiB |
@@ -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)
|
||||