pulp_fiction
pulp_fiction

Reputation: 185

Rblpapi BDH to get historical fundamental data

My objective is to get fundamental data from Bloomberg via Rblpapi. Say you wanted to compare QoQ and YoY revenue per share for AMD stock - in last reporting period (date:12/26/15) to 1yr before (date:12/27/14).

# To get data for last reporting period you could
last_report_dt = bdp ("AMD US Equity", "MOST_RECENT_PERIOD_END_DT")
rev_yrly_cur = bdh("AMD US Equity","REVENUE_PER_SH",last_report_dt,last_report_dt, opt=c("periodicitySelection"="YEARLY"))
rev_qtrly_cur = bdh("AMD US Equity","REVENUE_PER_SH",last_report_dt,last_report_dt, opt=c("periodicitySelection"="QUARTERLY"))

Question is how to get the reporting date for the year before (12/27/2014) programmatically (I have many tickers) so I can get revenue for that period and compare.

Any suggestions or workarounds welcome?

Upvotes: 1

Views: 2018

Answers (2)

pulp_fiction
pulp_fiction

Reputation: 185

Overrides is the solution:

bdp("AMD US Equity","REVENUE_PER_SH",overrides=c("EQY_FUND_RELATIVE_PERIOD"="-1FQ"))

Upvotes: 0

ytoledano
ytoledano

Reputation: 3133

Try something along the lines of:

bdp("AMD US Equity","REVENUE_PER_SH", override_fields = "EQY_FUND_RELATIVE_PERIOD", override_values = "-1FY")

This means get the value of the previous financial year. Other examples for options you can override with are: "-1FQ", "-1CQ" meaning previous financial quarter and previous calendar year, respectively.

Also, if you want to test easily you can use Excel API or FLDS on the Bloomberg Terminal. The formula to test this with Excel API is:

=BDP($E8,F$7,"DX243=-3FQ")

Upvotes: 2

Related Questions