챠트 데이터 웹소켓으로 연결
This commit is contained in:
@@ -605,11 +605,22 @@ async def execute_auto_trading(db: AsyncSession = Depends(get_db)):
|
||||
total_processed = 0
|
||||
max_trades = 5
|
||||
|
||||
for rule_group in recommendations_response["recommendations_by_rule"]:
|
||||
# make sure we iterate a list of rule group dicts
|
||||
rec_groups = recommendations_response.get("recommendations_by_rule", [])
|
||||
if isinstance(rec_groups, dict):
|
||||
normalized = []
|
||||
for name, grp in rec_groups.items():
|
||||
if isinstance(grp, dict):
|
||||
normalized.append(grp)
|
||||
else:
|
||||
normalized.append({"rule_name": name, "stocks": grp})
|
||||
rec_groups = normalized
|
||||
|
||||
for rule_group in rec_groups:
|
||||
if total_processed >= max_trades:
|
||||
break
|
||||
|
||||
for stock in rule_group["stocks"][:settings.AUTO_TRADE_TOP_N_PER_RULE]:
|
||||
for stock in rule_group.get("stocks", [])[:settings.AUTO_TRADE_TOP_N_PER_RULE]:
|
||||
if total_processed >= max_trades:
|
||||
break
|
||||
|
||||
|
||||
Reference in New Issue
Block a user