|
@@ -15,13 +15,7 @@ import psutil
|
|
|
from apscheduler.schedulers.blocking import BlockingScheduler
|
|
|
import gc
|
|
|
|
|
|
-auth('18616891214', 'Ea?*7f68nD.dafcW34d!')
|
|
|
-db_pool = pymysql.connect(host='localhost',
|
|
|
- user='root',
|
|
|
- port=3307,
|
|
|
- password='r6kEwqWU9!v3',
|
|
|
- database='hlfx_pool')
|
|
|
-cursor_pool = db_pool.cursor()
|
|
|
+# auth('18616891214', 'Ea?*7f68nD.dafcW34d!')
|
|
|
engine_stock = create_engine('mysql+pymysql://root:r6kEwqWU9!v3@localhost:3307/qmt_stocks_whole?charset=utf8')
|
|
|
|
|
|
|
|
@@ -103,7 +97,7 @@ def run(seq):
|
|
|
if now_date.replace(hour=11, minute=30, second=0) < dt.now() < now_date.replace(hour=13, minute=0, second=0):
|
|
|
print(f'现在时间:{dt.now()},已休市')
|
|
|
return 0
|
|
|
- elif dt.now() > now_date.replace(hour=15, minute=0, second=0):
|
|
|
+ elif dt.now() > now_date.replace(hour=16, minute=0, second=0):
|
|
|
print(f'现在时间:{dt.now()},已收盘')
|
|
|
return 0
|
|
|
return
|
|
@@ -269,6 +263,12 @@ def buy_trader(data):
|
|
|
results_industry = ','.join(set(results_industry))
|
|
|
print('1d', '\n', results_industry)
|
|
|
|
|
|
+ db_pool = pymysql.connect(host='localhost',
|
|
|
+ user='root',
|
|
|
+ port=3307,
|
|
|
+ password='r6kEwqWU9!v3',
|
|
|
+ database='hlfx_pool')
|
|
|
+ cursor_pool = db_pool.cursor()
|
|
|
sql = "INSERT INTO MA5_%s (date,value) VALUES('%s','%s')" % ('1d', dt.now().strftime('%Y-%m-%d %H:%M:%S'),
|
|
|
results_industry)
|
|
|
cursor_pool.execute(sql)
|
|
@@ -276,6 +276,9 @@ def buy_trader(data):
|
|
|
|
|
|
# print(len(results_industry), results_industry)
|
|
|
print(dt.now(), '数据库数据已赋值!')
|
|
|
+ cursor_pool.close()
|
|
|
+ db_pool.close()
|
|
|
+
|
|
|
|
|
|
# 取值交易
|
|
|
|