Bloomberg VBA API: How can I replace a BDS call with VBA and the BLPAPI?

user1323670 picture user1323670 · Apr 10, 2012 · Viewed 7.6k times · Source

I currently use BDS in the following manner:

=BDS("FDS US Equity","TOP_20_HOLDERS_PUBLIC_FILINGS","cols=10;rows=20")

I have the BBG VBA class module with the following functions:

Public Function ReferenceDataRequest(security As String, fields() As String) As Variant

Public Function HistoricalDataRequest(securities() As String, fields() As String, startDate As String, endDate As String, periodicity As String, nonTradingDayFillOption As String, nonTradingDayFillValue As String) As Variant

Public Function IntradayTickRequest(security As String, startDate As String, endDate As String, eventTypes() As String) As Variant

Public Function IntradayBarRequest(security As String, startDate As String, endDate As String, eventType As String, interval As Integer) As Variant

I cannot figure out which function to use and with what parameters.

Help!

Answer

markblandford picture markblandford · Apr 10, 2012

I'm not too familar with the BDS() Bloomberg function but am with the Bloomberg API and working with Bloomberg with VBA.

Your BDS() call has 'FDS US Equity' as the security parameter and the 'TOP_20_HOLDERS_PUBLIC_FILINGS' as the field. However, the 'fields()' parameter in the functions you list require an array.

Have you tried something like this?

Dim varData As Variant
Dim strFieldsArray(0) as string

strFieldsArray(0) = "TOP_20_HOLDERS_PUBLIC_FILINGS"   

varData = ReferenceDataRequest("FDS US Equity", strFieldsArray)

I am working on the assumption (not that I guess it matters) that this method is calling BlpSubscribe() of the Bloomberg Data Type library.