Ver Fonte

Merge remote-tracking branch 'origin/master'

daniel-ali há 2 anos atrás
pai
commit
0fe587174d
2 ficheiros alterados com 5 adições e 0 exclusões
  1. 3 0
      QMT/qmt_real_hlfx.py
  2. 2 0
      QMT/real_time.py

+ 3 - 0
QMT/qmt_real_hlfx.py

@@ -226,6 +226,7 @@ def hlfx(data, stocks, pool_list):
                     m = m - 1
                     if m == 0:
                         df_day.loc[x, 'HL'] = 'H'
+    engine_stock.dispose()
 
 
 
@@ -288,6 +289,7 @@ def bridge(data):
     cursor_pool.execute(sql)
     db_pool.commit()
     print(f'{dt.now()}写入新的results,hlfx_pool更新')
+    engine_hlfx_pool.dispose()
     # hlfx(data, engine_stock, engine_hlfx)
     pass
 
@@ -300,6 +302,7 @@ def prepare():
     results = [x.replace('XSHG', 'SH').replace('XSHE', 'SZ') for x in results]
     print('数据库读取,并转化后缀格式', len(results))
     # print(results[0:10])
+    engine_hlfx_pool.dispose()
     return results
 
 

+ 2 - 0
QMT/real_time.py

@@ -195,6 +195,7 @@ def buy_trader(data):
                     print('买入信号!!!!!!', stock, volume, current_price)
                     order_id = xt_trader.order_stock(acc, stock, xtconstant.STOCK_BUY, volume, xtconstant.LATEST_PRICE, current_price, 'strategy1', 'order_test')
                     print(order_id)
+    engine_hlfx_pool.dispose()
     print('一轮结束了,现在时间是:', dt.now())
 
 
@@ -282,6 +283,7 @@ if __name__ == '__main__':
     pus = psutil.Process()
     pus.cpu_affinity([4, 5, 6, 7])
 
+    mp.freeze_support()
     print("start")
     # 指定客户端所在路径
     path = r'c:\\qmt\\userdata_mini'