使用 Rblapi 包拉取数据 [英] Using the Rblapi package to pull data
问题描述
我有一个 ISIN 列表,这是我唯一的信息来源.在 Excel 中,我可以捕获在许多情况下需要的布隆伯股票代码,因为它指定了交易资产的交易所的代码.为此,我只需要在 BDP()-Formula 中添加... 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 公式中添加equity"并调用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屋!