챠트 데이터 웹소켓으로 연결

This commit is contained in:
2026-02-26 13:51:12 +09:00
parent 82346fcc46
commit 77e7464884
4 changed files with 82 additions and 5 deletions

View File

@@ -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