Add multi-factor conviction gate to activation
Make "qualified" mean an edge candidate, not just R:R + confidence. The gate now also requires (all admin-configurable, defaults on): - high conviction: recommended_action LONG_HIGH / SHORT_HIGH only - clean read: risk_level Low (no contradicting signals) - probable primary target: best target probability >= min (default 60) - Shared predicate: app/services/qualification.py + frontend/src/lib/qualification.ts (mirrored) - Activation config extended (min_target_probability, require_high_conviction, exclude_conflicts) with bool-aware get/update + validation - /trades/performance switched to ?qualified_only=true, applying the full gate server-side; confidence breakdown stays unfiltered - Dashboard "Qualified", Signals "Qualified only" toggle, and Track Record all use the one gate; Admin gains the new controls Sentiment provider runtime config (prior change) included. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -67,9 +67,8 @@ async def get_activation_thresholds(
|
||||
|
||||
@router.get("/trades/performance", response_model=APIEnvelope)
|
||||
async def get_trade_performance(
|
||||
min_rr: float | None = Query(None, ge=0, description="Only setups with R:R >= this"),
|
||||
min_confidence: float | None = Query(
|
||||
None, ge=0, le=100, description="Only setups with confidence >= this"
|
||||
qualified_only: bool = Query(
|
||||
False, description="Restrict overall/direction/action stats to setups that clear the activation gate"
|
||||
),
|
||||
_user=Depends(require_access),
|
||||
db: AsyncSession = Depends(get_db),
|
||||
@@ -78,11 +77,12 @@ async def get_trade_performance(
|
||||
|
||||
Outcomes are written by the nightly outcome_evaluator job (win = target
|
||||
hit first, loss = stop hit first, expired = neither within the window).
|
||||
Optional min_rr / min_confidence filters apply to the overall, direction
|
||||
and action breakdowns; the confidence breakdown always covers all setups
|
||||
so thresholds can be validated against it.
|
||||
With qualified_only, the overall/direction/action breakdowns cover only
|
||||
setups clearing the activation gate; the confidence breakdown always
|
||||
covers all setups so the gate can be validated against it.
|
||||
"""
|
||||
stats = await get_performance_stats(db, min_rr=min_rr, min_confidence=min_confidence)
|
||||
config = await admin_service.get_activation_config(db) if qualified_only else None
|
||||
stats = await get_performance_stats(db, config=config)
|
||||
return APIEnvelope(status="success", data=stats)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user