Zihao

Make small but daily progress

0%

定投eos脚本,看懂的自然懂

已经失效,这是当时eos在众筹的时候进行定投和套利的脚本。

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
#!/usr/bin/python
# -*- coding: utf-8 -*-

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)

# t = parser.parse(today_ico_end)
# print(t)

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("投入ETH:%s ETH兑EOS:%s EOS价格:%s EOS 云币价格:%s" % (today_ico_eth,eos_per_eth,eos_sale_price,eos_price))

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)

# print 'main running'
except Exception as identifier:
print (identifier)

time.sleep(1)

if __name__ == '__main__':
main()

欢迎关注我的其它发布渠道