1

I am trying to use the Bloomberg Python API. As I have no idea how to use the blpapi package even after reading the examples, I am trying to use xbbg package. I tried a few of the basic examples such as :

from xbbg import blp
blp.bdp(tickers='NVDA US Equity', flds=['Security_Name', 'GICS_Sector_Name'])

or

from xbbg import blp
blp.bdp('AAPL US Equity', 'Eqy_Weighted_Avg_Px', VWAP_Dt='20181224')

But I always receive an empty DataFrame, whatever the query is...

Do I have to ask a specific Python API access to my Bloomberg sales referent ? I don't really understand how xbbg connects to my Bloomberg account, I only need to have Bloomberg Terminal launched on my machine ?

Any help would be appreciated.

Madininais
  • 100
  • 9
  • yes you only need the terminal running on the same machine and bbcomm.exe process must be started (should be automatic). I'm not familiar with the Python API but if you have a way to inspect logs or increase logging verbosity qou will hopefully get more info about the issue. – assylias Apr 08 '21 at 11:11
  • For `Eqy_Weighted_Avg_Px`, Bloomberg only offers data within around 6 months. You need a closer date to receive data. – Alpha Apr 08 '21 at 13:07
  • Thanks, still empty with '20210324' as VWAP_Dt. I am trying to decompose the code and run it separately. Will keep you posted. – Madininais Apr 08 '21 at 13:22
  • EDIT : when I try to use tia package. The sample example returns an error : ``` import pandas as pd import tia.bbg.datamgr as dm # create a DataManager for simpler api access mgr = dm.BbgDataManager() # retrieve a single security accessor from the manager msft = mgr['MSFT US EQUITY'] # Can now access any Bloomberg field (as long as it is upper case) msft.PX_LAST, msft.PX_OPEN ``` – Madininais Apr 09 '21 at 14:54
  • the error : Exception: CID: {[ valueType=AUTOGEN classId=0 value=3 ]} RequestId: 65444a67-6015-4558-92b1-fbe0d0b4a4a7 ReferenceDataResponse = { responseError = { source = "rsfrdsvc2" code = 28 category = "NO_AUTH" message = "Authorization denied [nid:19556] " subcategory = "INVALID_USER" } } – Madininais Apr 09 '21 at 14:55
  • To be pedantic, you are using xbbg which is a 3rd party wrapper around the blpapi. Is the dataframe actually empty (have you printed it to check). I’ve had issues where xbbg has converted the original field names to lower case, so if you try and find a column in the dataframe using the original mixed-case name it doesn’t work. – DS_London Apr 10 '21 at 08:30
  • invalid user means you're not properly login Bloomberg on your PC – Alpha Apr 10 '21 at 16:30
  • @Alpha When using xbbg I am correctly logged in but it still returns an empty DataFrame. (When I try to use xbbg without being logged in I have the explicit error message that it is not possible to communicate with Bloomberg and I dont have this message when I am logged in) – Madininais Apr 15 '21 at 08:05

0 Answers0