Thursday, May 15, 2014

PDF Chart–> Inkscape SVG –> d3 Interactive Chart

I just spent the last couple of days updating myself on the newest research on currency management.  For the best real-time (delayed about a year) broad look, BIS puts out an incredibly helpful Triennial Central Bank Survey of foreign exchange... in which you see things like this

image

and this.

image

pdfs suffer from a lack of interactivity, so I thought why not use Inkscape’s PDF to SVG conversion to strip the above chart and make it SVG.  Then, if everything goes well, experiment with some basic interactivity provided by d3.js.  Here is what happened.

If anyone would like a more extensive write up of the process, please let me know.

Tuesday, May 6, 2014

High Frequency | Winners and Losers by Chord

I admit it looks like I am the only person in the world who has not read Michael Lewis’  Flash Boys.

I was more attracted to this fine paper with slightly fewer views than Flash Boys.

Baron, Matthew and Brogaard, Jonathan and Kirilenko, Andrei A.,
Risk and Return in High Frequency Trading
May 5, 2014
Available at SSRN: http://ssrn.com/abstract=2433118

The paper offers an incredible view of the players and their effects in the E-mini S&P 500 futures contract.   The data was so good that I just had to unlock the data from their tables.  By far my favorite table was table 7 with “the decomposition of average daily short-term profits among different trader types in August 2010.”  The profits are given as average daily $ profit and profit per trade per contract.  The d3 chord layout seemed perfect to visualize this data.  Fortunately, Ben Hunter had just blogged about his custom rCharts implementation of the chord layout in Chord Diagram with rCharts.  In beautiful open source fashion, I was able to adapt it and quickly view the data as below.  I am not sure how exactly it ties to Flash Boys, but I am guessing that this lends some credibilty to the story.  Just look at the miserable losses of “Small Traders”.

As a comparison between interactive and static graphs, I’ll add some ggplot2 versions.  I will admit that I spent little time customizing any of the charts above or below.  I will save that for later.

image

image

Source at Github: https://github.com/timelyportfolio/rCharts_chord