Browse Source

修正字段

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

+ 2 - 3
QMT/real_time.py

@@ -97,7 +97,7 @@ def sell_trader(data, positions_dict):
             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},开始判断:')
+            print(f'{stock},持仓量为{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,
@@ -187,8 +187,7 @@ def buy_trader(data, positions):
             if cash > 2000 and len(positions) < 12:
                 if stock in new_keep_stock:
                     current_price = data[stock]['lastPrice']
-                    volume = int((cash / 3 / current_price) // 100 * 100)
-                    print('volume:', volume)
+                    volume = int((cash / 2 / current_price) // 100 * 100)
                     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)