Tuesday, January 31, 2012

C++11 Compiler Support

Compiler support for C++11 is quite uneven at this point. Both Visual C++ and the Intel compiler only support 31 of the features. GCC has significantly better support at this point (48 features).

Monday, January 30, 2012

Trade Frequencies, Part 2

One of the main challenges in high-frequency finance is the irregular arrival of prices. Once you get down to the tick by tick prices, you can't count on normal interval time series. There are autoregressive models which support irregular arrival of prices. Engle and Russell's autoregressive conditional duration (ACD) model comes to mind (described in Econometric Modeling of Multivariate Irregularly-Spaced High-Frequency Data which extends the Engle-Russell Autoregressive Conditional Duration (ACD) model for the multivariate case).

Friday, January 27, 2012

Stock Price Limits and ADRs

Some foreign stock markets have daily price limits. For example, in Taiwan, the daily price limit is 7%. How often do we hit these limits? The US ADR for Taiwan Semiconductor (TSM) exceeded the daily price limit ceiling 114 times and dropped below the daily price floor 47 times during a 3597 trading day period from 1997 to yesterday (using Yahoo's adjusted prices). There turns out to be a few papers on price limits and international markets.

Thursday, January 26, 2012

Finance Research Papers

Here are some papers of interest I ran into recently:

Academic Programming Languages in Mainstream Use

It is said that once a programming language is born, it never really dies. That may be so, but popularity can still be a fickle thing. I think it is safe to say that most academic programming languages never make it out of the lab in a serious way. However, there are a few prominent exceptions to this observation, some of which were and are wildly successful:

Wednesday, January 25, 2012

Finance Research Papers

Here are a few hot-off-the-press research abstracts which caught my eye:

Tuesday, January 24, 2012

New C++ Features and C++ Texts

Without pretty fundamental changes such as concepts, it will only be a matter of time before we get a smattering of books on C++11. Some existing C++ books have been updated with a chapter to two on C++11 features. They will of course vary in quality considerably. David Vandevoorde is behind at least a couple of the new features. He has a book C++ Templates: The Complete Guide on template metaprogramming.

Writer's Market

A couple of days ago, I encounter 2012 Writer's Market Deluxe Edition (Writer's Market Online) at a neighborhood bookstore. The book contained a catalog of freelancing opportunities in a wide assortment of magazines and journals. What I found interesting was that financial and technology freelancers did not receive an appreciably higher rate than other areas. There were certainly exceptions, but for the most part, there was no real discrepancy between rates in different fields. The main trading-oriented publication the book listed was www.traders.com (Technical Analysis, Inc., publisher of Stock and Commodities, Working Money, and Traders.com Advantage magazines), where freelancers apparently contribute a good deal of the articles.

According to the Editorial Guidelines, the top 5 hot topics are relative strength indicator (RSI), average directional movement rating (ADXR), Fibonacci ratios, MACD and moving averages, and volume trends. I am a bit surprised to see RSI so prominent. In contrast, stochastics and chart reading are much further down on the list.

Monday, January 23, 2012

Saving Up for College Tuition and Hedging, Part 1

One of the biggest expenses for many American families is college tuition. In fact, it is a component of the Consumer Price Index (CPI), though not a very big component. The other overwhelming expenses are transportation (typically cars) and housing. For transportation and housing costs, you can at least partially hedge against further price increases (however imperfectly) by investing in appropriate securities (crude or RBOB futures and Case-Schiller housing futures). According to the December 2011 CPI report, tuition has increased by almost 7-fold since 1984 (the baseline of the CPI). For comparison, tuition increases have dwarfed even growth in hospital services expenses (only 6.5x). The only component of the CPI that grew more was tobacco (8.4x). Thus, not only is tuition a big expense, it is also one of the fastest growing. According to the Bureau of Labor Statistics (BLS)'s analysis, the college tuition inflation rate averages about 6.7% annually for the past 10 years (with a low of 4% and a high of 9.8%), even amidst recession. Recession exacerbated the increases as governments cut funding. Now what kind of investment can give an 8% annual return even in the midst of a massive downturn? A tax-sheltered education savings account such as a Coverdell or 529 Plan helps, but even then a steady 8% pre-tax return from index or mutual fund investing is quite challenging. MyMoneyBlog puts everything in perspective, showing that tuition increases dwarf that of the housing bubble.

In this series of posts, I will be looking into the cause of tuition inflation and the different possibilities for dealing with the phenomenon in investment terms.

Friday, January 20, 2012

C++ and GCC

