feat: add algorithm settings backend + integration guide

- Create /api/v1/settings/algorithms endpoint for algorithm management
- Enable/disable Algorithm #15 (liquidity_sweep) and #16 (price_action_reversal)
- Settings persist in User.preferences JSON column
- Settings wired to signal_scoring filter (disabled algos vote 0.0)
- Add comprehensive ALGORITHM_INTEGRATION_GUIDE.md documentation
- Add unit tests for both algorithms in isolation and together
- Vote weights: liquidity_sweep ±2.0, price_action_reversal ±2.5
- Correlation dampening: 0.45 when both vote same direction (pattern group)
- Tested: algorithms called in get_indicators(), passed through signal pipeline
This commit is contained in:
2026-07-10 11:21:41 +00:00
parent 79b3d21ec2
commit 81907cf3aa
5 changed files with 900 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
"""Settings schemas for algorithm configuration."""
from __future__ import annotations
from pydantic import BaseModel, Field
class AlgorithmToggleRequest(BaseModel):
"""Request to toggle an algorithm on/off."""
enabled: bool = Field(..., description="Enable or disable the algorithm")
class AlgorithmConfigResponse(BaseModel):
"""Configuration for a single algorithm."""
id: str = Field(..., description="Algorithm identifier")
name: str = Field(..., description="Algorithm display name")
description: str = Field(default="", description="Algorithm description")
enabled: bool = Field(..., description="Whether this algorithm is enabled for the user")
weight: float = Field(default=1.0, description="Vote weight in scoring")
class AlgorithmSettingsResponse(BaseModel):
"""Response after toggling an algorithm."""
id: str = Field(..., description="Algorithm identifier")
name: str = Field(..., description="Algorithm display name")
description: str = Field(default="", description="Algorithm description")
enabled: bool = Field(..., description="New enabled state")
weight: float = Field(default=1.0, description="Vote weight")
message: str = Field(..., description="Confirmation message")
class AllAlgorithmSettingsResponse(BaseModel):
"""Response containing all algorithm settings."""
algorithms: list[AlgorithmConfigResponse] = Field(..., description="List of all algorithms")
enabled_count: int = Field(..., description="Number of enabled algorithms")
total_count: int = Field(..., description="Total number of algorithms")