Browse Source

修正字段

daniel-ali 2 years ago
parent
commit
7c18a0a25d
1 changed files with 2 additions and 2 deletions
  1. 2 2
      QMT/real_time.py

+ 2 - 2
QMT/real_time.py

@@ -73,7 +73,7 @@ def ma_judge(data, stock_list, results):
     print('这个ma_judge的PID为:', os.getpid())
     for stock in data:
         i = stock.replace('XSHG', 'SH').replace('XSHE', 'SZ')
-        current_price, open_price = data[i]['lastPrice'], data[i]['open_front']
+        current_price, open_price = data[i]['lastPrice'], data[i]['open']
         MA5, MA10, MA20 = ma(i, 5, data), ma(i, 10, data), ma(i, 20, data)
         MA5_1 = ma_1(i, 5)
         # print(i, current_price, open_price, MA5, MA10, MA20, MA5_1)
@@ -93,11 +93,11 @@ def sell_trader(data, positions_dict):
 
     for stock, volume in positions_dict.items():
         if stock in data:
-            print('持仓', stock, volume)
             current_price = data[stock]['lastPrice']
             open_price = data[stock]['open']
             MA5 = ma(stock, 5, data)
             MA5_1 = ma_1(stock, 5)
+            print(f'{stocks},持仓量为{volume},当前价:{current_price},MA5:{MA5},昨日MA5:{MA5_1},开始判断:')
             if current_price < MA5 or MA5 < MA5_1 or current_price > MA5 * 1.07:
                 print('卖出信号!!!!!!', stock, current_price)
                 order_id = xt_trader.order_stock(acc, stock, xtconstant.STOCK_SELL, volume,