return_pct_30d in team matching has no time filter
Author: LudwigJMarxCreated Sep 21, 2026Updated Sep 21, 2026
Summary
_agent_feature reads the latest profit_history row with no date predicate and reports it as return_pct_30d. The three activity counts in the same function do filter on 30 days. The value is the cumulative profit since account start.
Where
service/server/team_matching.py:42-56
cursor.execute(
"""
SELECT profit
FROM profit_history
WHERE agent_id = ?
ORDER BY recorded_at DESC, id DESC
LIMIT 1
""",
(agent_id,),
)
profit_row = cursor.fetchone()
...
return_pct_30d = float(profit_row["profit"] or 0) / 100000.0 * 100 if profit_row else 0.0Compare :23 and :33 in the same function, which both carry AND created_at >= datetime('now', '-30 day').
profit is written as cash + position_value - (initial_capital + deposited) (tasks.py:800-803), a level since account start.
What consumes it
| Consumer | Use |
|---|---|
team_matching.py:68 |
feature_score = return_pct_30d + activity_score, which orders homogeneous and heterogeneous team formation (:106-109) |
team_scoring.py:70 |
a team's return_pct is the member mean of return_pct_30d |
team_scoring.py:71 |
final_score = return_pct + prediction_score * 0.2 + quality_score + consensus_gain |
research_exports.py |
team_results.csv, consumed by analyze_experiments.py:289 as the hybrid family metric |
So an agent's profit from before the mission enters both the team assignment and the team's score.
Environment
| Commit | d03ff6c |
| Python | 3.14.7 |
| sqlite3 | 3.53.4 |
Not verified
- Read from the source, not reproduced with a running mission. The claim is about the absent predicate, which is visible in the query above.
- Whether
_30dis the intended semantics or the name is wrong is a question for the maintainers; the two readings imply different fixes.
Source: HKUDS/AI-Trader