diff --git a/EastMoneyPy/venv/main/eastmoney/dbConn.py b/EastMoneyPy/venv/main/eastmoney/dbConn.py index 93e7ed8..9aba007 100644 --- a/EastMoneyPy/venv/main/eastmoney/dbConn.py +++ b/EastMoneyPy/venv/main/eastmoney/dbConn.py @@ -10,6 +10,7 @@ def __init__(self): self.db = pymysql.connect('localhost', 'root', 'eagle', 'db_east_money', charset='utf8') + # self.db = pymysql.connect(host='192.168.1.102', port=3309, user='root', password='eagle', db='db_east_money', charset='utf8') # 写入分类表 @@ -265,7 +266,7 @@ # 查询个股最新价 def getLastPrice(self, code): cursor = self.db.cursor() - sql = 'SELECT shijian, zuixinjia, percent FROM t_time_line WHERE `code` = '+code+' ORDER BY shijian desc limit 1; ' + sql = 'SELECT shijian, zuixinjia, percent, huanshoulv FROM t_time_line WHERE `code` = '+code+' ORDER BY shijian desc limit 1; ' try: cursor.execute(sql) results = cursor.fetchone() @@ -316,6 +317,18 @@ self.db.rollback(); print(e) + # 获取换手率的通知内容 + def getHuanShouLVList(self): + cursor = self.db.cursor() + sql = ''' + SELECT * FROM `t_notify_huanshoulv` WHERE `shijian` LIKE concat(( + SELECT date_format(`shijian`, '%Y-%m-%d') sj FROM `t_notify_huanshoulv` ORDER BY `shijian` DESC LIMIT 1 + ), '%') AND (`tag1` = 0 OR `tag2` = 0) ORDER BY `id` ; + ''' + cursor.execute(sql) + list = cursor.fetchall() + return list + # 写入临时个股连续2日高涨幅表 def save_tmp_day_line_table(self, data):