Files
signal-platform/app/schemas/admin.py
T
dennisthiessen 6da65b8d8f
Deploy / lint (push) Successful in 7s
Deploy / test (push) Successful in 32s
Deploy / deploy (push) Successful in 24s
Add activation thresholds: qualified-signal defaults and views
Admin-configurable thresholds (min R:R, default 2.0; min confidence,
default 70%) defining what counts as an actionable signal:

- Admin Settings: new Activation Thresholds panel
  (GET/PUT /admin/settings/activation)
- GET /trades/activation exposes values to all users with access
- Signals/Setups: filters initialize from activation values
- Track Record: "Qualified signals only" toggle (default on) via
  min_rr/min_confidence params on /trades/performance; the
  confidence breakdown always covers the full population so the
  thresholds can be validated against outcomes
- Dashboard: "Qualified" metric and qualified-first Top Setups
- Outcome evaluator unchanged: every setup is still evaluated

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 18:16:04 +02:00

65 lines
2.1 KiB
Python

"""Admin request/response schemas."""
from typing import Literal
from pydantic import BaseModel, Field
class UserManagement(BaseModel):
"""Schema for user access management."""
has_access: bool
class PasswordReset(BaseModel):
"""Schema for resetting a user's password."""
new_password: str = Field(..., min_length=6)
class CreateUserRequest(BaseModel):
"""Schema for admin-created user accounts."""
username: str = Field(..., min_length=1)
password: str = Field(..., min_length=6)
role: str = Field(default="user", pattern=r"^(user|admin)$")
has_access: bool = False
class RegistrationToggle(BaseModel):
"""Schema for toggling registration on/off."""
enabled: bool
class SystemSettingUpdate(BaseModel):
"""Schema for updating a system setting."""
value: str = Field(..., min_length=1)
class DataCleanupRequest(BaseModel):
"""Schema for data cleanup — delete records older than N days."""
older_than_days: int = Field(..., gt=0)
class JobToggle(BaseModel):
"""Schema for enabling/disabling a scheduled job."""
enabled: bool
class RecommendationConfigUpdate(BaseModel):
high_confidence_threshold: float | None = Field(default=None, ge=0, le=100)
moderate_confidence_threshold: float | None = Field(default=None, ge=0, le=100)
confidence_diff_threshold: float | None = Field(default=None, ge=0, le=100)
signal_alignment_weight: float | None = Field(default=None, ge=0, le=1)
sr_strength_weight: float | None = Field(default=None, ge=0, le=1)
distance_penalty_factor: float | None = Field(default=None, ge=0, le=1)
momentum_technical_divergence_threshold: float | None = Field(default=None, ge=0, le=100)
fundamental_technical_divergence_threshold: float | None = Field(default=None, ge=0, le=100)
class TickerUniverseUpdate(BaseModel):
universe: Literal["sp500", "nasdaq100", "nasdaq_all"]
class ActivationConfigUpdate(BaseModel):
"""Activation thresholds: what counts as an actionable signal."""
min_rr: float | None = Field(default=None, ge=0)
min_confidence: float | None = Field(default=None, ge=0, le=100)