# coding=utf-8
import dbConn
from SendEmail import Email
import datetime
###
# 任务: 个股日线连续2日涨幅大于15的记录
###
def start():
start = datetime.datetime.now()
# 获取code
codeList = dbConn.MY_SQL().get3060CodeList()
newList = []
for i in codeList:
code = i[0]
# 获取code的日线记录(2019-1-1至今)
lineList = dbConn.MY_SQL().getDayLineList(code, '2019-01-01')
if lineList is not None:
for index in range(len(lineList)):
if index > 0:
if lineList[index-1][12] != '-' and lineList[index][12] != '-':
total = float(lineList[index-1][12]) + float(lineList[index][12])
if total >= 15:
newList.append(lineList[index-1])
newList.append(lineList[index])
print('数据整理完成,准备入库...')
print(len(newList))
dbConn.MY_SQL().save_tmp_day_line_table(newList)
end = datetime.datetime.now()
print("完毕^_^", (end - start))
if __name__ == '__main__':
try:
start()
except Exception as e:
print(e)