Reference data requests made via the Bloomberg API can be simple (“current price of IBM Equity”) or complex (“trailing 12 month beta between AAPL US Equity and the Nasdaq index”). To send those more complex requests via external software requires overriding Blomberg’s default fields, something the Bloomberg-to-Mathematica interface did not allow. Until now.
moStarts = DateRange[{1990, 1, 1}, {2016, 4, 1}, "Month"];
moToInclude = 12;
corr1 = Table[{moStarts[[i + moToInclude - 1]], msGetBBG["SPX Index", "CORR_COEF", "noisy" -> False, "overrides" -> <|"BETA_OVERRIDE_REL_INDEX" -> "NDX Index", "BETA_OVERRIDE_START_DT" -> bbgifyDate[moStarts[[i]]], "BETA_OVERRIDE_END_DT" -> bbgifyDate[moStarts[[i + moToInclude - 1]]]|>]}, {i, 1, Length[moStarts] - moToInclude}];
corr2 = Table[{moStarts[[i + moToInclude - 1]], msGetBBG["SPX Index", "CORR_COEF", "noisy" -> False, "overrides" -> <|"BETA_OVERRIDE_REL_INDEX" -> "USGG10YR Index", "BETA_OVERRIDE_START_DT" -> bbgifyDate[moStarts[[i]]], "BETA_OVERRIDE_END_DT" -> bbgifyDate[moStarts[[i + moToInclude - 1]]]|>]}, {i, 1, Length[moStarts] - moToInclude}];
DateListPlot[{corr1, corr2}, PlotLabel -> "Trailing 12-Month Correlations", Frame -> {True, True, False, False}, PlotStyle -> {Blue, Purple}, Epilog -> {(Text[Style["SPX vs. NDX", FontSize -> 10, Blue], {{2010, 9, 2}, 1.01}]), (Text[Style["SPX vs. U.S. 10 Yr Rates", FontSize -> 10, Purple], {{2007, 3, 2}, .65}])}, ImageSize -> Large, Axes -> True]
—
The interface and source code can be found at GitHub