1

I'm trying to pull all available bonds in an exchange(NYSE) from the Blomberg terminal via Python. I want to retrieve the various bond data fields like say(Option Adjusted Spread ,S&P Rating, Yield to Maturity, Sector). How can I be able to achieve this either using xbbg or blpapi? In both of them from their docs you need the ticker option that is what I don't know how to navigate given I intend on referencing an exchange or different exchanges.

I've looked at this answer How to pull out the list of active German government bonds using xbbg? but this is specific to local bonds. From the Bloomberg docs as well I'm not clearly seeing from the "//blp/instruments" endpoint instrumentListRequest option how this can be achieved. however I tried playing around with this by passing a sector as part of the query but clearly this is not right given it returns an empty results.

session.openService("//blp/instruments")
service = session.getService("//blp/instruments")
request = service.createRequest("instrumentListRequest")
request.set("query", "Corporate Bonds")
request.set("sector", "Corporate")
request.set("maxResults",10)

response = session.sendRequest(request)

any one whose had some experience with this?

  • Are you trying to access options on these bonds? Bond trading is not generally tied to exchanges. Can you give some examples of the bonds you are looking at? – DS_London Mar 02 '23 at 15:36
  • @DS_London,Not options on them Just the basic bond information OAS Spread, Yield To Maturity, their S&P rating and Outstanding Amount. an E.g is in the Commercial Banks Sector bonds issued by say Barclays Bank and also say in the corporates sector bonds issued by "General Motors" – Lost Algorithm Mar 02 '23 at 19:08
  • @DS_London If I can rephrase this, My question is how do I get corporate bonds instruments in bulk(listing does not matter) from Bloomberg. – Lost Algorithm Mar 07 '23 at 08:40
  • 1
    I did think that using the `instrumentListRequest` on the //blp/instruments api would return what you wanted, but when I try `IBM` I get a whole load of securities including CDS and some that seem unrelated to IBM. There is virtually no documentation on how to specify the `query` field. It's not ideal, but if it were me, I'd have a separate Excel sheet to get the securities from a custom SRCH list on the Terminal. – DS_London Mar 07 '23 at 10:06
  • @DS_London,regarding the approach you mentioning using an Excel how would this sit? so the Excel would be fetching the securities(the column would consist of Blomberg Ticker or ISIN I imagine) from the terminal and this is what would now be carried to python and passed on the RefData endpoint to fetch the data? – Lost Algorithm Mar 08 '23 at 05:10

1 Answers1

0

To run something like SECF you will need you to use the instrumentListRequest you tried.

You can find all available info in the "services schema and references guide" on wapi. There are only 3 queries possible:

  • security lookup
  • curve lookup
  • government lookup

Only the security lookup makes sense for you. The following code snippet demonstrates how to make a Security Lookup Request, assumes that a Session already exists and that the “//blp/instruments” service has been successfully opened.

Service secfService = 
session.getService("//blp/instruments"); Request request = 
secfService.createRequest("instrumentListRequest");
request.asElement().setElement("query", "IBM"); 
request.asElement().setElement("yellowKeyFilter", 
"YK_FILTER_CORP"); 
request.asElement().setElement("languageOverride", 
"LANG_OVERRIDE_NONE"); 
request.asElement().setElement("maxResults", 10);
sendRequest(request, session);

It will be cumbersome to filter out relevant products and in cases like this, I think it will be easiest to either use a SRCH as suggested or directly BQL (where the help desk should be able to help) to obtain all filds and the entire universe of interest.

Certain tools (The FX toolkit, the curves toolkit for example) are simple better or only available in Excel.

AKdemy
  • 215
  • 1
  • 2
  • 6
  • 1
    I went with the suggested custom SRCH in the terminal and obtain the list of instruments and then use this list in the `blp/refData` end point. – Lost Algorithm Apr 15 '23 at 08:55