In the Bloomberg API Developer’s Guide it reads:
The Security Lookup [...] request constructs a search based upon the "query" element's string value, as well as the additional filters that you set [...]. This unctionality can also be found on the Bloomberg Professional service using the SECF < GO > function.
This is a simple snippet querying for IBM (C++, while I am actually targeting Java):
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);
With the SECF function I can set many other filters, such as the exchange, the country of domicile (which are also mapped in the FLDS function screen).
When I pass ("exchCode", "US"), I get an error.
com.bloomberglp.blpapi.NotFoundException: Element: exchCode not found in: InstrumentListRequest
(I tried with EXCH_CODE too)
How can I pass SECF filters to the request object?
Here's a snippet of Python code that dumps the schema for the InstrumentListRequest. Might be some language translation differences, but it's the same underlying API.
Sadly it doesn't look like you can formulate the query in the way you want to.
>>> print(instrreq.asElement().elementDefinition().toString())
ELEMENT InstrumentListRequest {
DESCRIPTION
MIN VALUES 0
MAX VALUES 1
TYPE InstrumentListRequest (SEQUENCE) {
DESCRIPTION Instrument list request
ELEMENT query {
DESCRIPTION String with keywords
MIN VALUES 0
MAX VALUES 1
TYPE STRING
}
ELEMENT yellowKeyFilter {
DESCRIPTION Yellow key filter
MIN VALUES 0
MAX VALUES 1
TYPE YellowKeyFilter(ENUMERATION) {
DESCRIPTION
YellowKeyFilter(STRING) {
YK_FILTER_NONE
YK_FILTER_CMDT
YK_FILTER_EQTY
YK_FILTER_MUNI
YK_FILTER_PRFD
YK_FILTER_CLNT
YK_FILTER_MMKT
YK_FILTER_GOVT
YK_FILTER_CORP
YK_FILTER_INDX
YK_FILTER_CURR
YK_FILTER_MTGE
}
}
}
ELEMENT languageOverride {
DESCRIPTION Language override
MIN VALUES 0
MAX VALUES 1
TYPE LanguageOverride(ENUMERATION) {
DESCRIPTION
LanguageOverride(STRING) {
LANG_OVERRIDE_NONE
LANG_OVERRIDE_ENGLISH
LANG_OVERRIDE_KANJI
LANG_OVERRIDE_FRENCH
LANG_OVERRIDE_GERMAN
LANG_OVERRIDE_SPANISH
LANG_OVERRIDE_PORTUGUESE
LANG_OVERRIDE_ITALIAN
LANG_OVERRIDE_CHINESE_TRAD
LANG_OVERRIDE_KOREAN
LANG_OVERRIDE_CHINESE_SIMP
LANG_OVERRIDE_NONE_1
LANG_OVERRIDE_NONE_2
LANG_OVERRIDE_NONE_3
LANG_OVERRIDE_NONE_4
LANG_OVERRIDE_NONE_5
LANG_OVERRIDE_RUSSIAN
}
}
}
ELEMENT maxResults {
DESCRIPTION Number of results requested
MIN VALUES 0
MAX VALUES 1
TYPE INT32
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With