彭博API请求超时 - python
我是彭博终端用户,无法与Python Bloomberg API建立连接。
我能够像彭博帮助页面上所述的那样安装BLPAPI软件包,并尝试导入XBBG软件包以获取一些数据。
href =“
import blpapi
from xbbg import blp
blp.bdp(tickers='NVDA US Equity', flds=['Security_Name', 'GICS_Sector_Name'])
https://pypi.org/project/xbbg/”出现以下错误消息:
12APR2022_15:07:37.756 33312:20836 ERROR blpapi_metadatamanagerimpl.cpp:247 blpapi.session.metadatamanager.{1} Resolve request timed out { RequestId=NULL }
Traceback (most recent call last):
File "C:\DevLab\MyMainEnv\lib\site-packages\IPython\core\interactiveshell.py", line 3361, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-16-83038899ddda>", line 5, in <cell line: 5>
blp.bdp(tickers='NVDA US Equity', flds=['Security_Name', 'GICS_Sector_Name'])
File "C:\DevLab\MyMainEnv\lib\site-packages\xbbg\blp.py", line 47, in bdp
request = process.create_request(
File "C:\DevLab\MyMainEnv\lib\site-packages\xbbg\core\process.py", line 47, in create_request
req = srv.createRequest(request)
File "C:\DevLab\MyMainEnv\lib\site-packages\blpapi\service.py", line 393, in createRequest
_ExceptionUtil.raiseOnError(errCode)
File "C:\DevLab\MyMainEnv\lib\site-packages\blpapi\exception.py", line 143, in raiseOnError
_ExceptionUtil.raiseException(errorCode, description)
File "C:\DevLab\MyMainEnv\lib\site-packages\blpapi\exception.py", line 135, in raiseException
raise errorClass(description, errorCode)
blpapi.exception.InvalidArgumentException: Null service handle (0x00020002)
'blpapi' in sys.modules
'xbbg' in sys.modules
给我true
,而
'blp' in sys.modules
给我false
有什么想法发生此错误?
I am a Bloomberg Terminal user and can't establish a connection with the Python Bloomberg API.
I was able to install the blpapi package like described on the Bloomberg help page and tried to import the xbbg package to get some data.
https://www.bloomberg.com/professional/support/api-library/
https://pypi.org/project/xbbg/
When I run this:
import blpapi
from xbbg import blp
blp.bdp(tickers='NVDA US Equity', flds=['Security_Name', 'GICS_Sector_Name'])
the following error message appears:
12APR2022_15:07:37.756 33312:20836 ERROR blpapi_metadatamanagerimpl.cpp:247 blpapi.session.metadatamanager.{1} Resolve request timed out { RequestId=NULL }
Traceback (most recent call last):
File "C:\DevLab\MyMainEnv\lib\site-packages\IPython\core\interactiveshell.py", line 3361, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-16-83038899ddda>", line 5, in <cell line: 5>
blp.bdp(tickers='NVDA US Equity', flds=['Security_Name', 'GICS_Sector_Name'])
File "C:\DevLab\MyMainEnv\lib\site-packages\xbbg\blp.py", line 47, in bdp
request = process.create_request(
File "C:\DevLab\MyMainEnv\lib\site-packages\xbbg\core\process.py", line 47, in create_request
req = srv.createRequest(request)
File "C:\DevLab\MyMainEnv\lib\site-packages\blpapi\service.py", line 393, in createRequest
_ExceptionUtil.raiseOnError(errCode)
File "C:\DevLab\MyMainEnv\lib\site-packages\blpapi\exception.py", line 143, in raiseOnError
_ExceptionUtil.raiseException(errorCode, description)
File "C:\DevLab\MyMainEnv\lib\site-packages\blpapi\exception.py", line 135, in raiseException
raise errorClass(description, errorCode)
blpapi.exception.InvalidArgumentException: Null service handle (0x00020002)
'blpapi' in sys.modules
'xbbg' in sys.modules
gives me True
while
'blp' in sys.modules
gives me False
any ideas why this error occurs?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这不是答案,而是某些诊断代码以隔离错误是来自彭博(
blpapi
)还是使用此API的xbbg
包装器。它显示了如何在没有
xbbg
的情况下在API级别访问彭博数据。如果此代码成功运行,则您的彭博连接很好,问题是XBBG,反之亦然。输出应该是:
这本质上是XBBG调用
bdp()
时正在做的事情,并测试基本的彭博API是否正在工作。This is not an answer, but some diagnostic code to isolate whether the error is coming from Bloomberg (
blpapi
) or thexbbg
wrapper that uses this API.It shows how to access Bloomberg data at the API level, without
xbbg
. If this code runs successfully then your Bloomberg connection is fine, and the problem is with xbbg, and vice-versa.The output should be:
This is essentially what xbbg is doing when you call
bdp()
, and tests whether the basic Bloomberg API is working.