├── $$decrypt.py ├── $$encrypt.py ├── EEEAA.txt ├── IMPORTANT ├── README.md ├── _load.bat ├── _upload.bat ├── config.py ├── database.sql ├── draw.py ├── filename.txt ├── main.py ├── model.py ├── processData.py ├── reg.py ├── requires.bat ├── run.bat └── test.py /$$decrypt.py: -------------------------------------------------------------------------------- 1 | def readFile(filename): 2 | with open(filename,'r', encoding='utf-8') as f: 3 | global inputext 4 | print(filename) 5 | inputext=f.read() 6 | 7 | 8 | def getPW(): 9 | global passw 10 | try: 11 | with open('IMPORTANT','r',encoding='utf-8') as f: 12 | passw=f.read() 13 | 14 | except: 15 | passw=input('请输入密码:\n') 16 | with open('IMPORTANT','w',encoding='utf-8') as f: 17 | f.write(passw) 18 | os.system('attrib +s +h +r +a IMPORTANT') 19 | 20 | def decrypt(outfile): 21 | '''indicates that the input text should be number only ''' 22 | listin = list(inputext) 23 | listp=list(passw) 24 | p=[ord(x) for x in listp] 25 | pw=1 26 | for x in p: 27 | pw=x*pw 28 | pw=str(pw) 29 | pw=pw[-18:] 30 | pws='0.'+str(pw) 31 | pw=float(pws) 32 | listin=inputext.split(' ') 33 | texto='' 34 | for x in listin: 35 | pw=pw*(1-pw)*3.93699989893668722729139042 36 | pws=str(pw) 37 | pivot= int(pws[-6:-3]) 38 | if x=='': 39 | texto=texto+' ' 40 | elif x[0]=='\n': 41 | texto=texto+'\n' 42 | else: 43 | texto=texto+chr(int(x)^pivot) 44 | with open(outfile,'w',encoding='utf-8') as f: 45 | f.write(texto) 46 | pass 47 | 48 | if __name__ == "__main__": 49 | import os 50 | import sys 51 | os.chdir(sys.path[0]) 52 | from pathlib import Path as p, PurePath as pp 53 | os.chdir(sys.path[0]) 54 | try: 55 | with open('filename.txt','r',encoding='utf-8') as f: 56 | ss=f.read().strip() 57 | except: 58 | ss=input('请输入要解密文件夹名称:\n') 59 | with open('filename.txt','w',encoding='utf-8') as f: 60 | f.write(ss) 61 | 62 | if p('./'+ss).is_dir(): 63 | for x in p('./'+ss).iterdir(): 64 | if x.is_file(): 65 | plist=['*.py', '*.txt', '*.js', '*.cpp', '*.c', '*.html','*.json', '*.bat','*.sql'] 66 | match=False 67 | for m in plist: 68 | if x.match(m): 69 | match=True 70 | break 71 | if match: 72 | readFile(str(x)) 73 | getPW() 74 | decrypt(str(x.name)) -------------------------------------------------------------------------------- /$$encrypt.py: -------------------------------------------------------------------------------- 1 |  2 | import os 3 | import sys 4 | 5 | def readFile(filename): 6 | with open(filename,'r', encoding='utf-8') as f: 7 | global inputext 8 | print(filename) 9 | inputext=f.read() 10 | 11 | def getPW(): 12 | global passw 13 | try: 14 | f=open('IMPORTANT','r',encoding='utf-8') 15 | passw=f.read() 16 | f.close() 17 | except: 18 | passw=input('请输入密码:\n') 19 | with open('IMPORTANT','w',encoding='utf-8') as f: 20 | f.write(passw) 21 | os.system('attrib +s +h +r +a IMPORTANT') 22 | 23 | 24 | def encrypt(outfile): 25 | '''turn string into number string every word takes one lines''' 26 | listin=list(inputext) 27 | listp=list(passw) 28 | p=[ord(x) for x in listp] 29 | pw=1 30 | for x in p: 31 | pw=x*pw 32 | pw=str(pw) 33 | pw=pw[-18:] 34 | pws='0.'+pw 35 | pw=float(pws) 36 | texto='' 37 | for x in listin: 38 | pw=pw*(1-pw)*3.93699989893668722729139042 39 | pws=str(pw) 40 | pivot= int(pws[-6:-3]) 41 | texto=texto+str(ord(x)^pivot)+' ' 42 | with open(outfile,'w',encoding='utf-8') as f: 43 | f.write(texto) 44 | pass 45 | 46 | if __name__ == "__main__": 47 | os.chdir(sys.path[0]) 48 | from pathlib import Path as p 49 | try: 50 | with open('filename.txt','r',encoding='utf-8') as f: 51 | ss=f.read().strip() 52 | except: 53 | ss=input('请输入github对应仓库名!\n') 54 | with open('filename.txt','w',encoding='utf-8') as f: 55 | f.write(ss) 56 | try: 57 | p('./'+ss).mkdir() 58 | except: 59 | pass 60 | for x in p('.').iterdir(): 61 | if x.is_file(): 62 | plist=['*.py', '*.txt', '*.js', '*.cpp', '*.c', '*.html','*.json', '*.bat','*.sql'] 63 | match=False 64 | for m in plist: 65 | if x.match(m): 66 | match=True 67 | break 68 | if match: 69 | readFile(str(x)) 70 | getPW() 71 | encrypt('./'+ss+'/'+str(x)) 72 | 73 | -------------------------------------------------------------------------------- /EEEAA.txt: -------------------------------------------------------------------------------- 1 | //+------------------------------------------------------------------+ 2 | //| NewsCatcher.mq4 | 3 | //| Copyright 2015, MetaQuotes Software Corp. | 4 | //| https://www.mql5.com | 5 | //+------------------------------------------------------------------+ 6 | #property copyright "Copyright 2015, MetaQuotes Software Corp." 7 | #property link "https://www.mql5.com" 8 | #property version "1.00" 9 | #property strict 10 | 11 | enum BUY_SELL 12 | { 13 | BUY, 14 | SELL 15 | }; 16 | 17 | input datetime PENDING_TIME;//做单时间。 18 | input datetime NEWSTIME; //新闻公布时间 19 | input int LOW_GAP=300; //止损点 20 | input int HIGH_GAP=700; //止盈点 21 | input double LOTS=0.01; //下单手数,默认投入总金额的0.8 22 | input int MODIFY_SECOND=20; //新闻公布前,多少秒修改一次订单 23 | input int MODIFY_SECOND_AFTERNEWS=5; //新闻公布后,多少秒一次修改订单 24 | input BUY_SELL BUY_OR_SELL=BUY; 25 | 26 | double lots=0.0; 27 | int modify_gap=0; 28 | int scale=int(MathCeil(1/Point)); 29 | bool waitForDeal; 30 | int timegap; 31 | bool waitForModify; 32 | int modtimegap; 33 | datetime now; 34 | datetime dealtime; 35 | bool haddeal; 36 | 37 | //+------------------------------------------------------------------+ 38 | //| Expert initialization function | 39 | //+------------------------------------------------------------------+ 40 | int OnInit() 41 | { 42 | //--- 43 | lots=LOTS; 44 | modify_gap=MODIFY_SECOND; 45 | if(LOTS == 0.01) 46 | lots = 0.8*AccountFreeMargin()/MarketInfo(Symbol(),MODE_MARGINREQUIRED); 47 | dealtime=TimeCurrent(); 48 | haddeal=false; 49 | timegap=-1000; 50 | modtimegap=10000; 51 | waitForDeal=false; 52 | waitForModify=false; 53 | now=TimeCurrent(); 54 | EventSetMillisecondTimer(100); 55 | if(!IsTradeAllowed()) Alert("Trade is not allowed"); 56 | //--- 57 | return(INIT_SUCCEEDED); 58 | } 59 | //+------------------------------------------------------------------+ 60 | //| Expert deinitialization function | 61 | //+------------------------------------------------------------------+ 62 | void OnDeinit(const int reason) 63 | { 64 | //--- 65 | EventKillTimer(); 66 | 67 | } 68 | //+------------------------------------------------------------------+ 69 | //| Expert tick function | 70 | //+------------------------------------------------------------------+ 71 | void OnTick() 72 | { 73 | now=TimeCurrent(); 74 | int remainSecond=int(NEWSTIME-now); 75 | int passSecond=int(now-NEWSTIME); 76 | 77 | if(remainSecond<10&&passSecond<3600) 78 | modify_gap=MODIFY_SECOND_AFTERNEWS; 79 | else 80 | modify_gap=MODIFY_SECOND; 81 | 82 | int gap=int(now-PENDING_TIME)*10; 83 | if(waitForDeal==false&&gap>=-500&&gap<=0){ 84 | if(gap>timegap) 85 | timegap=gap; 86 | waitForDeal=true; 87 | }else if(gap>200){ 88 | timegap=-100000; 89 | waitForDeal=false; 90 | } 91 | 92 | if(!waitForModify&&remainSecond<10&&remainSecond>0){ 93 | if(modtimegapNEWSTIME&&ordersall%2==1){ 142 | for(int ii=0,all=OrdersTotal();iiBid+(LOW_GAP+10)*Point){ 157 | if(OrderProfit()/lots-20&&timegap<-5) 171 | Print(timegap); 172 | /////////////////////////////////////////////////////////////////////////////////////////////////// 173 | if(++timegap==-10) 174 | { 175 | if(BUY_OR_SELL==BUY){ 176 | if(!OrderSend(Symbol(),OP_BUY,lots,Ask,10,0,0,"My order",16384,0,clrWhite)){ 177 | Print(GetLastError()); 178 | } 179 | } 180 | if(BUY_OR_SELL==SELL){ 181 | if(!OrderSend(Symbol(),OP_SELL,lots,Bid,10,0,0,"My order",16384,0,clrBlue)){ 182 | Print(GetLastError()); 183 | } 184 | } 185 | dealtime=TimeCurrent(); 186 | haddeal=true; 187 | } 188 | //////////////////////////////////////////////////////////////////// 189 | } 190 | 191 | if(waitForModify){ 192 | if(--modtimegap<30&&modtimegap>9){ 193 | for(int ii=0,all=OrdersTotal();iithrashold).order_by(xm.c.DATE)) 52 | for row in res: 53 | DATE.append(row.DATE) 54 | for name in XM.keys(): 55 | XM[name].append(row[name]) 56 | 57 | for name in XM.keys(): 58 | fig=plt.figure() 59 | plt.plot(DATE, XM[name]) 60 | fig.autofmt_xdate() 61 | plt.savefig('./imagines/XM_'+ name+'.jpg') 62 | plt.close() 63 | 64 | DATE=[] 65 | res = yield from conn.execute(atos.select().where(atos.c.DATE>thrashold).order_by(atos.c.DATE)) 66 | for row in res: 67 | DATE.append(row.DATE) 68 | for name in ATOS.keys(): 69 | ATOS[name].append(row[name]) 70 | 71 | # if(len(DATE)>430 or max(DATE)-min(DATE)> td(days=2.5)): 72 | # yield from delData(engine) 73 | 74 | for name in ATOS.keys(): 75 | fig=plt.figure() 76 | plt.plot(DATE, ATOS[name]) 77 | fig.autofmt_xdate() 78 | plt.savefig('./imagines/ATOS_'+ name+'.jpg') 79 | plt.close() 80 | 81 | for x in p('./imagines').iterdir(): 82 | if x.is_file(): 83 | src='.\\imagines\\'+x.name 84 | dst='..\\HotIO\\public\\private_images\\' 85 | sh.copy(src,dst+x.name) 86 | pass 87 | 88 | sh.copy('.\\Calendar.txt', '..\\HotIO\\public\\Calendar.txt') 89 | 90 | if __name__ == '__main__': 91 | for x in p('./imagines').iterdir(): 92 | if x.is_file(): 93 | src='.\\imagines\\'+x.name 94 | print(src) 95 | dst='..\\HotIO\\public\\private_images\\' 96 | sh.copy(src,dst+x.name) 97 | pass 98 | 99 | sh.copy('.\\Calendar.txt', '..\\HotIO\\public\\Calendar.txt') 100 | # os.system('copy Calendar.txt ..\\\\HotIO\\public\\') 101 | # os.system('copy imagines\\*.* ..\\HotIO\\public\\private_images') -------------------------------------------------------------------------------- /filename.txt: -------------------------------------------------------------------------------- 1 | encryptedfiles -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | #-*- coding: utf-8 -*- 2 | import aiohttp 3 | import asyncio 4 | import config 5 | import processData as pd 6 | import aiomysql as sql 7 | import draw 8 | import time 9 | from datetime import datetime as dt, timedelta as td 10 | 11 | @asyncio.coroutine 12 | def fetchData(url, callback = pd.Xm, params=None): 13 | #set request url and parameters here or you can pass from outside. 14 | 15 | 16 | con = aiohttp.TCPConnector(limit=config.REQ_AMOUNTS) 17 | s = aiohttp.ClientSession(headers = config.HEADERS, connector=con) 18 | #use s.** request a webside will keep-alive the connection automaticaly, 19 | #so you can set multi request here without close the connection 20 | #while in the same domain. 21 | #i.e. 22 | #await s.get('***/page1') 23 | #await s.get('***/page2') 24 | ######################################################################## 25 | r=yield from s.get(url, params = params) 26 | #here the conection closed automaticly. 27 | data = yield from r.text(encoding='utf-8') 28 | yield from callback(data) 29 | r.close() 30 | 31 | 32 | if __name__ == '__main__': 33 | loop = asyncio.get_event_loop() 34 | delta=td(hours=5) 35 | #coroutine in tasks will run 36 | calendar_url= 'http://ec.cn.forexprostools.com/?ecoDayFontColor=%23c5c5c5&ecoDayBackground=%23ffffff&innerBorderColor=%23edeaea&borderColor=%23edeaea&columns=exc_flags,exc_currency,exc_importance,exc_actual,exc_forecast,exc_previous&category=_employment,_economicActivity,_inflation,_credit,_centralBanks,_confidenceIndex,_balance,_Bonds&importance=1,2,3&features=datepicker,timezone,timeselector,filters&countries=29,25,54,145,34,163,32,70,6,27,37,122,15,113,107,55,24,121,59,89,72,71,22,17,51,39,93,106,14,48,33,23,10,35,92,57,94,97,68,96,103,111,42,109,188,7,105,172,21,43,20,60,87,44,193,125,45,53,38,170,100,56,80,52,36,90,112,110,11,26,162,9,12,46,85,41,202,63,123,61,143,4,5,138,178,84,75&calType=week&timeZone=28&lang=1' 37 | n=0 38 | 39 | 40 | while True: 41 | tasks = [ 42 | fetchData('http://www.xm.com', pd.Xm), 43 | fetchData('http://biz.aetoscg.com/content/get-ratio!callback.json?ln=0&group=TOOL&callback=showToolsLAS&_=1458550863266', pd.Atos), 44 | fetchData(calendar_url, pd.Calendar) 45 | ] 46 | 47 | future = asyncio.Future() 48 | asyncio.ensure_future(pd.Database(future)) 49 | try: 50 | loop.run_until_complete(future) 51 | engine = future.result() 52 | loop.run_until_complete(asyncio.wait(tasks)) 53 | except Exception: 54 | print('exception happend.') 55 | loop.run_until_complete(pd.CloseDB()) 56 | continue 57 | 58 | if engine: 59 | loop.run_until_complete(draw.Draw(engine)) 60 | n+=1 61 | print(n,' rounds completed.') 62 | time.sleep(600) 63 | timenow=dt.now()-delta 64 | if timenow.isoweekday() == 6: 65 | break 66 | 67 | loop.close() 68 | -------------------------------------------------------------------------------- /model.py: -------------------------------------------------------------------------------- 1 | import sqlalchemy as sa 2 | import asyncio 3 | 4 | global xm, atos 5 | 6 | metadata = sa.MetaData() 7 | 8 | # tbl = sa.Table('tbl', metadata, 9 | # sa.Column('id', sa.Integer, primary_key=True), 10 | # sa.Column('val', sa.String(255))) 11 | 12 | 13 | 14 | xm = sa.Table('xm', metadata, 15 | sa.Column('DATE',sa.DateTime, primary_key=True), 16 | sa.Column('EURUSD',sa.Float(8)), 17 | sa.Column('GBPUSD',sa.Float(8)), 18 | sa.Column('USDJPY',sa.Float(8)), 19 | sa.Column('XAUUSD',sa.Float(8)), 20 | sa.Column('XAGUSD',sa.Float(8)), 21 | sa.Column('OIL',sa.Float(8)), 22 | sa.Column('US30',sa.Float(8)), 23 | sa.Column('GER30',sa.Float(8)), 24 | sa.Column('JP225',sa.Float(8)), 25 | sa.Column('EURJPY',sa.Float(8)), 26 | sa.Column('GBPJPY',sa.Float(8)) 27 | ) 28 | 29 | atos = sa.Table('atos', metadata, 30 | sa.Column('DATE',sa.DateTime, primary_key=True), 31 | sa.Column('EURUSD',sa.Float(8)), 32 | sa.Column('GBPUSD',sa.Float(8)), 33 | sa.Column('USDJPY',sa.Float(8)), 34 | sa.Column('AUDUSD',sa.Float(8)), 35 | sa.Column('XAUUSD',sa.Float(8)), 36 | sa.Column('XAGUSD',sa.Float(8)), 37 | sa.Column('OIL',sa.Float(8)), 38 | sa.Column('HKG50',sa.Float(8)), 39 | sa.Column('US30',sa.Float(8)) 40 | ) 41 | 42 | 43 | # @asyncio.coroutine 44 | # def create_table(engine): 45 | # with (yield from engine) as conn: 46 | # yield from conn.execute('DROP TABLE IF EXISTS tbl') 47 | # yield from conn.execute('''CREATE TABLE tbl ( 48 | # id serial PRIMARY KEY, 49 | # val varchar(255))''') 50 | 51 | -------------------------------------------------------------------------------- /processData.py: -------------------------------------------------------------------------------- 1 | #-*- coding: utf-8 -*- 2 | 3 | import asyncio 4 | from pyquery import PyQuery as pq 5 | import config 6 | import json 7 | from datetime import datetime as dt, timedelta as td 8 | from aiomysql.sa import create_engine 9 | from datetime import datetime 10 | import random as rand 11 | 12 | from model import * 13 | 14 | 15 | @asyncio.coroutine 16 | def Database(future): 17 | ''' 18 | data is from the http response in main module. 19 | ''' 20 | global engine 21 | engine = yield from create_engine(user='root',db='Currency',port=3306, 22 | host='127.0.0.1', password='11111') 23 | # yield from create_table(engine) 24 | 25 | # with (yield from engine) as conn: 26 | # yield from conn.execute(tbl.insert().values(val='sag34')) 27 | # yield from conn.execute('commit') 28 | # res = yield from conn.execute(tbl.select(tbl.c.id)) 29 | # print('ok') 30 | # for row in res: 31 | # print(row.id) 32 | 33 | future.set_result(engine) 34 | 35 | 36 | @asyncio.coroutine 37 | def CloseDB(): 38 | engine.close() 39 | yield from engine.wait_closed() 40 | pass 41 | 42 | @asyncio.coroutine 43 | def Xm(data): 44 | d = pq(data) 45 | d = d('div#dashboard-wrap') 46 | ratioList={} 47 | for i in range(11): 48 | seltct=d('i.red-bar-nbr').eq(i).text() 49 | if seltct: 50 | ratioList[d('b').eq(i).text()] = float(seltct) 51 | pass 52 | #print(seltct) 53 | 54 | #print(ratioList) 55 | ratioList['XAUUSD']=ratioList['GOLD'] 56 | ratioList['XAGUSD']=ratioList['SILVER'] 57 | ratioList['DATE']=datetime.now() 58 | del ratioList['GOLD'] 59 | del ratioList['SILVER'] 60 | 61 | with (yield from engine) as conn: 62 | yield from conn.execute(xm.insert(),ratioList) 63 | yield from conn.execute('commit') 64 | 65 | res = yield from conn.execute(xm.select()) 66 | # for row in res: 67 | # print(row) 68 | pass 69 | 70 | @asyncio.coroutine 71 | def Atos(data): 72 | data=json.loads(data[13:-1]) 73 | data=data['data']['ratioList'] 74 | ratioList={} 75 | for x in data: 76 | k=x['value'].split(':') 77 | ratioList[x['symbol']] = float(k[1][0:-1]) 78 | #print(ratioList) 79 | ratioList['OIL']=ratioList['USOIL'] 80 | ratioList['DATE']=datetime.now() 81 | del ratioList['USOIL'] 82 | del ratioList['UKOIL'] 83 | with (yield from engine) as conn: 84 | yield from conn.execute(atos.insert(),ratioList) 85 | yield from conn.execute('commit') 86 | 87 | res = yield from conn.execute(atos.select()) 88 | # for row in res: 89 | # print(row) 90 | pass 91 | 92 | @asyncio.coroutine 93 | def Calendar(data): 94 | d=pq(data) 95 | s=d('tr[id^=eventRowId]') 96 | f=open('Calendar.txt','w',encoding='utf-8') 97 | for i in s.items(): 98 | tem=i('td.sentiment').attr('title') 99 | if tem and tem[-1]=='高': 100 | time=i.attr('event_timestamp') 101 | t1=dt.strptime(time,'%Y-%m-%d %H:%M:%S') 102 | t1=t1+td(hours=8) 103 | time=dt.strftime(t1,'%Y-%m-%d %H:%M:%S') 104 | t2=dt.now() 105 | delta=t1-t2 106 | if -1<=delta.days<2: 107 | f.write(time+' ') 108 | country=i('td.flagCur span').attr('title') 109 | f.write(country+' ') 110 | f.write(i('td.event').text()+'\n\n') 111 | f.close() 112 | 113 | pass 114 | 115 | 116 | if __name__ == '__main__': 117 | Xm('hello') -------------------------------------------------------------------------------- /reg.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Tue Jun 02 16:26:52 2015 4 | 5 | @author: dapenghuang 6 | """ 7 | import sys 8 | from winreg import * 9 | 10 | # tweak as necessary 11 | version = '3.4' 12 | installpath = sys.prefix 13 | regpath = "SOFTWARE\\Python\\Pythoncore\\%s\\" % (version) 14 | installkey = "InstallPath" 15 | pythonkey = "PythonPath" 16 | pythonpath = "%s;%s\\Lib\\;%s\\DLLs\\" % ( 17 | installpath, installpath, installpath 18 | ) 19 | 20 | def RegisterPy(): 21 | print("begin RegisterPy ") 22 | try: 23 | print("open key : %s"%regpath) 24 | reg = OpenKey(HKEY_CURRENT_USER, regpath) 25 | SetValue(reg, installkey, REG_SZ, installpath) 26 | SetValue(reg, pythonkey, REG_SZ, pythonpath) 27 | except EnvironmentError as e: 28 | try: 29 | reg = CreateKey(HKEY_CURRENT_USER, regpath) 30 | SetValue(reg, installkey, REG_SZ, installpath) 31 | SetValue(reg, pythonkey, REG_SZ, pythonpath) 32 | CloseKey(reg) 33 | except: 34 | print("*** EXCEPT: Unable to register!") 35 | return 36 | 37 | print("--- Python", version, "is now registered!" ) 38 | return 39 | 40 | 41 | if (QueryValue(reg, installkey) == installpath and 42 | QueryValue(reg, pythonkey) == pythonpath): 43 | CloseKey(reg) 44 | print("=== Python", version, "is already registered!" ) 45 | return CloseKey(reg) 46 | 47 | print("*** ERROR:Unable to register!" ) 48 | print("*** REASON:You probably have another Python installation!") 49 | 50 | def UnRegisterPy(): 51 | #print("begin UnRegisterPy " 52 | try: 53 | print("open HKEY_CURRENT_USER key=%s"%regpath) 54 | reg = OpenKey(HKEY_CURRENT_USER, regpath) 55 | #reg = OpenKey(HKEY_LOCAL_MACHINE, regpath) 56 | except EnvironmentError: 57 | print("*** Python not registered?!") 58 | return 59 | try: 60 | DeleteKey(reg, installkey) 61 | DeleteKey(reg, pythonkey) 62 | DeleteKey(HKEY_LOCAL_MACHINE, regpath) 63 | except: 64 | print("*** Unable to un-register!") 65 | else: 66 | print("--- Python", version, "is no longer registered!" ) 67 | 68 | if __name__ == "__main__": 69 | RegisterPy() -------------------------------------------------------------------------------- /requires.bat: -------------------------------------------------------------------------------- 1 | pip install aiohttp 2 | pip install aiomysql 3 | pip install pyquery 4 | pip install tqdm -------------------------------------------------------------------------------- /run.bat: -------------------------------------------------------------------------------- 1 | cd C:\Users\Administrator\Desktop\HOT\privatesolution 2 | start main.py -------------------------------------------------------------------------------- /test.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import time 3 | from datetime import datetime as dt, timedelta as td 4 | 5 | n=0 6 | @asyncio.coroutine 7 | def add(): 8 | global n 9 | n+=1 10 | yield from asyncio.sleep(1) 11 | # print(n,'\n\n') 12 | 13 | 14 | @asyncio.coroutine 15 | def test(): 16 | global n 17 | yield from asyncio.sleep(1) 18 | # lloo=asyncio.get_event_loop() 19 | task=[add() for i in range(20)] 20 | # lloo.run_until_complete(asyncio.wait(task)) 21 | # lloo.close() 22 | # print(n ,'\n\n') 23 | 24 | loop = asyncio.get_event_loop() 25 | while True: 26 | loop.run_until_complete(test()) 27 | time.sleep(1) 28 | # print(dt.now().isoweekday()) 29 | delta=td(hours=8) 30 | timenow=dt.now()-delta 31 | if timenow.isoweekday() == 6: 32 | break 33 | pass 34 | 35 | loop.close() 36 | 37 | ''' 38 | SINAGLOBAL=4101766048397.4727.1457666572383; 39 | wb_publish_vip_5896005318=1; wb_publish_fist100_5896005318=1; 40 | myuid=5896005318; un=18701115105; wvr=6; 41 | SUS=SID-5896005318-1461303485-XD-lxhiw-8248eb95a1ea059989157511021c7852; 42 | SUE=es%3Dda43682d92b6238d8da2959f377b4785%26ev%3Dv1%26es2%3De27bf0106c3828ee6aacd375aa9d462c%26rs0%3DdJAJgm3BYAJjASzazmbw5QaLXNJuvLOE9FwMHZVyCw3UXXGSAUWuRWtKqvvZzUbendac7MdSeEWRMsyMwYUT5zM2oSzaRzZmB85XCHa6WU1JgzQOARTGRbsRXLKinMECyZ1f5zw5w1cCIGO%252FmUwLfmVDMz6Be2W6IsjbkFE1%252F1s%253D%26rv%3D0; 43 | SUP=cv%3D1%26bt%3D1461303485%26et%3D1461389885%26d%3Dc909%26i%3D7852%26us%3D1%26vf%3D0%26vt%3D0%26ac%3D0%26st%3D0%26uid%3D5896005318%26name%3D18701115105%26nick%3D%25E8%25A6%2583%25E6%2580%259D%25E9%2592%25A7%26fmp%3D%26lcp%3D; SUB=_2A256HcjtDeRxGeNG4lQR8CvPyjSIHXVZar0lrDV8PUNbvtAPLW_tkW9LHetq-9ssiGT-jOfbX2lCuJaQQinqZw..; 44 | SUBP=0033WrSXqPxfM725Ws9jqgMF55529P9D9W5Ze6bCc.Vlk69OWLrmQHS25JpX5KMt; SUHB=0rr72a7ItUyln7; ALF=1492839485; SSOLoginState=1461303485; _s_tentry=login.sina.com.cn; Apache=1193117033934.6787.1461303510721; ULV=1461303510809:44:33:8:1193117033934.6787.1461303510721:1461292579294; TC-Page-G0=6fdca7ba258605061f331acb73120318; 45 | TC-Ugrow-G0=968b70b7bcdc28ac97c8130dd353b55e; 46 | WBtopGlobal_register_version=60539f809b40ed0d; 47 | ULOGIN_IMG=14613036063579; 48 | TC-V5-G0=8518b479055542524f4cf5907e498469; 49 | UOR=www.csdn.net,widget.weibo.com,login.sina.com.cn 50 | ''' 51 | 52 | ''' 53 | SINAGLOBAL=4101766048397.4727.1457666572383; 54 | wb_publish_vip_5896005318=1; 55 | wb_publish_fist100_5896005318=1; 56 | un=18701115105; 57 | SUHB=0rr72a7ItUyln7; 58 | _s_tentry=login.sina.com.cn; 59 | Apache=1193117033934.6787.1461303510721; 60 | ULV=1461303510809:44:33:8:1193117033934.6787.1461303510721:1461292579294; 61 | TC-Page-G0=6fdca7ba258605061f331acb73120318; 62 | TC-Ugrow-G0=968b70b7bcdc28ac97c8130dd353b55e; 63 | ULOGIN_IMG=14613036063579; 64 | TC-V5-G0=8518b479055542524f4cf5907e498469; 65 | WBtopGlobal_register_version=60539f809b40ed0d; 66 | myuid=5896005318; 67 | SUB=_2AkMgRTWpdcPhrAZZkf4VzG7hbYVMywDzudfwMUvdFyYzHBt_7j5nqSVo8kZ_Xd6h2GvmYbQyCDc7WvmhJ2jQnDWxnlcV; 68 | SUBP=0033WrSXqPxfM72wWs9jqgMF55529P9D9W5Ze6bCc.Vlk69OWLrmQHS25JpVF02RS05peK2feK5f; 69 | login_sid_t=149d2fe7d8b2022db80d2b54c679d00f; 70 | UOR=www.csdn.net,widget.weibo.com,login.sina.com.cn 71 | ''' --------------------------------------------------------------------------------