vba 彭博 API 参考
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41262939/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Bloomberg API reference
提问by Jeweller89
I have the following code which works fine with Excel 2010 but due to updated API by Bloomberg this code will not work in Excel 2016. The reference BLP_DATA_CTRLLib.BlpData is outdated but I struggle to use the new API reference.
我有以下代码可以在 Excel 2010 中正常工作,但由于彭博更新了 API,此代码在 Excel 2016 中不起作用。参考 BLP_DATA_CTRLLib.BlpData 已过时,但我很难使用新的 API 参考。
Does anyone know how do update my Bloomberg reference in order to store the quotes?
有谁知道如何更新我的彭博参考以存储报价?
Function Get_BBG_Price(dataa As Variant, CISI As Long)
Dim ReqSecurities As Variant, vtResult As Variant, ReqFields As Variant
Dim Arraystr As String
Dim oBlp As BLP_DATA_CTRLLib.BlpData
ReDim ReqSecurities(1 To UBound(dataa, 1))
For i = 1 To UBound(dataa, 1)
ReqSecurities(i) = dataa(i, CISI) & "@IEHY ISIN" '
Next i
Set oBlp = New BlpData
'
ReqFields = Array("PX_BID")
With oBlp
.SubscriptionMode = ByRequest
.Subscribe ReqSecurities, 1, ReqFields, , , vtResult
End With
Get_BBG_Price = vtResult
End Function
回答by Jimmy Smith
I was taking a look and it looks like this version of the coding is deprecated. I would figure you get errors along the line of "cannot create object", but it may be hiding that in 2016.
我看了一下,看起来这个版本的编码已被弃用。我认为您会遇到“无法创建对象”的错误,但它可能在 2016 年隐藏了这一点。
You'd likely want to use the C# version they have here, https://www.bloomberglabs.com/api/libraries/
您可能想使用他们在此处提供的 C# 版本, https://www.bloomberglabs.com/api/libraries/
To put it to use, I would use the code here, http://mikejuniperhill.blogspot.com/2013/06/bloomberg-v3com-api-wrapper-update-for.html*The code is too lengthy or I'd post it here.
要使用它,我会使用这里的代码,http://mikejuniperhill.blogspot.com/2013/06/bloomberg-v3com-api-wrapper-update-for.html*代码太长或者我会把它贴在这里。