|
@@ -203,8 +203,10 @@ def buy_trader(data, positions):
|
|
|
positions[x].volume > 0}
|
|
|
if stock in new_keep_stock:
|
|
|
current_price = data[stock]['lastPrice']
|
|
|
- if cash > 5000 and len(positions_dict) < max_pos and current_price > 9:
|
|
|
- volume = int((cash / 2 / current_price) // 100 * 100)
|
|
|
+ current_high = data[stock]['high']
|
|
|
+ if cash > 5000 and len(positions_dict) < max_pos and current_price > 9 \
|
|
|
+ and current_price > (current_high*0.98):
|
|
|
+ volume = int((cash / 5 / 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')
|