|
@@ -183,7 +183,7 @@ def sell_trader(data):
|
|
|
positions = xt_trader.query_stock_positions(acc)
|
|
|
positions_dict = {positions[x].stock_code: positions[x].can_use_volume for x in range(0, len(positions))}
|
|
|
print(f'今日可卖出个股总数:{len([value for value in positions_dict.values() if value != 0])}')
|
|
|
- print(f'目前持仓总数为:{len(positions)}')
|
|
|
+ print(f'目前持仓总数为:{len([positions[x].stock_code for x in range(0, len(positions)) if positions[x].volume != 0])}')
|
|
|
|
|
|
for stock, can_use_volume in positions_dict.items():
|
|
|
if stock in data and can_use_volume != 0:
|
|
@@ -217,7 +217,7 @@ def buy_trader(data):
|
|
|
try:
|
|
|
stock_pool = pd.read_sql_query(
|
|
|
'select value from `%s` order by `index` desc limit 10' % '1d', engine_hlfx_pool)
|
|
|
- stock_pool = stock_pool.iloc[-1, 0].split(",")
|
|
|
+ stock_pool = stock_pool.iloc[0, 0].split(",")
|
|
|
stock_pool.sort()
|
|
|
print('stock_pool', len(stock_pool))
|
|
|
except BaseException:
|
|
@@ -303,7 +303,7 @@ def buy_trader(data):
|
|
|
current_price, 'MA5策略', 'MA5趋势向上')
|
|
|
print(order_id)
|
|
|
else:
|
|
|
- print(f'Cash只有:{cash} 或者 现有持仓{len(positions)} 超过了{max_pos}')
|
|
|
+ print(f'Cash只有:{cash} 或者 现有持仓{len(positions_dict)} 超过了{max_pos}')
|
|
|
engine_hlfx_pool.dispose()
|
|
|
print('一轮结束了,现在时间是:', dt.now())
|
|
|
|