A SourceImporter that ingests post-no-preference/earnings into earnings_events for the tracked universe. Shadow by construction (nothing reads earnings_events until A4). - earnings_alignment.py: pure calendar<->EPS-history min-cost monotonic DP, reused from scripts/import_dolthub_earnings.py with identical constants (not extending that one-off script); symbol/session normalization; unit-tested against the pinned constants. - dolt_client.py: async dolt CLI wrapper (pull / current_commit / query_csv via asyncio.create_subprocess_exec — never blocks the shared event loop) + disk guard before pull. - dolt_earnings_importer.py: detect_revision = pull + HEAD hash; stage = query earnings_calendar + eps_history, dedup, align, map act_symbol->ticker_id (normalize both sides so dotted BRK.B joins); promote is destructive (delete future dolt_earnings rows + upsert; past never deleted) so validate is FAIL-CLOSED — blocks when the staged forward calendar is empty or has collapsed below 50% of what's loaded (the forward calendar is the acceptance gate). - NOTICE: CC BY-SA 4.0 attribution; config: DOLT_BINARY / DOLT_DATA_DIR / etc. Verified end-to-end against the real 1.68 GB clone (5 tickers: 133 events, 128 paired, forward calendar to 2026-08-26, BRK.B joined). Tests: 9 alignment + 7 importer + 1 skip-guarded real-clone smoke. Full suite 699 passed. Remaining for A2: wire the daily ~02:30 ET shadow cron — deferred to pair with the deploy-time dolt install + DOLT_DATA_DIR provisioning. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
67 lines
1.9 KiB
Bash
67 lines
1.9 KiB
Bash
# Database
|
|
DATABASE_URL=postgresql+asyncpg://stock_backend:changeme@localhost:5432/stock_data_backend
|
|
|
|
# Auth
|
|
JWT_SECRET=change-this-to-a-random-secret
|
|
JWT_EXPIRY_MINUTES=60
|
|
|
|
# OHLCV Provider — Alpaca Markets
|
|
ALPACA_API_KEY=
|
|
ALPACA_API_SECRET=
|
|
|
|
# Sentiment Provider — Gemini with Search Grounding
|
|
GEMINI_API_KEY=
|
|
GEMINI_MODEL=gemini-2.0-flash
|
|
|
|
# Sentiment Provider — OpenAI
|
|
OPENAI_API_KEY=
|
|
OPENAI_MODEL=gpt-4o-mini
|
|
OPENAI_SENTIMENT_BATCH_SIZE=5
|
|
|
|
# Fundamentals Provider — Financial Modeling Prep
|
|
FMP_API_KEY=
|
|
|
|
# Fundamentals Provider — Finnhub (optional fallback)
|
|
FINNHUB_API_KEY=
|
|
|
|
# Fundamentals Provider — Alpha Vantage (optional fallback)
|
|
ALPHA_VANTAGE_API_KEY=
|
|
|
|
# Dolt bulk data — local clone of post-no-preference/earnings (workstream A).
|
|
# DOLT_BINARY: path to the dolt CLI (set the full path in dev if it's not on PATH,
|
|
# e.g. Windows: C:\Program Files\Dolt\bin\dolt.exe). DOLT_DATA_DIR holds the
|
|
# clones; in PRODUCTION it MUST be outside the deploy tree (deploy is
|
|
# rsync --delete) — e.g. /var/lib/signal-platform/dolt. The earnings clone lives
|
|
# at <DOLT_DATA_DIR>/<DOLT_EARNINGS_SUBDIR>. Set up: dolt clone post-no-preference/earnings <dir>.
|
|
DOLT_BINARY=dolt
|
|
DOLT_DATA_DIR=dolt-data
|
|
DOLT_EARNINGS_SUBDIR=earnings
|
|
DOLT_MIN_FREE_DISK_GB=2.0
|
|
|
|
# Regime Monitor — FRED (VIX + HY credit spreads). Free key: https://fred.stlouisfed.org/docs/api/api_key.html
|
|
# Optional: without it the volatility (V1) and credit (C1) pillars show as n/a.
|
|
FRED_API_KEY=
|
|
|
|
# Scheduled Jobs
|
|
DATA_COLLECTOR_FREQUENCY=daily
|
|
SENTIMENT_POLL_INTERVAL_MINUTES=30
|
|
FUNDAMENTAL_FETCH_FREQUENCY=daily
|
|
RR_SCAN_FREQUENCY=daily
|
|
FUNDAMENTAL_RATE_LIMIT_RETRIES=3
|
|
FUNDAMENTAL_RATE_LIMIT_BACKOFF_SECONDS=15
|
|
|
|
# Scoring Defaults
|
|
DEFAULT_WATCHLIST_AUTO_SIZE=10
|
|
DEFAULT_RR_THRESHOLD=3.0
|
|
|
|
# Outcome Evaluation
|
|
# Trading days before an undecided setup expires at 0R
|
|
OUTCOME_EVALUATION_MAX_BARS=30
|
|
|
|
# Database Pool
|
|
DB_POOL_SIZE=5
|
|
DB_POOL_TIMEOUT=30
|
|
|
|
# Logging
|
|
LOG_LEVEL=INFO
|