First A3 implementation checkpoint (design: docs/dolt-sec-a3-design.md). - sec_client.py: async SEC EDGAR client honoring fair-access — identifying User-Agent (config), request spacing < 10 req/s, exponential backoff on 429, and 403 -> SecForbiddenError (alert and stop, never retry-loop). Fetchers: company_tickers (normalised, multi-class share CIK), submissions (merges the paginated filings.files shards so full history is visible), companyfacts, daily_index (fixed-width form.idx parse), latest_index_date. - sec_universe.py: resolve_ciks (tickers.cik backfill), refresh_sic (sic/sic_description), and the composite-revision pieces — universe_fingerprint (a new ticker changes the revision, so it's never no_op'd/starved), index_content_hash, compose_revision. - config + .env.example: SEC_USER_AGENT (must be a real contact email) + spacing / retries / timeout. Verified live against real SEC: AAPL->320193, GOOG==GOOGL, BRK-B resolved; submissions shard-merge proven (131 filings back to 1993); daily index parsed. Tests: 11 (mocked-transport parsing + 403/429 handling + resolution/fingerprint). Full suite 713 passed. Next slice: companyfacts -> snapshot parser + importer. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
80 lines
2.5 KiB
Bash
80 lines
2.5 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
|
|
# Free-space floor checked before a pull (clone is ~1.7 GB and grows). 5 GB is a
|
|
# safe production default; lower only on a space-constrained dev box.
|
|
DOLT_MIN_FREE_DISK_GB=5.0
|
|
# Hard timeout (s) on each dolt subprocess so a hung pull/sql can't pin the
|
|
# import connection + advisory lock.
|
|
DOLT_COMMAND_TIMEOUT_SECONDS=600.0
|
|
|
|
# SEC EDGAR (fundamentals, workstream A). SEC fair-access REQUIRES an identifying
|
|
# User-Agent with a REAL contact email — set it, or requests get 403'd. Stay well
|
|
# under 10 req/s (spacing below).
|
|
SEC_USER_AGENT=signal-platform/1.0 (contact: you@example.com)
|
|
SEC_REQUEST_SPACING_SECONDS=0.2
|
|
SEC_MAX_RETRIES=4
|
|
SEC_REQUEST_TIMEOUT_SECONDS=30.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
|