I managed to install blpapi in my python. However, there is error Exception: failed to start session
My simple code is as follows.
import blpapi
import pandas as pd
import tia.bbg.datamgr as dm
mgr = dm.BbgDataManager()
sids = mgr['MSFT US EQUITY', 'IBM US EQUITY', 'CSCO US EQUITY']
df = sids.get_historical('PX_LAST', '1/1/2014', '11/12/2014')
What Can I do with this? Can you help?
Please clarify which IP and port you're attempting to connect to.
If connecting to the local process 'bbcomm.exe' then the IP is 127.0.0.1 (localhost) and port 8194. Check if bbcomm.exe process is running (e.g. in Task Manager) if not then start it manually by typing bbcomm.exe in CMD, or by launching Excel with one or more BDP() functions. Make sure the Bloomberg Terminal is running.
If you are connecting to a remote host (e.g. B-Pipe or ServerApi) then check if the port is reachable: telnet
It sounds like all you did was import the library and attempt to use it.
Most apis require you to set up some sort of account with them to access their data so that they can see who's using their api improperly and who's exceeding their rate limits.
Download the BLPAPI Core Developer Guide from their website and follow those instructions carefully.
https://www.bloomberg.com/professional/support/api-library/
Don’t need to worry about connections if you use
xbbg
:Output: