add track-record reset; drop dead distance_penalty_factor knob
Track Record: new "Reset" action (POST /admin/track-record/reset) deletes all trade setups so stats start fresh after material scoring/setup changes — live setups regenerate on the next scan. Guarded by a confirm dialog. Recommendation config: remove distance_penalty_factor, which was exposed in the admin UI but consumed nowhere (the touch-probability model superseded it). A knob that silently does nothing is worse than no knob. Remaining defaults are left as-is — they're reasonable, and the honest way to tune them is backtesting against accumulated outcomes, not invented "researched" numbers. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -23,7 +23,6 @@ RECOMMENDATION_CONFIG_DEFAULTS: dict[str, float] = {
|
||||
"recommendation_confidence_diff_threshold": 20.0,
|
||||
"recommendation_signal_alignment_weight": 0.15,
|
||||
"recommendation_sr_strength_weight": 0.20,
|
||||
"recommendation_distance_penalty_factor": 0.10,
|
||||
"recommendation_momentum_technical_divergence_threshold": 30.0,
|
||||
"recommendation_fundamental_technical_divergence_threshold": 40.0,
|
||||
}
|
||||
@@ -236,7 +235,6 @@ async def get_recommendation_config(db: AsyncSession) -> dict[str, float]:
|
||||
"confidence_diff_threshold": config["recommendation_confidence_diff_threshold"],
|
||||
"signal_alignment_weight": config["recommendation_signal_alignment_weight"],
|
||||
"sr_strength_weight": config["recommendation_sr_strength_weight"],
|
||||
"distance_penalty_factor": config["recommendation_distance_penalty_factor"],
|
||||
"momentum_technical_divergence_threshold": config["recommendation_momentum_technical_divergence_threshold"],
|
||||
"fundamental_technical_divergence_threshold": config["recommendation_fundamental_technical_divergence_threshold"],
|
||||
}
|
||||
@@ -309,6 +307,19 @@ async def cleanup_data(db: AsyncSession, older_than_days: int) -> dict[str, int]
|
||||
return counts
|
||||
|
||||
|
||||
async def reset_trade_setups(db: AsyncSession) -> dict[str, int]:
|
||||
"""Delete all trade setups, wiping the track record for a fresh start.
|
||||
|
||||
Stats are derived from evaluated trade setups, so this resets the Track
|
||||
Record to zero. Live setups regenerate on the next R:R scan. Used after
|
||||
material changes to scoring / setup generation, when historical outcomes no
|
||||
longer reflect current logic.
|
||||
"""
|
||||
result = await db.execute(delete(TradeSetup))
|
||||
await db.commit()
|
||||
return {"trade_setups": result.rowcount} # type: ignore[attr-defined]
|
||||
|
||||
|
||||
async def get_pipeline_readiness(db: AsyncSession) -> list[dict]:
|
||||
"""Return per-ticker readiness snapshot for ingestion/scoring/scanner pipeline."""
|
||||
tickers_result = await db.execute(select(Ticker).order_by(Ticker.symbol.asc()))
|
||||
|
||||
@@ -22,7 +22,6 @@ DEFAULT_RECOMMENDATION_CONFIG: dict[str, float] = {
|
||||
"recommendation_confidence_diff_threshold": 20.0,
|
||||
"recommendation_signal_alignment_weight": 0.15,
|
||||
"recommendation_sr_strength_weight": 0.20,
|
||||
"recommendation_distance_penalty_factor": 0.10,
|
||||
"recommendation_momentum_technical_divergence_threshold": 30.0,
|
||||
"recommendation_fundamental_technical_divergence_threshold": 40.0,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user