Skip to content

Fixed income

Bonds, curves, quotes, and yield analytics.

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.

Workflow map ​

Discover

Use bsrch, bgovts, bcurves, corporate bond, and preferred workflows to find instruments.

Quote

Use bqr / abqr for dealer quote workflows, broker attribution, spread price, yield fields, and date offsets.

Analyze

Use YAS and bond helpers for yield analysis, duration, convexity, DV01, spread measures, key-rate risk, and cashflows.

Output

Return pandas, Polars, PyArrow, DuckDB, Narwhals, or Arrow-backed results using the same backend model as the rest of xbbg.

Discover curves and government securities ​

python
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.

Request dealer quotes with BQR ​

python
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.

Use async variants for services ​

python
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.

YAS and bond analytics ​

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.

python
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.

Corporate bonds and preferreds ​

python
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.

Output and middleware ​

Fixed-income helpers use the same production controls as the rest of xbbg:

  • pandas
  • Polars
  • PyArrow
  • DuckDB
  • Narwhals
  • request middleware
  • SDK logging
  • typed errors
python
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.

Async Patterns

Run concurrent requests without changing the helper shape.

Configuration

Configure Terminal, B-PIPE, ZFP, TLS, failover, SOCKS5, and SDK logging.

API Reference

Browse generated signatures for BQR, BCURVES, BGOVTS, and more.

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