<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Chris Donnan : Programming - Brooklyn Style</title>
	<atom:link href="http://chrisdonnan.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://chrisdonnan.com/blog</link>
	<description>software, trading, family, fun</description>
	<lastBuildDate>Sat, 13 Feb 2010 10:49:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>London/ New York Neighborhood Analogies</title>
		<link>http://chrisdonnan.com/blog/2010/02/13/london-new-york-neighborhood-analogies/</link>
		<comments>http://chrisdonnan.com/blog/2010/02/13/london-new-york-neighborhood-analogies/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 10:49:08 +0000</pubDate>
		<dc:creator>chrisdrop</dc:creator>
				<category><![CDATA[London]]></category>

		<guid isPermaLink="false">http://chrisdonnan.com/blog/?p=577</guid>
		<description><![CDATA[(Compiled from Yelp here)
As a native New Yorker &#8211; I found this great chat series on Yelp comparing NY and London neighborhoods. IMO &#8211; VERY accurate!
LONDON WEST
Notting Hill = New York Soho/West Village
Holland Park = Sutton Place
Mayfair = Fifth Avenue on the Upper East Side
Knightsbridge = Central Park South, the very lower portion of the [...]]]></description>
			<content:encoded><![CDATA[<p>(Compiled from Yelp <a href="http://www.yelp.com/topic/new-york-where-to-live-in-london">here</a>)</p>
<p>As a native New Yorker &#8211; I found this great chat series on Yelp comparing NY and London neighborhoods. IMO &#8211; VERY accurate!</p>
<p>LONDON WEST<br />
Notting Hill = New York Soho/West Village<br />
Holland Park = Sutton Place<br />
Mayfair = Fifth Avenue on the Upper East Side<br />
Knightsbridge = Central Park South, the very lower portion of the Upper East Side</p>
<p>Chelsea = Upper East side east of Lexington<br />
LONDON CENTER<br />
West End/Picadilly Circus/Lecester Square = Times Square<br />
London&#8217;s Soho = the Village (sort of the hectic bustling tourist parts) + Chelsea (gay scene)</p>
<p>LONDON NORTH<br />
Camden town = sort of also like the east village<br />
the nice parts of Islington (barnsbury, highbury fields) = Brooklyn Heights<br />
Clerkenwell = Fort Greene<br />
the rest of Islington = miscellaneous brooklyn<br />
Hampstead = Park Slope<br />
West Hampstead = bo-co-ca brooklyn (god I hate that word)<br />
[you get the picture - basically, North London is generally brooklyn]</p>
<p>LONDON EAST<br />
The City = Wall Street<br />
Hoxton and Shoreditch = Lower East Side<br />
East London = the bronx</p>
<p>LONDON SOUTH OF THE RIVER<br />
the vast unknown of South London = Queens</p>
<p>Essex (the suburban region where everyone from the east end and east london settled) = New Jersey<br />
Surrey = Connecticut around Greenwich</p>
<p><em>(Complete aside &#8211; a friend of mine; Dave asked me to give a small signal of notification to another ex-colleauge &#8211; so consider this it !)</em></p>
]]></content:encoded>
			<wfw:commentRss>http://chrisdonnan.com/blog/2010/02/13/london-new-york-neighborhood-analogies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Service Based Enterprise Trading Optimisation is in the Wild</title>
		<link>http://chrisdonnan.com/blog/2010/01/10/service-based-enterprise-trading-optimisation-is-in-the-wild/</link>
		<comments>http://chrisdonnan.com/blog/2010/01/10/service-based-enterprise-trading-optimisation-is-in-the-wild/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 08:59:18 +0000</pubDate>
		<dc:creator>chrisdrop</dc:creator>
				<category><![CDATA[AI/ Machine Learning]]></category>
		<category><![CDATA[algorithmic trading]]></category>

		<guid isPermaLink="false">http://chrisdonnan.com/blog/?p=575</guid>
		<description><![CDATA[The the January 2007 issue of Automated Trader Magazine I wrote an article about optimising trading systems. One concept I discussed was firms offering enterprise optimisation algorithms for client use (and fees of course). I found a reference this morning:
FlexTrade FlexPTS Offers Portfolio Optimisation Algos Using IBM Ilog Cplex
The addition of IBM’s Ilog Cplex software [...]]]></description>
			<content:encoded><![CDATA[<p>The the January 2007 issue of Automated Trader Magazine I wrote an article about optimising trading systems. One concept I discussed was firms offering enterprise optimisation algorithms for client use (and fees of course). I found a reference this morning:</p>
<p><a href="http://www.a-teamgroup.com/article/flextrade-flexpts-offers-portfolio-optimisation-algos-using-ibm-ilog-cplex/">FlexTrade FlexPTS Offers Portfolio Optimisation Algos Using IBM Ilog Cplex</a></p>
<blockquote><p>The addition of IBM’s Ilog Cplex software to FlexPTS allows the FlexTrade platform to optimise its trading schedule every 15 minutes</p>
<p>..</p>
<p>many firms use “rudimentary algorithms they’ve created in-house to schedule transactions. But in our view, anyone who’s serious about optimisation uses a powerful optimization engine like CPLEX from IBM.</p>
<p>..</p>
<p>the ability to define a trading strategy that can adapt dynamically not only to changes in the market, but also to the impact of other firms’ trading strategies.</p></blockquote>
<p>All of this is in line with my own continued personal beliefs. IBM is offering optimisation as a service. Trading systems are consuming optimisation as a service. The intent is to make trading algorithms more adaptive to continuously changing conditions and to optimise the intended objectives correctly, robustly etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisdonnan.com/blog/2010/01/10/service-based-enterprise-trading-optimisation-is-in-the-wild/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My 2009 Mostly Science Fiction Reading</title>
		<link>http://chrisdonnan.com/blog/2009/12/28/my-2009-mostly-science-fiction-reading/</link>
		<comments>http://chrisdonnan.com/blog/2009/12/28/my-2009-mostly-science-fiction-reading/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 11:49:49 +0000</pubDate>
		<dc:creator>chrisdrop</dc:creator>
				<category><![CDATA[books]]></category>
		<category><![CDATA[sci fi]]></category>

		<guid isPermaLink="false">http://chrisdonnan.com/blog/?p=573</guid>
		<description><![CDATA[So &#8211; 2009 was a great year for my continued sci-fi &#8220;reading&#8221;. I actually read perpetually &#8211; and the actual reading that I do is usually of the technical sort (quant finance, trading, software, teams, leadership, etc.). In the walking commute and during my daily running &#8211; I listen to audio books &#8211; quite a [...]]]></description>
			<content:encoded><![CDATA[<p>So &#8211; 2009 was a great year for my continued sci-fi &#8220;reading&#8221;. I actually read perpetually &#8211; and the actual reading that I do is usually of the technical sort (quant finance, trading, software, teams, leadership, etc.). In the walking commute and during my daily running &#8211; I listen to audio books &#8211; quite a lot of them actually. I have been listening to audio books for maybe 5 or 6 years now and it is something that I really enjoy.</p>
<p>So &#8211; here are the audio books that I &#8220;read&#8221; this year in my order of preference:</p>
<blockquote>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica;">Scott Lynch &#8211; <strong>The Lies of Locke Lamora</strong> (amazing &#8211; I love this book &#8211; can&#8217;t wait for the next ones &#8211; best book of the year!)</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica;">Robert Jordan, Brandon Sanderson -<strong> The Gathering Storm</strong> (Love it &#8211; can&#8217;t wait for the rest)</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica;">Patrick Rothfuss &#8211; <strong>The Name of the Wind</strong> (great 1st effort &#8211; I hope the rest is as good when it comes)</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica;">Brent Weeks &#8211; <em>Night Angel Trilogy</em> (fantastic series &#8211; fantastic magic thieves/ heros run amuck )</p>
<ul>
<li><strong>The Way of Shadows</strong></li>
<li><strong>Shadow&#8217;s Edge</strong></li>
<li><strong>Beyond the Shadows</strong></li>
</ul>
<p style="font: normal normal normal 13px/normal Arial; margin: 0px;">Brandon Sanderson &#8211; <em>Mistborn</em> (amazing series, sci-fi at its best)</p>
<ul>
<li><strong>The Hero of Ages</strong></li>
<li><strong>The Well of Ascension</strong></li>
<li><strong>The Final Empire</strong></li>
</ul>
<p style="font: normal normal normal 13px/normal Helvetica; margin: 0px;">Jim Butcher - <em>Codex Alera</em> (great series)</p>
<ul>
<li><strong>Furies of Calderon</strong></li>
<li><strong>Academ&#8217;s Fury</strong></li>
<li><strong>Captain&#8217;s Fury</strong></li>
<li><strong>Cursor&#8217;s Fury</strong></li>
<li><strong>Princeps&#8217; Fury</strong></li>
<li><strong>First Lord&#8217;s Fury</strong></li>
</ul>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica;">David Anthony Durham -<strong>The Other Land (</strong>great continuation)</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Arial;">David Weber &#8211; <strong>By Heresies Distressed </strong>(a great continuation)</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Arial;">Brandon Sanderson - <strong>Elantris </strong>(good &#8211; less than Mistborn by far)</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Arial;">Malcolm Gladwell - <strong>Outliers</strong> (good &#8211; non-fiction!)</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Arial;">Brandon Sanderson -<strong>Warbreaker</strong></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Arial;">Richard K. Morgan - <strong>The Steel Remains</strong> (mediocre &#8211; I prefer Kovacs)</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Arial;">Neal Stephenson &#8211; <strong>Anathem</strong> (too long and self indulgent &#8211; but OK)</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Arial;">John Steakley - <strong>Armor</strong> &#8211; (just mediocre semi-interesting)</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Arial;">Suzanne Collins &#8211; T<strong>he Hunger Games</strong> (finished it &#8211; but it was an error &#8211; too teen aged girlie!)</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Arial;">David Weber &#8211; <strong>On Basilisk Station</strong> (could not finish it &#8211; too mediocre)</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Arial;">David Eddings &#8211; <strong>Guardians of the West</strong> (worst book &#8211; I could not stomach it and quit it)</p>
<div><span style="font-family: Arial, 'Times New Roman', 'Bitstream Charter', Times, serif;"><span style="line-height: normal;"><br />
</span></span></div>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://chrisdonnan.com/blog/2009/12/28/my-2009-mostly-science-fiction-reading/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Seminal Algorithmic Trading Papers</title>
		<link>http://chrisdonnan.com/blog/2009/12/22/seminal-algorithmic-trading-papers/</link>
		<comments>http://chrisdonnan.com/blog/2009/12/22/seminal-algorithmic-trading-papers/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 20:03:34 +0000</pubDate>
		<dc:creator>chrisdrop</dc:creator>
				<category><![CDATA[algorithmic trading]]></category>
		<category><![CDATA[trading]]></category>

		<guid isPermaLink="false">http://chrisdonnan.com/blog/?p=570</guid>
		<description><![CDATA[There are several papers (and authors) that are referenced again and again in the algorithmic trading literature. 1st &#8211; the &#8216;mother&#8217; of most papers in algo trading:

Robert Almgren and Neil Chriss. Optimal execution of portfolio transactions. J. Risk, 3(2):5–39, 2000.

This paper in particular is referenced by just about *every* paper on algorithmic trading. In this [...]]]></description>
			<content:encoded><![CDATA[<p>There are several papers (and authors) that are referenced again and again in the algorithmic trading literature. 1st &#8211; the &#8216;mother&#8217; of most papers in algo trading:</p>
<ul>
<li>Robert Almgren and Neil Chriss.<strong> Optimal execution of portfolio transactions</strong>. <em>J. Risk</em>, 3(2):5–39, 2000.</li>
</ul>
<p>This paper in particular is referenced by just about *every* paper on algorithmic trading. In this paper the generalized model for arrival price algorithms is related to the reader. This paper itself also does reference an earlier and oft referenced paper worth mentioning:</p>
<ul>
<li>Bertsimas and Lo (1998). <strong>Optimal control of liquidation costs</strong>. J. Financial Markets</li>
</ul>
<p>The second most important paper referenced constantly is:</p>
<ul>
<li><strong>Optimal Trading Strategy and Supply/Demand Dynamics</strong> Anna Obizhaeva and Jiang Wang</li>
</ul>
<p>This paper is also fantastic, referencing the work of Almgren and Chriss and talking more about limit order books and such.</p>
<p>Next there are several worth getting to &#8211; listed in my preferred order:</p>
<ul>
<li><strong>Bayesian Adaptive Trading with a Daily Cycle</strong> Robert Almgren? and Julian Lorenz</li>
<li><strong>Understanding the Profit and Loss Distribution of Trading Algorithm</strong><strong>s</strong> Robert Kissell 2005</li>
<li><strong>The Expanded Implementation Shortfall: “Understanding Transaction Cost Components</strong>” Robert Kissell May 2006</li>
</ul>
<p>There are dozens more, and I would point the interested reader to these &#8216;less than seminal&#8217; yet educational papers in the area of algo trading:</p>
<ul>
<li>S<strong>tatistical properties of stock order books: empirical results and models</strong> Jean-Philippe Bouchaud, Marc M ?ezard, Marc Potters February 6, 2008</li>
<li><strong>Order Aggressiveness in Limit Order Book Markets </strong>Angelo Ranaldo* UBS Global Asset Management</li>
<li><strong>Optimal Trading in a Dynamic Market </strong>Robert Almgren? June 30, 2009</li>
<li><strong>Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk</strong> Robert F. Almgren? October 2001</li>
<li><strong>Optimal execution strategies in limit order books with general shape functions</strong> Aur ?elien Alfonsi?, Alexander Schied? 2007</li>
<li><strong>Algorithmic Trade Execution and Market Impact </strong>Richard Coggins†, Marcus Lim‡, Kevin Lo 2006</li>
</ul>
<p>I have been reading, re-reading and re-reading these (and more) over and over &#8211; all great stuff for anyone interested in algo trading.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisdonnan.com/blog/2009/12/22/seminal-algorithmic-trading-papers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hyde Park Global Bets on Adaptive Models to Trade Arbitrage Strategies in Milliseconds</title>
		<link>http://chrisdonnan.com/blog/2009/12/09/hyde-park-global-bets-on-adaptive-models-to-trade-arbitrage-strategies-in-milliseconds/</link>
		<comments>http://chrisdonnan.com/blog/2009/12/09/hyde-park-global-bets-on-adaptive-models-to-trade-arbitrage-strategies-in-milliseconds/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 09:02:00 +0000</pubDate>
		<dc:creator>chrisdrop</dc:creator>
				<category><![CDATA[AI/ Machine Learning]]></category>
		<category><![CDATA[algorithmic trading]]></category>

		<guid isPermaLink="false">http://chrisdonnan.com/blog/?p=567</guid>
		<description><![CDATA[Hyde Park Global Bets on Adaptive Models to Trade Arbitrage Strategies in Milliseconds
Because no formula is going to work all the time, Hyde Park Global develops adaptive models, using a genetic algorithm (i.e, such as mutations and crossover), which are designed to respond to changing market conditions in real time, Afshar explains. While he refers [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.advancedtrading.com/algorithms/showArticle.jhtml;jsessionid=1OFCPBGWKZADDQE1GHPSKHWATMY32JVN?articleID=220300546">Hyde Park Global Bets on Adaptive Models to Trade Arbitrage Strategies in Milliseconds</a></p>
<blockquote><p>Because no formula is going to work all the time, Hyde Park Global develops adaptive models, using a genetic algorithm (i.e, such as mutations and crossover), which are designed to respond to changing market conditions in real time, Afshar explains. While he refers to this as machine-based learning, he points out that the machines don&#8217;t actually learn. Rather, &#8220;They recalibrate themselves within the parameters that you have identified,&#8221; Afshar says, adding that they rely on data and quotes from previous trades to recalibrate.</p></blockquote>
<p>Sounds just like what we began doing in ~2004.  It is *very* easy to do this poorly and we put in *years* of working on #1) a process to enable us to use these techniques properly, #2) An incorporation and understanding of the state of the art technologies (multi-objective optimization, boosting/ bagging, SVMs, fuzzy rule induction, etc). #3) specific implementations of the core machine learning techniques specialized for automated trading.</p>
<p>My basic belief is that these patterns of machine learning will continue to drive the state of the art of extracting money from the global markets.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisdonnan.com/blog/2009/12/09/hyde-park-global-bets-on-adaptive-models-to-trade-arbitrage-strategies-in-milliseconds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Good paper: Characterization of Financial Time Series</title>
		<link>http://chrisdonnan.com/blog/2009/12/06/good-paper-characterization-of-financial-time-series/</link>
		<comments>http://chrisdonnan.com/blog/2009/12/06/good-paper-characterization-of-financial-time-series/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 09:13:44 +0000</pubDate>
		<dc:creator>chrisdrop</dc:creator>
				<category><![CDATA[algorithmic trading]]></category>
		<category><![CDATA[trading]]></category>

		<guid isPermaLink="false">http://chrisdonnan.com/blog/?p=564</guid>
		<description><![CDATA[I have been reading a few books that are related:

Empirical Market Microstructure
An Introduction to High Frequency Finance

This paper gives a pretty good overview and meaningful conclusions from the space&#8230;
Characterization of Financial Time Series
]]></description>
			<content:encoded><![CDATA[<p>I have been reading a few books that are related:</p>
<ul>
<li><a href="http://www.amazon.co.uk/Empirical-Market-Microstructure-Institutions-Econometrics/dp/0195301641/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1260090701&amp;sr=8-1">Empirical Market Microstructure</a></li>
<li><a href="http://www.amazon.co.uk/Introduction-High-Frequency-Finance-Ramazan-GenÃ§ay/dp/0122796713/ref=pd_cp_b_1">An Introduction to High Frequency Finance</a></li>
</ul>
<p>This paper gives a pretty good overview and meaningful conclusions from the space&#8230;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 17.2px Helvetica;"><a href="http://dl.dropbox.com/u/39904/Automated%20Trading/Dec12/characterization.pdf">Characterization of Financial Time Series</a></p>
]]></content:encoded>
			<wfw:commentRss>http://chrisdonnan.com/blog/2009/12/06/good-paper-characterization-of-financial-time-series/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Go</title>
		<link>http://chrisdonnan.com/blog/2009/11/11/google-go/</link>
		<comments>http://chrisdonnan.com/blog/2009/11/11/google-go/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 08:53:31 +0000</pubDate>
		<dc:creator>chrisdrop</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://chrisdonnan.com/blog/?p=562</guid>
		<description><![CDATA[Google’s Go: A New Programming Language That’s Python Meets C++
Go site
1st blush looks nice. Types good, C like performance good. Built for multi-core etc. I will admit I wish it looked more functionally inspired. I am loving Erlang these days (and to a lesser extent Haskell) so going more imperative again feels a step back&#8230;
I [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.techcrunch.com/2009/11/10/google-go-language/">Google’s Go: A New Programming Language That’s Python Meets C++</a></p>
<a href="http://chrisdonnan.com/blog/2009/11/11/google-go/"><em>Click here to view the embedded video.</em></a>
<p><a href="http://golang.org/">Go site</a></p>
<p>1st blush looks nice. Types good, C like performance good. Built for multi-core etc. I will admit I wish it looked more functionally inspired. I am loving Erlang these days (and to a lesser extent Haskell) so going more imperative again feels a step back&#8230;</p>
<p>I will give this one a *go* I think&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisdonnan.com/blog/2009/11/11/google-go/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Intro to Erlang Part 1</title>
		<link>http://chrisdonnan.com/blog/2009/08/09/intro-to-erlang-part-1/</link>
		<comments>http://chrisdonnan.com/blog/2009/08/09/intro-to-erlang-part-1/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 09:36:30 +0000</pubDate>
		<dc:creator>chrisdrop</dc:creator>
				<category><![CDATA[erlang]]></category>
		<category><![CDATA[functional programming]]></category>

		<guid isPermaLink="false">http://chrisdonnan.com/blog/?p=559</guid>
		<description><![CDATA[Why blog about Erlang now?
For me writing blog posts is often a therapeutic way to work out puzzles and clarify my own understanding of a concept. I have been writing Erlang on and off for around 1.5 years now. As of late I have also been typing a lot more Haskell and some OCaml. This [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Why blog about Erlang now?</strong></p>
<p>For me writing blog posts is often a therapeutic way to work out puzzles and clarify my own understanding of a concept. I have been writing Erlang on and off for around 1.5 years now. As of late I have also been typing a lot more Haskell and some OCaml. This has all been great and I love these languages. I have decided to commit a bit more to Erlang lately and I thought I would start blogging again in earnest &#8211; mostly with small-ish Erlang examples just to force myself to be able to explain the concepts. I can program in Erlang (to some level at least) &#8211; now I want to be able to be good enough to explain Erlang software to people.</p>
<p>Essentially &#8211; I think that erlang the language is OK, I think that Erlang the runtime is amazing and I think that OTP &#8211; the common set of Erlang behaviors is very powerful. The entire ecosystem puts together a very compelling offering. You can achieve massively parallel, manageable bits of software in small enough bits of code that it is ownable. So &#8211; Erlang it is&#8230;</p>
<p>So in that spirit &#8211; I will start here with some very simple Erlang concepts.</p>
<p><strong>Erlang is Dynamically Typed</strong></p>
<p>Erlang is a dynamically typed language that to be honest &#8211; I found pretty ugly (syntactically) at first. I have done plenty of programming in dynamic languages &#8211; especially in Ruby (and to a slightly lesser extent &#8211; Python). I really do like dynamic languages but to be honest; I do believe that in larger software projects today that static typing can really by you a generally higher degree of assertable &#8216;correctness&#8217;. I prefer Haskell&#8217;s type system to many others &#8211; but my basic point is that I think types are powerful. In any case &#8211; I still think Erlang&#8217;s total offering is powerful enough to make a concede this point.</p>
<p>While Erlang is dynamically typed it does have a simple way to organize primitive data elements into composite types &#8211; this is Erlang records. You can also of course use tuples (a sort of anonymous type). In addition, Erlang code is organized into modules. So &#8211; while we may organize our code differently than in other languages &#8211; we have some good organizational concepts.</p>
<p><strong>Modules</strong></p>
<p><strong></strong></p>
<p><strong><span style="font-weight: normal;"> -module(exchange).</span></p>
<p><span style="font-weight: normal;"> -export([addOrder/2,exchangeLoop]).</span></p>
<p><span style="font-weight: normal; ">At the top of our .erl Erlang file, we put the name of our module. We also put the names of the functions we want to make visible to the outside world. Note the . at the end of each line. This is the way we tell Erlang that we are at the end of a statement. In the export call &#8211; we give it some stuff inside the []s. Those [...] bits are how we declare a list. Inside the list we are giving it the names of the functions we want to export along with their arity &#8211; the # of arguments they have. This gives us a module named exchange that exports 2 functions to be used to the outside world.</span></p>
<p></strong></p>
<p><strong>Records and Tuples</strong></p>
<p>As I mentioned &#8211; erlang lets us organize primative elements into composite data types. The anonymous way of doing this is tuples. The &#8216;named&#8217; way of doing this is records.</p>
<p><strong></strong></p>
<p><strong><span style="font-weight: normal; "> -record(order,{market, price, size, side}).</span></p>
<p></strong></p>
<p>This is the declaration of a record in Erlang. You can declare an instance of a record like this:</p>
<p>#order{market=vodln,price=127.95,size=350,side=bid}</p>
<p>It is essentially a nice dress on top of a tuple which would look like this:</p>
<p>{vodln,127.95, 350, bid}</p>
<p>So &#8211; records are really just nice ways to put together composite types with names. Tuples are ways to assembly composite types anonymously. Both have their usages.</p>
<p><strong>Object Orientation vs Functional Programming</strong></p>
<p>Notice that these records/ tuple things have no methods &#8216;on&#8217; them. Typically when you declare a type in OO languages &#8211; you put methods on them. This whole bundling up of methods and data IS OO programming. Functional Programming lets you have data and describe functionality. What this means is that it is usually easier to add more functions on a given data type in a functional language &#8211; but harder to change the data structures. This is because in an OO language &#8211; the data is WITH the functionality. In a functional language the data is apart from the functionality. It is all a tradeoff, but I think the functional paradigm is often much closer to the domains I have been working in (trading specifically). So &#8211; FP takes away the general encapsulation of data/ methods together. Note that you can still hide private functions inside a module. Eg; you implement a module and export 1 of 10 methods. This is still a good way to expose a minimal surface area of your software to the outside consumer of it.</p>
<p><strong>Functions</strong></p>
<p>Functions are &#8211; as you may have guessed at the heart of Erlang.</p>
<p>levelFor(<span>Order</span>, <span>Exch</span>) <span>when</span> <span>Order</span>#order.side == bid <span>-&gt;</span></p>
<p>levelForSide(<span>Order</span>, <span>Exch</span>, bid, <span>fun</span>(<span>E</span>) <span>-&gt;</span> <span>E</span>#exch.bids <span>end</span>);</p>
<p>levelFor(<span>Order</span>, <span>Exch</span>) <span>when</span> <span>Order</span>#order.side == offer <span>-&gt;</span></p>
<p>levelForSide(<span>Order</span>, <span>Exch</span>, offer, <span>fun</span>(<span>E</span>) <span>-&gt;</span> <span>E</span>#exch.offers <span>end</span>).</p>
<p>Here we have an example function that I will use as a demonstration for several points.</p>
<ul>
<li>You declare functions in erlang as a top level item. You do not put them inside of records, you put them in a module &#8211; but that is it.</li>
<li>Values/ Parameters all start with upper case letters (I found this very odd at 1st).</li>
<li>You can declare the same function N times each with different &#8216;guard clauses&#8217; and the order of the declrations is the order in which the runtime attempts to bind to them.</li>
<li>This example shows how to extract values from records.</li>
<li>This example shows  simple funs- anonymous functions.</li>
</ul>
<p><strong>Declaring functions, Guard Clauses, Extracting data from records</strong></p>
<p>&#8220;levelFor&#8221; is the name of our function. This function takes 2 arguments named Order and Exch. The arguments come after the name in the (&#8230;).</p>
<p>After that is a guard clause &#8211; this &#8216;when&#8217; is evaluated by the runtime to see if the method should be executed. So &#8211; we can see in case 1 &#8211; if the side == bid &#8211; then we will execute the method. The actual method body comes after the -&gt;.</p>
<p>You can extract values from records using this syntax ValueName#recordName.fieldName. So our example above has several of those.</p>
<p><strong>Funs and multiple function Declarations </strong></p>
<p>The bit after the -&gt; is invoking another method and passing in as the last argument an anonymous function. That bit that starts with fun(E) and ends with &#8220;end&#8221;. This is simply an unnamed function (delegate, function ptr, etc) passed to the next function.</p>
<p>Also notice that I declared the function 2x &#8211; at the end of the 1st declaration I put a ; and at the end of the 2nd I put a &#8220;.&#8221; ( a dot). This is a convenient way to get switch statements out of our code nesting. We use the guard statements to see which of the functions get bound to at runtime. We could have also used if or case statements &#8211; but for this example&#8217;s sake &#8211; we are not <img src='http://chrisdonnan.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>OK &#8211; that is all the time I have for today&#8230; more next weekend <img src='http://chrisdonnan.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>-Chris</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisdonnan.com/blog/2009/08/09/intro-to-erlang-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Good reads (me skimping on a real blog post)</title>
		<link>http://chrisdonnan.com/blog/2009/08/02/good-reads-me-skimping-on-a-real-blog-post/</link>
		<comments>http://chrisdonnan.com/blog/2009/08/02/good-reads-me-skimping-on-a-real-blog-post/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 19:32:29 +0000</pubDate>
		<dc:creator>chrisdrop</dc:creator>
				<category><![CDATA[Lean]]></category>
		<category><![CDATA[Rx]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://chrisdonnan.com/blog/?p=557</guid>
		<description><![CDATA[
15 Scalability and Performance Best Practices
The Joy of Rx: Building an Asynchronous API with Rx and IQueryable
We are not doing this to beat the other guys (amazing Honda inspiration)
Japan Lean Study Mission Day 4: Toyota Home, Norman Bodek, and Takeshi Kawabe (More amazing Honda inspiration)

]]></description>
			<content:encoded><![CDATA[<ul>
<li><a class="outgoing" title="http://www.docstoc.com/docs/9315209/scale_perf_best_practices" href="http://highscalability.com/links/goto/728/566/links_weblink">15 Scalability and Performance Best Practices</a></li>
<li><a href="http://themechanicalbride.blogspot.com/2009/08/joy-of-rx-building-asynchronous-service.html">The Joy of Rx: Building an Asynchronous API with Rx and IQueryable</a></li>
<li><a href="http://themechanicalbride.blogspot.com/2009/08/joy-of-rx-building-asynchronous-service.html"></a><strong><a href="http://jchyip.blogspot.com/2009/08/we-are-not-doing-this-to-beat-other.html">We are not doing this to beat the other guys</a> (amazing Honda inspiration)</strong></li>
<li><strong><strong><a href="http://jchyip.blogspot.com/2008/12/japan-lean-study-mission-day-4-toyota.html">Japan Lean Study Mission Day 4: Toyota Home, Norman Bodek, and Takeshi Kawabe</a> (More amazing Honda inspiration)</strong></strong></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://chrisdonnan.com/blog/2009/08/02/good-reads-me-skimping-on-a-real-blog-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monads and my many language road to more functional programming</title>
		<link>http://chrisdonnan.com/blog/2009/07/28/monads-and-my-many-language-road-to-more-functional-programming/</link>
		<comments>http://chrisdonnan.com/blog/2009/07/28/monads-and-my-many-language-road-to-more-functional-programming/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 18:47:32 +0000</pubDate>
		<dc:creator>chrisdrop</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[erlang]]></category>
		<category><![CDATA[functional programming]]></category>
		<category><![CDATA[haskell]]></category>

		<guid isPermaLink="false">http://chrisdonnan.com/blog/?p=554</guid>
		<description><![CDATA[So &#8211; I am deep into Erlang (still learning for &#62; 1.5 years), Getting into Clojure (new) and getting into Haskell (a few months now). I have decided to spurn the OCaml/ F# branch of the world at least for a little while&#8230;
Anyhow &#8211; Erlang is the functional language I have the most experience with, [...]]]></description>
			<content:encoded><![CDATA[<p>So &#8211; I am deep into Erlang (still learning for &gt; 1.5 years), Getting into Clojure (new) and getting into Haskell (a few months now). I have decided to spurn the OCaml/ F# branch of the world at least for a little while&#8230;</p>
<p>Anyhow &#8211; Erlang is the functional language I have the most experience with, yet next to Haskell &#8211; the LANGUAGE feels weak. Erlang the language + OTP + the Erlang VM runtime is amazing but the Language itself is not as lovely as Haskell. When I am typing C# code, I am finding myself more and more functionally minded. For a few years now I have felt the move to functional programming on me. C# has had great improvements &#8211; but it still feels way too brittle and verbose next to Haskell.</p>
<p>I recently read these articles:</p>
<h3 class="post-title entry-title"><a href="http://themechanicalbride.blogspot.com/2008/11/haskell-for-c-programmers-part-2.html">Haskell for C# Programmers Part 2: Understanding IO</a>.</h3>
<h3 class="post-title entry-title"><a href="http://themechanicalbride.blogspot.com/2008/12/haskell-for-c-programmers-part-3.html">Haskell for C# Programmers Part 3: Visualizing Monads</a></h3>
<p>I found them helpful understanding monads as someone with a large C# experience. I also found this one:</p>
<p><a href="http://www.haskell.org/haskellwiki/Monads_as_containers">Monads as containers </a> very helpful. I will admit to having read dozens of articles on monads and just now really getting to a point where I think I can actually perceive the need for writing one of my own.</p>
<p>Functional programming style has made great differences in my personal style in several languages. I like programming languages and I am literate in many. Seek the monad, but 1st seek to understand the primitive bits of functional programming and it will aide your programming in any language.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisdonnan.com/blog/2009/07/28/monads-and-my-many-language-road-to-more-functional-programming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>High Performance Functional Languages</title>
		<link>http://chrisdonnan.com/blog/2009/07/12/high-performance-functional-languages/</link>
		<comments>http://chrisdonnan.com/blog/2009/07/12/high-performance-functional-languages/#comments</comments>
		<pubDate>Sun, 12 Jul 2009 09:05:12 +0000</pubDate>
		<dc:creator>chrisdrop</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[algorithmic trading]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[functional programming]]></category>

		<guid isPermaLink="false">http://chrisdonnan.com/blog/?p=549</guid>
		<description><![CDATA[I have been thinking quite a lot about a few programming topics:

Correctness &#8211; how do we make it easy to write correct software
Size &#8211; how do we curb growth in size of our software (characters &#8211; not just lines &#8211; it all counts!)
Understandability &#8211; how do we keep our software simple looking
Parallelism &#8211; how do [...]]]></description>
			<content:encoded><![CDATA[<p>I have been thinking quite a lot about a few programming topics:</p>
<ul>
<li>Correctness &#8211; how do we make it easy to write correct software</li>
<li>Size &#8211; how do we curb growth in size of our software (characters &#8211; not just lines &#8211; it all counts!)</li>
<li>Understandability &#8211; how do we keep our software simple looking</li>
<li>Parallelism &#8211; how do we really scale out across CPUs, machines from a language perspective</li>
<li>Performance &#8211; how do we keep all of these other things AND have performance</li>
</ul>
<p>All in all &#8211; I am after a functional/ functional hybrid language in order to achieve improved correctness, reduce size, increase understandability and promote parallelism. I have been working on a &#8216;pet project&#8217; &#8211; mini-exchange for matching orders &#8211; a limit order book system. This has got me thinking about extreme performance.</p>
<p>Recently a former colleague went to work for the LSE, while another went to go work for a low latency trading group @ one of the banks. In light of recent events (<a href="http://tech.slashdot.org/story/09/07/03/1216250/London-Stock-Exchange-To-Abandon-Windows?from=rss">the LSE is going to abandon windows</a>) and when considering the experiences of reality &#8211; I think windows is simply not the tool for exchanges/ low latency trading &#8211; at least not now. This is much debated and I do not want to debate it &#8211; just to state my opinion.</p>
<p><strong>Windows is not the solution for high frequency trading &#8217;nuff said</strong></p>
<p>Now &#8211; I have classically spent most of my professional development career working on windows machines developing software to be used by traders. I have done Java programming, some C++ programming, ruby and a zillion other languages for play.</p>
<p>Here is a good pointer to s set of writing on <a href="http://blogs.zdnet.com/Murphy/?p=514">windows vs *nix performance</a>.</p>
<p><strong>What functional languages offer what performance?</strong></p>
<p>Functional languages will win in the end for all the goals I have  - especially the languages that allow some OO-isms. I am really a fan of several functional languages. I have been doing small to mid size experimental projects with Clojure, OCaml, F#, Clean, Haskell and a few others. I have done some work on my mac, some on windows, some on Ubuntu. At the end of the day, this is all well and good &#8211; and with my 1st caveat (not just windows), the next question is what language on what *nix?</p>
<p>Here are a few links to the great language/ performance shootout</p>
<ul>
<li><a href="http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&amp;lang=all">Ubuntu 64 Bit Quad Core</a></li>
<li><a href="http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&amp;lang=all#about">Gentoo P4</a></li>
<li><a href="http://shootout.alioth.debian.org/u64q/ocaml.php">Ubuntu 64 Bit Quad Core OCaml vs C++ Intel</a></li>
<li><a href="http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&amp;lang=ocaml&amp;lang2=clean&amp;box=1">Ubuntu 64 Bit Quad Core OCaml vs Clean</a></li>
</ul>
<p>You can see a few basic things here. Currently - C++ GNU g++ is the best perf across the board- not surprising at all.</p>
<p>Essentially we see that OCaml is fast &#8211; from 1-3x slower than C++ &#8211; max, similar for memory &#8211; certain tests OCaml wins, but mostly 1-3 multiplier for memory size. OCaml &#8211; unsurprisingly wins &#8211; code typically 1/2 the size of the C/C++ code. Clean is also fast in many cases. In certain cases it outperfs OCaml, but mostly OCaml wins.</p>
<p>In many &#8211; less trivial cases I bet that OCaml/ functional solutions will compare with C/C++ because it will be easier to make them small, understandable, less redundant etc. For &#8216;benchmarks&#8217; where you can optimize the code in a small area &#8211; you can be as obtuse/ obscure as you need to in order to optimize for the benchmark. It becomes increasingly difficult to scale your software and maintain its performance if it is in some obscure form. Program size and understandability become very important &#8211; even to performance as the software scales up.</p>
<p>We need a higher performance functional language in order to use it to compete in the arms race vs uber low-latency trading systems. If we can write low latency trading systems that are competitive with C based systems on *nix machines. 3x slower worst case is still way to slow. It is not 30x slower like F#/ mono &#8211; but it is still too slow at that level of competition. Haskell is doing better these days &#8211; raking 6th after c/ c++ and java servers. OCaml and clean are a bit behind &#8211; but doing OK relative to the bunch.</p>
<p><strong>Abstraction costs performance</strong></p>
<p>Ultimately c/c++ abstract the computer for the most part &#8211; they abstract the computers memory and cpu resources. Functional languages are more abstract &#8211; they try to hide away the hardware-ness of the computer. This has a cost. The cost is still performance. The value for cost is size, understandability etc. Hopefully we can get the perf more in line and then we will be onto something&#8230;</p>
<p><strong>OCaml Trading</strong></p>
<p>Old news, but an excellent watch &#8211; Jane Street does trading using OCaml, here is a video&#8230;</p>
<a href="http://chrisdonnan.com/blog/2009/07/12/high-performance-functional-languages/"><em>Click here to view the embedded video.</em></a>
<p><strong>ATS</strong></p>
<p>Interestingly<strong> </strong><a href="http://en.wikipedia.org/wiki/ATS_(programming_language)">ATS</a> is a programming language I never heard of. According to Wikipedia:</p>
<blockquote><p>The performance of ATS has been demonstrated to be comparable to that of the <a title="C (programming language)" href="http://en.wikipedia.org/wiki/C_(programming_language)">C</a> and <a title="C++" href="http://en.wikipedia.org/wiki/C%2B%2B">C++</a> programming languages.</p></blockquote>
<p>and</p>
<blockquote><p>ATS is derived mostly from the <a title="ML (programming language)" href="http://en.wikipedia.org/wiki/ML_(programming_language)">ML</a> and <a title="Objective Caml" href="http://en.wikipedia.org/wiki/Objective_Caml">Objective Caml</a> programming languages.</p></blockquote>
<p>Now this is interesting&#8230;. According to the most relevant current shootout mentioned above, ATS is at worst 1.83x worse than C/C++. This is not a bad start. I bet that we could improve that number and we would have a functional &#8211; OCaml like programming language that is nearer to competitive with C/C++&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisdonnan.com/blog/2009/07/12/high-performance-functional-languages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LAgent: An Agent Framework in F# &#8211; YES</title>
		<link>http://chrisdonnan.com/blog/2009/07/06/lagent-an-agent-framework-in-f-yes/</link>
		<comments>http://chrisdonnan.com/blog/2009/07/06/lagent-an-agent-framework-in-f-yes/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 19:41:42 +0000</pubDate>
		<dc:creator>chrisdrop</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[F#]]></category>
		<category><![CDATA[functional programming]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://chrisdonnan.com/blog/?p=546</guid>
		<description><![CDATA[LAgent : an agent framework in F# – Part I – Workers and ParallelWorkers
LAgent : an agent framework in F# – Part II – Agents and control messages
LAgent: an agent framework in F# – Part III – Default error management
LAgent: an agent framework in F# – Part IV – Custom error management
LAgent: an agent framework [...]]]></description>
			<content:encoded><![CDATA[<h2><a id="bp___ctl00___RecentPosts___postlist___EntryItems_ctl05_PostTitle" href="http://blogs.msdn.com/lucabol/archive/2009/05/29/lagent-an-agent-framework-in-f-part-i-workers-and-parallelworkers.aspx">LAgent : an agent framework in F# – Part I – Workers and ParallelWorkers</a></h2>
<h2><a id="bp___ctl00___RecentPosts___postlist___EntryItems_ctl04_PostTitle" href="http://blogs.msdn.com/lucabol/archive/2009/06/05/lagent-an-agent-framework-in-f-part-ii-agents-and-control-messages.aspx">LAgent : an agent framework in F# – Part II – Agents and control messages</a></h2>
<h2><a id="bp___ctl00___RecentPosts___postlist___EntryItems_ctl03_PostTitle" href="http://blogs.msdn.com/lucabol/archive/2009/06/12/lagent-an-agent-framework-in-f-part-iii-default-error-management.aspx">LAgent: an agent framework in F# – Part III – Default error management</a></h2>
<h2><a id="bp___ctl00___RecentPosts___postlist___EntryItems_ctl02_PostTitle" href="http://blogs.msdn.com/lucabol/archive/2009/06/19/lagent-an-agent-framework-in-f-part-iv-custom-error-management.aspx">LAgent: an agent framework in F# – Part IV – Custom error management</a></h2>
<h2><a id="bp___ctl00___RecentPosts___postlist___EntryItems_ctl01_PostTitle" href="http://blogs.msdn.com/lucabol/archive/2009/06/26/lagent-an-agent-framework-in-f-part-v-timeout-management.aspx">LAgent: an agent framework in F# – Part V – Timeout management</a></h2>
<h2><a id="bp___ctl00___RecentPosts___postlist___EntryItems_ctl00_PostTitle" href="http://blogs.msdn.com/lucabol/archive/2009/07/03/lagent-an-agent-framework-in-f-part-vi-hot-swapping-of-code-and-something-silly.aspx">LAgent: an agent framework in F# – Part VI – Hot swapping of code (and something silly)</a></h2>
]]></content:encoded>
			<wfw:commentRss>http://chrisdonnan.com/blog/2009/07/06/lagent-an-agent-framework-in-f-yes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