Now that C++11 has been live for a little while, I was curious of the state of support from the major compilers. GCC/G++ is the major one. As of GCC 4.7, it appears to support of good deal of C++11 features which actually made it into the standard (concepts being the big omission). Variadic templates, auto-type declarations, initializer lists (vector<int> v {1,2,3}; works), unions supporting all non-reference member types, strongly-typed enums and many others made it into GCC. There is even a range for (for i : collection), something Java incorporated a while ago and the scripting languages had before then. The omissions (stuff in the standard but not in GCC 4.7) include garbage collection and most of the concurrency features.

Thursday, January 19, 2012

Algorithmic Finance

There is a brand new journal combining Computer Science and Finance, Journal of Algorithmic Finance. Both the advisory board and editorial team are ensemble casts with some of the biggest names in computer science and finance. They just published their inaugural issue in December 2011. The top paper (as indicated by number of SSRN downloads) is one on Markets are Efficient if and Only if P = NP, which perhaps is very reassuring to all the traders out there, at least at a theoretical level. For those unfamiliar with the terminology, P means solvable in polynomial time (i.e., we have reasonably smart, efficient algorithms to solve them) and NP means verifiable in polynomial time (i.e., given a solution, we can verify that it works efficiently). NP-complete is a class of problems such that all problems in NP can be (efficiently) reframed in terms of any NP-complete problem. For problems in NP but not in P, we generally do not have efficient algorithms for exact solutions. Instead, we pretty much have to fall back on exhaustive search (i.e., try all the possible answers and see what works). If one can solve an NP-complete problem efficiently in the general case, then one can solve any problem in NP efficiently, which potentially saves some astounding sum of money and enables a lot of previously impractical technologies. The more interesting implication of the paper is that the market can serve as an oracle to solve NP-complete problems. Recently DARPA has decided to invest in crowd-sourcing and gamification to solve difficult formal verification problems. Instead of potentially awkward game embeddings of difficult computational problems, I wonder if market strategies may be more effective and direct.

Earnings versus Dividend Yields

Given the good Bank of America earnings announcement today, I thought it is fitting to look at the earnings yield versus dividend yield of the S&P over a 50 year stretch of time. The ratio has been growing for a long, long while. Back in the 1960s, companies paid out a lot more of their earnings in dividends. Even given the rising trend, the ratio seems over-extended at this point. We have pretty high earnings yield at 7.7% but only a 2.1% dividend yield. The ratio seems to fall whenever we have some recession or slowdown, indicating that dividend cuts may lag earning declines. Assuming that earnings yield at least hold the line (a big IF), the long term trend suggests an overall dividend yield of 2.57%.

Wednesday, January 18, 2012

Net Worth, Income, and Media

In New York, everywhere you look is CNBC and Bloomberg. Both tout how their viewership has high net worth and income. With all the captive audiences on trading floors around the world, that isn't a far-fetched claim. For the most part, though, all I ever see on those two channels were GEICO commercials. The interesting part is that as a percentage of viewership, seekingalpha.com does better than both CNBC and Bloomberg at attracting people with household incomes 100k+ (44% versus 40% and 38% respectively). One can do better than that if you can convince kitcometals.com, Neiman-Marcus, or ThinkOrSwim.com to let you advertise on their sites which attract 56%, 41%, and 52% respectively of 100k+ household income viewership as a percentage of total viewership.

I would have included MoneyScience.com in this comparison but the data source I used was quite US-centric.

Microstructure Modeling

Jonathan Kinlay has an interesting list of papers on market microstructure including his synopsis of each. Many of them applied a vector autoregression model to quote and trade data. The focus, however, is always the impact of the limit order book and the strategies for generating new bids and asks on the limit order book. All of the studies focused on the stock markets. Perhaps the most interesting of the papers is a recent one on Price Dynamics in a Markovian Limit Order Market from Rama Cont of Columbia, which provides a mostly analytical model for high frequency dynamics of prices and order flow with endogenous relationship between durations and price changes. Most of the data in this study came from 2008. According to that data, for certain DJ stocks, ~1.2% of observed bid-ask spreads were more than 1 tick, thus not as pertinent to the model. The average lifetime of such a spread appears to be only a couple of milliseconds. The model does consider order flow in the presence of market orders and cancellations, including the case when they dominate limit orders.

I also found a number of books on the subject (more after the jump).

Tuesday, January 17, 2012

Memory Management and Concurrency in C++

Despite the flurry of activity from the Boost and C++11 standards committee, two crucial things remain quite challenging: efficient memory management and concurrency. What started me down this train of thought was some good old code reading. I encountered plain old vectors of pointers. There are apparently a handful of alternatives to this. Boost implements ptr_vector that keeps track of the lifetimes of all its elements as a unit. vector<shared_ptr> is another possibility. The core of the problem is that since vectors' underlying representation is a pointer, and one cannot get a pointer to a reference (the assumption being one wanted the efficiency of reference-passing but with the convenience of STL containers).

More after the jump

