Friday, November 28, 2008

Blue Threads For C++

I continue my research work on this topic by constructing 3 working papers:

(1) Agent Strategies for Automated Stock Market Trading
(2) Automated Trading Algorithms in C++.Net
(3) FRACNET: The Conditional Simulation of Cascade Models

and reviewing the content at cplusplus.com. I also viewed the seven part series of "Threading in .NET" on the Intel Software Network:

http://software.intel.com/en-us/videos/threading-in-net-best-practices-1-of-7-series

and led to the work by Intel on Threading Building Blocks at

http://www.threadingbuildingblocks.org/

I downloaded the 2.1 version to use with their tutorial and the Reinders (2007) book. In addition, at Developers.net the following case study on risk management and compliance

http://www.developers.net/intelisdshowcase/view/2534

discussed the 64 bit Intel Itanium 2 processors for Monte Calo credit risk modeling. This permits banks to base their credit risk profiles and capital investment strategies on more complex simulations.

Some more good articles:

(1) Primer: Developing Multithreaded Applications

http://www.developers.net/intelisnshowcase/view/544

(2) Developing Multithreaded Applications: A Platform Consistent Approach

http://cache-www.intel.com/cd/00/00/05/15/51534_developing_multithreaded_applications.pdf

(3) Multithreaded Game Programming and Hyper-Threading Technology

http://software.intel.com/en-us/articles/multithreaded-game-programming-and-hyper-threading-technology

Since most of the transformations for trading is done on matrices, we have

(4) Matrix Vector Mulitiplication and Multi-threading Benefits

http://software.intel.com/en-us/articles/matrix-vector-multiplication-and-multi-threading-benefits

(5) Three Methods for Speeding up Matrix-Vector Multiplication

http://www.developers.net/intelisnshowcase/view/152

Finally, we have

(6) Multi-Threading for Experts: Inside a Parallel Application

http://www.developers.net/intelisnshowcase/view/474

References

Reinders, James (2007, July). Intel Threading Building Blocks: Outfitting C++ for Multi-core Processor Parallelism (Paperback) Sebastopol: O'Reilly Media, ISBN 978-0-596-51480-8.

Monday, November 24, 2008

C++ Programming Channel

In this continued work on research for Algorithmic Trading, I have been thinking about having not just posts from a blog, but channels devoted to each aspect of the architecture. One important feature is C++ threading which is covered in this Google Tech Talks video:



Other related topics:

Getting C++ Threads Right -http://www.youtube.com/watch?v=mrvAqvtWYb4
C++ Stylistics-http://www.youtube.com/watch?v=zh8W4ZglOlw&feature=channel

Creative Experimentation:Statistical Arbitrage

The Opening

I was bringing my daughter back from Penn State University yesterday for Thanksgiving break and she had my Pi movie

http://www.pithemovie.com/gifpage.html

that I had not seen in some time and seemed to fit right in with the work this morning. I am reviewing the Statistical Arbitrage work of Ed Thorp published by Wimott Magazine. The first 3 parts are pdfs:


Parts 4-6 are Word documents and can be found in the references at

http://en.wikipedia.org/wiki/Statistical_arbitrage


The articles examines the 70s-80s-90s work in this discipline. Here some of his thoughts and I would encourage to read all six parts of the article.

The Middle Game

Part 1:

Stocks with a large trading volume are called "liquid". They calculate a "fair" price for the largest and most traded stocks on both the New York and American Exchanges. Their strategy is based on their prediction buy the underpriced stocks and short the overpriced stocks. Each stock is 2.5 percent of the long portfolio. They limit the short position to 1.5 percent for each stock. Because of their strategy their results are "postively skewed".

There are about 253 trading days per year.

Part 2:


The author reviews the meaning of arbitrage with hypothetical numerical examples.


First example:
"An example might be sellinggold in London at $300 an ounce while at thesame time buying it at, say $290 in New York.Suppose the total cost to finance the deal and toinsure and deliver the New York gold to Londonis $5, leaving a $5 sure profit. That’s an arbitrage in its original usage." -Ed Thorp

