-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGetMaxcoinPriceBot.py
62 lines (38 loc) · 1.42 KB
/
GetMaxcoinPriceBot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env python
# encoding=utf8
import sys
import time
reload(sys)
sys.setdefaultencoding('utf8')
from twython import Twython, TwythonError
## Setting these as variables will make them easier for future edits
app_key = ''
app_secret = ''
oauth_token = ''
oauth_token_secret = ''
## Prepare your twitter, you will need it for everything
twitter = Twython(app_key, app_secret, oauth_token, oauth_token_secret)
#The above should just be a single line, without the break
import json
from coinmarketcap import Market
import threading
coinmarketcap = Market()
def run_total_id():
threading.Timer(1200, run_total_id).start()
s = coinmarketcap.ticker('maxcoin/?convert=GBP&limit=10')
n = coinmarketcap.ticker('maxcoin/?convert=RUB')
l = coinmarketcap.ticker('maxcoin/?convert=CNY')
total_id = ('Maxcoin Price ' + '\n' + '@getmaxcoin')
price_rub = ('RUB: ' + n[0]['price_rub'])
price_cny = ('CNY: ' + l[0]['price_cny'])
rank = ('Rank: ' + s[0]['rank'])
price_usd = ('USD: ' + s[0]['price_usd'])
price_btc = ('BTC: ' + s[0]['price_btc'])
txt1 = (total_id + str ('\n' + '\n' + 'Price: ' + '\n' + price_usd + '\n' + price_btc + '\n' + price_rub + '\n' + price_cny + '\n' + '\n' + 'MaxcoinProject.org' + '\n' + '\n' + rank))
try:
s = twitter.update_status(status=txt1)
except TwythonError, e:
if e.error_code == 403:
pass
print txt1
run_total_id()