Monday, January 16, 2012

Airport Reading

When I am stuck in the airport I often visit the bookstores there. Airports are apparently one of the last bastions where bookstores still exist whereas they have completely disappeared in some towns. Most of the time, airport bookstores do not carry anything of interest to me except the latest Barron's and a few finance magazines. Consequently, I was surprised pleasantly to see at least two of Michael Lewis' books at one airport bookstore, Boomerang: Travels in the New Third World (about the roots of financial crises in Greece, Ireland, Germany, and the US) and Moneyball (about the business and economics of baseball), both being NY Times bestsellers. Lewis the the author of Liar's Poker, a sardonic expose on the unreal bigger-than-life world of Wall Street in the 1980s.

Tuesday, January 10, 2012

Earnings season is upon us

It's earnings season again. Alcoa started us on a sour note with a multi-cent miss even after excluding one-time items. Tiffany's warned. But benign retail numbers were out this morning (with Ross and Costco among others doing fairly well). This has given the market a lift.

I revisit a trade I was watching but did not make after the jump.

Friday, January 6, 2012

Trade Frequencies, Part 1

Typically what people refer to as high-frequency trading occurs on the stock markets. However, firms have also branched out to a whole assortment of other markets in attempt to reap the alpha from high-frequency strategies. Moreover, data such as futures prices sometimes serve as a signal for equity trading. Different kinds of markets, however, have considerably different characteristics. Moreover, the volume and trade frequency varies among each individual security. On one side, you have the SPY ETF which is easily among the most actively traded securities in the stock market with daily volumes in the hundreds of millions. During August 2011, SPY's volume even spiked to as much as 717 million, though 100-200 million is more typical. To put that into perspective, the total daily volume of the NYSE is about a couple billion in recent times. In contrast, some securities are barely traded at all.

More on all this after the jump...

Thursday, January 5, 2012

Garbage Collection and C++

C/C++ had the potential for automatic garbage collection in the form of the conservative mark-sweep Boehm-Demers-Weiser garbage collector for decades (at least from 1988 onwards). Although an early version of the garbage collector is even included in the GCC distribution, only a few groups actively use it. Some have used it as a leak detector. Boehm himself explains this as due to lack of standardization. With C++11, the hope is that this will change with official sanctioning of garbage collected implementations. The slide presentation you can find in the above link summarizes the design. The argument for garbage collection in C++ is the move to multicore, where the claim is that GC parallelizes better than manual management and that some parallelization techniques are simplified in the presence of GC.

POPL 2012 Papers

It's just a few weeks until POPL 2012 (Symposium on Principles of Programming Languages, one of the top programming language theory research conferences) in Philadelphia. The program has been out for a while. This time, there are three papers on C/C++ semantics. Apparently we have gotten to the point where researchers have (mechanically) formalized interesting chunks of that large, complicated edifice. The one coming out from INRIA [PDF] has a mechanized (Coq) semantics for C++ construction and destruction including C++11 features. The authors actually give a formal proof of the RAII (resource acquisition is initialization) pattern, specifically that in a terminating program every construction of a subobject is indeed matched by a destruction. The process of developing a formal semantics also helped identify issues in the C++ standard both C++03 and C++11. On the type systems side, there is also a paper from Adobe Research on gradual type systems, especially a type inference scheme with support for dynamic types. One paper describes a type system and language design supporting probability density functions for custom probability distributions and continuous probability. Apparently probability distributions are monads too!

Wednesday, January 4, 2012

Market Indexing

Fundamental indexing, an idea promulgated by Rob Arnott and his firm, caused quite a stir when it was introduced in 2004 with many questioning the whole idea. It has since given rise to a number of ETFs. The original is PRF, an ETF launched in December 2005. According to PowerShares' site, they are benchmarking PRF against the Russell 1000. Powershares followed on this product with 5 more, covering the developed markets ex-US (PXF), Asia Pacific ex-Japan (PAF), emerging markets (PXH), developed ex-US small cap (PDN), and US small-mid cap (PRFZ).

Tuesday, January 3, 2012

Forward Looking

Now that the holidays are over, what is going on in the markets? A couple of European debt auctions went fairly well last week. This does not change the overall long-term picture, but looks like nothing collapsed over the holidays. Moreover, the Iran-Strait of Hormuz situation could have spun out of control early on, but it did not (yet).

I was curious what news items were affecting the companies on my equity watch lists (both long and short). On the growth side of things, the basic materials and energy side lead the market (APA, EOG, ROSE, APC, HAL, NE, MOS, FCX). FCX is up ~6%. The rest are up more than 2% for the most part. HAL is suffering from some headline shock due to its spate with BP (BP is asking HAL to foot the cleanup bill plus lost profits), but the damage is mild since nothing is decided yet.