Author Archives: stern

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. 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];

big macs

New release of the Bloomberg-to-Mathematica link

Those who use Bloomberg and Mathematica should find this useful. This interface allows the direct loading of Bloomberg data (historical prices, bulk data like dividends, current data like stock prices, etc.) into Mathematica. I’ve made the interface freely available since 2008, but this release represents the largest changes in over six years. Most importantly, it can now handle bulk data like current holders of a security and historical dividends, and it’s much more robust about errors.

Historically I’ve thrown source code in the .zip file with the binaries but starting with this release, the source code and the binaries will be in separate GitHub repositories. See for everything. If you just want to install the links, check out in particular.

histLink = msBBGgetHistoryMakeLinkObject[];

x1 = msBBGgetHistory["IBM US Equity", "Px_Last", {2014, 1, 1}, "",
"Day", "use DPDF" -> False, LinkObject -> histLink];
x2 = msBBGgetHistory["IBM US Equity", "Px_Last", {2014, 1, 1}, "",
"Day", "use DPDF" -> True, LinkObject -> histLink];
DateListPlot[{x1, x2}, PlotStyle -> {Orange, Purple},
PlotLabel -> "IBM Stock Price via the new interface",
ImageSize -> Large,
Epilog -> {(Text[
Style["not dividend-adjusted", FontFamily -> "Times New Roman",
FontSize -> 10, Orange], {{2015, 1, 22}, 169}]),
(Text[Style["dividend-adjusted", FontFamily -> "Times New Roman",
FontSize -> 10, Purple], {{2015, 1, 22}, 140}])

demo of the new interface

Significant update to the Bloomberg to Mathematica link

I’ve been making significant changes to the Bloomberg-to-Mathematica link recently, including

  1. the ability to specify whether historical data has DPDF adjustments (in other words, whether or not prices have been adjusted for dividends, splits, and other capital events),
  2. the ability to pull bulk data like historical dividend records and current holders, and
  3. the ability to keep the link live between queries, significantly reducing latency.

Other improvements include more sophisticated handling and reporting of errors and more widespread use of modern Mathematica data types (Associations and TimeSeries). I will provide all the source code, perhaps in the form of a GitHub depository. The new and improved functions are based on Wolfram’s current WSTP libraries and the current version of the Bloomberg BLP API. I’ve built to 32-bit architecture but I believe that 64-bit versions should be possible as well.

I’m waiting for Bloomberg to help with one source of crashes (when a company announces a distribution but cancels it before record date). When that’s taken care of I will upload the improved binaries and interfaces, etc. Those who want to play with the source code should visit

[update March 7, 2016: the new executables are also available on Github, at]

Disassembling the Apple Studio Display 21″ CRT

Once upon a time, computers used cathode ray tube monitors (CRTs), and the best ones were made by Sony, and in 1999 Apple bought some Sony tubes for use in creating the wonderful monster that is the Apple Studio Display 21″ CRT.

It was beautiful and enormous.

The monitor is almost three feet deep.

The monitor is almost three feet deep.


And very, very heavy. The service manual contains the following warning:

Caution: Out of the box, the Studio Display (21″ CRT) weighs 77 pounds (35 kg). Use caution when lifting or moving the display. To move it, lift it by the hand grips on the bottom of the display. It is recommended that two people lift the monitor together.

After the bloom came off the CRT rose, I got two of these monitors for free by offering to “dispose” of them for designers who were moving up to LCD screens. Neither was working well, and they’ve been in my basement basically ever since. I plan someday to convert the shells into fishtanks or litterboxes or something. At one point, I thought I might build a computer into the case with a modern LCD monitor mounted into the front, but a 20″ square monitor is an odd commodity now that the world has moved on to panoramic aspect ratios.

Anyway, it was time to move the monitors and I decided to gut them first. The things are totally over-engineered, with dozens of screws hidden under mylar stickers. The “Take Apart” section of the service manual is 101 pages long. Not very big pages, but still.

So I found a shortcut . . .

CRTs can be extreme hazardous. Use a wooden-handled implement when discharging.

CRTs can be extreme hazardous. Use a wooden-handled implement when discharging.

Also wear protective eyewear and an airmask; the tube will explode.

Also wear protective eyewear and an airmask; the tube will explode.

Then remove the shell.

Then remove the shell.

And remove the guts.

And remove the guts.