<?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>Hack the market &#187; dereferenced</title>
	<atom:link href="http://www.puppetmastertrading.com/blog/index.php/category/dereferenced/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.puppetmastertrading.com/blog</link>
	<description>Algorithmic trading experiences</description>
	<lastBuildDate>Wed, 21 Apr 2010 23:11:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>pairs portfolio</title>
		<link>http://www.puppetmastertrading.com/blog/2010/04/08/pairs-portfolio/</link>
		<comments>http://www.puppetmastertrading.com/blog/2010/04/08/pairs-portfolio/#comments</comments>
		<pubDate>Thu, 08 Apr 2010 15:51:48 +0000</pubDate>
		<dc:creator>tito</dc:creator>
				<category><![CDATA[EMS Internals]]></category>
		<category><![CDATA[back-testing]]></category>
		<category><![CDATA[dereferenced]]></category>
		<category><![CDATA[portfolio management]]></category>
		<category><![CDATA[strategy development]]></category>

		<guid isPermaLink="false">http://www.puppetmastertrading.com/blog/?p=1175</guid>
		<description><![CDATA[People have asked me how I go about implementing a strategy in Stratbox.  While I&#8217;ve illustrated a good number of strategies running in Stratbox in these pages, I&#8217;ve never walked through a non-trivial example from conception, through design, implementation and iteration.  Today we&#8217;ll go through a reasonably complex example in total (I&#8217;ll provide source) detail.
The [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" src="/images/pairs.jpg" alt="" width="269" height="180" />People have asked me how I go about implementing a strategy in Stratbox.  While I&#8217;ve illustrated a good number of strategies running in Stratbox in these pages, I&#8217;ve never walked through a non-trivial example from conception, through design, implementation and iteration.  Today we&#8217;ll go through a reasonably complex example in total (I&#8217;ll provide source) detail.</p>
<p>The example I&#8217;ve chosen is, I think, very nice because it&#8217;s a portfolio-oriented strategy, which is pretty much the only kind I care to explore; it&#8217;s also based around the concept of pairs trading, which is something which most can easily relate to; and finally, it&#8217;s already public domain and yet almost certainly has some juice in it for those who care to understand it and extend it intelligently.</p>
<p>The example comes from the blog of a company, <a title="Palantir" href="http://www.palantirtech.com/" target="_blank">Palantir</a> which does (something like?) analytical / decision support software for both finance and intelligence-gathering services (quants and spooks &#8211; spooky quants?).  The specific example is <a title="Palantir: pairs trading strategy" href="http://www.palantirfinance.com/analysis-blog/?p=194" target="_blank">here</a> and is described thusly:</p>
<p><span id="more-1175"></span></p>
<blockquote><p>In this study we explore a trading strategy that isolates pairs of  instruments within a sector that are highly correlated. We enter a trade  if the price paths of these instruments diverge, going long one  instrument and short the other, with the assumption that their price  paths will converge.</p>
<p>We construct our strategy in four parts: (1) isolate the target set  of tradable instruments, (2) choose a rule for finding correlated pairs  within that set, (3) pick criteria for entering trades, and (4) test the  trading strategy.</p>
<p>&#8230;</p>
<p>For this study we want to isolate pairs of instruments whose  correlation is above a certain threshold.  At the beginning of each  quarter, we restrict our target stocks to the top 5 in the sector by  252-day correlation to the S&amp;P 500.  Then our <a href="http://www.palantirfinance.com/apps/strategy.html">Strategy</a> uses a metric that, for a given group of stocks, outputs a list of pairs  with a correlation above our target threshold of .60 over the same time  period.</p>
<p><strong>&#8230;<br />
</strong></p>
<p>Across every day and every pair in our trading list, we check the  21-day z-score (number of standard deviations from the mean) of the  difference between the two series. We classify the stocks as diverging  when the absolute value of the z-score is between 1.5 and 3.0. When this  condition is met we short the stock that is rising and long the stock  that is falling, sizing our position relative to the z-score and the  number of pairs currently trading.</p></blockquote>
<p><strong>~(sectors) ; reframing the strategy<br />
</strong></p>
<p>While I&#8217;ll implement a strategy broadly based on their description, I will use some poetic license to modify it in ways that seem to me sensible.  First, I have good experience writing equity strategies which deal with sectors and have pretty uniformly found that sectors, as defined by S&amp;P or whomever, are more trouble than they&#8217;re worth.  Instead, looking at correlation matrices and determining on that basis who should be paired, is much more fruitful in my experience.  Tr8der has some very nice posts illustrating (very prettily!) a similar point <a title="Tr8der: equity clusters 2" href="http://tr8dr.wordpress.com/2009/12/31/equity-clusters-2/" target="_blank">here</a> and <a title="Tr8der: equity clusters" href="http://tr8dr.wordpress.com/2009/12/30/equity-clusters/" target="_blank">here</a>.  (Actually, his point is a bit broader and represents an area of possibly promising development of this strategy which I won&#8217;t pursue here.)</p>
<p>So, we&#8217;re going to chunk the idea of explicitly using sectors.  Instead, we&#8217;ll simply construct, on a monthly basis (Palantir did this quarterly) a <em><strong>TrailDays</strong></em> correlation matrix from which we&#8217;ll extract the set of pairs which have a correlation greater than <em><strong>MinCorrelation</strong></em>.  On a daily basis, we will calculate the <em><strong>ZScoreDays</strong></em> z-scores of each of these pairs and sort them by absolute value, tossing those whose values are less than <em><strong>MinZScore </strong></em>or exceed <em><strong>MaxZScore</strong></em>.  Since I don&#8217;t like the idea of having an open-ended number of pairs/positions in my portfolio, I will constrain the portfolio to a maximum of <em><strong>N</strong></em> names and will <em><strong>Allocate</strong></em> $1M to the strategy.   Finally, we will look at the effect of trading an <em><strong>EvenlyWeight</strong></em>ed portfolio or a z-score weighted portfolio (as Palantir had done).</p>
<p>The initial &#8216;universe&#8217; of equities across which we will calculate our correlations will be filtered from my database of daily equity data going back to 2005 where the closing price is over $1, the average daily dollar-volume is over $50M and the data is relatively clean (few if any gaps).  This yields an initial universe of ~600 equities and ~180K pairs.</p>
<p>Assuming that we keep <em><strong>N</strong></em> above 20 or so and we keep our allocation constant at $1M, and assume execution at the close price, we should expect our results to be reasonably believable as it&#8217;s unlikely that the size we&#8217;re trading in would distort the market.  Scaling any strategy presents its own set of challenges which we&#8217;re not going to go into for this example, but an obvious direction for scaling the strategy would be to simply run it over intraday data and scale into and out of positions as conditions permit.</p>
<p>Ok, so that&#8217;s what our strategy is going to look like.  Now, how do we &#8220;make it so&#8221;?</p>
<p><strong>structure of a stratpart</strong></p>
<p>Within Stratbox, strategies are represented as composites made-up of &#8217;stratparts&#8217; each of which has its own metadata descriptor containing parameters.  Stratparts can be composed together within a strategy to enhance or modify the behavior of a strategy.  Thus, one can have a stratpart which implements the above logic paired with another stratpart which will e.g., modify the portfolio to impose beta neutrality, damp volatility or some other form of reporting or risk management.  Given that this example is already complexish, we&#8217;ll just stick to the one stratpart.</p>
<p>A stratpart has a few key elements.  One is the metadata descriptor which allows the strategy container (stratbox) to interact with it for back-testing, optimization or forward-walking purposes, or to allow a &#8216;trader&#8217; to interact with it dynamically during run-time (the so-called &#8216;gray box&#8217;).  Beyond that, it has an essentially event-driven design.  The method <strong>quote() </strong>is called when relevant (i.e., subscribed) market data arrives.  The method <strong>execution()</strong> is called when executions for orders that originated with this strategy are received.  And the method <strong>strategyEvent()</strong> is invoked on a variety of &#8216;interesting&#8217; events that the strategy implementer might care about.  None of these methods are required, so in its simplest form, a stratpart is a very simple piece of code to write.</p>
<p><strong>services in a stratpart</strong></p>
<p>Once one has complied with the minimal requirements for implementing a stratpart, one is rewarded with a variety of useful services: subscription-based market data feeds as well as a fast snapshot db and an in-memory historical db for quick correlation analyses cover market data needs.  Position management is handled at both the strategy level and at the exchange level (if you&#8217;re trading across multiple exchanges).  There is more, including performance analysis (e.g., sharpe, and its various analytic friends) and hierarchical cash allocation within and across strategies, but we won&#8217;t look at these in this example.</p>
<p><strong>implementing metadata</strong></p>
<p>So, the first thing we need to do is define our metadata.  This is done through the use of a conventionally-named static method <strong>Descriptor().<br />
</strong></p>
<pre class="brush: java;">
public static Descriptor Descriptor() {

 ArrayList&lt;Param&gt; params = new ArrayList&lt;Param&gt;();

 String cd = &quot;Unleveraged capital to apply&quot;;
 params.add(new Param(InitialBalance, cd, false, 1000000.0));

 String n = &quot;# of instruments to hold in portfolio&quot;;
 params.add(new Param(N, n, true, 20));

 String tc = &quot;Trailing days over which to calculate correlations&quot;;
 params.add(new Param(TrailDays, tc, true, 252));

 String mc = &quot;the minimum correlation of pairs to consider&quot;;
 params.add(new Param(MinCorrelation, mc, true, .75));

 String zd = &quot;trailing days over which to calc z-score&quot;;
 params.add(new Param(ZScoreDays, zd, true, 21));

 String mizs = &quot;minimum z-score&quot;;
 params.add(new Param(MinZScore, mizs, true, 1.5));

 String mazs = &quot;maximum z-score&quot;;
 params.add(new Param(MaxZScore, mazs, true, 3.0));

 String ew = &quot;evenly-weight portfolio? (or weight by z-score)&quot;;
 params.add(new Param(EvenlyWeight, ew, true, true));

 Descriptor _desc = new Descriptor
   (&quot;puppetmaster.strats.Pairs&quot;, _Desc, params);

 return _desc;
}

public Pairs(Strategy strat, Descriptor d) { super(strat, d); }
</pre>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p>Not the most interesting chunk of code, but pretty straightforward and its inclusion opens up a lot of functionality within the environment as each of these parameters can now be systematically or manually modified in-flight.  The third parameter to the Param constructor, a boolean, indicates if we want to allow the system to optimize this parameter.  Thus, the allocation/initialBalance parameter isn&#8217;t optimizable as it wouldn&#8217;t make any sense to do so.  Even so, we can (ourselves or through an allocation algorithm) modify this value to force the strategy to lighten or extend its financial footprint.  The others are fair game for optimization.</p>
<p>The constructor is also required &#8211; with that exact signature.  This is pretty much it for the &#8216;boilerplate&#8217; code required.</p>
<p><strong>&#8216;installing&#8217; the stratpart</strong></p>
<p>Now that we&#8217;ve met the minimum requirements for a stratpart, we can install it into stratbox.  This requires adding one line to your personal stratparts.xml config file.  Like so:</p>
<pre class="brush: xml; highlight: [5];">
&lt;?xml version='1.0'?&gt;
&lt;stratParts&gt;
 &lt;descriptor class='puppetmaster.model.strategy.FwdWalker'/&gt;
 &lt;descriptor class='puppetmaster.model.strategy.StrategyPortfolio'/&gt;
 &lt;descriptor class='puppetmaster.strats.Pairs'/&gt;
 &lt;descriptor class='puppetmaster.strats.AMBO'/&gt;
 &lt;descriptor class='puppetmaster.strats.meta.AdjMeanReverter'/&gt;
 &lt;descriptor class='puppetmaster.strats.meta.AdjTrendFollower'/&gt;
 &lt;descriptor class='puppetmaster.strats.meta.Binary'/&gt;
</pre>
<p>Once we&#8217;ve informed stratbox of the new stratpart we&#8217;ve written, we can view it within our library of stratparts within the strategy wizard in stratbox:</p>
<div class="wp-caption aligncenter" style="width: 454px"><img src="/images/plib.jpg" alt="" width="444" height="481" /><p class="wp-caption-text">Our Pairs strategy in the Strategy Wizard&#39;s stratparts library</p></div>
<p>And all of the parameters we defined within our descriptor show up on the next page where we can parameterize or optimize the strategy:</p>
<div class="wp-caption aligncenter" style="width: 453px"><img src="/images/pcfg.jpg" alt="" width="443" height="554" /><p class="wp-caption-text">Configuring the Pairs stratpart within the strategy wizard</p></div>
<p>This means that the stratpart can be combined with other stratparts to create new strategies as I&#8217;ve described  and that it can partake in the rich set of functionality within the stratbox gui.  Including actually trading.  But first, we must make the strategy actually do something&#8230;</p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong>implementing event handling</strong></p>
<p>To that end, we must implement the event handling methods I&#8217;d described previously.  Since we&#8217;re not going to do any detailed execution handling in this strategy, we&#8217;ll only implement the <strong>quote()</strong> method and a subset of the events sent to the <strong>strategyEvent() </strong>method. In particular, we&#8217;ll listen to activation events (so we can initialize cleanly), changes to our descriptor and changes to our positions.</p>
<pre class="brush: java;">
/** listen for select strategyEvents */
public void strategyEvent(StrategyEvent event) {
  super.strategyEvent(event);
  switch (event.type) {
    case Activated:            _init();                 break;
    case DescriptorChanged:    _readDesc();             break;
    case PositionChanged:      _posnChange(event);      break;
  }
}
&lt;pre&gt;</pre>
<p>For quotes, we&#8217;ll just listen to the Beginning of Day (BOD) event.  If we wanted to trade intraday, we&#8217;d have to listen to tick events, but we&#8217;ll leave that for another day&#8230;</p>
<p>From a high-level, our code is pretty simple.  We determine the universe of pairs we might trade, we select from among them, we determine what our new portfolio should look like and then we trade to transition from our current state to our desired state.  That&#8217;s it.</p>
<pre class="brush: java;">
/** mkt data goes here, but we only listen for the BOD
 * (&quot;Beginning of day&quot;) event */
public void quote(Quote q) {
  if (q.type() != Quote.Type.BOD) return; // daily strat...

  try {
    List&lt;_Pair&gt; pairs = _getPairs();
    List&lt;_Pair&gt; sel = _selectPairs(pairs);
    List&lt;Position&gt; dp = (List&lt;Position&gt;)_desiredPfolio(pairs,sel);
    _Log.debug(&quot;PORTFOLIO: &quot;+dp);
    _trade(dp);
  } catch(Exception e) { _Log.error(e.getMessage(),e); }
}
</pre>
<p><strong>the messy details</strong></p>
<p>Digging into the details gets more complex, but not horrifically so, as stratbox already has basic analytics like correlation matrices, z-scores, volatility built into it.  Likewise with basic portfolio analytics and transformations. Thus, our code to trade a (pairs-based) long-short portfolio with an arbitrary number of elements is surprisingly simple:</p>
<pre class="brush: java;">
/** given a desired portfolio, trade to make it so */
void _trade(List&lt;? extends Position&gt; desiredFolio) {
  PositionRecord[] currFolio = posns();
  // Given our current portfolio (posns) and our desired state (dfolio),
  //  we generate the set of orders which will transform from the former
  //  to the latter
  //
  List&lt;Order&gt; orders = PortfolioComposer.TransformPortfolio
    (currFolio, desiredFolio, _orderF(), _strat, _strat.account());

  // place the orders for execution
  for (Order order : orders) {
    try {
      order.setType(Order.Type.MOC); // we trade at the close only
      _subscribe(order.contract());
      _execP().placeOrder(order);
    } catch (Exception e) { _Log.error(e.getMessage(), e); }
  }
}
</pre>
<p>As promised, I provide the full source listing below for those interested, but won&#8217;t over burden the discussion with a complete description of every little piece of it.</p>
<p><strong>a telling omission and some results</strong></p>
<p>Early in my career, working as a software engineer in a wall st front office technology department, I was befriended by a manager who told me he had once been a trader.  I asked him why he wasn&#8217;t a trader anymore.  He quipped:</p>
<blockquote><p>I was half of a talented trader.  I knew, in my bones, when to get into a trade.  Sadly, I was never really sure when to get out&#8230;</p></blockquote>
<p>It seems that the author of the Palantir example suffers a similar characteristic to my old friend (or is just being understandably cagey) &#8211; she specifies an entry condition, but not an exit!  Since she doesn&#8217;t impose any costs for trading, this has no big side effects, but in stratbox we do impose (pretty onerous -&gt; realistic!) costs for trading.</p>
<p>In any case, since this is just a simple example I&#8217;ve maintained the &#8216;no exit&#8217; policy and simply exit a trade once its pair goes out of the acceptable ranges for either correlation or z-score.  This has a bad effect on the strategy as you end up churning a lot of trades at the high end of the z-score range.  That is, if we set our upper boundary for z-score to be 3, then we might enter and exit a position multiple times as the z-score oscillates between, say, 2.9 and 3.1.  A more careful implementation could minimize this effect.</p>
<p>Another difference imposed by our more realistic simulation as opposed to the original example is that I&#8217;m restricting the portfolio size explicitly and explicitly limiting myself to trading a given contract within one pair as opposed to allowing a contract to trade across multiple pairs (invoking higher costs but allowing positions to offset and thus providing a neat little optimization &#8211; assuming trading costs nothing!).</p>
<p>All the same, the strategy clearly has some positive characteristics and when parameterized to take advantage of its naive exit strategy (by making the z-score low-end quite low, e.g., 0.5) takes on the character of a hedged trend-following strategy.  How so?  Well, while we are getting churned around the high-end (entry) z-scores, our profitable exits only happen once the z-scores have diminished (the prices have converged) considerably.  So we take more, smaller losses while our winners are held a bit longer.</p>
<div class="wp-caption aligncenter" style="width: 628px"><img src="/images/pairsOpt.jpg" alt="" width="618" height="260" /><p class="wp-caption-text">some Pairs results in &#39;10</p></div>
<p>Adding to my portfolio size improves things generally (and also increases the strategy&#8217;s scalability) while increasing the <em><strong>MinCorrelation </strong></em>parameter seems to hurt performance<em><strong> </strong></em>(not sure why, honestly &#8211; perhaps because if they&#8217;re very highly correlated and already diverging so strongly it may mean they&#8217;re actually diverging fundamentally).<strong> </strong>Returning to the topic of costs, each of these strategies incurred costs of over $5K for the period in question.<strong> </strong>And returning to the parameter which governs the weighting strategy employed, although I haven&#8217;t illustrated it here (as I haven&#8217;t looked at it very carefully), my initial finding is that it changed very little.  <em><strong><br />
</strong></em></p>
<p>There&#8217;s a great many areas where this strategy could be improved &#8211; that&#8217;s the fun, after all! &#8211; but hopefully even in its primitive form this example brings to light both an interesting baseline portfolio pairs strategy, while answering the question of how one goes about concretely implementing it within stratbox.</p>
<p>The entire strategy weighs-in at ~400 LOC including comments, boilerplate and individualized imports.  The source is here: <a href="/images/Pairs.java" target="_blank">Pairs.java</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.puppetmastertrading.com/blog/2010/04/08/pairs-portfolio/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Kooderive</title>
		<link>http://www.puppetmastertrading.com/blog/2010/02/03/kooderive/</link>
		<comments>http://www.puppetmastertrading.com/blog/2010/02/03/kooderive/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 15:31:20 +0000</pubDate>
		<dc:creator>tito</dc:creator>
				<category><![CDATA[EMS Internals]]></category>
		<category><![CDATA[dereferenced]]></category>
		<category><![CDATA[monte-carlo methods]]></category>
		<category><![CDATA[open-source software]]></category>
		<category><![CDATA[options pricing]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://www.puppetmastertrading.com/blog/?p=1000</guid>
		<description><![CDATA[Some time back, I&#8217;d written about NVidia&#8217;s CUDA noting that it looked ideal for many asset-pricing and monte-carlo type problems in finance.  At the time, I was hopeful that it would be quickly integrated into existing open source efforts like QuantLib, but adoption has proved slower than I&#8217;d hoped, most likely because implementing non-trivial problems [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignleft" style="width: 240px"><img class="   " src="/images/cuda_simonRogerson.jpg" alt="photo by Simon Rogerson" width="230" height="173" /><p class="wp-caption-text">photo by Simon Rogerson</p></div>
<p>Some time back, I&#8217;d <a title="TESLA &amp; CUDA" href="http://www.puppetmastertrading.com/blog/2008/11/29/nvidias-tesla-and-the-compute-unified-device-architecture/" target="_blank">written</a> about NVidia&#8217;s CUDA noting that it looked ideal for many asset-pricing and monte-carlo type problems in finance.  At the time, I was hopeful that it would be quickly integrated into existing open source efforts like <a title="QuantLib: a free/open-source library for quantitative finance" href="http://quantlib.org/" target="_blank">QuantLib</a>, but adoption has proved slower than I&#8217;d hoped, most likely because implementing non-trivial problems on CUDA is, well, even less trivial than doing them without..</p>
<p><strong>LMM on CUDA</strong></p>
<p><strong> </strong>Happily, I&#8217;ve just seen a promising first step in this direction as Über-quant and C++ artisan <a title="Mark Joshi" href="http://www.markjoshi.com/" target="_blank">Mark Joshi</a> recently announced an open-source project, <a title="Sourceforge: Kooderive" href="http://sourceforge.net/projects/kooderive/" target="_blank">Kooderive</a> which looks to implement the <a title="Wiki: LMM" href="http://en.wikipedia.org/wiki/LIBOR_market_model" target="_blank">LIBOR Market Model</a> (LMM)  on top of CUDA.  His announcement on the QuantLib mailing lists reads:</p>
<blockquote><p>Dear All,</p>
<p>various people have shown interest in the use of <span id="lw_1265210335_0">CUDA</span> with QuantLib. I<br />
have now made some progress on a CUDA implementation of the <span id="lw_1265210335_1" style="border-bottom: 1px dashed #0066cc; background: transparent none repeat scroll 0% 0%; cursor: pointer;">LIBOR<br />
market model</span>.</p>
<p>In particular, I now have a path generator for the LMM working which<br />
does 16384 paths for 40 rates, 40 steps, 5 factor model, displaced<br />
diffusion predictor-corrector that takes 0.1 seconds on my Quadro 4600.</p>
<p>The state of the project is code fragments that can be called from<br />
other code. Those who are interested can get the code via<br />
the subversion repository on <a href="http://kooderive.sourceforge.net/" target="_blank"><span id="lw_1265210335_2">kooderive.sourceforge.net</span></a> .  The only<br />
project file is currently for VC9 x64. It also uses thrust and the<br />
CUDA SDK.</p>
<p>The next stage will be writing routines, that use QuantLib for the CPU<br />
stuff and kooderive for the GPU stuff,  to actually price things.</p>
<p>A gentle reminder that I will be giving a course on the LMM and<br />
QuantLib in June in <span id="lw_1265210335_3" style="background: transparent none repeat scroll 0% 0%; cursor: pointer;">London</span>, and I will include a session on kooderive<br />
if there<br />
is sufficient interest.</p>
<p>I am happy to take code contributions for kooderive. However, I am not<br />
looking for a redesign of the library or contributions which introduce<br />
dependence on other libraries. I am interested in contributions of<br />
separate routines and of optimizations of existing routines that do<br />
not change interfaces.</p>
<p>regards</p>
<p>Mark<br />
&#8211;<br />
Pricing exotic <span id="lw_1265210335_4" style="border-bottom: 1px dashed #0066cc; background: transparent none repeat scroll 0% 0%; cursor: pointer;">interest rate derivatives</span> &#8211; The <span id="lw_1265210335_5" style="background: transparent none repeat scroll 0% 0%; cursor: pointer;">LIBOR Market Model</span> in<br />
QuantLib <span id="lw_1265210335_6" style="border-bottom: 1px dashed #0066cc; cursor: pointer;">June 2010</span>, London,<br />
<a href="http://www.moneyscience.com/training/index.html" target="_blank"><span id="lw_1265210335_7">http://www.moneyscience.com/training/index.html</span></a></p>
<p>Assoc Prof Mark Joshi<br />
Centre for Actuarial Studies<br />
<span id="lw_1265210335_8">University of Melbourne</span><br />
My website is <a href="http://www.markjoshi.com/" target="_blank"><span id="lw_1265210335_9">www.markjoshi.com</span></a></p></blockquote>
<p><span><br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.puppetmastertrading.com/blog/2010/02/03/kooderive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;the SEC made Madoff&#8221;</title>
		<link>http://www.puppetmastertrading.com/blog/2010/01/17/the-sec-made-madoff/</link>
		<comments>http://www.puppetmastertrading.com/blog/2010/01/17/the-sec-made-madoff/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 14:32:59 +0000</pubDate>
		<dc:creator>tito</dc:creator>
				<category><![CDATA[dereferenced]]></category>
		<category><![CDATA[our managed markets]]></category>

		<guid isPermaLink="false">http://www.puppetmastertrading.com/blog/?p=944</guid>
		<description><![CDATA[Bill Harts, a friend of mine who has, as they say, forgotten more about electronic trading and market structure than most will ever be burdened by, has recently taken an interest in the public letters written to the SEC in response to their requests for public comments on dark pools.  Mostly, these letters are funny [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Bill Harts &amp; Co." href="http://hartsandco.blogspot.com/" target="_blank">Bill Harts</a>, a friend of mine who has, as they say, forgotten more about electronic trading and market structure than most will ever be burdened by, has recently taken an interest in the <a title="public letters to the SEC on dark pools" href="http://hartsandco.blogspot.com/2010/01/dark-pool-letters-to-sec.html" target="_blank">public letters written to the SEC</a> in response to their requests for public comments on dark pools.  Mostly, these letters are funny and reveal people&#8217;s propensity to point shoot and aim in that untidy order.</p>
<p>But some are revealing and one in particular is <a title="Steve Wunsch letter to SEC" href="http://www.sec.gov/comments/s7-27-09/s72709-32.pdf" target="_blank">100% required reading</a> for anyone interested in electronic markets.</p>
<p>The writer introduces himself thusly:</p>
<blockquote><p>I am Steve Wunsch, the principal inventor of two SEC‐regulated stock exchanges, the Arizona Stock Exchange “AZX” (originally called Wunsch Auction Systems, Inc. “WASI”) and the ISE Stock Exchange, both of which include dark pools. In fact, both of them, like all modern stock exchanges, have both lit and dark components and, thus, have provided me with potentially useful perspective on the dark pool question and on transparency in general. I will focus heavily on the latter, for it is impossible to understand the dark pool issues raised without understanding the value of transparency or, if improperly applied, the lack thereof. The AZX experience was, I believe, particularly instructive in this regard. Its highly transparent call market structure, combined with its unique regulatory status as a “low volume exempt”exchange, enabled me to see transparency and the role of regulation in promoting it from a perspective that I don’t believe anyone else has.</p></blockquote>
<p>He deftly mixes snark and a historical perspective on regulation with an opinionated and informed view on the forces driving current equity markets&#8217; microstructure arguing that the worst issues are due to regulatory failures.  He concludes, logically enough, that the SEC should be disbanded.  Perhaps his most inflammatory bit is his claim that the &#8220;SEC made Madoff.&#8221;  For effect, the section is entitled &#8220;An American Oligarchy&#8221;:</p>
<blockquote><p>AN AMERICAN OLIGARCHY</p>
<p>It is not in the Commission’s interest to admit failures of policy, such as the ones I have described in this letter, and I have never seen it done. It was not in the Commission’s interest to admit that Bernie Madoff was the SEC’s most trusted and intimate confidante in formulating and selling transparency, electronic trading and<br />
the whole NMS concept to Wall Street, the public and Congress. His legitimate business was the epitome of the kind of transparent electronic competition that NMS’s leveling policies were trying to create, and he occupied the most favored place of all industry advisors on policy and rules as NMS was being created. In a very real and literal sense, Madoff’s legitimate business and NMS were made for each other. NMS cleared a path for the application of continuous transparency by new electronic competitors, very visibly led by Madoff, enabling him to become at one time the third largest market in the United States, even though he wasn’t officially registered as anything but a broker‐dealer.</p>
<p>Had the SEC not emasculated the rules by which the NYSE controlled its members, Madoff would never have happened. In the time before NMS, when the exchange had Rule 390 or the stronger Rule 394 before it, diverting orders away from the floor or selling them to Madoff would have been banned. But on antitrust principles, the SEC wanted to foster NYSE‐busting competition in NMS, and Madoff became its PosterBoy for such competition. In order to make way for him, the SEC opened up a variety of loopholes that allowed orders to be diverted from NYSE to Madoff and printed on regionals like Cincinnati. Rules 19c‐1, 19c‐2 and 19c‐3 were in this vein. There were perennial attempts by the NYSE to plug the loopholes and rein in the membership, but the SEC batted them all away, enabling Madoff to continually grow his business. Eventually, the NMS environment forced the NYSE to abandon Rule 394, then Rule 390 and ultimately its membership organization altogether when it demutualized. This was all very good for Madoff. And Madoff was very good for NMS, giving it industry cred far in excess of what this poorly articulated socialist leveling theory could have had without his support.</p>
<p>In spite of a 457‐page SEC investigation into Madoff and how his Ponzi scheme was missed, the most obvious reasons were not considered, namely, that Madoff played a central role in helping the Commission design and sell NMS, and that NMS made him rich long before the Ponzi scheme. Most importantly, the credibility that theCommission’s collaboration with Madoff on NMS conferred on him was the principal factor enabling him to bring in money for the Ponzi scheme. Although the investigation’s report notes his credibility in the industry, it is mentioned as if itwere just a fact of life and was already there. Not mentioned is that his superior access to the SEC and apparent influence over the Commission, both of which were implicitly proved by his ability to get rich on NMS, are the most important reasons that he had such extraordinary credibility in the industry. The truth is that the SEC made Madoff. He could not have existed as a threat to investors without the Commission’s active and dedicated support over several decades.</p></blockquote>
<p>Although, in typical blogger fashion, I&#8217;ve highlighted his spiciest claim, the rest of the letter is more technical and informative while just as entertaining.  I encourage you to read it and then engage in a thought experiment in which You are the designer of an electronic exchange and must balance the needs of a very heterogeneous set of users and stakeholders while ensuring transparency, liquidity, profitability, &#8220;fairness&#8221;, performance (he references an exchange targeting 100M executions per second) and utterly fail-safe transactional integrity&#8230;</p>
<p>I have embedded the full letter below the break&#8230;</p>
<p><span id="more-944"></span></p>
<p><object style="width: 600px; height: 475px;" classid="clsid:166b1bca-3f9c-11cf-8075-444553540000" width="600" height="475" codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0"><param name="sound" value="true" /><param name="progress" value="true" /><param name="autostart" value="true" /><param name="swliveconnect" value="false" /><param name="swstretchstyle" value="meet" /><param name="swstretchhalign" value="none" /><param name="swstretchvalign" value="none" /><param name="src" value="/images/steveWunsch.pdf" /><param name="align" value="left" /><embed style="width: 600px; height: 475px;" type="application/x-director" width="600" height="475" src="/images/steveWunsch.pdf" align="left" swstretchvalign="none" swstretchhalign="none" swstretchstyle="meet" swliveconnect="false" autostart="true" progress="true" sound="true"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.puppetmastertrading.com/blog/2010/01/17/the-sec-made-madoff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>core arb</title>
		<link>http://www.puppetmastertrading.com/blog/2009/12/15/core-arb/</link>
		<comments>http://www.puppetmastertrading.com/blog/2009/12/15/core-arb/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 15:05:17 +0000</pubDate>
		<dc:creator>tito</dc:creator>
				<category><![CDATA[FIX Protocol]]></category>
		<category><![CDATA[dereferenced]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://www.puppetmastertrading.com/blog/?p=918</guid>
		<description><![CDATA[Cloud computing looks to have turned yet another interesting corner.   This time the turn leads towards the development of a liquid, fully electronic new marketplace in &#8220;spot instances&#8221;.
&#8216;Spot&#8216; means what you would expect it to in the context of trading: the current pricing for immediate delivery of a commodity.  &#8216;Instance&#8216; is the atomic element [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignleft" style="width: 95px"><img src="/images/core.jpeg" alt="core arbitrage?" width="85" height="127" /><p class="wp-caption-text">FIX interface?</p></div>
<p>Cloud computing looks to have turned yet <a title="Amazon EC2 Spot Instances Blog post" href="http://aws.typepad.com/aws/2009/12/ec2-spot-instances-and-now-how-much-would-you-pay.html" target="_blank">another interesting corner</a>.   This time the turn leads towards the development of a liquid, fully electronic new marketplace in &#8220;spot instances&#8221;.</p>
<p>&#8216;<a title="wikipedia: spot priing" href="http://en.wikipedia.org/wiki/Spot_price" target="_blank"><em>Spot</em></a>&#8216; means what you would expect it to in the context of trading: the current pricing for immediate delivery of a commodity.  &#8216;<em>Instance</em>&#8216; is the atomic element within Amazon&#8217;s cloud environment; an instance is the smallest chunk of computing capability which can be provisioned within the cloud.</p>
<p><strong>Amazon is making markets in <em>cores</em> and they&#8217;re exposing functionality just as a regular exchange would: both through user interface &#8217;screens&#8217; as well as programmable APIs.</strong></p>
<p>From their <a title="spot instances announcement" href="http://aws.amazon.com/ec2/spot-instances/" target="_blank">announcement</a>:<strong><br />
</strong></p>
<blockquote><p>Spot Instances enable you to bid for unused Amazon <span>EC2</span> capacity.  Instances are charged the Spot Price set by Amazon <span>EC2</span>, which fluctuates periodically depending on the supply of and demand for Spot Instance capacity. To use Spot Instances, you place a Spot Instance request, specifying the instance type, the region desired, the number of Spot Instances you want to run, and the maximum price you are willing to pay per instance hour. To determine how that maximum price compares to past Spot Prices, the Spot Price history is available via the Amazon <span>EC2 API</span> and the <span>AWS</span> Management Console. If your maximum price bid exceeds the current Spot Price, your request is fulfilled and your instances will run until either you choose to terminate them or the Spot Price increases above your maximum price (whichever is sooner).</p></blockquote>
<h5>embedded optionality</h5>
<p>While the inclusion of, effectively, a market data service is neat, probably the most interesting aspect of the initial protocol they&#8217;ve designed is that it contains embedded optionality and behaves a bit like <a title="wikipedia: barrier options" href="http://en.wikipedia.org/wiki/Barrier_option" target="_blank">barrier options</a>.  That is, when I setup an &#8216;order&#8217;, I need specify a maximum price I&#8217;m willing to pay.  When the spot price drops below my max, I get &#8220;knocked-into&#8221; a contract and instances are allocated to me.  If the spot price rises above my max while I&#8217;m running, I get &#8220;knocked-out&#8221; of the contract and my jobs get terminated.</p>
<p>The intent is to allow for low-priority jobs to be dynamically run whenever pricing drops below a user&#8217;s threshold, but the (intended?) consequence is that it adds the <em>delicious and malleable tang of path dependency</em> to these instruments&#8230;</p>
<h5>secondary markets, FIX, arbitrage..?</h5>
<p>Amazon currently controls the market entirely, but it&#8217;s not hard to imagine a secondary market evolving.  Given that others are beginning to copy Amazon&#8217;s APIs, one can also imagine markets which operate across providers &#8230;  perhaps accessed via FIX?&#8230;</p>
<p>Who knows?  In the not-too-distant future, we may well be able to implement &#8216;<strong><em>core arb</em></strong>&#8216; strategies&#8230;or make markets in cores&#8230; or find that we can effectively hedge with disciplined exposure to the &#8216;core market&#8217; or &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.puppetmastertrading.com/blog/2009/12/15/core-arb/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>peaky</title>
		<link>http://www.puppetmastertrading.com/blog/2009/12/08/peaky/</link>
		<comments>http://www.puppetmastertrading.com/blog/2009/12/08/peaky/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 14:41:51 +0000</pubDate>
		<dc:creator>tito</dc:creator>
				<category><![CDATA[dereferenced]]></category>
		<category><![CDATA[market data]]></category>
		<category><![CDATA[our managed markets]]></category>

		<guid isPermaLink="false">http://www.puppetmastertrading.com/blog/?p=894</guid>
		<description><![CDATA[I came across this compelling site which uses a hardware-based ticker plant (Exegy) in a colo environment to measure peak bandwidth across scads of NA feeds and then, every minute, updates a chart like the above to capture the average messages/sec across all of them.  Pretty swank.
While the uninformed may rail against colocation rather than [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption aligncenter" style="width: 453px"><a href="http://www.marketdatapeaks.com/"><img title="peaky" src="/images/peaky.png" alt="messages per second across all feeds" width="443" height="294" /></a><p class="wp-caption-text">messages per second across &quot;all&quot; feeds</p></div>
<p>I came across this compelling <a title="Market Data Peaks" href="http://www.marketdatapeaks.com/" target="_blank">site</a> which uses a hardware-based ticker plant (<a title="Exegy ticker plant" href="http://www.exegy.com/" target="_blank">Exegy</a>) in a colo environment to measure peak bandwidth across scads of NA feeds and then, every minute, updates a chart like the above to capture the average messages/sec across all of them.  Pretty swank.</p>
<p>While the uninformed may rail against colocation rather than focus on less intriguing issues like banana-variety corruption, they miss the basic point that colo can be done by anyone with the checkbook and the wish to do so.</p>
<div class="wp-caption alignright" style="width: 144px"><img class="   " src="/images/forrest-gump-shrimping.jpg" alt="unfair advantage?" width="134" height="134" /><p class="wp-caption-text">unfair advantage?</p></div>
<p>It&#8217;s sort of like that boat in Forrest Gump.  Forrest wanted to be a shrimper.  So he invested in a boat.  With his initial capital, hard work, perseverance and a bit of luck, Forrest made a go of it.  He might easily have not made it.  Colo is like that.  You can shrimp without a boat if you have a mask and fins, but it&#8217;s likely not a sustainable model&#8230; either way, it&#8217;s hard to see the harm in Gump&#8217;s boat.  Or colocation.</p>
<p>Hat-tip to <a title="Rodrick's Web Log !!" href="http://rodrickbrown.com/blog/" target="_blank"><em>Rodrick&#8217;s Web Log !!</em></a> for spotting the market data peaks site.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.puppetmastertrading.com/blog/2009/12/08/peaky/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>perfect crime</title>
		<link>http://www.puppetmastertrading.com/blog/2009/11/02/perfect-crime/</link>
		<comments>http://www.puppetmastertrading.com/blog/2009/11/02/perfect-crime/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 12:42:04 +0000</pubDate>
		<dc:creator>tito</dc:creator>
				<category><![CDATA[dereferenced]]></category>
		<category><![CDATA[options pricing]]></category>
		<category><![CDATA[our managed markets]]></category>

		<guid isPermaLink="false">http://www.puppetmastertrading.com/blog/?p=754</guid>
		<description><![CDATA[or: a computational complexity model for derivatives fraud
Derivatives pricing has always been a notoriously complex, computationally expensive and potentially breathtakingly remunerative undertaking.  This is true enough for relatively vanilla, exchange-traded options, but once one goes off-market and starts applying creative financial engineering, it can get much more complicated.  Products like CDOs, CDSs, CDO^2s and their [...]]]></description>
			<content:encoded><![CDATA[<h4><span style="color: #000000;">or: a computational complexity model for derivatives fraud</span></h4>
<div class="wp-caption alignleft" style="width: 196px"><img src="/images/lemon.jpg" alt="lemon law arbitrage?" width="186" height="248" /><p class="wp-caption-text">lemon-law arbitrage?</p></div>
<p>Derivatives pricing has always been a notoriously complex, computationally expensive and potentially breathtakingly remunerative undertaking.  This is true enough for relatively vanilla, exchange-traded options, but once one goes off-market and starts applying creative financial engineering, it can get much more complicated.  Products like CDOs, CDSs, CDO^2s and their ilk have exploded in recent years creating opaque markets of trillions of notional dollars and accounting complexities we&#8217;re still only beginning to understand.</p>
<p>A recent paper, <a title="Computational Complexity and Information Asymmetry in Financial Products" href="http://www.cs.princeton.edu/~rongge/derivative.pdf" target="_blank">Computational Complexity and Information Asymmetry in Financial Products</a>, by Arora, Barak, Brunnermeier and Ge take things a step or two further as they illustrate using information theory that it may be far worse than imagined as <strong><em>totally undetectable fraud</em></strong> <em><strong>can be engineered into these products</strong></em>.  They show that fraud with these products can be undetectable in the sense that the pricing process is a <em>formally</em> <em>intractable</em> problem when the informational asymmetry inherent in the development of these products is taken into consideration. In this context, &#8220;informational asymmetry&#8221; is a polite way of saying &#8220;fraud.&#8221;</p>
<p>The authors, from the Department of Computer Science and Center for Computational Intractability at Princeton (man, I want one of their business cards!), demonstrate that if the designer of, say, a CDO wants to cherry-pick amongst bundled assets to maximize their own return, they can do so in a way such that it would be impossible for a buyer of the derivative to know they were being stiffed.  The problem can be so hard that if you got the NSA&#8217;s mythic clusters humming on a pricing model, they might chug away until the sun falls from the sky before they accurately price it&#8230;  Co-author Rong Ge provides a FAQ to the paper <a title="FAQ" href="http://www.cs.princeton.edu/~rongge/derivativeFAQ.html" target="_blank">here</a> and I must hat-tip Andrew Appel for his <a title="Freedom to Tinker" href="http://www.freedom-to-tinker.com/blog/appel/intractability-financial-derivatives" target="_blank">informative post</a> on the paper.</p>
<p>The &#8220;perfect crime&#8221; is a puzzle that has occupied the (criminal and otherwise) mind of many a bright and motivated soul from time immemorial.  While some may indulge towards the vulgar or base through violence or vice and others might ponder the perfect crime of passion, the cerebral Queen of Crime is surely some form of regulatory arbitrage: committing the crime for which the law has yet to be written or creatively engineering a legal loophole for a crime one has perpetrated or is about to perpetrate.  The developers of CDOs are to be lauded as it appears they have materially upped the state-of-the-art of the perfect crime.</p>
<p>hmmm&#8230; Is there a Nobel for that?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.puppetmastertrading.com/blog/2009/11/02/perfect-crime/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>easy money</title>
		<link>http://www.puppetmastertrading.com/blog/2009/10/27/easy-money/</link>
		<comments>http://www.puppetmastertrading.com/blog/2009/10/27/easy-money/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 13:35:05 +0000</pubDate>
		<dc:creator>tito</dc:creator>
				<category><![CDATA[books]]></category>
		<category><![CDATA[dereferenced]]></category>
		<category><![CDATA[strategy development]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://www.puppetmastertrading.com/blog/?p=698</guid>
		<description><![CDATA[There seems to be a developing meme out there suggesting that algorithmic-, and in particular high-frequency, trading is some kind of gold-rush route to easy money which brings to mind&#8230;
&#8230;this revision of a paper I&#8217;d read previously: &#8220;Statistical Arbitrage in the US Equities Market&#8221; by Avellaneda and Lee.   It&#8217;s a detailed and thoroughly worked [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignleft" style="width: 252px"><img style="margin: 3px 5px;" src="/images/easyMoney.jpg" alt="" width="242" height="300" /><p class="wp-caption-text">you, hf-trading</p></div>
<p>There seems to be a developing meme out there suggesting that algorithmic-, and in particular high-frequency, trading is some kind of gold-rush route to easy money which brings to mind&#8230;</p>
<p>&#8230;this revision of a paper I&#8217;d read previously: <a title="Statistical Arbitrage in the US Equities Market by Avellaneda &amp; Lee" href="/images/AvellanedaLeeStatArb20090616.pdf" target="_blank">&#8220;Statistical Arbitrage in the US Equities Market&#8221;</a> by Avellaneda and Lee.   It&#8217;s a detailed and thoroughly worked (and now re-worked) paper illustrating the development and analysis of a US equity stat-arb strategy based on <a title="Principal Component Analysis" href="http://en.wikipedia.org/wiki/Principal_component_analysis" target="_blank">Principal Component Analysis</a> (PCA) and then revised to use ETFs.</p>
<p>I came across this paper as I have still never used PCA in any of my own strategy development work and read Carol Alexander&#8217;s excellent <a title="Market Models, Carol Alexander " href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0471899755.html" target="_blank"><span style="text-decoration: underline;">Market Models</span></a> over my summer vacation with an eye towards giving a PCA hedging model a spin in the near-term. Thus, I wanted another look at this paper as a reference point.  Although it&#8217;s an excellent paper, I&#8217;m not going to urge you to go out and read it immediately unless you have a reasonably pressing practical interest.  Instead, I find it interesting largely because of one of its authors &#8211; Professor Avellaneda &#8211; and its conclusions in the form of its strategies&#8217; performance.</p>
<p>I&#8217;ve seen Prof Avellaneda speak a number of times at a variety of quant meetups organized by the relevant <a title="Columbia's Center for Financial Engineering" href="http://www.cfe.columbia.edu/">Columbia</a>/<a title="Courant" href="http://www.cims.nyu.edu/">NYU</a> financial engineering depts.  His paper reminds me that at least once during my noisome adolescent years, my father intoned darkly that:</p>
<blockquote><p><strong>the streets are littered with brilliant minds</strong></p></blockquote>
<p><span id="more-698"></span>Implying that any wits I may believe myself to possess wouldn&#8217;t by themselves be worth much in life and that I&#8217;d need to bring actual <em>tools</em> to the task of solving problems if I wanted to address interesting ones.  Having seen Mr Avellaneda speak, I&#8217;m confident that at my peak, my &#8220;processor&#8221; was never as fast as his.  Much worse, there is no comparison between the tools he can level at a problem compared to me &#8211; he&#8217;s on an entirely different playing field so far as concrete mathematical/analytical capabilities go.  That&#8217;s why I go see him speak and read his papers.</p>
<p>Thus, the <em>results</em> of Avellaneda and Lee&#8217;s work are particularly interesting to me as they&#8217;re really pretty dull: something like a Sharpe of .9 and degrading briskly.  Now, you don&#8217;t expect people to be providing detailed recipes to wildly profitable strategies, and this result isn&#8217;t <em>bad</em>, particularly given that they&#8217;re describing strategies which likely have significant capacity.  Still, it illustrates that very smart people working with sophisticated mathematical tools even over extended periods are still operating under noteworthy constraints.  Perhaps also: ideas are relatively easy &#8211; examining them in the requisite detail is difficult and time consuming, even for (particularly for?) people with the most finely honed toolsets&#8230;</p>
<p>I frequently have friends or colleagues who will observe that if you &#8220;just write a strategy that <em>foos</em> when <em>bar</em> but <em>yaddas</em> when <em>baz</em>&#8230; you should surely make money.&#8221;  Maybe.  But the reality is that just putting together the strategy and <em>working through it</em> takes significant time for anything but the simplest strategies.  Once you add genuine complexity to a strategy, you can spend enormous time tuning it.</p>
<p>This, in turn, poses a dilemma I encounter frequently and honestly don&#8217;t have a great answer for:</p>
<blockquote><p>how to find the balance between continuing development on a known good strategy and initiating the development and analysis of unrelated and novel strategies?</p></blockquote>
<h3>the back of the envelope as canvas</h3>
<p>This next (de-)reference isn&#8217;t directly pertinent to algo trading, but the lessons learned by building <strong>BIG</strong> distributed systems can surely be applied elsewhere.  And they&#8217;re just plain fascinating.</p>
<p>Google&#8217;s Jeff Dean gave a recent talk entitled &#8220;Designs, Lessons and Advice from Building Large Distributed Systems&#8221; at the <span style="font-family: Cambria;"><span style="text-decoration: underline;">La</span>rge Scale <span style="text-decoration: underline;">Di</span>stributed                         <span style="text-decoration: underline;">S</span>ystems and Middleware (somehow &#8220;LADIS&#8221;) <a title="LADIS" href="http://www.cs.cornell.edu/projects/ladis2009/" target="_blank">workshop</a> and the slides are <a title="Jeff Dean Keynote LADIS" href="http://www.cs.cornell.edu/projects/ladis2009/talks/dean-keynote-ladis2009.pdf" target="_blank">here</a>.   Go read them. </span></p>
<p><span style="font-family: Cambria;">If bald exhortation doesn&#8217;t convince you maybe slide 24 will:</span></p>
<p><span style="font-family: Cambria;"><img class="aligncenter" src="/images/ladis-slide24.png" alt="" width="497" height="377" /><br />
</span></p>
<p>or perhaps what he does with these baseline numbers in slide 27 will pique your interest:</p>
<div class="wp-caption aligncenter" style="width: 512px"><img src="/images/ladis-slide27.png" alt="back of the envelope as art form" width="502" height="375" /><p class="wp-caption-text">back of the envelope as art form</p></div>
<p><span style="font-family: Cambria;">One that made me (a serial prototype-builder) cringe:<br />
</span></p>
<blockquote style="text-align: left;"><p>Important skill: ability to estimate performance of a system design<br />
<span style="color: #ff0000;">– without actually having to build it!</span></p></blockquote>
<p>Ouch.</p>
<h3><span style="color: #ff0000;"><span style="color: #000000;">maybe it is easy after all</span></span></h3>
<p><span style="color: #ff0000;"><span style="color: #000000;">Of course, if you&#8217;ve studied Avellaneda &amp; Lee&#8217;s paper and it held no challenges or surprises and you&#8217;ve reviewed Mr Dean&#8217;s presentation and it&#8217;s old hat to you, too&#8230;<br />
</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;"> </span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.puppetmastertrading.com/blog/2009/10/27/easy-money/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>multi-strategy trading with regimes</title>
		<link>http://www.puppetmastertrading.com/blog/2009/09/13/multi-strategy-trading-with-regimes/</link>
		<comments>http://www.puppetmastertrading.com/blog/2009/09/13/multi-strategy-trading-with-regimes/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 19:02:12 +0000</pubDate>
		<dc:creator>tito</dc:creator>
				<category><![CDATA[EMS Internals]]></category>
		<category><![CDATA[dereferenced]]></category>
		<category><![CDATA[portfolio management]]></category>
		<category><![CDATA[regime-switching]]></category>
		<category><![CDATA[strategy development]]></category>

		<guid isPermaLink="false">http://www.puppetmastertrading.com/blog/?p=594</guid>
		<description><![CDATA[One of the challenges of algorithmic trading is that although there&#8217;s plenty of interest in the space, practitioners aren&#8217;t generally forthcoming about their observations.  Academics, instead, focus on things that are frequently not very immediately practicable, or when they might be, always seem to set-up a little hedge-fund on the side while publishing colorful chum [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" style="margin: 2px;" src="/images/rswitch.jpg" alt="" width="225" height="300" />One of the challenges of algorithmic trading is that although there&#8217;s plenty of interest in the space, practitioners aren&#8217;t generally forthcoming about their observations.  Academics, instead, focus on things that are frequently not very immediately practicable, or when they might be, always seem to set-up a little hedge-fund on the side while publishing colorful chum about how markets are &#8216;behavioural&#8217; or somesuch.</p>
<p>Even if it&#8217;s hard to find good stuff, one must still look as there&#8217;s always more information that can help you than you can effectively process or retain.  A few weeks ago I was trying to formalize the expected profit function of an algorithm I&#8217;m developing and wanted to see what people had written about the topic.  I entered &#8216;define profit function for trading algo&#8217; into google and was pleasantly surprised to see a paper entitled <a title="Multi-strategy trading utilizing market regimes" href="/images/mstratRegimes.pdf" target="_blank">&#8216;Multi-strategy trading utilizing market regimes&#8217;</a> by Mlnarik, Ramamoorthy and Savani.  It doesn&#8217;t directly cover the topic I was looking for, but instead addresses a number of related topics I&#8217;ve been interested in for some time:</p>
<ul>
<li>the treatment of a strategy as an instrument in its own right</li>
<li>composing portfolios comprised of strategies</li>
<li>using regime switching techniques to manage portfolios of strategies</li>
</ul>
<p>In this post, I&#8217;ll briefly review their paper, illustrate how one can easily model strategies in relevant ways using the strategy &#8216;object model&#8217; I&#8217;ve described <a title="containing a strategy" href="http://www.puppetmastertrading.com/blog/2009/08/19/containing-a-strategy/" target="_blank">previously</a> through an example, and conclude with some thoughts on how these kinds of strategies might be implemented and further explored.</p>
<p><span id="more-594"></span></p>
<p><strong><a title="Multi-strategy trading utilizing market regimes" href="/images/mstratRegimes.pdf" target="_blank">&#8216;Multi-strategy trading utilizing market regimes&#8217;</a> by Mlnarik, Ramamoorthy and Savani</strong></p>
<p>Their paper begins:</p>
<blockquote><p>This paper considers the problem of dynamically allocating capital to a portfolio of trading strategies. The allocation should be robust, and the capital allocated to a trading strategy should reflect the confidence in the expected profit that the strategy will make in current market conditions.</p>
<p>Good trading strategies exploit recurring market dynamics that can be more prevalent in some time periods than in others. Indeed, the concept of regimes is fundamental to financial markets, and much research has focused on the detection of regime shifts. In this paper, we consider a regime as defined by a set of trading strategies that exhibit similar performance in a given time period.</p>
<p>We consider different parameterizations of the same strategy as distinct in our ground set of strategies. The trading problem is to pick a distribution over the ground set that will achieve good performance in the current time period.</p></blockquote>
<p>They start with some interesting definitions.  A trading strategy is defined as a function which takes a given market <em>State </em>and generates a convenient<strong> </strong><em>Answer </em>&#8220;denoting all possible trading decisions&#8221;.  <em>Strategy functions</em> can also be parameterized and different parameterizations of the same function/strategy are viewed as distinct <em>qualitative strategies</em>.  They assume the existence of  the set of all strategies.  A <strong>regime</strong> is defined as a set of trading strategies who behave similarly over a given period of time where <em>similarly</em> is measured by the variance of a fitness function.</p>
<p>So they start with a set of strategies, a fitness function and some historical market data or state, and their first task is to identify the regimes.  They do this by running the strategies against randomly selected partitions of historical data, quantifying their respective performances with the fitness function and identifying the clusters deemed statistically significant.  Those sufficiently significant and similar sets of strategies are themselves the <em>reasonable regimes</em> while the set of strategies within all the reasonable regimes are themselves dubbed the <em>reasonable strategies</em> &#8211; the candidates for execution.  This might sound strange, but as I&#8217;ll illustrate with a concrete example below, this is actually a pretty effective and even intuitive way of defining regimes.</p>
<p>They define function <em><strong>stFuncDist </strong></em>as, for any regime, generating a distribution or weighting of the strategies within the regime.<em><strong> </strong></em>While <em><strong>classifyMarket</strong></em> is a function that generates a distribution across all regimes for any given market state. Both models can be &#8220;trained&#8221; and they do so by again iterating randomly across chunks of historical data adjusting the weighting constants of these two functions.</p>
<p>Finally, it&#8217;s time to trade and they can effectively use <strong>classifyMarket </strong>to determine a predominant regime and allocate capital as indicated by <strong>stFuncDist</strong> to the appropriate set of &#8220;reasonable strategies.&#8221;</p>
<p>They claim to have utilized this technique to generate the results charted in Figure 1, but they give little detail on the initial universe of strategies.  I believe they had one strategy which was parameterized into a set of <em>qualitative strategies</em> and run across one market, the CME&#8217;s Nasdaq emini.  I have no reason to doubt that they had exactly this result, but without more details on what they actually did, it&#8217;s hard to view it as very meaningful, though it certainly is suggestive.  An interesting thing about how they present their result, which I&#8217;ve seen in other academic papers, is that because they&#8217;ve precisely defined the set of possible strategies they look at, they can also calculate max and min possible returns over the relevant period.</p>
<p><strong> </strong></p>
<div class="wp-caption aligncenter" style="width: 283px"><strong><strong><img src="/images/mstumr-returns.jpg" alt="Figure 1: Out-of-sample profit (middle line) versus possible min (bottom line) and max profit (top line) over all strategies for the period 2006-11-01 to 2008-08-28." width="273" height="142" /></strong></strong><p class="wp-caption-text">Figure 1: Out-of-sample profit (middle line) versus possible min (bottom line) and max profit (top line) over all strategies for the period 2006-11-01 to 2008-08-28.</p></div>
<p><strong> </strong></p>
<p>The paper continues with another section, but I&#8217;m going to stop my overview here as the last part is less interesting to me and the interested reader should of course read it themselves.</p>
<p><strong>complex strategies or simple strategies combined</strong></p>
<p>One of the broadest design questions I see for the development of effective trading algorithms is whether one should employ complex, customized algorithms or instead utilize simple algos which can be simply combined to produce <em>emergent</em> complexity.  Although the authors of this paper allude to &#8220;Good trading strategies&#8221;, I wonder if one can even forget the &#8220;good&#8221; part and instead worry about applying &#8211; even <em>bad</em>! &#8211; strategies at the right times.</p>
<p>There are a lot of things I like about this paper, but probably most of all it&#8217;s their definition and use of a regime.  One of my first <a title="redistribution" href="http://www.puppetmastertrading.com/blog/2007/10/07/redistribution/" target="_blank">posts</a> describes a pair of strategies &#8211; a simple mean reverter and a simple trend follower.  These two strategies are about as dumb as you please.  And yet, their behavior is pretty interesting apart the observations I&#8217;d published at the time regarding the distribution of their returns.  During the trading day, I&#8217;ve taken to running those two, old, dumb strategies across a variety of markets in simulation mode.  Why?  Because it&#8217;s easy, costs me nothing and actually is pretty interesting in that the strategies really do cluster in the way Mlnarik et al describe, effectively partitioning the market into visible regimes.</p>
<p><strong>a simple example: identifying regimes with strategies<br />
</strong></p>
<p>In order to illustrate this, I created a desktop within stratbox onto which I ran these two <em>qualitative strategies</em> parameterized differently and across six different markets.  In total, I have 48 strategies running with 24 of the mean reverting (MR) variety and 24 of the trend following (TF).  In figure 2 and figure 3, they are sorted by qualitative strategy – all of the MR strategies followed by all of the TF strats.   In figure 4, they’re instead sorted by instrument at the end of the day after all of the strats had been rendered quiescent for the night by their schedulers.  You can click to see a bigger version of these screenshots.  On each, the left side of the screen shows simple charts of the relevant markets while the right contains a table in which each line item is a running strategy.  The first is at the beginning of the day. the second is shortly before going silent at 4pm and the third is shortly after 4pm.</p>
<p style="text-align: center;">
<div class="wp-caption aligncenter" style="width: 510px"><a href="/images/regimes1.jpg" target="_blank"><img class="   " src="/images/regimes1.jpg" alt="variously parameterized mean-reverting &amp; trend-following strats run in sim " width="500" height="312" /></a><p class="wp-caption-text">Figure 2: variously parameterized MR &amp; TF strats run in realtime+simulation mode.  Sorted with the MR strats first. (click)</p></div>
<p style="text-align: center;">
<div class="wp-caption aligncenter" style="width: 510px"><a href="/images/regimes2.jpg" target="_blank"><img class=" " src="/images/regimes2.jpg" alt="later the same day" width="500" height="312" /></a><p class="wp-caption-text">Figure 3: later the same day</p></div>
<p style="text-align: center;"><strong> </strong></p>
<div class="wp-caption aligncenter" style="width: 510px"><strong><strong><a href="/images/regimes3.jpg" target="_blank"><img class=" " src="/images/regimes3.jpg" alt="at EOD, now sorted by instrument" width="500" height="312" /></a></strong></strong><p class="wp-caption-text">Figure 4: at EOD, now sorted by instrument</p></div>
<p>You’ll note that at all times throughout the day, the MR and TF strategies effectively mirrored each other regardless of market.  Although I’m not going to illustrate it, I’m going to just go right ahead and assert that this is almost always true  based on what I’ve seen.  And this is at the heart of the paper’s authors&#8217; insight regarding regimes – they can be effectively identified by examining the performance of even simple but well-defined strategies.</p>
<p>This suggests a simple means of implementing a similar design to that they described right on top of this example I’ve put together.</p>
<p><strong>modeling meta-strategies</strong></p>
<p>We need one more element to manage all of this – a meta-strategy – that is, a strategy for managing other strategies.  We support this idea in stratbox with what we call a controller strat.  The cannonical example of a controller strat is our implementation of the (Don’t) Panic button (the bright red button with an ! in the upper right hand corner) which will get all strategies out of the market with varying degrees of urgency and finality.  This is implemented as a controller strat which injects a stratpart into all running strategies.  The injected stratpart first deactivates its peers and then cancels outstanding orders and then gets out of the market with whatever urgency the user has required.</p>
<p><strong>allocating to portfolios of strategies</strong></p>
<p>In my example above, I have 48 strategies running in simulation across 6 futures markets.  Let’s imagine that at any moment in time, I will always have at least one strategy of each type (MR and TF) running for each market.<strong> </strong>Thus, I’ll always have 12 live strategies running against real money accounts and 36 candidates running against a simulator.  Effectively, we’ve just described a portfolio of 12 elements where each element is itself a strategy.</p>
<p>It’s not difficult to imagine implementing a controller strat which on a regular schedule will simply adjust the parametrization of the running strategies and their allocation of cash <em>based on the performance of the strategies running in simulation</em>.</p>
<p>It&#8217;s not difficult to imagine, but implementing it inevitably poses a variety of challenges not least of which is finding the time!  For now, we&#8217;re still finding new and interesting ways to express strategies which deal with portfolios of exchange-traded instruments.  But I think that this is just a point on our technology&#8217;s maturation curve which will ultimately lead to the regular development of strategies which operate on portfolios of strategies themselves&#8230;</p>
<p>Anyway, it&#8217;s nice to see a bit of academic work formalizing what I expect is a natural step in the evolution of trading algorithms.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.puppetmastertrading.com/blog/2009/09/13/multi-strategy-trading-with-regimes/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>real battlebots</title>
		<link>http://www.puppetmastertrading.com/blog/2009/08/17/real-battlebots/</link>
		<comments>http://www.puppetmastertrading.com/blog/2009/08/17/real-battlebots/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 15:10:03 +0000</pubDate>
		<dc:creator>tito</dc:creator>
				<category><![CDATA[dereferenced]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://www.puppetmastertrading.com/blog/?p=526</guid>
		<description><![CDATA[
There&#8217;s been a lot of attention focused on  trading battlebots recently.  It&#8217;s important to keep in mind that this is part of a long-standing, broad and arguably inexorable trend that is now spreading rapidly away from its successful base in industrial manufacturing to every other conceivable field from scheduling and logistics, to CAD and on [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" style="margin: 3px 5px;" src="/images/weddingParty.jpg" alt="wedding party popper" width="336" height="182" /></p>
<p>There&#8217;s been a lot of attention focused on  <a title="trading battlebots" href="http://www.google.com/search?q=trading+battlebots" target="_blank">trading battlebots</a> recently.  It&#8217;s important to keep in mind that this is part of a long-standing, broad and arguably inexorable trend that is now spreading rapidly away from its successful base in industrial manufacturing to every other conceivable field from scheduling and logistics, to CAD and on to more aggressive pursuits like trading and battlefield operations.  Perhaps looking at the state of the art in related fields can inform us about the direction of our algo bots.</p>
<p><a title="Drones take over" href="http://www.foreignpolicy.com/articles/2009/08/13/this_week_at_war_a_weak_state_solution_for_afghanistan" target="_blank">This article</a> in Foreign Policy illustrates an area where automation is making great strides into historically human undertakings.  The use of so-called drone aircraft for recon and tactical missile strikes has reached a remarkable milestone: <strong>this year, the US Air Force will train more &#8220;pilots&#8221; for unmanned aircraft than for real fighters or bombers</strong>.  Evidently there&#8217;s good reason for this change:</p>
<blockquote><p>By 2013, software and communications improvements will allow the Air Force&#8217;s unmanned-aircraft pilots to simultaneously fly three drones at one time, and four in an emergency. Another factor supporting the likely proliferation of drones such as the Predator, Reaper, and Global Hawk is their low cost compared with new manned aircraft such as the F-35 Joint Strike Fighter.</p>
<p>According to the Government Accountability Office, $24.5 million will purchase a set of four MQ-9 Reaper hunter-killer drones plus a ground station and satellite relay. (See page 117 of <a href="http://www.gao.gov/new.items/d09326sp.pdf" target="_blank"><span style="text-decoration: underline;">this report</span></a>.) The latest guess of the price for a single F-35 fighter-bomber is $100 million. (See page 93.) This gap in cost led Defense Secretary <strong>Robert Gates </strong>to demand the cancellation of the manned F-22 Raptor program <a href="http://www.af.mil/news/story.asp?id=123163023" target="_blank"><span style="text-decoration: underline;">in order to fund the purchase of more drones</span></a> for service in Afghanistan and Iraq.</p></blockquote>
<p><span id="more-526"></span></p>
<p>So, for the price of one F-35, I can get a 16-strong phalanx of drones and the required ground-based support to deploy them.  For the price of one F-22, I could get over 20.  Sounds like a deal.  But, they&#8217;re not really interchangeable parts as the F-35 or Raptor and other fighter-bombers can overcome &#8220;air defense threats&#8221; while the drones aren&#8217;t quite there yet.  Thus, they&#8217;re really only good against opponents that don&#8217;t have an air force or anti-aircraft capabilities.  In schoolyard parlance: they&#8217;re only good for defenseless opposition.  But we&#8217;re buying lots of them, so we must have found nails for our hammer.</p>
<p>While developmentally they are likely in different places, there&#8217;s probably an analogy to be made between the current state of development between military drones and their algo trading equivalents.</p>
<p>If today&#8217;s algos are like today&#8217;s drones in that they&#8217;re relatively dumb and can&#8217;t overcome defensive threats, what might tomorrow&#8217;s algos look like?  <strong>Who will they be able to target that they can&#8217;t currently?</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.puppetmastertrading.com/blog/2009/08/17/real-battlebots/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>it&#8217;s not about microstructure</title>
		<link>http://www.puppetmastertrading.com/blog/2009/08/07/its-not-about-microstructure/</link>
		<comments>http://www.puppetmastertrading.com/blog/2009/08/07/its-not-about-microstructure/#comments</comments>
		<pubDate>Fri, 07 Aug 2009 20:30:59 +0000</pubDate>
		<dc:creator>tito</dc:creator>
				<category><![CDATA[dereferenced]]></category>
		<category><![CDATA[our managed markets]]></category>

		<guid isPermaLink="false">http://www.puppetmastertrading.com/blog/?p=490</guid>
		<description><![CDATA[Steal a little and they call you &#8220;thief&#8221;&#8230; Steal a lot and they call you &#8220;King&#8221; &#8211; Bob Dylan
I try to avoid the news during the trading day.  I never trade manually and as I&#8217;ve mentioned before, I&#8217;ve never yet had much success trading the news and none of our models presently use news feeds [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>Steal a little and they call you &#8220;thief&#8221;&#8230; Steal a lot and they call you &#8220;King&#8221; &#8211; Bob Dylan</p></blockquote>
<p>I try to avoid the news during the trading day.  I never trade manually and as I&#8217;ve mentioned before, I&#8217;ve never yet had much success <a title="trading the news" href="http://www.puppetmastertrading.com/blog/2008/11/18/trading-the-news/" target="_blank">trading the news</a> and none of our models presently use news feeds for decision-making.  So I really try to avoid keeping excessively abreast of the news as it&#8217;s just a distraction from real work.</p>
<div class="wp-caption alignright" style="width: 143px"><img src="/images/hankGreenberg.jpg" alt="would-be king" width="133" height="89" /><p class="wp-caption-text">would-be king</p></div>
<p>That said, this morning I noted a pretty good jump in our pre-market p&amp;l and wanted to see what splendid news had prompted the spike.  So I scanned some headlines.</p>
<p>On Bloomberg I saw:</p>
<p><span class="newbullet">•</span><a href="http://www.bloomberg.com/apps/news?pid=20601087&amp;sid=ajR8ZIdKCXrU">U.S. Payroll Cuts Slow, Jobless Rate Unexpectedly Falls as Recession Eases </a></p>
<p><span class="newbullet">•</span><a href="http://www.bloomberg.com/apps/news?pid=20601087&amp;sid=atloJejwn8YA">AIG Reports First Profit in Seven Quarters After Investment Losses Shrink </a></p>
<p><span class="newbullet">•</span><a href="http://www.bloomberg.com/apps/news?pid=20601087&amp;sid=agHzSEPBxTMc">Dollar Advances as U.S. Employers Cut Fewer Jobs Than Economists Estimated </a></p>
<p>Unemployment down?  AIG profitable?  Dollar rumbling to strength?  Splendid, splendid and splendid.</p>
<p>I also saw the bit about <a title="Hank Greenberg pays $15M SEC" href="http://online.wsj.com/article/SB124956529248610983.html">Hank Greenberg paying the SEC $15M</a> as he &#8220;thought it would be good to get it behind us.&#8221;  Indeed, good thinking.</p>
<p>And anyone looking at the news this week knows that regulators are likely going to put the <a title="Lions and tigers and flash orders, oh my! " href="http://online.wsj.com/article/SB124940289965505053.html" target="_blank">kabosh on flash orders</a> and that <a title="Good as Goldman" href="http://ftalphaville.ft.com/blog/2009/08/06/65666/how-good-are-goldman/" target="_blank">Goldman trades profitably</a>.  (And they <a title="Goldman: improving an incredible return distribution" href="http://www.puppetmastertrading.com/blog/2009/02/04/distributions-gone-pear-shaped/" target="_blank">improve</a>!)</p>
<div class="wp-caption alignnone" style="width: 539px"><img src="/images/goodAsGoldman.jpg" alt="now thats a fat tail..." width="529" height="286" /><p class="wp-caption-text">  my kind of fat tail</p></div>
<p><span id="more-490"></span></p>
<p>Within a few moments, I&#8217;d identified the likely causes for our spike in p&amp;l: optimism.  Thank you, optimists!</p>
<p>My immediate question was answered, but the news about Mr Greenberg stuck with me for a moment.  After all, one of the positions we made some money on this morning was AIG, a firm perhaps as central to our current financial crisis as any could possibly be.  A *personal* $15M fine over accounting um irregularities.  Ouch, that&#8217;s gotta hurt.  Could you imagine paying a $15M fine?  &#8220;Without admitting wrong-doing.&#8221;  Remarkable.  I&#8217;d own-up to a fair amount of wrong-doing if it meant saving me $15M.  Of course, if the average American got hit by a $15M fine they&#8217;d be bankrupt.  What&#8217;s it do to Mr Greenberg?</p>
<p>Last I could find him on the Forbes list of <a title="#79 in the world" href="http://www.forbes.com/static/bill2005/LIROJGR.html?passListId=10&amp;passYear=2005&amp;passListType=Person&amp;uniqueId=OJGR&amp;datatype=Person" target="_blank">&#8220;World&#8217;s Richest People&#8221;</a> was 2005 when he was ranked #79, weighing-in with a fortune of ~$3.2B.  Of course, it&#8217;s been a tough few years and he&#8217;s probably taken it on the chin.  How much?  No idea, but for the sake of argument, let&#8217;s say he&#8217;s down to a lightened but still respectable fortune of ~$1B.</p>
<p>The average American instead has a &#8220;fortune&#8221; of somewhere between $0 and $1M, according to the FED&#8217;s most recent <a title="FED Survey of Consumer Finances" href="http://www.federalreserve.gov/pubs/bulletin/2009/pdf/scf09.pdf" target="_blank">Survey of Consumer Finances</a>.</p>
<div class="wp-caption aligncenter" style="width: 444px"><img title="Average American Income &amp; Net Worth" src="/images/averageIncomeNetWorth.jpg" alt="Hank wins" width="434" height="280" /><p class="wp-caption-text">Hank wins</p></div>
<p>For the sake of our back-of-the-envelope calculation, we&#8217;ll say that the average American family is worth $1M, though this is surely fanciful.  This means that Hank is only about 1000 times richer than our fanciful American family who&#8217;s equivalent fine would be $15K.</p>
<p>Now, $15K will get you a beer and more, so I&#8217;ll never be the one to spit on $15K, but for a $1M family it is something that will look a lot like an ordinary item on their taxes.  Not fun, but a lot of people would rather part with $15K than pass a kidney stone.  Actually, when you pass a kidney stone in the US you also typically have to cough up something like $15K, but that&#8217;s another story altogether..</p>
<p>It&#8217;s just not the kind of fine you&#8217;d think would be very effective at getting people to not ruin the global economy so they can pocket a few quick billions, thank you very much.  If I know I stand to make billions at the cost of being fined in the millions, I just might spin the wheel.  Not much deterrent there.</p>
<p>So, Hank really didn&#8217;t do so badly as all that.</p>
<p>Now that that&#8217;s out of the way, regulators can address important items like flash orders, short sellers and high-frequency trading.  Meanwhile, an almost manufactured-looking populist backlash suggests darkly that Goldman&#8217;s trading gains are ill-gotten.</p>
<p>/pitchfork-mode-on</p>
<p>I don&#8217;t personally believe that Goldman is front-running their clients, but I&#8217;d prefer to avoid the possibility entirely by disallowing firms with proprietary trading operations from handling client accounts.  In programming, the best way to deal with concurrency issues is to prevent them from happening structurally by employing producer-consumer queues and other such mechanisms.  In just the same way, front-running should be structurally prevented by regulation.  Just make it effectively impossible.  But this eminently sensible model was over-written in the twilight of the Clinton I years by some of the super heroes who brought us all the marvelous financial innovations we&#8217;ve enjoyed over the subsequent decade.</p>
<div class="wp-caption aligncenter" style="width: 250px"><img class=" " src="/images/supermen.jpg" alt="more kings, yay!" width="240" height="316" /><p class="wp-caption-text">more kings, yay!</p></div>
<p>Back to Goldman.  While I don&#8217;t think they&#8217;re front-running, everyone ethical/sensible will agree that if they were, it would be bad.  How bad?  Well, 252 trading days times $100M of ill-gotten gains yields something like $25B annually.  Big money by my proletarian standards, but let&#8217;s say that <a title="that's a 'T'?" href="http://www.nytimes.com/2009/07/21/business/economy/21bailout.html?_r=1" target="_blank">Mr Barofsky overcooked his stew</a> by an order of magnitude and this bailout will only cost us ~$2.5T.  That would make the worst case scenario for HFT hijinks something like 1% of our crisis tab.</p>
<p>Worth pursuing, if there&#8217;s something there, but probably not the most bang for regulatory buck out there.</p>
<p>What&#8217;s an ambitious regulator to do?  Well, faced with symptoms like those evident in today&#8217;s US markets, the <a title="IMF advice" href="http://www.theatlantic.com/doc/200905/imf-advice" target="_blank">IMF would recommend breaking-up the finance oligarchy</a> outright:</p>
<blockquote>
<p id="blurb">The crash has laid bare many unpleasant truths about the United States. One of the most alarming, says a former chief economist of the International Monetary Fund, is that the finance industry has effectively captured our government—a state of affairs that more typically describes emerging markets, and is at the center of many emerging-market crises. If the IMF’s staff could speak freely about the U.S., it would tell us what it tells all countries in this situation: recovery will fail unless we break the financial oligarchy that is blocking essential reform.</p>
</blockquote>
<p>As Americans we are participants to a historic transfer of wealth from the US taxpayer to [?].  We don&#8217;t know how much, but we know it&#8217;s measured in Trillions.  And we really can&#8217;t say where it has gone.  Remarkable circumstance.</p>
<p>Some are saying that modern finance is so complex that we can&#8217;t hope to understand what just happened.  But I don&#8217;t think we need people with sophisticated intuitions about volatility smiles or nuanced appreciation for the creative engineering of structured products to solve these mysteries.</p>
<p><strong>We just need garden-variety, honest and empowered investigators. </strong></p>
<p><img class="alignleft" style="margin: 3px 5px;" src="/images/untouchables.jpg" alt="" width="255" height="204" /></p>
<p>The &#8220;Untouchables&#8221; and other real-life gang-busters come to mind.  The techniques they employed would be effective for identifying and bringing down the people who&#8217;ve contributed to this epic transfer of wealth.</p>
<p>Just as they identified the &#8220;associates&#8221; of their prime suspects and then pieced together their activities by following money trails, our own regulators need to do some straightforward investigation of the people involved in this mysterious money hole.  Some will be innocent, some will have committed crimes.</p>
<p>Start with someone central to the fracas.  AIG has a few candidates with both Greenberg and Cassano likely suitable, but there are any number of <a title="Blameworthy" href="http://www.time.com/time/specials/packages/0,28757,1877351,00.html" target="_blank">lists</a> out there implicating people with our &#8220;credit crisis.&#8221;  Pick one.  Look closely at his (or her) taxes, offshore holdings, business interests.  Identify 50 of their top social &amp; business contacts.  Again, start with taxes.  Do this for a few cycles and you&#8217;ll have unwittingly collected the cream and dregs of international finance.  Investigate them.  Look at their taxes.  Follow the money.</p>
<div class="wp-caption alignright" style="width: 310px"><img src="/images/theyCallItAFamily2.jpg" alt="" width="300" height="200" /><p class="wp-caption-text">identify the bad guys, follow the money, prosecute</p></div>
<p>People who committed crimes go to jail.  People who didn&#8217;t don&#8217;t.  Some new laws will need to be made and probably others will need to be taken off the books.  Minimal math required.</p>
<p>But what few honest and competent regulators we have are not empowered to do anything except kvetch pleasantly on <a title="Elizabeth Warren on John Stewart" href="http://www.thedailyshow.com/watch/wed-april-15-2009/elizabeth-warren-pt--1" target="_blank">the John Stewart show</a> and perhaps muck about with market microstructure.  They are certainly not empowered to take on the beneficiaries of the crisis we&#8217;ll spend a generation paying for.  It&#8217;s even difficult to imagine how a regulator could be empowered to take down the architects of this most ambitious of capers.  The arch-villains of Mario Puzo or David Chase&#8217;s most feverish moments never approached the sophisticated operations unfolding today.</p>
<p>Focusing on market microstructure in an environment like this is truly missing the forest for the leaves.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.puppetmastertrading.com/blog/2009/08/07/its-not-about-microstructure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
