|  | @@ -180,12 +180,13 @@ def buy_trader(data, positions):
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          keep_stocks = results_industry.split(",")
 |  |          keep_stocks = results_industry.split(",")
 | 
											
												
													
														|  |          new_keep_stock = [stock.replace('XSHG', 'SH').replace('XSHE', 'SZ') for stock in keep_stocks]
 |  |          new_keep_stock = [stock.replace('XSHG', 'SH').replace('XSHE', 'SZ') for stock in keep_stocks]
 | 
											
												
													
														|  | -        print(f'new_keep_stock is:{new_keep_stock}')
 |  | 
 | 
											
												
													
														|  | 
 |  | +        print(f'new_keep_stock is:{len(new_keep_stock)},{new_keep_stock}')
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +        max_pos = 12
 | 
											
												
													
														|  |          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
 | 
											
												
													
														|  | -            if cash > 2000 and len(positions) < 12:
 |  | 
 | 
											
												
													
														|  | 
 |  | +            if cash > 2000 and len(positions) < max_pos:
 | 
											
												
													
														|  |                  if stock in new_keep_stock:
 |  |                  if stock in new_keep_stock:
 | 
											
												
													
														|  |                      current_price = data[stock]['lastPrice']
 |  |                      current_price = data[stock]['lastPrice']
 | 
											
												
													
														|  |                      volume = int((cash / 2 / current_price) // 100 * 100)
 |  |                      volume = int((cash / 2 / current_price) // 100 * 100)
 | 
											
										
											
												
													
														|  | @@ -193,6 +194,8 @@ def buy_trader(data, positions):
 | 
											
												
													
														|  |                      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,
 | 
											
												
													
														|  |                                                       current_price, 'strategy1', 'order_test')
 |  |                                                       current_price, 'strategy1', 'order_test')
 | 
											
												
													
														|  |                      print(order_id)
 |  |                      print(order_id)
 | 
											
												
													
														|  | 
 |  | +            else:
 | 
											
												
													
														|  | 
 |  | +                print(f'Cash只有:{cash} 或者 现有持仓{len(positions)} 超过了{max_pos}')
 | 
											
												
													
														|  |      engine_hlfx_pool.dispose()
 |  |      engine_hlfx_pool.dispose()
 | 
											
												
													
														|  |      print('一轮结束了,现在时间是:', dt.now())
 |  |      print('一轮结束了,现在时间是:', dt.now())
 | 
											
												
													
														|  |  
 |  |  
 |