Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Bloomberg API pdblp intraday request

pdblp allows daily historical Bloomberg requests via:

con = pdblp.BCon(debug=False)
con = start()
df = con.bdh(['SPY Equity'], 'PX_LAST', '20150103', '20150619')

How can intraday price/volume/open interest etc requests be made?

Desired behavior resembling as below, the price on 15 minute intervals.

df = con.bdh(['SPY Equity'], 'PX_Last', ... , periodSelection = 'MINUTE', period=15)
like image 977
rbonallo Avatar asked Jul 24 '17 14:07

rbonallo


1 Answers

Start time and end time must be in UTC timezone. So a bit of conversions should be made - and need to account for daylight savings as well.

Using xbbg instead is much easier:

In [1]: from xbbg import blp

In [2]: blp.bdib(ticker='SPY US Equity', dt='2018-11-20').tail()
Out[2]:
ticker                    SPY US Equity
field                              open   high    low  close   volume num_trds
2018-11-20 15:57:00-05:00        264.42 264.49 264.35 264.41   590775     2590
2018-11-20 15:58:00-05:00        264.42 264.42 264.26 264.27  1005241     3688
2018-11-20 15:59:00-05:00        264.26 264.48 264.12 264.15  4227150     7886
2018-11-20 16:09:00-05:00        264.12 264.12 264.12 264.12        0        1
2018-11-20 16:15:00-05:00        264.12 264.12 264.12 264.12        0        1

Need the full equity ticker here to find the timezone of exchange.

like image 158
Alpha Avatar answered Sep 22 '22 16:09

Alpha