1

So I've been using this one package called xbbg which is more or less syntactically the same as the Excel API, and everything has been working fine except for the blp.bdib calls. Every time I try running it, including the example provided in the docs (blp.intraday(ticker='7974 JT Equity', dt='2018-10-17', session='am_open_30').tail() ), it returns an empty data frame. Could someone run me through piece-by-piece how to map these assets.yml and exch.yml to the BBG_ROOT sys path? Sorry, I'm quite the rookie at this. See https://pypi.org/project/xbbg/ specifically the section on the blp.bdib (intraday bars) example and the accompanying text below it.

Tried copying the exch.yml and assets.yml files to a folder called BBG_ROOT in my blp folder for the Bloomberg install, and then appending BBG_ROOT in sys.path.append() but it doesn't seem to help. Also, for reference, I'm trying to get high and low prices on September-dated Nikkei and SPX futures contracts, so from what I can see, the assets and exchange ymls already include the definitions by default.

user494427
  • 11
  • 4
  • Bloomberg only gives access to the past 6 months for intraday data. You may want to try a more recent date and see if it makes a difference. – assylias Jun 24 '19 at 04:01
  • I did this already, and thanks, that solved the first part of my problem. However, when trying to specify the exchanges and assets for NOU9 Index and ESU9 Index, which I did, I’m still getting an empty dataframe. – user494427 Jun 24 '19 at 14:34

1 Answers1

1

It takes a different approach to reference futures. You can specify NO contract the same way as in assets.yml:

  - tickers: [ES, DM, NQ]
    exch: CME
    freq: Q
    is_fut: True

Exchange should be FuturesJapan, which is already available in exch.yml.


Intraday data for futures

After update to xbbg 0.3.1, you can use blp.fut_ticker to check for any given date, what's 1 or 2 referring to. For example:

In [1]: from xbbg import blp
In [2]: blp.fut_ticker('NK1 Index', dt='2019-08-07', freq='Q')
Out[2]: 'NKU9 Index'

You can add log='debug' to above function to see the full futures chain.

You can also use blp.active_futures to see which contract is active for any given date:

In [3]: blp.active_futures('NKA Index', dt='2019-08-07')
Out[3]: 'NKU9 Index'

Then you can use blp.bdib and generic futures contract to download historical intraday data:

In [4]: blp.bdib('NK1 Index', '2019-08-07').tail()
Out[4]:
ticker                    NK1 Index
field                          open      high       low     close volume num_trds
2019-08-07 15:05:00+09:00 20,490.00 20,490.00 20,470.00 20,480.00    170       25
2019-08-07 15:06:00+09:00 20,480.00 20,480.00 20,480.00 20,480.00    193       34
2019-08-07 15:07:00+09:00 20,480.00 20,500.00 20,470.00 20,500.00    450       76
2019-08-07 15:08:00+09:00 20,500.00 20,520.00 20,500.00 20,520.00    492       49
2019-08-07 15:09:00+09:00 20,520.00 20,530.00 20,510.00 20,510.00    471       63
Alpha
  • 2,372
  • 3
  • 21
  • 23