Prerequisite refactor: - Consolidate duplicate _to_dicts into shared obb_utils.to_list - Add fetch_historical and first_or_empty helpers to obb_utils Phase 1 - Local computation (no provider risk): - Group I: 12 technical indicators (ATR, ADX, Stoch, OBV, Ichimoku, Donchian, Aroon, CCI, Keltner, Fibonacci, A/D, Volatility Cones) - Group J: Sortino, Omega ratios + rolling stats (variance, stdev, mean, skew, kurtosis, quantile via generic endpoint) - Group H: ECB currency reference rates Phase 2 - FRED/Federal Reserve providers: - Group C: 10 fixed income endpoints (treasury rates, yield curve, auctions, TIPS, EFFR, SOFR, HQM, commercial paper, spot rates, spreads) - Group D: 11 economy endpoints (CPI, GDP, unemployment, PCE, money measures, CLI, HPI, FRED search, balance of payments, Fed holdings, FOMC documents) - Group E: 5 survey endpoints (Michigan, SLOOS, NFP, Empire State, BLS search) Phase 3 - SEC/stockgrid/FINRA providers: - Group B: 4 equity fundamental endpoints (management, dividends, SEC filings, company search) - Group A: 4 shorts/dark pool endpoints (short volume, FTD, short interest, OTC dark pool) - Group F: 3 index/ETF enhanced (S&P 500 multiples, index constituents, ETF N-PORT) Phase 4 - Regulators: - Group G: 5 regulatory endpoints (COT report, COT search, SEC litigation, institution search, CIK mapping) Security hardening: - Service-layer allowlists for all getattr dynamic dispatch - Regex validation on date, country, security_type, form_type params - Exception handling in fetch_historical - Callable guard on rolling stat dispatch Total: 32 existing + 67 new = 99 endpoints, all free providers.
1.3 KiB
1.3 KiB
Research Findings
Architecture Analysis (2026-03-19)
Current Codebase
- 22 Python files, flat layout, all under 250 lines
- Pattern: service file (async OpenBB wrapper) + route file (FastAPI router with @safe decorator)
- Shared utils: obb_utils.py, route_utils.py, mappers.py, models.py
Technical Debt
- Duplicated
_to_dictsin openbb_service.py and macro_service.py (same as obb_utils.to_list) - calendar_service.py has scope creep (ownership, screening mixed with calendar events)
- No shared
fetch_historicalhelper (duplicated in technical_service.py and quantitative_service.py)
Provider Availability (Verified)
- No API key needed: yfinance, stockgrid, finra, multpl, cftc, government_us, sec, ecb, cboe
- Already configured: fred, finnhub, alphavantage
- Not needed: fmp (removed), intrinio, tiingo, benzinga
Key Design Decisions
- Keep flat file layout (avoid breaking all imports for ~40 files)
- Domain-prefixed naming for new files
- Generic technical indicator dispatcher pattern for 14 new indicators
- Consolidate _to_dicts before adding new services
OpenBB Features Discovered
- 67 new endpoints across 10 groups (A-J)
- 3 Small, 4 Medium, 3 Large complexity groups
- All use free providers (no new API keys required)