$ show OpenBB-finance/OpenBB
OpenBB is an open-source financial data platform that provides a unified, multi-interface access layer to over 20 data providers (FMP, FRED, CBOE, Yahoo Finance, Intrinio, etc.) through a modular provider-extension architecture. The core library (`openbb_core`) defines a standardized Fetcher pattern (transform_query -> extract_data -> transform_data), Pydantic-based standard models for equities, derivatives, fixed income, economics, and more, and a command routing system exposed via a Python SDK (OBBject), a REST API (FastAPI), a CLI (argparse translator), a desktop app (Tauri + React), and an MCP (Model Context Protocol) server for AI agents. The platform includes domain-specific extensions (equity, crypto, economy, quantitative, technical analysis, charting) and a cookiecutter template for scaffolding new providers or OBBject extensions. While the codebase is large and actively maintained, there is notable technical drift in the form of hardcoded API URLs, mixed sync/async extraction, deprecated endpoints, and code duplication across many provider implementations. The charting extension's plugin-based technical indicator system, the country/exchange validation utilities, and the LRU cache with TTL are high-craftsmanship, reusable components that demonstrate non-obvious software engineering skill.
The LLM identified 5 files worth highlighting for reuse:
A plugin-based technical indicator system using a custom metaclass (`PluginMeta`) that automatically registers indicator subclasses into a `self.indicators` dict. Each plugin module defines indicators as classes inheriting from `Indicator` with `plot` methods. This pattern allows adding new indicators without modifying the charting core, and could be extracted for any domain requiring pluggable visualization overlays.
A `Country` type that validates and normalizes country names/ISO codes against a comprehensive embedded dataset (from `country_data.json`). Supports aliases (e.g., 'US', 'USA', 'United States'), group membership (G7, G20, EU, etc.), and returns consistent ISO codes. This is a self-contained, highly reusable component for any system that needs robust country input normalization.
An `Exchange` type that validates and normalizes exchange identifiers using ISO 10383 Market Identifier Codes (MIC). Backed by `exchange_data.json`, it supports lookup by MIC, short name, or common acronym (e.g., 'XNYS' for NYSE). This reusable component solves the common data engineering problem of normalizing exchange identifiers across multiple data sources.
A thread-safe LRU cache implementation with optional TTL (time-to-live) expiration. It uses `OrderedDict` for the LRU eviction policy and supports a `get_or_add` method that accepts a default factory. This is a clean, well-tested utility that could be extracted into any Python project needing a simple bounded cache with expiration.
The `Data` base class extends Pydantic's `BaseModel` with a custom `alias_generator` that converts camelCase API keys to snake_case, and a `model_config` allowing extra fields while maintaining strict type validation. This elegantly bridges the gap between external data source naming conventions and internal Pythonic attribute names, and is reusable wherever API responses need flexible field mapping.