The import numpy as np
The import tushare as ts
The import aiohttp
The import asyncio
The import time
Codes=[' 787819 ', '787317', '787317', '600320', '600191', '600191', '600967', '600765', '600238', '603650')
Cvs_30=[]
Start=time. Time ()
Async def get_index (code) :
All_data=https://bbs.csdn.net/topics/ts.get_hist_data (code, start='2020-05-12', end='2020-12-28')
If all_data is None:
Cv_30=0
# to join the corresponding list
Cvs_30. Append (cv_30)
The else:
Data=[' close ']
https://bbs.csdn.net/topics/all_dataCv_30=np. STD (data. The head (30))/np scheme (data. The head (30))
# to join the corresponding list
Cvs_30. Append (cv_30 * 1000)
The tasks=[asyncio ensure_future (get_index (code)) for code codes in]
Loop=asyncio. Get_event_loop ()
Loop. Run_until_complete (asyncio. Gather the tasks (*)
End=time. Time ()
print(end - start)