資源簡介
python獲取萬得行情數據
代碼片段和文件信息
#-*-?coding:?UTF-8?-*-?
#python使用用Wind接口獲取全部A股歷史交易數據?批量寫入mysql庫
#python?getallAHisTrade2DB.py?-o?E:\wuyou\python\wind\
#wing?ide?debug?input:-o?E:\wuyou\python\wind\
#?open?wind?api?spend?lots?of?time
“““
@Author:?chenchuang
@Date:?2017-07-25
@Version:?V1.0
“““
#!/user/python
#?-*-?coding:?gb2312?-*-
import?os
import?sys
import?getopt
from?WindPy?import?*
from?datetime?import?*
import?pymysql
import?time
class?LoadHisInfo:
????def?__init__(self):
????????self.OutputDir=r‘E:‘
????????self.StockCodeList=[]
????????self.getdate?=?time.strftime(“%Y-%m-%d“?time.localtime())
????????print(self.getdate) ????????
????def?StartWind(self):
????????w.start()
????def?LoadStockList(self):
????????#get?datewind_codesec_name
????????res?=?w.wset(“sectorconstituent““date=“+str(self.getdate)+“;sectorid=a001010100000000“)
????????#print(res)
????????if?res.ErrorCode?!=?0:
????????????print(‘Error[‘+str(res.ErrorCode)+‘][load?stockcode?list?fail]\n‘
評論
共有 條評論