from pathlib import Path from pydantic_settings import BaseSettings APP_DIR = Path(__file__).resolve().parent class Settings(BaseSettings): database_path: str = "/data/newsatlas.db" owm_api_key: str = "" acled_api_key: str = "" acled_email: str = "" rss_poll_minutes: int = 10 market_poll_minutes: int = 15 # Absolute floor: minimum |% change| between two consecutive polls of the # same instrument before it's even eligible to be a "spike," regardless # of that instrument's own volatility. Prevents a very calm instrument's # tiny normal wiggle from counting as "abnormal" just because it's small. market_spike_threshold_pct: float = 1.5 # Above the floor, a move must also be at least this many times the # instrument's own recent typical (mean absolute) poll-to-poll move to # count as a spike — the "higher than historical norm" check. Skipped # (falls back to the floor alone) until there's enough price history. market_spike_volatility_multiplier: float = 2.5 # How far back to look when computing that "recent typical move" baseline. market_spike_history_days: int = 7 # Minimum number of historical poll-to-poll observations required before # the volatility check applies; below this, only the floor above applies. market_spike_min_samples: int = 8 # How far back (and forward, capped at "now") from the previous poll to # search for candidate-cause articles around a detected spike. market_spike_lookback_hours: int = 6 conflict_poll_minutes: int = 60 article_window_hours: int = 72 sources_file: str = str(APP_DIR / "sources.yaml") gazetteer_file: str = str(APP_DIR / "data" / "gazetteer.csv") # --- Flights overlay (OpenSky Network) --- # Anonymous access works out of the box but is capped at 400 credits/day; # a full-globe states/all poll costs several credits, so the default # interval below is deliberately conservative. Free registration # (opensky-network.org) raises the cap to 4000/day — set these and drop # FLIGHTS_POLL_SECONDS if you want closer-to-live updates. opensky_username: str = "" opensky_password: str = "" flights_poll_seconds: int = 300 military_ranges_file: str = str(APP_DIR / "data" / "military_ranges.yaml") # --- Polymarket trending bets (public Gamma API, no key needed) --- polymarket_poll_minutes: int = 15 class Config: env_file = ".env" settings = Settings()