February 8th, 2008, 7:20 pm
There shouldn't be a book; the WAPI gives you all the examples you need!Here is a random snippet for some code i've used in the pastDim objBBG As BLP_DATA_CTRLLib.BlpDataIf objBBG Is Nothing Then Set objBBG = New BlpDataarrayfields = Array("Sales_Rev_Turn", "Ebit", "EBIT_MARGIN", "CF_NET_INC", "PROF_MARGIN", "CF_FREE_CASH_FLOW", "CASH_AND_EQUIV", "BS_TOT_ASSET", "RETURN_ON_ASSET", "RETURN_ON_CAP", "BS_TOT_EQY", "TOT_DEBT_TO_TOT_CAP", "LT_DEBT_TO_TOT_CAP", "TOT_DEBT_TO_EBITDA", "EBIT_TO_TOT_INT_EXP") Application.StatusBar = "Financial data downloading" Application.ScreenUpdating = True objBBG.DisplayNonTradingDays = Quarterly objBBG.NonTradingDayValue = ShowNoNumber 'objBBG.ReverseChronological = Not Sheets("Template").reverseBOX.Value If Sheets("Template").QuarterlyBox.Value = False Then objBBG.Periodicity = bbQuarterly Else objBBG.Periodicity = bbYearly 'Set r = Range(Cells(17, 3), Cells(21, 18)) End If Dim crncy As String crncy = Range("A27") If Sheets("Template").Range("years").Value = 5 And Sheets("Template").QuarterlyBox.Value = True Then BACKDAYS = 6 * 365 End If dim secCode = "F US Equity" ' set this equal to a range in your template ReSult = objBBG.BLPGetHistoricalData2(secCode, arrayfields, CDate(Date - BACKDAYS), crncy) uBoundNumber = UBound(ReSult) If (uBoundNumber <= 0) & Sheets("Template").QuarterlyBox.Value = False Then MsgBox ("There is no quarterly data available for this ticker sorry!") Exit Sub ElseIf (uBoundNumber <= 0) Then MsgBox ("There is no data available for this ticker sorry!") Exit Sub End If 'Inputting data for the specific obligor Dim numarrayfields numarrayfields = UBound(arrayfields) For i = 0 To numarrayfields If i = 0 Then For j = 0 To uBoundNumber Cells(17 + j, 3) = Left(ReSult(j, 0, 0), 10) 'GET THE DATE If Left(ReSult(j, 0, 1), 1) <> "#" Then _ Cells(j + 17, 4) = ReSult(j, 0, i + 1) Next j Else For j = 0 To uBoundNumber If Left(ReSult(j, 0, i + 1), 1) <> "#" Then Cells(j + 17, i + 4) = ReSult(j, 0, i + 1) ElseIf Left(ReSult(j, 0, i + 1), 1) = "#" Then Cells(j + 17, i + 4) = "Not Available" End If Next j End If Next i