Discover
Use bsrch, bgovts, bcurves, corporate bond, and preferred workflows to find instruments.
Fixed income
xbbg keeps fixed-income workflows on the same request engine as reference data, historical data, streaming, Python, and Node.js: typed requests in, Arrow-native output out.
WARNING
These examples require appropriate Bloomberg licenses, entitlements, and connectivity for the requested services and instruments.
Use bsrch, bgovts, bcurves, corporate bond, and preferred workflows to find instruments.
Use bqr / abqr for dealer quote workflows, broker attribution, spread price, yield fields, and date offsets.
Use YAS and bond helpers for yield analysis, duration, convexity, DV01, spread measures, key-rate risk, and cashflows.
Return pandas, Polars, PyArrow, DuckDB, Narwhals, or Arrow-backed results using the same backend model as the rest of xbbg.
from xbbg import blp
# List USD government curves
curves = blp.bcurves(currency='USD', curve_type='GOVERNMENT')
# Search for US Treasury securities
govts = blp.bgovts('T')
# Exact match only
specific = blp.bgovts('T 2.5 05/15/24', partial_match=False)bcurves() searches yield curves by country, currency, curve type, subtype, curve ID, or Bloomberg Global ID. bgovts() searches government securities by ticker or name.
from xbbg import blp
quotes = blp.bqr(
'US037833FB15@MSG1 Corp',
date_offset='-2d',
include_broker_codes=True,
include_spread_price=True,
include_yield=True,
)BQR retrieves dealer quote data using BID / ASK events by default and supports date offsets such as -2d, -1w, and -3h. Use start_date / end_date for explicit windows, or event_types=['TRADE'] when you only want trade events.
import asyncio
from xbbg import blp
async def main():
curves, quotes = await asyncio.gather(
blp.abcurves(currency='USD', curve_type='GOVERNMENT'),
blp.abqr(
'US037833FB15@MSG1 Corp',
date_offset='-2d',
include_broker_codes=True,
include_spread_price=True,
include_yield=True,
),
)
return curves, quotes
curves, quotes = asyncio.run(main())The async variants use the same parameter shape as the blocking helpers and run through the shared Rust worker pool.
The generated Python API exposes Bloomberg request helpers such as bqr, bcurves, and bgovts. Higher-level fixed-income analytics live under xbbg.ext where available in the installed package.
from datetime import date
from xbbg.ext.fixed_income import yas
from xbbg.ext.bonds import bond_risk, bond_cashflows
yield_table = yas(
'US912810TM69 Govt',
'YAS_BOND_YLD',
settle_dt=date(2024, 6, 15),
)
risk = bond_risk('T 4.5 05/15/38 Govt', settle_dt=date(2024, 6, 15))
cashflows = bond_cashflows('T 4.5 05/15/38 Govt')Use these helpers when the workflow is about analytics rather than raw field retrieval: yield analysis, duration, convexity, DV01, spreads, cashflow schedules, and key-rate risk.
from xbbg.ext import corporate_bonds, preferreds
issuer_bonds = corporate_bonds('AAPL US Equity')
issuer_preferreds = preferreds('BAC US Equity')These helpers are useful for issuer-linked discovery workflows before requesting reference fields, quote history, or risk analytics for individual securities.
Fixed-income helpers use the same production controls as the rest of xbbg:
from xbbg import blp
@blp.add_middleware
async def audit_fixed_income(context, call_next):
context.metadata['desk'] = 'fixed-income'
return await call_next(context)Request middleware is the right place to attach desk tags, request IDs, tracing spans, metrics, entitlement checks, or policy decisions across all fixed-income calls.
Run concurrent requests without changing the helper shape.
Choose pandas, Polars, PyArrow, DuckDB, or Narwhals.
Configure Terminal, B-PIPE, ZFP, TLS, failover, SOCKS5, and SDK logging.
Browse generated signatures for BQR, BCURVES, BGOVTS, and more.