`tickets =`

msBBGhistory["BOXOSOLD Index", "Px_Last", {1980, 1, 1}, "", "Day"];

DateListPlot[tickets, Joined -> True, PlotRange -> All,

Frame -> {True, True, False, False},

PlotLabel -> "Box office tickets sold,\nU.S. and Canada",

FrameTicks -> {{Table[{i,

AccountingForm[Floor[i], DigitBlock -> 3]}, {i, .9*10^6,

1.55*10^6, 2*10^5}], None}, Automatic}]

# Category Archives: financial markets

# Unexpected data from Bloomberg

`pets = msBBGhistory["DOG KILL Index", "Px_Last", {2000, 1, 1}, "",`

"Month"]; DateListPlot[pets, Frame -> {True, True, False, False},

PlotLabel ->

"Air Travel Consumer Report\nAnimals Killed During Air Travel"]

# New release of Bloomberg-to-Mathematica code

A new release of my code to move data from Bloomberg to Mathematica. The big changes here include

- rolling all four functions (current data, historical data, intraday data, and intraday bar data) into a single executable. This reduces the number of connections needed by Mathematica among other advantages,
- standardization of function names,
- addition of DPDF code to intraday functions, allowing the user to specify whether or not data should be adjusted for dividends, and
- it has been compiled for the first time for x64 as well as x86.

This interface, its source code, and compiled binaries are freely available at

https://github.com/MichaelSternNYC/

Example:

`x1 = msBBGhistory["IBM US Equity", "Px_Close_1D", {2015, 1, 1}, "", "Day", "use DPDF" -> False];`

x2 = msBBGhistory["IBM US Equity", "Px_Close_1D", {2015, 1, 1}, "", "Day", "use DPDF" -> True];

DateListPlot[{Callout[x1/x1["FirstValue"], "without dividends"], Callout[x2/x2["FirstValue"], "with dividends"]}, PlotStyle -> {Red, Blue}, PlotLabel -> "Historical IBM Returns", Frame -> {True, True, False, False}, ImageSize -> Large]

# Bloomberg-to-Mathematica interface now supports overrides

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

# More revisions to the Bloomberg-to-Mathematica code

It can now take multiple simultaneous securities requests for current data, for a speedup of about 20x. You can download the WSTP conduits and source code at Github. https://github.com/MichaelSternNYC Sample below with some of *The Economist*‘s Big Mac Indices.

indices = {"BIGMUS", "BIGMBZ", "BIGMMX"};

```
```data = Map[

msBBGgetHistory[# <> " Index", "Px_Last", {1997, 1, 1}, "", "Monthly"] &, indices];

`DateListPlot[data, PlotStyle -> {Red, Blue, Purple}, PlotRange -> {1.1, 6.4}, Frame -> {True, True, False, False}, PlotLabel -> "Global Big Mac Prices (USD)", Epilog -> {(Text[Style["U.S.", FontFamily -> "Calibri", FontSize -> 10, Red], {{2007, 1, 10, 16}, 3.4}]), (Text[Style["Brazil", FontFamily -> "Calibri", FontSize -> 10, Blue], {{2007, 5, 10, 16}, 4}]), (Text[Style["Mexico", FontFamily -> "Calibri", FontSize -> 10, Purple], {{2007, 1, 10, 16}, 2.3}])}, ImageSize -> Large];`