Skip to content

Python

xbbg for notebooks, pipelines, and services.

Bloomberg-style helpers in Python, while sessions, authentication, async execution, middleware, and Arrow-native output run on the same Rust engine as @xbbg/core.

Start here ​

Install

Install from PyPI or conda-forge on Python 3.11–3.15, provide the Bloomberg runtime, and check detection with get_sdk_info().

Make requests

bdp, bdh, bds, intraday bars and ticks, BQL and search, generic requests, subscriptions, and fixed-income workflows.

Choose outputs

Narwhals by default, or native Arrow, PyArrow, pandas, Polars, and DuckDB — in long, typed, or field-per-column shapes.

Run in production

Async helpers, scoped engines, request middleware, B-PIPE/SAPI authentication, TLS, ZFP, failover, SOCKS5, sharding, and SDK logging.

Why xbbg ​

Many Python Bloomberg packages wrap Bloomberg's blpapi Python bindings directly. That is enough for small scripts, but production workflows still have to decide where session lifecycle, event parsing, concurrency, diagnostics, enterprise connectivity, and output conversion live.

xbbg puts those concerns in a native Rust engine on the Bloomberg C++ SDK. The engine manages sessions and worker pools, builds typed Arrow output, shares real-time feeds between subscriptions, and handles enterprise transports — ZFP over leased lines, B-PIPE/SAPI authentication, TLS, failover servers, SOCKS5 — alongside SDK logging, field validation, request diagnostics, and request middleware.

API families ​

FamilyHelpersUse when
Reference, historical, bulkbdp, bdh, bds, bdib, bdtick (+ async)Core market-data retrieval
Query and searchbql, beqs, bsrch, blkp, bport, bflds, requestBloomberg services beyond field pulls
Streamingsubscribe, asubscribe, stream, astream, vwap, mktbar, depth, chainsReal-time data with shared feeds and diagnostics
Fixed incomebqr, bcurves, bgovts, ext.yas, ext.bond_*, ext.corporate_bonds, ext.preferredsQuotes, curves, government securities, yield and risk analytics
Analytics recipesext futures, CDX, options, ETF NAV, volatility surfaces, index members, ISINs, dividends, btaMulti-step Bloomberg workflows
Exchange auctionsext.resolve_venues, ext.auction_snapshot, ext.subscribe_auctionImbalance and auction data on the right venue
Entitlementsdelay_status, check_entitlements, seat_type, return_eids=, on_delayed=Knowing what a session may see and whether it is delayed
Operationsconfigure, Engine, middleware, logging, backends, xbbg.testingProduction setup, observability, and tests

Request middleware ​

Middleware receives each request's parameters, an engine snapshot, and the result, so one shared chain can add audit logging, request IDs, metrics, tracing, entitlement checks, policy enforcement, and caching without wrapping every bdp(), bdh(), or bql() call. See Request Middleware.

Compared with other Bloomberg Python packages ​

  • Raw blpapi is official but low-level: each application builds session startup, service opening, request construction, correlation IDs, event parsing, error mapping, retries, logging, and dataframe conversion itself. xbbg keeps SDK access underneath and adds typed helpers, generic requests, typed errors, async execution, and Arrow output.
  • bbg-fetch is a pandas-oriented Desktop API helper; NumPy and pandas are required dependencies.
  • pdblp is a pandas-era wrapper whose last release dates from 2019.
  • blp is a cleaner pandas wrapper (python>=3.6, pandas required) in the same classic category.
  • polars-bloomberg is Polars-first (Python 3.12+). xbbg treats Polars as one backend among several and adds intraday, streaming, enterprise transports, middleware, diagnostics, and Node.js support on the same engine.

Quick example ​

python
import xbbg

prices = xbbg.bdp(
    ['AAPL US Equity', 'MSFT US Equity'],
    ['PX_LAST', 'VOLUME'],
)

The top-level helpers (xbbg.bdp(...), xbbg.configure(...)) and the module style (from xbbg import blp, then blp.bdp(...)) are the same functions. Analytics helpers live in xbbg.ext.

Next steps ​

Quick Start

Reference, historical, bulk, intraday, async, streaming, and fixed-income requests.

Streaming Data

Subscriptions, shared feeds, current-value boards, and diagnostics.

Fixed Income

Curves, government securities, BQR, YAS, corporate bonds, and bond analytics.

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