You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
90 lines
3.3 KiB
Python
90 lines
3.3 KiB
Python
"""
|
|
Overlay feature configuration - source weights, thresholds, and feature flags.
|
|
"""
|
|
|
|
from app.core.config import settings
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Source weights (used for weighted-average scoring; normalized internally)
|
|
# ---------------------------------------------------------------------------
|
|
SOURCE_WEIGHTS = {
|
|
"yahoo": 0.30,
|
|
"youtube": 0.25,
|
|
"wikimedia": 0.20,
|
|
"finra": 0.15,
|
|
"google_trends": 0.10,
|
|
}
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Overlay band thresholds (overlay_score 0~1)
|
|
# ---------------------------------------------------------------------------
|
|
BAND_THRESHOLDS = {
|
|
"frenzied": 0.80,
|
|
"loud": 0.60,
|
|
"supportive": 0.40,
|
|
"tepid": 0.20,
|
|
"silent": 0.0,
|
|
}
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Confidence
|
|
# ---------------------------------------------------------------------------
|
|
# Each present source adds this much to overlay_confidence (max 1.0)
|
|
CONFIDENCE_PER_SOURCE = 0.20
|
|
|
|
# Min sources for non-trivial confidence
|
|
MIN_SOURCES_STRONG_CONFIDENCE = 3
|
|
MIN_SOURCES_DEGRADED_MODE = 1
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# z-score normalization
|
|
# ---------------------------------------------------------------------------
|
|
ZSCORE_WINDOW_DAYS = 30
|
|
|
|
# Winsorization clamps
|
|
WINSOR_LOWER = -3.0
|
|
WINSOR_UPPER = 3.0
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Staleness
|
|
# ---------------------------------------------------------------------------
|
|
# Hours before a feature record is considered stale and on-demand rebuild triggers
|
|
FEATURE_STALE_HOURS: int = int(getattr(settings, "OVERLAY_STALE_HOURS", 8))
|
|
|
|
# On-demand pipeline timeout (seconds) - prevents blocking API requests
|
|
ONDEMAND_TIMEOUT_SECONDS = 25
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Batch scheduling (UTC)
|
|
# ---------------------------------------------------------------------------
|
|
SCHEDULE_RSS_UTC = "23:30" # 18:30 ET
|
|
SCHEDULE_WIKI_YOUTUBE_UTC = "01:00" # 20:00 ET (next UTC day)
|
|
SCHEDULE_FEATURE_BUILD_UTC = "01:30"
|
|
SCHEDULE_SCORING_UTC = "02:00"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Hint thresholds
|
|
# ---------------------------------------------------------------------------
|
|
HOLD_EXTENSION_EXTEND_THRESHOLD = 0.65
|
|
HOLD_EXTENSION_TRIM_THRESHOLD = 0.30
|
|
ADD_ON_ELIGIBILITY_THRESHOLD = 0.55
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Yahoo RSS feed URLs
|
|
# ---------------------------------------------------------------------------
|
|
YAHOO_RSS_FEEDS = [
|
|
"https://finance.yahoo.com/rss/headline",
|
|
]
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Seed symbols (Top 50 US equities)
|
|
# ---------------------------------------------------------------------------
|
|
TOP_50_SYMBOLS = [
|
|
"AAPL", "MSFT", "NVDA", "AMZN", "GOOGL", "META", "TSLA", "BRK.B",
|
|
"JPM", "JNJ", "V", "UNH", "XOM", "PG", "MA", "HD", "CVX", "LLY",
|
|
"ABBV", "BAC", "KO", "PEP", "AVGO", "COST", "WMT", "MRK", "TMO",
|
|
"DIS", "ACN", "ABT", "VZ", "ADBE", "CRM", "NFLX", "CMCSA", "TXN",
|
|
"CSCO", "NKE", "NEE", "AMD", "DHR", "BMY", "QCOM", "T", "LOW",
|
|
"PM", "HON", "ORCL", "RTX", "UPS",
|
|
]
|