Skip to content

Installation

Install xbbg and connect it to Bloomberg.

The package ships the Python API and the native engine; your environment supplies Bloomberg connectivity, the Bloomberg runtime library, and entitlements.

Requirements ​

Python

CPython 3.11 through 3.15. Wheels are published for Windows x64, Linux x86_64 (glibc 2.28 or newer), and macOS.

Bloomberg access

A Bloomberg Terminal (Desktop API), Server API, B-PIPE, or ZFP leased line, with the entitlements for the data you request.

Bloomberg runtime library

blpapi3_64.dll or libblpapi3_64.so, from Bloomberg's blpapi wheel, a Terminal install, or a Bloomberg C++ SDK.

Linux wheels are manylinux_2_28: RHEL/Alma/Rocky 8+, Debian 10+, Ubuntu 20.04+, and Amazon Linux 2023 work. ZFP leased lines also need Bloomberg-issued TLS credentials; see ZFP over Leased Lines.

Since 1.8.0, releases also include free-threaded CPython wheels (cp314t, cp315t) for Linux x86_64, Windows x64, and macOS arm64, marked beta. PyArrow, pandas, and Narwhals output work there; the Polars and DuckDB backends and xbbg-langgraph do not, because they or their dependencies publish no free-threaded wheels. The package no longer declares an upper Python bound, so newer interpreters resolve to the current release (building from source when no wheel exists); the supported versions are unchanged.

Install xbbg ​

bash
pip install xbbg

or from conda-forge:

bash
conda install -c conda-forge xbbg

The only required dependency is narwhals. Install the dataframe libraries you want as extras:

bash
pip install "xbbg[pyarrow]"     # pyarrow.Table output (recommended)
pip install "xbbg[pandas]"      # pandas DataFrames
pip install "xbbg[polars]"      # Polars DataFrames and LazyFrames
pip install "xbbg[duckdb]"      # DuckDB relations

Package page: PyPI / xbbg

Provide the Bloomberg runtime ​

xbbg does not need Bloomberg's Python package as such — only the runtime library it ships. When the native extension first loads (on the first request or first engine use since 1.8.0, at import xbbg before that), xbbg looks in this order and uses the first source found; discovery locates the blpapi package without importing it:

  1. a path set with xbbg.set_sdk_path()
  2. Bloomberg's blpapi Python package
  3. a Bloomberg Terminal (DAPI) installation
  4. the BLPAPI_ROOT environment variable
Bloomberg's blpapi wheel (simplest)
bash
pip install blpapi --index-url https://blpapi.bloomberg.com/repository/releases/python/simple/
Bloomberg Terminal (DAPI)

On a machine with a Terminal, xbbg probes the standard DAPI locations automatically:

  • Windows: %SystemDrive%\blp\DAPI, Bloomberg\Blp\DAPI under %ProgramFiles% and %ProgramFiles(x86)%, and Bloomberg\DAPI or Bloomberg\Blp\DAPI under %LOCALAPPDATA%
  • Linux and macOS: ~/blp/DAPI and /opt/bloomberg/DAPI
Bloomberg C++ SDK or a custom location

Point BLPAPI_ROOT at an extracted Bloomberg C++ SDK:

bash
export BLPAPI_ROOT=/path/to/blpapi_cpp_3.x.x.x

or set a directory at runtime, before the first request:

python
import xbbg

xbbg.set_sdk_path('/path/to/blpapi_cpp_3.x.x.x')

xbbg.clear_sdk_path() returns to automatic detection.

Verify the installation ​

python
import xbbg

print(xbbg.__version__)
print(xbbg.get_sdk_info())

get_sdk_info() returns a dict with sources (every runtime source found, with versions), active (the source in use), and runtime_version. If importing the native extension fails, the error lists these options; see Troubleshooting.

Configure the first connection ​

With a Terminal on the same machine, no configuration is needed: the first request connects to localhost:8194. For anything else, configure the engine once before the first request:

python
import xbbg

xbbg.configure(host='localhost', port=8194)

For Server API/B-PIPE authentication, ZFP, TLS, failover, SOCKS5, timeouts, and SDK logging, continue to Configuration.

Building from source ​

The source distribution compiles the Rust extension: it needs Rust 1.88 or newer and the Bloomberg C++ SDK headers and libraries (BLPAPI_ROOT). In a repository checkout, scripts/sdktool.sh (macOS/Linux) or scripts/sdktool.ps1 (Windows) stages an SDK, and the repository README covers the development setup.

Agent tools ​

  • MCP Server — a separate local MCP server for coding agents, with its own downloads.
  • LangChain and LangGraph — Bloomberg tools for Python agents (xbbg-langgraph, installed from source).

Next steps ​

Configuration

Desktop, B-PIPE, ZFP, TLS, failover, SOCKS5, authentication, and logging.

xbbg is independent open-source software and is not affiliated with, endorsed by, sponsored by, or approved by Bloomberg Finance L.P.