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需要正确安装和配置才能使用。

相关内容

热门资讯

透视真的!aapoker可以开... 透视真的!aapoker可以开挂吗,顺欣茶楼怎么开挂,安装教程(有挂神器)1、许多玩家不知道顺欣茶楼...
玩家必用!德扑之星用刷数据吗,... 玩家必用!德扑之星用刷数据吗,德扑之星有作弊,扑克教程(其实存在有挂);致您一封信;亲爱德扑之星有作...
透视透视!hhpoker透视脚... 透视透视!hhpoker透视脚本视频,边锋斗地主辅助微信,科技教程(有挂透视);建议优先通过边锋斗地...
盘点十款!wepooke ap... 盘点十款!wepooke app系统规律,智星德州菠萝有挂吗,德州论坛(真是是真的有挂)1、这是跨平...
透视app!wpk有脚本吗,多... 透视app!wpk有脚本吗,多乐游戏破解器,我来教教你(有挂神器);致您一封信;亲爱多乐游戏破解器玩...
大家学习交流!pokerwor... 大家学习交流!pokerworld软件,WPK透视辅助,透明挂教程(素来真的有挂),您好,WPK透视...
透视计算!德朴之星脚本,老k麻... 透视计算!德朴之星脚本,老k麻将辅助器,规律教程(有挂神器);老k麻将辅助器软件透明挂作为一款老k麻...
揭秘关于!德扑统计软件,wep... 揭秘关于!德扑统计软件,wepokeai机器人,黑科技教程(真是真的有挂)1)wepokeai机器人...
透视ai代打!wepoker底... 1、透视ai代打!wepoker底牌透视脚本,樱花之盛牛牛挂,曝光教程(有挂神器)。2、樱花之盛牛牛...
科技新动态!nzt德州辅助软件... 科技新动态!nzt德州辅助软件,wpk透视辅助测试,新版2025教程(果然真的是有挂)是一款可以让一...