Skip to main content
Version: v5

openbb-core

openbb-core is the runtime layer. By itself it ships no data, no providers, and no commands. It finds the extensions installed in the current Python environment, merges them into one router, generates the typed obb client from that router, and serves the same router as a FastAPI application. Every call returns an OBBject.

The package contains both the openbb_core module and the openbb module that from openbb import obb imports. Most users never install it directly; provider and toolkit packages depend on it.

Installation​

pip install openbb-core

Two optional extras are declared. pandas adds pandas, which the data-processing extensions, openbb-news, and openbb-charting require through openbb-core[pandas]. flask adds Flask and a2wsgi.

pip install "openbb-core[pandas]"

The package requires Python >=3.10,<4. Its direct dependencies are fastapi, uvicorn, pydantic 2, websockets, aiohttp, requests, python-multipart, uuid7, importlib-metadata, python-dotenv, ruff, pyjwt, and, on Python 3.10, tomli.

Entry points​

Extensions register with the runtime through setuptools entry points. The core reads three groups.

GroupTargetResult
openbb_core_extensiona Router, FastAPI, or APIRouter instanceCommands mounted under obb.<name> and /api/v1/<name>
openbb_provider_extensiona Provider instanceA data source selectable with provider="<name>"
openbb_obbject_extensionan Extension instanceAn accessor on every OBBject, or a callback on command output

A fourth group, openbb_charting_extension, is read by the charting engine rather than by the core; it maps chart views to command routes. The extension types page describes each group and its options.

Each V5 provider package registers both a provider entry point and a router entry point, which is how obb.fred, obb.sec, and the other provider namespaces come to exist.

Building the Python client​

The obb object is generated code. After installing, upgrading, or removing an extension, regenerate it:

openbb-build

The command imports openbb in a subprocess, which rebuilds the static package when it is missing or stale, and calls openbb.build() directly if the import did not rebuild. Importing openbb also rebuilds on its own when it detects that extensions were added or removed since the last build; set OPENBB_AUTO_BUILD=false to turn that off, for example in a container image where the build ran at install time.

Serving the REST API​

The router that backs from openbb import obb is also a FastAPI application at openbb_core.api.rest_api:app, so any ASGI server can run it:

uvicorn openbb_core.api.rest_api:app --reload

The interactive OpenAPI documentation is served at /docs. For Workspace integration, widgets, and launcher options, use openbb-api, which wraps this application.

Classes for extension authors​

Extension packages build on a small set of public classes.

ClassImport pathRole
Routeropenbb_core.app.routerDeclares commands with @router.command(...)
Provideropenbb_core.provider.abstract.providerDescribes a data source, its credentials, and its fetchers
Fetcheropenbb_core.provider.abstract.fetcherImplements transform_query, extract_data or aextract_data, and transform_data
QueryParamsopenbb_core.provider.abstract.query_paramsBase Pydantic model for command parameters
Dataopenbb_core.provider.abstract.dataBase Pydantic model for returned rows
OBBjectopenbb_core.app.model.obbjectThe response envelope
Extensionopenbb_core.app.model.extensionRegisters an OBBject accessor or command-output callback

A provider's credentials are named <provider>_<credential>: a Provider(name="fred", credentials=["api_key"]) produces the credential fred_api_key.

See the architecture page for how a call flows through these pieces, and the extension types section to start building.