# coding=utf-8
import dbConn
def getZhuLiPerFromDay(code, day, pre_price):
pass
per_list = dbConn.MY_SQL().getZhuLiPerFromDay(code, day)
if per_list is not None or len(per_list) == 0:
pass
isResult = False
for i in range(0, len(per_list)):
# print(per_list[i])
if pre_price != 0 and isResult == False and i>3 and per_list[i] is not None and per_list[i][0] is not None and per_list[i][0]!='-':
result = float(per_list[i][0]) - pre_price
isResult = True
print(round(result, 2), per_list[i])
dbConn.MY_SQL().saveYanZheng1(code, round(result, 2), per_list[i][0], per_list[i][3])
if i != 0:
today = per_list[i][2]
pre_day = per_list[i-1][2]
if per_list[i][0] is not None and \
today is not None and \
today != '-' and \
pre_day is not None and pre_day != '-' and \
float(today) > 10 > float(pre_day):
return (per_list[i])
break
def getTradeDay(code):
pass
day_list = dbConn.MY_SQL().getTradeDayFromCode(code)
per_price = 0
for day in day_list:
l = getZhuLiPerFromDay(code, day[0], per_price)
# print('lllllll')
# print(l)
if l is not None:
print(l)
per_price = float(l[0])
else:
per_price = 0
def start():
# 取出code
code_list = dbConn.MY_SQL().get3060CodeList()
for code in code_list:
print('======================== %s ============================', code[0])
getTradeDay(code[0])
if __name__ == '__main__':
start()