They depend on a large number favorable trades to eventually deliver a profit. The basic
question is "How inefficient is the market?" "How can this be exploited to our advantage?" I agree that questions are more important than answers.

The article provides an overview to the historical answer to these questions.

Part 3:

A discussion on the refrigeration of CPUs and risk reduction. In order to control risk, they segregated into industry groups using factor analysis became the STAR model with 55 industry and 13 macroeconomic factors.

Part 4:

The article makes the important point.

"Note that every stock market system is necessarily limited in the amount of money it can use to produce excess returns. One reason is that buying underpriced securities tends to raise the price, reducing or eliminating the mispricing, and selling short overpriced securities tends to reduce the price, once again reducing or eliminating the mispricing. Thus systems for beating the market are limited in size by the impact of their own trading." -Ed Thorp

Part 5:


A discussion on haggling. I like this quote with the reference to 1/8 dollar a share by


"As President Lyndon Johnson once said about congressional spending, a billion dollars
here, a billion dollars there, and pretty soon you’re talking about some real money." -Ed Thorp


Another right on target quote that dovetails with my reading of Kasparov's latest book
"How Life Imitates Chess" is

"It reminded me of my granddaughter Ava, who when asked at the age of two, “What’s happening?”, replied “Nothing’s happening.” My beautiful ideas were rotting on the vine for lack of follow through. It was clear that if I wanted significant research and development we would have to do it 'in house.'" Back to the Pi movie and looking at every detail of the problem asking questions and leaving bread crumbs.

Part 6:

It is all about time..TIME...TIME... The discussion is on the hedge fund business-a statistical arbitrage hedge fund.

The End Game

The days are passing and ideas are percolating. I think back to Kasparov's book and the following quote:

Play the opening like a book,
the middle game like a magician,
and the end game like a machine.-Rudolf Spielmann

and his comments that, the purpose of the opening isn't to just survive the beginning of the game, it is to set the stage for the type of middle game you want to play.

Thursday, November 20, 2008

Tuesday, November 18, 2008

White Label Algorithmic Trading Platforms

In the course of my research, I found the following vendor that provides considerable insight into the direction that I am going. Modulus Financial Engineering has white label VC++ modules to purchase for algorithmic trading:

http://www.modulusfe.com/tasdk/vcpp.asp

Furthermore, they have a video demonstration of their application with discussion at

http://www.modulusfe.com/m4/

It is worth the investment of time to go through their site and think about a multi-tier object-oriented approach, modules and design patterns to this kind of system as well as an open source purchase of the building blocks for the application. More on this in the next post.

More research on this topic uncovered the following:

Sockets

Multithreading

Generalities

Monday, November 17, 2008

Automated E-Trading Systems in .NET

My thought today is on developing C++ and C# applications for an electronic trading environment. Therefore, this week I am looking at VC++/BOOST/ STL, templates, real-time trading, messaging (Tibco Rv, sockets, FIX) and multithreading as well as exchange links, connectivity, data feeds, gateways and TCP/IP for a trading system to cover options, futures and equities. I would use the .NET 3.5 framework with a SQL Server 2005 backend to communicate with (CBOT, CME, NYSE, NASDAQ) and other market data using live feeds from Bloomberg, Reuters and other systems.

In addition, this research is on the use of Smart Order Routing/Matching Engine and the architecture of Order Management Systems and review fixed income derivatives and exotics. Thus, the posts this week will use this as a basic motif.

Monday

Smart Order Routing/Matching Engine


  1. http://www.thetradenews.com/791
  2. http://streambase.typepad.com/streambase_stream_process/2008/09/smart-order-routing-and-cep.html
  3. http://complexevents.com/wp-content/uploads/2008/09/streambase_whitepaper_smart_order_routing.pdf
  4. http://www.futuresindustry.org/downloads/Jul-Aug-Algo.pdf
  5. http://www.pipelinetrading.com/resources/wst7371_final.pdf
  6. http://www.tradingtechnologies.com/news/TT_FA05.pdf

FIX

  1. http://www.tradingtechnologies.com/news/TT_FA05.pdf

Tuesday

Visual C++ and Trading Systems

  1. http://www.amazon.com/Building-Automated-Trading-Systems-Introduction/dp/0750682515