def get_stick_hisdata_w(self,begin_date,end_date,all='YES'):
if all == 'YES':
print('all stock ...........')
self.cur.execute(
"select code,outstanding from t_all_stickcode ;")
else:
print('part stock ........................')
self.cur.execute("select code,outstanding from t_all_stickcode where outstanding < 50000 and (substr(code,1,1)='0' or substr(code,1,1)='6'); ;")
#self.cur.execute("select code,outstanding from t_all_stickcode a where not EXISTS (select * from t_stick_data_w where code = a.code);")
sqlrs = self.cur.fetchall();
# self.cur.execute("delete from t_stick_data_w")
#self.sqlconn.commit()
for code in sqlrs:
print(code[0]+'_w' ,begin_date,end_date)
try:
rs = ts.get_k_data(code=code[0],start=begin_date,end=end_date,ktype='W')
except Exception as e:
print('ERR:',e)
self.db.delete_date('t_stick_data_w',begin_date,code[0])
self.db.insert_data('t_stick_data_w',rs.as_matrix())
self.db.commit()
return
评论列表
文章目录