gpt4 book ai didi

java - 彭博安全查找请求

转载 作者:行者123 更新时间:2023-11-30 03:55:25 24 4
gpt4 key购买 nike

在 Bloomberg API 开发人员指南中,它是这样写的:

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.

这是一个查询 IBM 的简单片段(C++,而我实际上是针对 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);

通过 SECF 功能,我可以设置许多其他过滤器,例如交易所、住所所在的国家(它们也映射在 FLDS 功能屏幕中)。

当我传递 ("exchCode", "US") 时,出现错误。

com.bloomberglp.blpapi.NotFoundException: Element: exchCode not found in: InstrumentListRequest

(我也尝试过 EXCH_CODE)

如何将 SECF 过滤器传递给 request 对象?

最佳答案

这是转储 InstrumentListRequest 架构的 Python 代码片段。可能存在一些语言翻译差异,但底层 API 相同。
遗憾的是,您似乎无法按照您想要的方式制定查询。

>>> 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
}
}

关于java - 彭博安全查找请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29049542/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com