AuthorizingintotheBEAP(BloombergEnterpriseAccessPoint)fromExcelVBAscript
创始人
2024-09-22 16:30:13
0

将在Excel VBA脚本中授权到BEAP(Bloomberg企业访问点)的解决方案是使用Bloomberg API并创建一个VBA对象来处理授权和数据请求。以下是一个代码示例:

' Bloomberg API reference required
'
' Declare variables
Dim Session As New blpapicomLib2.Session
Dim Service As blpapicomLib2.Service
Dim PiApi As blpapicomLib2.ProviderSession
Dim PiRequest As blpapicomLib2.Request
Dim FieldList As blpapicomLib2.Element
Dim SecurityList As blpapicomLib2.Element
Dim RequestSecurity As String
Dim RequestField As String

' Start session
If Not Session.Start Then
    MsgBox "Could not start session.", vbExclamation
    Exit Sub
Else
    ' Open service
    Set Service = Session.GetService("//blp/mktdata")
    
    ' Login to Pi
    Set PiApi = Service.OpenService("//blp/piapi")
    If Not PiApi.Authorize Then
        MsgBox "Could not authorize.", vbExclamation
        Exit Sub
    End If
    
    ' Create request
    Set PiRequest = PiApi.CreateRequest("//blp/piapi/request")
    
    ' Set security and fields
    RequestSecurity = "AAPL US Equity"
    RequestField = "PX_LAST"
    PiRequest.Set("security", RequestSecurity)
    PiRequest.Set("fields", RequestField)
    
    ' Send request
    PiApi.SendRequest PiRequest
    
    ' Get response
    Do While PiApi.ProcessResponses(10000) > 0
        Set SecurityList = PiRequest.GetElement("security")
        Set FieldList = PiRequest.GetElement("fieldData")
        
        ' Output data
        Debug.Print RequestSecurity & " " & RequestField & ": " & FieldList.GetElement(RequestField).Value
    Loop
    
    ' Close Pi
    PiApi.CloseService
End If

' Stop session
Session.Stop

注:这只是一个简单的示例,要使用Bloomberg API需要正确安装和配置才能使用。

相关内容

热门资讯

今日科普!微信卡五星辅助器,微... 今日科普!微信卡五星辅助器,微乐自建房脚本免费入口(开挂自建房)攻略;1.微信卡五星辅助器 选牌创建...
重大通报!微乐自建房辅助工具挂... 重大通报!微乐自建房辅助工具挂,微乐小程序免费黑科技(开挂自建房)app1、打开软件启动之后找到中间...
让我来分享经验!微乐自建房辅助... 让我来分享经验!微乐自建房辅助工具免费app,微乐自建房脚本免费入口(开挂自建房)脚本1、微乐自建房...
记者揭秘!微乐小程序自建房辅助... 记者揭秘!微乐小程序自建房辅助工具插件,微乐自建房脚本免费入口(开挂自建房)软件微乐小程序自建房辅助...
必看攻略!微乐自建房辅助工具免... 必看攻略!微乐自建房辅助工具免费app,微乐家乡麻将自建房辅助app(开挂自建房)攻略1、每一步都需...
必备攻略!微乐家乡麻将自建房辅... 必备攻略!微乐家乡麻将自建房辅助app,微乐家乡麻将自建房辅助app(开挂自建房)技巧1、必备攻略!...
查到实测辅助!微信卡五星辅助器... 查到实测辅助!微信卡五星辅助器,微乐家乡麻将自建房辅助app(开挂自建房)教程1、超多福利:超高返利...
传递经验!微乐自建房辅助工具挂... 传递经验!微乐自建房辅助工具挂,微乐小程序免费黑科技(开挂自建房)技巧1、操作简单,无需微乐自建房辅...
一分钟教你!微信卡五星辅助器,... 一分钟教你!微信卡五星辅助器,微乐家乡麻将自建房辅助app(开挂自建房)插件1、这是跨平台的微乐家乡...
传递经验!微乐小程序自建房辅助... 传递经验!微乐小程序自建房辅助工具插件,微乐自建房脚本免费入口(开挂自建房)脚本传递经验!微乐小程序...