您如何 return 使用 Bloomberg VBA API 筛选特定日期的 EQS?
How do you return EQS screens for a particular date using the Bloomberg VBA API?
对于给定的 Bloomberg EQS 屏幕,我希望能够 return 给定日期的屏幕结果。
我一直在研究 Bloomberg 文件 EqsDataExample.xls 有一段时间了,但是我无法 return 除了当前日期的屏幕之外的任何东西。
Excelsheet中使用的彭博函数是:
=BEQS(screen_name,"Asof=" & asof_date,)
下面是示例中的函数,我修改失败了。我想我需要对覆盖功能做些什么,但它还没有。
Public Sub MakeRequest(sScreenName As String, sScreenType As String, sGroup As String)
Dim req As Request
Dim nRow As Long
Set req = refdataservice.CreateRequest("BeqsRequest")
req.Set "screenName", sScreenName
req.Set "screenType", sScreenType
'req.Set "Group", sGroup
' >> My addition, trying to get the asof date override
Dim overrides As Element
Set overrides = req.GetElement("overrides")
Dim override As Element
Set override = overrides.AppendElment()
override.SetElement "fieldId", "ASOF="
override.SetElement "value", "20101130"
'MsgBox req.Print
' <<
' The following code is used to request data for a custom field that is setup
' using EQS <GO> on the Bloomberg Professional service. To use, uncomment these
' next 3 lines of code and comment out the previous 3 lines of code (above)
' Set req = refdataservice.CreateRequest("CustomEqsRequest")
' req.GetElement("fields").AppendValue "#NameOfCustomField" ' Add name of custom field with # prefix
' req.Append "securities", "IBM US Equity" ' Add name of your security
' Add a correlation id
Dim cid As blpapicomLib2.CorrelationId
' Send the request
Set cid = session.SendRequest(req)
curRow = 0
End Sub
解决方案是将 fieldId 设置为 "PiTDate" - 我在 Bloomberg API 文档中找到了这个。
这是有效的代码:
Public Sub MakeRequest(sScreenName As String, sScreenType As String, sGroup As String)
Dim req As Request
Dim nRow As Long
Set req = refdataservice.CreateRequest("BeqsRequest")
req.Set "screenName", sScreenName
req.Set "screenType", sScreenType
'req.Set "Group", sGroup
' My Code >>
Dim overrides As Element
Set overrides = req.GetElement("overrides")
Dim override As Element
Set override = overrides.AppendElment()
override.SetElement "fieldId", "PiTDate"
override.SetElement "value", "20141130"
'MsgBox req.Print
' <<
' The following code is used to request data for a custom field that is setup
' using EQS <GO> on the Bloomberg Professional service. To use, uncomment these
' next 3 lines of code and comment out the previous 3 lines of code (above)
' Set req = refdataservice.CreateRequest("CustomEqsRequest")
' req.GetElement("fields").AppendValue "#NameOfCustomField" ' Add name of custom field with # prefix
' req.Append "securities", "IBM US Equity" ' Add name of your security
' Add a correlation id
Dim cid As blpapicomLib2.CorrelationId
' Send the request
Set cid = session.SendRequest(req)
curRow = 0
End Sub
对于给定的 Bloomberg EQS 屏幕,我希望能够 return 给定日期的屏幕结果。
我一直在研究 Bloomberg 文件 EqsDataExample.xls 有一段时间了,但是我无法 return 除了当前日期的屏幕之外的任何东西。
Excelsheet中使用的彭博函数是:
=BEQS(screen_name,"Asof=" & asof_date,)
下面是示例中的函数,我修改失败了。我想我需要对覆盖功能做些什么,但它还没有。
Public Sub MakeRequest(sScreenName As String, sScreenType As String, sGroup As String)
Dim req As Request
Dim nRow As Long
Set req = refdataservice.CreateRequest("BeqsRequest")
req.Set "screenName", sScreenName
req.Set "screenType", sScreenType
'req.Set "Group", sGroup
' >> My addition, trying to get the asof date override
Dim overrides As Element
Set overrides = req.GetElement("overrides")
Dim override As Element
Set override = overrides.AppendElment()
override.SetElement "fieldId", "ASOF="
override.SetElement "value", "20101130"
'MsgBox req.Print
' <<
' The following code is used to request data for a custom field that is setup
' using EQS <GO> on the Bloomberg Professional service. To use, uncomment these
' next 3 lines of code and comment out the previous 3 lines of code (above)
' Set req = refdataservice.CreateRequest("CustomEqsRequest")
' req.GetElement("fields").AppendValue "#NameOfCustomField" ' Add name of custom field with # prefix
' req.Append "securities", "IBM US Equity" ' Add name of your security
' Add a correlation id
Dim cid As blpapicomLib2.CorrelationId
' Send the request
Set cid = session.SendRequest(req)
curRow = 0
End Sub
解决方案是将 fieldId 设置为 "PiTDate" - 我在 Bloomberg API 文档中找到了这个。
这是有效的代码:
Public Sub MakeRequest(sScreenName As String, sScreenType As String, sGroup As String)
Dim req As Request
Dim nRow As Long
Set req = refdataservice.CreateRequest("BeqsRequest")
req.Set "screenName", sScreenName
req.Set "screenType", sScreenType
'req.Set "Group", sGroup
' My Code >>
Dim overrides As Element
Set overrides = req.GetElement("overrides")
Dim override As Element
Set override = overrides.AppendElment()
override.SetElement "fieldId", "PiTDate"
override.SetElement "value", "20141130"
'MsgBox req.Print
' <<
' The following code is used to request data for a custom field that is setup
' using EQS <GO> on the Bloomberg Professional service. To use, uncomment these
' next 3 lines of code and comment out the previous 3 lines of code (above)
' Set req = refdataservice.CreateRequest("CustomEqsRequest")
' req.GetElement("fields").AppendValue "#NameOfCustomField" ' Add name of custom field with # prefix
' req.Append "securities", "IBM US Equity" ' Add name of your security
' Add a correlation id
Dim cid As blpapicomLib2.CorrelationId
' Send the request
Set cid = session.SendRequest(req)
curRow = 0
End Sub