使用Rblapi软件包提取数据 [英] Using the Rblapi package to pull data
问题描述
我有一个ISIN列表,这是我唯一的信息来源.在Excel中,我可以捕获很多情况下所需的Bloomber代码,因为它指定了资产进行交易的交易所的代码.为此,我只需要在BDP()公式中添加"... Equity isin",其中"..."是ISIN的占位符. 因此,使用新的Rblpapi程序包(顺便说一句,它是一个了不起的工具!),我可以尝试执行以下操作:
I have a list of ISINs which is my only source of information. In Excel I can catch the Bloomber ticker which is needed in many cases because it specifies the code of the exchange on which the asset is traded. To do so I only have to add "... Equity isin" in a BDP()-Formula where "..." is a placeholder for the ISIN. So with the new Rblpapi package (which is by the way a fantastic tool!) I can try to do the same:
以下是随机的ISIN列表
Here is a list of random ISINs
isins = c("LU0942970442", "LU0997545750" ,"CH0019597530" , "CH0017142719" , "CH0131872431", "VGG0475N1087", "US46429B6974",
"LU0911032141" , "DE000A1JCWS9")
在bdp公式中添加股权"并调用"TICKER_AND_EXCH_CODE"
adding "equity" and calling "TICKER_AND_EXCH_CODE" within the bdp formula
require(Rblpapi)
blpConnect()
portfolio_ticker = bdp(paste(c(isins),"equity"), "TICKER_AND_EXCH_CODE")
但是,未指定某些股票行情指示器.
however leaves some Tickers unspecified.
> portfolio_ticker
TICKER_AND_EXCH_CODE
LU0942970442 equity XBAC SW
LU0997545750 equity AXESZHD LX
CH0019597530 equity
CH0017142719 equity
CH0131872431 equity
VGG0475N1087 equity ARIASII VI
US46429B6974 equity
LU0911032141 equity FCEUSMI LX
DE000A1JCWS9 equity CHOMCAR GR
我的问题是:这是我这方面的思维错误,还是程序包中的错误?
My question is: Is this a thinking-error on my side or is this a bug in the package?
作为示例,它在Excel中对我来说是这样,相应的图片.
As an example how it looks on my side in Excel, here is the corresponding picture.
推荐答案
Rblpapi使用C API-查询isins,您需要像这样格式化它们:
Rblpapi uses the C API - to query isins you need to format them like this:
/isin/THE_ISIN_HERE
因此在您的示例中,这应该可行:
So in your example, this should work:
bdp("/isin/LU0942970442", "TICKER_AND_EXCH_CODE")
这篇关于使用Rblapi软件包提取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!