Xbbg
An intuitive Bloomberg API
Install / Use
/learn @alpha-xone/XbbgREADME
<a href="https://github.com/alpha-xone/xbbg"><img src="https://raw.githubusercontent.com/alpha-xone/xbbg/main/docs/src/assets/xbbg-logo.png" alt="xbbg logo" width="150"></a>
<!-- markdownlint-disable MD036 -->xbbg: An intuitive Bloomberg API for Python
<!-- markdownlint-enable MD036 --><a href="https://www.buymeacoffee.com/Lntx29Oof"><img src="https://img.shields.io/badge/Buy%20Me%20a%20Coffee-1E3A8A?style=plastic&logo=buy-me-a-coffee&logoColor=white" alt="Buy Me a Coffee"></a>
Quick Links: Discord • Documentation • Installation • Quickstart • Examples • Contributing • Changelog
</div> <!-- markdownlint-enable MD033 MD041 --><!-- xbbg:latest-release-start -->
Latest release: xbbg==1.0.0rc2 (release: notes)
<!-- xbbg:latest-release-end -->This
mainbranch now tracks the Rust-based v1 beta line, a significant upgrade over 0.x in performance and architecture. Need the legacy pure-Python behavior? Userelease/0.x.
Table of Contents
- Overview
- Why Choose xbbg?
- Supported Functionality
- Requirements
- Installation
- Quickstart
- Examples
- Data Storage
- Troubleshooting
- Development
- Contributing
- Getting Help
- Links
- License
Overview
xbbg is a comprehensive Bloomberg API wrapper for Python, providing a clean, Pythonic interface to Bloomberg data services.
This main branch is the v1 beta generation: core request execution is now Rust-powered while preserving the familiar xbbg API for day-to-day workflows.
Key Features
<table> <tr> <td width="50%">Complete API Coverage
- Reference data (BDP/BDS)
- Historical time series (BDH)
- Intraday bars and tick data
- Real-time subscriptions
- BQL, BEQS, and BSRCH queries
- Technical analysis (BTA)
Production-Grade Features
- Parquet caching for intraday bars
- Async/await support for non-blocking operations
- Multi-backend output (pandas, Polars, PyArrow, DuckDB)
- Full type hints for IDE integration
- Comprehensive error handling
- Exchange-aware market hours
Excel Compatibility
- Familiar Bloomberg Excel syntax
- Same field names and date formats
- Minimal learning curve for Excel users
- Direct migration path from Excel workflows
Developer Experience
- Consistent, intuitive API design
- Extensive documentation and examples
- Active community support (Discord)
- Regular updates and maintenance
- Semantic versioning
Quick Example
from xbbg import blp
# Reference data
prices = blp.bdp(['AAPL US Equity', 'MSFT US Equity'], 'PX_LAST')
# Historical data
hist = blp.bdh('SPX Index', 'PX_LAST', '2024-01-01', '2024-12-31')
# Intraday bars with sub-minute precision
intraday = blp.bdib('TSLA US Equity', dt='2024-01-15', interval=10, intervalHasSeconds=True)
See examples/xbbg_jupyter_examples.ipynb for comprehensive tutorials and examples.
Why Choose xbbg?
xbbg is the most complete and production-ready Bloomberg API wrapper for Python, trusted by quantitative researchers and financial engineers worldwide. Here's what sets it apart:
🎯 Unmatched Feature Coverage
xbbg is the only Python library that provides:
- Complete Bloomberg API access: All major services (Reference, Historical, Intraday, Real-time, BQL, BEQS, BSRCH)
- Sub-second precision: Down to 10-second intraday bars (unique to xbbg)
- Real-time streaming: Live market data with async support
- Advanced utilities: Futures/CDX contract resolution, currency conversion, market hours
📊 Production-Grade Features
- Intraday caching: Automatic Parquet storage for
bdib()bar data - Async/await support: Non-blocking operations for modern Python applications
- Exchange-aware sessions: Precise market hour handling for 50+ global exchanges
- Type safety: Full type hints for IDE autocomplete and static analysis
- Comprehensive error handling: Clear, actionable error messages
💡 Developer Experience
- Excel-compatible: Use familiar Bloomberg Excel syntax - zero learning curve
- Pythonic API: Consistent, intuitive function names (
bdp,bdh,bdib) - Rich documentation: 100+ examples, Jupyter notebooks, comprehensive guides
- Active community: Discord support, regular updates, responsive maintainers
🚀 Performance & Reliability
- Battle-tested: Used in production by hedge funds, asset managers, and research teams
- Modern Python: Supports Python 3.10-3.14 with latest language features
- CI/CD pipeline: Automated testing across multiple Python versions and platforms
- Semantic versioning: Predictable releases with clear upgrade paths
Comparison with Alternatives
| Feature | xbbg | pdblp | blp | polars-bloomberg | |---------|------|-------|-----|------------------| | Data Services | | | | | | Reference Data (BDP/BDS) | ✅ | ✅ | ✅ | ✅ | | Historical Data (BDH) | ✅ | ✅ | ✅ | ✅ | | Intraday Bars (BDIB) | ✅ | ❌ | ❌ | ✅ | | Tick-by-Tick Data | ✅ | ❌ | ❌ | ❌ | | Real-time Subscriptions | ✅ | ❌ | ❌ | ❌ | | Advanced Features | | | | | | Equity Screening (BEQS) | ✅ | ❌ | ❌ | ❌ | | Query Language (BQL) | ✅ | ❌ | ❌ | ✅ | | Quote Request (BQR) | ✅ | ❌ | ❌ | ❌ | | Search (BSRCH) | ✅ | ❌ | ❌ | ✅ | | Technical Analysis (BTA) | ✅ | ❌ | ❌ | ❌ | | Yield & Spread Analysis (YAS) | ✅ | ❌ | ❌ | ❌ | | Developer Features | | | | | | Excel-compatible syntax | ✅ | ❌ | ❌ | ❌ | | Sub-minute intervals (10s bars) | ✅ | ❌ | ❌ | ❌ | | Async/await support | ✅ | ❌ | ❌ | ❌ | | Intraday bar caching (Parquet) | ✅ | ❌ | ❌ | ❌ | | Multi-backend output | ✅ | ❌ | ❌ | ❌ | | Utilities | | | | | | Currency conversion | ✅ | ❌ | ❌ | ❌ | | Futures contract resolution | ✅ | ❌ | ❌ | ❌ | | CDX index resolution | ✅ | ❌ | ❌ | ❌ | | Exchange market hours | ✅ | ❌ | ❌ | ❌ | | Project Health | | | | | | Active development | ✅ | ❌[^1] | ✅ | ✅ | | Python version support | 3.10-3.14 | 3.8+ | 3.8+ | 3.12+ | | DataFrame library | Multi-backend | pandas | pandas | Polars | | Type hints | ✅ Full | ❌ | Partial | ✅ Full | | CI/CD testing | ✅ | ❌ | ✅ | ✅ |
[^1]: pdblp has been superseded by blp and is no longer under active development.
Bottom line: If you need comprehensive Bloomberg API access with production-grade features, xbbg is the clear choice.
Complete API Reference
Reference Data - Point-in-Time Snapshots
| Function | Description | Key Features |
|----------|--------------|-------------|
| bdp() | Get current/reference data | Multiple tickers & fields<br>Excel-style overrides<br>ISIN/CUSIP/SEDOL support |
| bds() | Bulk/multi-row data | Portfolio holdings<br>Fixed income cash flows<br>Corporate actions |
| abdp() | Async reference data | Non-blocking operations<br>Concurrent requests<br>Web application friendly |
| abds() | Async bulk data | Parallel bulk queries<br>Same API as bds() |
| bflds() | Unified field metadata | Get field info or search by keyword<br>Single function for both use cases |
| fieldInfo() | Field metadata lookup (alias for bflds) | Data types & descriptions<br>Discover available fields |
| fieldSearch() | Search Bloomberg fields (alias for bflds) | Find fields by keyword<br>Explore data catalog |
| blkp() | Find tickers by name | Company name search<br>Asset class filtering |
| bport() | Portfolio data queries | Dedicated portfolio API<br>Holdings & weights |
Fixed Income Analytics
| Function | Description | Key Features |
|----------|-------------|--------------|
| yas() | Yield & Spread Analysis | YAS calculator wrapper<br>YTM/YTC yield types<br>Price↔yield conversion<br>Spread calculations |
Bond Analytics (via xbbg.ext)
| Function | Description | Key Features |
|----------|-------------|--------------|
| bond_info() | Bond reference metadata | Ratings, maturity, coupon |
| bond_risk() | Duration and risk metrics | Modified/Macaulay duration, convexity, DV01 |
| bond_spreads() | Spread analytics | OAS, Z-spread, I-spread, ASW |
| bond_cashflows() | Cash flow schedule | Coupon and principal payments |
| bond_key_rates() | Key rate durations | Key rate DV01s and risks |
| bond_curve() | Relative value comparison | Multi-bond analytics |
Options Analytics (via xbbg.ext)
| Function | Description | Key Features |
|----------|-------------|--------------|
| option_info() | Contract metadata | Strike, expiry, exercise
