Skip to content
All library documents

Python Options for Accessing Bloomberg Data and Excel Functions

Article Quant Q&A · Author: Juan

Summary

The document surveys ways to access Bloomberg data from Python, including requests similar to Excel's BDP and BDH functions. One answer recommends Bloomberg's blpapi as a direct interface and notes that wrappers such as pdblp can simplify use. Other responses mention TIA for Pandas workflows, pybbg for common Bloomberg queries, and Bloomberg's BQNT environment with Jupyter access to terminal data.

The examples illustrate reference data, historical data, bulk data, overrides, and intraday bars, showing the range of tasks these interfaces can support. The advice is based on user experience rather than a systematic comparison, and compatibility details may have changed: the response specifically describes TIA as Python 2 compatible at the time. Access depends on an authenticated Bloomberg session and appropriate entitlements, while library maintenance and API behavior should be checked against current documentation before adoption.

Key ideas

  • blpapi provides direct Python access to Bloomberg services.
  • pdblp and pybbg are wrappers that can simplify common data requests.
  • The responses describe reference, historical, bulk, and intraday data workflows.
  • TIA is presented as a Pandas-oriented option, with a period-specific compatibility caveat.
  • Bloomberg's BQNT offers a Jupyter environment for users with access enabled.

Tags

Full text
# Python libraries for bloomberg?


# Python libraries for bloomberg?












I am very new with python, and I am used to work with bloomberg formulas for excel. I am starting to use a lot more python in my analysis, is there any library that performs same functions as bdp, bdh or bcurve? Thanks! Juan

## Answer by Dimitri Vulis (score 5)

https://quant.stackexchange.com/a/53912

I have experimented with various choices quite a bit.

My advice is to use vanilla blpapi . There are many good examples in the git repository. Some helpful installation notes are also here .

There are packages built on top, such as pdblp that, in my opinion, are very good but not required by most people.

## Answer by DMSTA (score 2)

https://quant.stackexchange.com/a/54585

blpapi as mentioned it worth learning for sure. In addition to it, if you are looking to work with Pandas I would suggest using TIA: https://github.com/bpsmith/tia

At the moment, TIA is only compatible with Python 2, but here https://github.com/bpsmith/tia/issues/11 has a Python 3 conversion. I've been using this recently and it's pretty good. An example:

```
from tia.bbg import LocalTerminal
import tia.bbg.datamgr as dm
import datetime

sid = 'IBM US EQUITY'
event = 'TRADE'
dt = pd.datetools.BDay(-1).apply(pd.datetime.now())
start = pd.datetime.combine(dt, datetime.time(13, 30))
end = pd.datetime.combine(dt, datetime.time(21, 30))
f = LocalTerminal.get_intraday_bar(sid, event, start, end, 
interval=60).as_frame()
f.head(1)

      close     high    low   numEvents   open      time                value   volume
0   162.2500    162.70  161.51  4005    162.4900    2015-02-24 14:30:00  110345672  680888
```

The github link above has loads of examples, too.

## Answer by David Duarte (score 2)

https://quant.stackexchange.com/a/54590

I normally use pybbg which is also a wrapper for blpapi.

With a logged in Bloomberg session, just import it and start a connection

```
import pybbg as pybbg
bbg = pybbg.Pybbg()
```

Then you can use bdp, bdh, bds and bdih.

#### bdp

```
bbg.bdp('PGB 1.95 06/15/2029 Govt', ['MATURITY', 'COUPON', 'ISSUE_DT', 'YLD_YTM_MID'])
```

You can even query deals from SWPM...

```
pd.options.display.float_format = '{:,.2f}'.format
flds = ['SW_CURVE_DT', 'SW_MARKET_VAL', 'SW_CNV_BPV', 'VALUE_1_BP_CHANGE_IN_FIXED_CPN']
bbg.bdp('SLPA2EZJ Corp', flds)
```

...and provide overrides

```
flds = ['SW_CURVE_DT', 'SW_MARKET_VAL', 'SW_CNV_BPV', 'VALUE_1_BP_CHANGE_IN_FIXED_CPN']
overrides = {'SW_CURVE_DT': '20190507'}
bbg.bdp('SLPA2EZJ Corp', flds, overrides)
```

#### bdh

```
bbg.bdh('EUR Curncy', 'PX_LAST', '20200525')
```

#### bds

```
bbg.bds('YCSW0045 Index', 'CURVE_TENOR_RATES')
```

#### bdib

```
from datetime import  datetime
flds = ['close', 'high', 'low', 'open']
ticker = 'PGB 1.95 06/15/2029 Govt'
bbg.bdib(ticker, flds, datetime(2020,6,1,15,0), datetime(2020,6,1,15,30), eventType='ASK', interval = 5)
```

## Answer by VVKK77 (score 2)

https://quant.stackexchange.com/a/65507

Ask your Bloomberg rep to enable you for BQNT access. They will push a Python instance to your machine and you can go to the terminal and run BQNT

You will get a Jupyter environment that can use Bloomberg data

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.