21ed83c56c
Closes the feedback loop on R:R scanner signals: - Nightly outcome_evaluator job replays unresolved setups against daily OHLCV bars: target_hit / stop_hit / ambiguous (same-bar, counted as loss) / expired after OUTCOME_EVALUATION_MAX_BARS (default 30) - Migration 004: evaluated_at + outcome_date on trade_setups - GET /trades/performance: hit rate, expectancy (avg R), total R with breakdowns by direction, recommended action, and confidence bucket - New Performance page (stat cards, breakdown tables, Evaluate Now, methodology disclosure) wired into sidebar and mobile nav - 17 new unit tests for evaluation logic and stats aggregation Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
60 lines
1.7 KiB
Python
60 lines
1.7 KiB
Python
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8")
|
|
|
|
# Database
|
|
database_url: str = "postgresql+asyncpg://stock_backend:changeme@localhost:5432/stock_data_backend"
|
|
|
|
# Auth
|
|
jwt_secret: str = "change-this-to-a-random-secret"
|
|
jwt_expiry_minutes: int = 60
|
|
|
|
# OHLCV Provider — Alpaca Markets
|
|
alpaca_api_key: str = ""
|
|
alpaca_api_secret: str = ""
|
|
|
|
# Sentiment Provider — Gemini with Search Grounding (legacy)
|
|
gemini_api_key: str = ""
|
|
gemini_model: str = "gemini-2.0-flash"
|
|
|
|
# Sentiment Provider — OpenAI
|
|
openai_api_key: str = ""
|
|
openai_model: str = "gpt-4o-mini"
|
|
openai_sentiment_batch_size: int = 5
|
|
|
|
# Fundamentals Provider — Financial Modeling Prep
|
|
fmp_api_key: str = ""
|
|
|
|
# Fundamentals Provider — Finnhub (optional fallback)
|
|
finnhub_api_key: str = ""
|
|
|
|
# Fundamentals Provider — Alpha Vantage (optional fallback)
|
|
alpha_vantage_api_key: str = ""
|
|
|
|
# Scheduled Jobs
|
|
data_collector_frequency: str = "daily"
|
|
sentiment_poll_interval_minutes: int = 30
|
|
fundamental_fetch_frequency: str = "daily"
|
|
rr_scan_frequency: str = "daily"
|
|
fundamental_rate_limit_retries: int = 3
|
|
fundamental_rate_limit_backoff_seconds: int = 15
|
|
|
|
# Scoring Defaults
|
|
default_watchlist_auto_size: int = 10
|
|
default_rr_threshold: float = 1.5
|
|
|
|
# Outcome evaluation: trading days before an undecided setup expires
|
|
outcome_evaluation_max_bars: int = 30
|
|
|
|
# Database Pool
|
|
db_pool_size: int = 5
|
|
db_pool_timeout: int = 30
|
|
|
|
# Logging
|
|
log_level: str = "INFO"
|
|
|
|
|
|
settings = Settings()
|