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
|
import decimal import hashlib import json import time import requests from datetime import datetime,timezone,timedelta
def main(): while True: try: resp = requests.get(url='http://eos.io/eos-sale-statistic.php',timeout=10) result = json.loads(resp.text)
period = 13 today_sale = result[period] today_ico_eth = round(today_sale['dailyToday'],2) today_ico_end_utc_str = today_sale['ends'] today_ico_end_utc = datetime.strptime(today_ico_end_utc_str,"%Y-%m-%dT%H:%M:S.000Z") tz_utc_8 = timezone(timedelta(hours=8)) today_ico_end_bj = today_ico_end_utc.replace(tzinfo=tz_utc_8) print (today_ico_end_bj)
resq = requests.get(url='https://yunbi.com//api/v2/tickers/ethcny,json',timeout=10) result=json.loads(resq.text) eth_price = float(result['ticker']['last'])
all_num = 2000000.0 eos_sale_price = round(eth_price * today_ico_eth / all_num,2)
eos_per_eth = round(all_num/today_ico_eth,2)
resq = requests.get(url='https://yunbi.com//api/v2/tickers/eoscny,json', timeout=10) result = json.loads(resq.text)
eos_price = round(float(result['ticker']['last']),2)
now = datetime.now() print (now)
print ("hedgeL today_ico_eth,eos_per_eth,eos_sale_proce,eos_yunbi_price:",today_ico_eth,eos_per_eth,eos_sale_price,eos_price)
except Exception as identifier: print (identifier)
time.sleep(1)
if __name__ == '__main__': main()
|