简体   繁体   中英

Using Rblpapi via rpy2

I can successfully use the Rblpapi from R:

> library("Rblpapi")
> conn <- blpConnect(host='myhost', port=18194)
> bds("SPX Index", "INDX_MEMBERS")

Member Ticker and Exchange Code
500 XYL UN
501 YHOO UW
502 YUM UN
503 ZBH UN
504 ZION UW

However, I can't use it from Python:

>>> from rpy2.robjects.packages import importr
>>> r = importr('Rblpapi') 
>>> r.blpConnect(host='myhost', port=18194)
>>> print r.bds('SPX Index', 'INDEX_MEMBERS') 
NULL

The blpconnect() call seems to work (errors are thrown if the service isn't available), but I'm at a loss on how to debug this further.

You've misspelled INDX_MEMBERS

print r.bds('SPX Index', 'INDX_MEMBERS')

works as expected

Why? Bloomberg gives you plenty of Python APIs ready-made .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM