|  | @@ -199,9 +199,11 @@ def buy_trader(data, positions):
 | 
											
												
													
														|  |          for stock in new_keep_stock:
 |  |          for stock in new_keep_stock:
 | 
											
												
													
														|  |              asset = xt_trader.query_stock_asset(acc)
 |  |              asset = xt_trader.query_stock_asset(acc)
 | 
											
												
													
														|  |              cash = asset.cash
 |  |              cash = asset.cash
 | 
											
												
													
														|  | 
 |  | +            positions_dict = {positions[x].stock_code: positions[x].volume for x in range(0, len(positions)) if
 | 
											
												
													
														|  | 
 |  | +                              positions[x].volume > 0}
 | 
											
												
													
														|  |              if stock in new_keep_stock:
 |  |              if stock in new_keep_stock:
 | 
											
												
													
														|  |                  current_price = data[stock]['lastPrice']
 |  |                  current_price = data[stock]['lastPrice']
 | 
											
												
													
														|  | -                if cash > 5000 and len(positions) < max_pos and current_price > 9:
 |  | 
 | 
											
												
													
														|  | 
 |  | +                if cash > 5000 and len(positions_dict) < max_pos and current_price > 9:
 | 
											
												
													
														|  |                      volume = int((cash / 2 / current_price) // 100 * 100)
 |  |                      volume = int((cash / 2 / current_price) // 100 * 100)
 | 
											
												
													
														|  |                      print('买入信号!!!!!!', stock, volume, current_price)
 |  |                      print('买入信号!!!!!!', stock, volume, current_price)
 | 
											
												
													
														|  |                      order_id = xt_trader.order_stock(acc, stock, xtconstant.STOCK_BUY, volume, xtconstant.LATEST_PRICE,
 |  |                      order_id = xt_trader.order_stock(acc, stock, xtconstant.STOCK_BUY, volume, xtconstant.LATEST_PRICE,
 |