alpha-xone / xbbg

An intuitive Bloomberg API
https://xbbg.readthedocs.io/
Apache License 2.0
249 stars 52 forks source link

Multi Day Intraday bar data #14

Closed mcdonaldaj closed 4 years ago

mcdonaldaj commented 4 years ago

Hi - Great library. thank you enormously.

currently blp.bdib() will only return intraday data for one date. it would be very useful to allow a dtFrom & dtTo and return data across multiple sessions.

i've hacked a suggestion via time_range() and blp.bdib(). see attached.

xbbg_idbib_multidayExample.txt

alpha-xone commented 4 years ago

This package tries to provide simplest interface for data access. There are combinations of choices for multiple days, multiple tickers, even how to combine multiple tickers with timezone choices, and etc. Inevitably you have to write codes on top of it to meet your goals.

Additionally, bdib involves caching and loading data for each day.

It's relatively easy to download and combine data for few days as below:

pd.concat([
    blp.bdib('QQQ US Equity', dt=dt, session='day')
    for dt in pd.bdate_range(end='today', periods=6)[:-1]
], sort=False)