xbbg
raw JSON → 1.2.1 verified Fri May 01 auth: no python
Independent client for Bloomberg data workflows. Current version 1.2.1, supports Python 3.10-3.14. Releases follow semantic versioning with frequent minor/patch updates. Provides pandas- and Arrow-native wrappers around Bloomberg's data services (historical, reference, tick, BQL, etc.) without requiring Bloomberg Terminal GUI.
pip install xbbg Common errors
error ModuleNotFoundError: No module named 'blpapi' ↓
cause Bloomberg SDK library not installed.
fix
pip install blpapi
error AttributeError: module 'xbbg' has no attribute 'bdh' ↓
cause Common mistake: importing bdh directly instead of accessing via xbbg.blp.
fix
from xbbg import blp; blp.bdh(...)
error KeyError: 'ticker must contain a security type' ↓
cause Ticker missing the exchange/type suffix (e.g., Equity, Curncy).
fix
Use full Bloomberg ticker like 'AAPL US Equity' or 'EURUSD Curncy'.
error BlpapiNotFoundException: Failed to create session ↓
cause Bloomberg Desktop API (bbcomm) not running or not available.
fix
Start Bloomberg Terminal or ensure Bloomberg Server API (SAPI) is configured.
error TypeError: unsupported operand type(s) for +: 'NoneType' and 'str' ↓
cause Data frame contains None or NaN due to no data, often from invalid tickers.
fix
Verify ticker strings and date range; check Bloomberg connectivity.
Warnings
gotcha All Bloomberg data functions (bdh, bdp, bds, etc.) are exposed via xbbg.blp, not as standalone imports. Common mistake: from xbbg import bdh (AttributeError). Always use: from xbbg import blp then blp.bdh(...). ↓
fix Use 'from xbbg import blp' and call blp.bdh(...).
gotcha Bloomberg ticker strings must include exchange/type suffix (e.g., 'AAPL US Equity', 'TSLA US Equity'). Omitting suffix (e.g., just 'AAPL') causes errors or wrong data. ↓
fix Always provide full Bloomberg ticker: 'TSLA US Equity', 'EURUSD Curncy', 'SPX Index'.
deprecated In version 1.1.0, the apps xbbg-browser, xbbg-bridge, and xbbg-server were removed. Users of those should migrate to JavaScript bindings or direct Python API. ↓
fix Use Python xbbg directly or the JavaScript/NAPI bindings (js-xbbg, napi-xbbg).
gotcha bdh with per=ticker/security yields multi-index columns. Reshaping or indexing incorrectly leads to unexpected outputs. ↓
fix Set pivot='on' to get ticker-column format, or handle MultiIndex appropriately.
gotcha Bloomberg API (blpapi) must be installed separately and configured. xbbg does not bundle it; pip install blpapi is required for live data. ↓
fix Run 'pip install blpapi' and ensure Bloomberg services (bbcomm) are available.
Install
pip install xbbg==1.2.1 Imports
- bdh
from xbbg import blp - bdp
from xbbg import blp - bds
from xbbg import blp
Quickstart
from xbbg import blp
df = blp.bdh(
tickers=['AAPL US Equity'],
flds=['PX_LAST'],
start_date='2024-01-01',
end_date='2024-01-10',
)
print(df.head())