quant links

23

Click here to load reader

Upload: magna-forex-signals

Post on 08-Mar-2016

217 views

Category:

Documents


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Quant Links

Quant Platforms:http://www.smartquant.com/platform.php - http://www.cqg.com/ - Solid Order Platformhttp://epchan.blogspot.com/http://epchan.com/book/http://www.traderslog.com/trading-pairs.htm

Pairs trading is a strategy that uses two highly correlated financial instruments (eg Coca-Cola and Pepsi) whose price relationship has divergerged outside of the historical range. In buying one and selling the other, the strategy aims to profit from the price reverting back to as the mean trend as the spread between the two converges.

Related Reading: Trading Pairs: Capturing Profits and Hedging Risk with Statistical Arbitrage Strategies by Mark Whistler (2004)

Trade Like a Hedge Fund with this ATS!!!!Back to topics list To post a new topic, please log in or register. You can also visit

MQL5 forum

628

An ATS(Automated Trading System) is up for sale. The system is a Quantitative Pairs Trading StrategyThe Trading System is based on an equity strategy detailed in this article http://www.traderslog.com/trading-pairs.htm

The strategy is 100% fully Automated, the above article link contains the full details of such strategy and is setup for Manual Trading. Safe4x, LLC Automated the Trading System and is offering to anyone who wants to run Mechanical Trading Systems without following the market or analyzing Fundamentals/Technicals.

A client will setup a VPS(virtual private server) account, on which the Automated Trading system will run. The system is implemented in MetaTrader. The client will also receive Matlab back-testing code, the code is a carbon copy of the Trading System. With Matlab, the strategy can be evaluated for the past 2 years on historical data. In Matlab different parameters can be modified to see the final results of the trading system. Safe4x, LLC has found an optimized parameter setting, which will be used for the clients trading system. It is important to understand the risks involved with FOREX trading, the implemented strategy is a hedging strategy which controls risk! With hedging volatility is eliminated, therefore only profiting from relative mispricing with high correlation. To get more information please read the article mentioned above and the reference provided below. For pricing and questions, feel free to contact Safe4x, LLC at [email protected]

Below are the back-testing results of the offered Quantitative Pairs-Trading strategy, the first chart is the SHORT/LONG results. The area under the curve shows profit, the area above the zero-cross is profit, the area below zero-cross is loss. Second chart is the LONG/SHORT results, the area under the curve is profit. Area above zero-cross is positive profit, area below zero-cross is loss. Studying the results of the strategy for the past two years, the system with specific settings is profitable in long term. The results are obtained with Matlab, the strategy can be evaluated with different setting to see if the strategy is setup for profit or loss.

Page 2: Quant Links

References: http://en.wikipedia.org/wiki/Pairs_tradehttp://en.wikipedia.org/wiki/Hedge_(finance)

Safe4x, LLC offers other services, Econometric Modeling with Matlab, Back-Testing, Custom Strategy Programming in MQL4, Custom Strategy Development with any API for HFT(high frequency trading) systems in any market with any instrument.

Feel free to contact with any programming needs, indicator development or script development

Page 3: Quant Links

Fabien Benetou's PIMNotes to a future self.

View Edit History Print

ReadingNotes

Quantitative Trading

Quantitative Trading: How to Build Your Own Algorithmic Trading Business by Ernest Chan - ISBN 9780470284889 - Wiley 2008

Motivation

Discovering in Ghost in the Shell the idea of a fully automated trading system, letting it rest for few years then starting to organize links related to this idea (cf FinancialTools), offering a link to Sylvain then deciding to read it together.

Pre-reading model

Draw a schema (using PmGraphViz or another solution) of the situation of the area in the studied domain before having read the book.

Reading Preface

o "can an independent, retail trader benefit from these algorithms? Can an individual with limited resources and computing power backtest and execute their strategies over thousands of stocks, and come to challenge the powerful industry participants in their own game? I will show you how this can, in fact, be achieved. " (pxi)

o "it is much more logical and sensible for someone to become a profitable $100,000 trader before becoming a profitable $100 million trader. " (pxi-xii)

o "this is a possible route to riches as well as intellectual accomplishment, and for someone with an entrepreneurial bent, a preferred route. " (pxii)

o "This book is definitely not designed as an encyclopedia of quantitative trading techniques or terminologies. It will not even be about specific profitable strategies" (pxii)

1 The Whats, Whos, and Whys of Quantitative Trading o "Quantitative trading, also known as algorithmic trading, is the trading

of securities based strictly on the buy/sell decisions of computer algorithms. " (p1)

o "quantitative trading includes more than just technical analysis. Many quantitative trading systems incorporate fundamental data in their inputs: numbers such as revenue, cash flow, debt-toequity ratio, and others. " (p1)

Page 4: Quant Links

o "As long as you can convert information into bits and bytes that the computer can understand, it can be regarded as part of quantitative trading. " (p2)

o "Statistical arbitrage deals with the simplest financial instruments: stocks, futures, and sometimes currencies. " (p2)

o "It is important not to have a need for immediate profits to sustain your daily living, as strategies have intrinsic rates of returns that cannot be hurried (see Chapter 6)." (p4)

o "research and development of new strategies is the creative part of any business, and it can be done whenever you want to. " (p7)

o "in the financial marketplace base their purchase decisions on nothing but the price" (p7)

o "there is absolutely no marketing to do in a quantitative trading business. " (p7)

2 Fishing for Ideas o "Increasingly, however, I have found that many strategies described

by academics are either too complicated, out of date (perhaps the once-profitable strategies have

already lost their power due to competition), or require expensive data to backtest (such as historical

fundamental data). " (p9) o Table 2.1 Sources of Trading Ideas (p10) o "many traders' forums or blogs may suggest simpler strategies that

are equally profitable. " (p10) o "the trick is that you can often modify the basic strategy and make it

profitable. " (p11) o "one of the best ways to gather and share trading ideas is to start your

own trading blog - for every trading <<secret>> that you divulge to the world, you will be rewarded with multiple ones from your readers. " (p11)

o "what you thought of as secrets are more often than not well-known ideas to many others! " (p11)

o "No, the difficulty is not the lack of ideas. The difficulty is to develop a taste for which strategy is suitable for your personal circumstances and goals, and which ones look viable even before you devote the time to diligently backtest them. " (p11)

o "In general, I would not recommend quantitative trading for an account with less than $50,000 capital. " (p13)

"With a low-capital account, we need to find strategies that can utilize the maximum leverage available. " (p13)

"a hedged position is less risky than an unhedged position, the returns generated are correspondingly smaller and may not meet your personal requirements. " (p14)

o Table 2.2 How Capital Availability Affects Your Many Choices (p15) o "as long as you are aware of the limitations of your tools and data, you

can cut many corners and still succeed. " (p16) o "the more regularly you want to realize profits and generate income,

the shorter your holding period should be. " (p17) o "Information ratio is the measure to use when you want to assess a

long-only strategy. " (p18) o "It is defined as

Information Ratio = Average of Excess Returns / Standard Deviation of Excess Returns

Page 5: Quant Links

where Excess Returns = Portfolio Returns - Benchmark Returns"

(p18) o "The Sharpe ratio is actually a special case of the information ratio,

suitable when we have a dollar-neutral strategy, so that the benchmark to use is always the risk-free rate. " (p19)

o "As a rule of thumb, any strategy that has a Sharpe ratio of less than 1 is not suitable as a stand-alone strategy. " (p21)

o "A historical database of stock prices that does not include stocks that have disappeared due to bankruptcies, delistings, mergers, or acquisitions suffer from the so-called survivorship bias, because only <<survivors>> of those often unpleasant events remain in the database. " (p24)

o "The reason that survivorship bias mainly inflates the performance of an earlier period is that the further back we go in our backtest, the more missing stocks we will." (p24-25)

o "[the more statistically robust the backtest should be] is true only when the financial time series is generated by a stationary process. Unfortunately, financial time series is famously nonstationary, due to all of the reasons given earlier. " (p25)

o "in general, the more rules the strategy has, and the more parameters the model has, the more likely it is going to suffer data-snooping bias. " (p26)

o section adapted from Artificial Intelligence and Stock Picking (p26-27) o "niches are [...] likely to be [still] profitable because they have not yet

been completely arbitraged away by the gigantic hedge funds. " (p27) see my notes on Chapter 6 Cultural niche construction:

evolution's cradle of language of The Prehistory Of Language o summary of the chapter (p28-29)

my answer to the questions 3 Backtesting

o "this chapter [describes] the common platforms that can be used for backtesting, various sources of historical data useful for backtesting, a minimal set of standard performance measures that a backtest should provide, common pitfalls to avoid, and simple refinements and improvements to strategies. " (p31)

o Excel, WYSIWYG but limited in scope and to generate orders (p32) o MATLAB, not free but easy to backtest thanks to principal component

analysis and other tools (p32) scrapping example on Yahoo! Finance (p34)

code available at epchan.com/book/ o TradeStation

"advantages of this setup are: Most of the historical data necessary for backtesting is

readily available, whereas you have to download the data from somewhere else if you use Excel or MATLAB.

Once you have backtested the program, you can immediately generate orders using the same program and transmit them to the brokerage. " (p35)

o High-End Backtesting Platform (p36) o "databases that are free from survivorship bias are quite expensive

[...] to overcome this problem [...]

Page 6: Quant Links

start collecting point-in-time data yourself for the benefit of your future backtest. If you save the prices each day of all the stocks in your universe to a file, then you will have a point-in-time or survivorship-bias-free database to use in the future.

Another way to lessen the impact of survivorship bias is to backtest your strategies on more recent data so that the results are not distorted by too many missing stocks. " (p40)

o "For almost all daily stock data, the high and low prices are far noisier than the open and close prices. " (p42)

o "the discrepancies of the open and close prices usually have less impact on backtest performance than the errors in the high and low prices, since the latter almost always inflate your backtest returns. " (p42)

o "I would argue that the Sharpe ratio and drawdowns are the two most important [performance measures]. " (p43)

o "Usually, an erroneous backtest would produce a historical performance that is better than what we would have obtained in actual trading. " (p50)

o Look-Ahead Bias "refers to the situation when you are using information that was

available only at a time ahead of the instant the trade was made. " (p51)

"How do we avoid look-ahead bias? Use lagged historical data for calculating signals at every opportunity. " (p51)

truncate your data and compare the result, if it is not identical to non-truncated historical data, you have a look-ahead bias

o Data-Snooping Bias "the danger that backtest performance is inflated relative to the

future performance of the strategy because we have overoptimized the parameters of the model based on transient noise in the historical data. " (p52)

"The less independent data you have, the fewer adjustable parameters you should employ in your trading model. " (p52)

"As a rule of thumb, I would not employ more than five parameters, including quantities such as entry and exit thresholds, holding period, or the lookback period, in computing moving averages. " (p53)

"The most basic safeguard against data-snooping bias is to ensure that you have a sufficient amount of backtest data relative to the number of free parameters you want to optimize. " (p53)

"Out-of-Sample Testing Divide your historical data into two parts" (p53)

seems similar to machine learning techniques to avoid overfitting

"The ultimate out-of-sample testing is familiar to many traders, and it is called paper trading . Running the model on actual unseen data is the most reliable way to test it (short of actually trading it). " (p55)

o "No backtest performance is realistic without incorporating transaction costs. " (p60)

o Strategy Refinement "The guiding principle is the same as that of parameter

optimization: Whatever changes you make to the strategy to

Page 7: Quant Links

improve its performance on the training set, it must also improve the performance on the test set. " (p65)

o "it is preferable that the refinement has some basis in fundamental economics or a well-studied market phenomenon, rather than some arbitrary rule based on trial and error. Otherwise, data-snooping bias looms. " (p66)

o summary of the chapter (p66-67) 4 Setting Up Your Business

o "this chapter, we will be taking a break from the technical aspect of trading to focus on the business side of it." (p69)

o "The main choice you have to make is whether to open a retail brokerage account or to join a proprietary trading firm.

The next step is to determine what features of the brokerage or trading firm are important to you.

Finally, you have to decide what kind of physical trading infrastructure you need in order to execute your quantitative strategy." (p69)

o since 2007, the National Association Of Securities Dealers (NASD) merged with the New York Stock Exchange's regulation committee to form the Financial Industry Regulatory Authority (FINRA).

General Securities Representative Exam commonly referred to as the Series 7 Exam

o Wikipedia:Dark pools of liquidity Dark Pool Traders Dark Pools In Equity Markets Dark pools are large blocks of

equities traded off the exchange floor, QuantPrinciple o "too much real-time information may not necessarily lead to more

profitable trades." (p76) o "any delay in the transmission of your order to your brokerage results

in slippage, which is quite real in terms of lost profits. " (p76) o "The advantage of this setup [,remote servers] is not only that your

trading will almost never have downtime, but that the Internet connection at the hosting company is likely to be faster than what you have at home or in your office. " (p77)

o "it is advantageous to locate your servers near an Internet backbone as close as possible to the exchange on which your trades will be executed. " (p77)

o summary of the chapter (p77-78) 5 Execution Systems

o " This chapter is about building such an automated trading system and ways to minimize trading costs and divergence with your expected performance based on your backtests." (p79)

o "A basket trader is an application that allows you to upload multiple orders for multiple symbols and submit them to the brokerage in one keystroke. " (p82)

o "Spread trader is an application with which you can specify the symbols of multiple pairs of stocks or other securities, and the conditions when orders for each of these pairs should be entered. " (p82)

Wikipedia:Spread trader o "To cut down on commissions, you can refrain from trading lowprice

stocks. " (p87)

Page 8: Quant Links

o "In order to minimize market impact cost, you should limit the size (number of shares) of your orders based on the liquidity of the stock. " (p87)

o "Another way to reduce market impact is to scale the size of your orders based on the market capitalization of a stock. " (p87)

o "Paper trading has a number of benefits; chief among them is that this is practically the only way to see if your ATS software has bugs without losing a lot of real money. " (p89)

o "Backtesting also won’t reveal the operational difficulties, such as how fast you can download all the needed data before the market opens each day and how you can optimize your operational procedures in actual execution. " (p89)

o applying debugging techniques not just to the ATS but also to its results over time

o "Regime shifts refer to the situation when the financial market structure or the macroeconomic environment undergoes a drastic change so much so that trading strategies that were profitable before may not be profitable now." (p91)

o "There are two noteworthy regime shifts in recent years related to market (or regulatory) structure that may affect certain strategies.

The first one is the decimalization of stock prices. [...] The other regime shift is relevant if your strategy shorts stocks.

[plus-tick rule]" (p91) o summary of the chapter (p92 to 94)

6 Money and Risk Management o "The optimal allocation of capital and the optimal leverage to use so

as to strike the right balance between risk management and maximum growth is the focus of this chapter, and the central tool we use is called the Kelly formula. " (p95)

Kelly criterion o "Every optimization problem begins with an objective. Our objective

here is to maximize our long-term wealth - an objective that I believe is not controversial for the individual investor. " (p96)

o "Maximizing long-term wealth is equivalent to maximizing the long-term compounded growth rate g of your portfolio. " (p96)

o "Risk management always dictates that you should reduce your position size whenever there is a loss, even when it means realizing those losses. (The other face of the coin is that optimal leverage dictates that you should increase your position size when your strategy generates profits.)" (p104)

o reference to Nassim Taleb's "black swan" (p105) o "The truly scary scenario in risk management is the one that has not

occurred in history before. " (p106) o behavioral bias

endowment effect, status quo bias, or loss aversion (p106) "Despair occurs when a trading model is in a major, prolonged

drawdown. " (p110) "Greed is the more usual emotion when the model is having a

good run and is generating a lot of profits. " (p110) o "We must remember that we are operating in a probabilistic regime:

No system can avoid all the market vagaries that can result in losses. " (p109)

Page 9: Quant Links

o "As with most human endeavors, the way to do this is to start with a small portfolio and gradually gain psychological preparedness, discipline, and confidence in your models. " (p111)

o summary of the chapter (p111-112) "I have found that in order to proceed slowly and cautiously, it

is helpful to have other sources of income or other businesses to help sustain yourself either financially or emotionally (to avoid the boredom associated with slow progress). " (p112)

7 Special Topics in Quantitative Trading o doubts of AI, ML and other complex techniques (p116) o "Constructing a trading strategy is essentially a matter of determining

if the prices under certain conditions and for a certain time horizon will be mean reverting or trending, and what the initial reference price should be at any given time. " (p116)

o "what about the much-feared datasnooping bias that seems to creep into every strategy that is based on machine learning or artificial intelligence? " (p125)

o Matlab Econometrics Toolbox by James P. LeSage]]

o Wikipedia:Arbitrage pricing theory o sumarry of chapter (p154 to 156)

8 Conclusion o "The key, it turns out, is capacity, a concept I introduced at the end of

Chapter 2. (To recap: Capacity is the amount of equity a strategy can generate good returns on.)" (p158)

o "There are many simple and profitable strategies that can work at the low capacity end that would be totally unsuitable to hedge funds. This is the niche for independent traders like us. " (p158)

o "Another reason that independent traders can often succeed when large funds fail is the myriad constraints imposed by management in an institutional setting. " (p159)

o "experience tells us that strategies do lose their potency over time as more traders catch on to them. It takes ongoing research to supply you with new strategies. " (p162)

see also Seedea:Research/Drive on epistemic arm-races

Tables and figures

Sources of Trading Ideas (p10)

Academic Business schools' finance professors' web sites Social Science Research Network National Bureau of Economic Research Business schools' quantitative finance seminars Mark Hulbert's column in the New York Times' Sunday business section Buttonwood column in the Economist magazine's finance section

Financial web sites and blogs Yahoo! Finance TradingMarkets

Page 10: Quant Links

Seeking Alpha TheStreet.com The Kirk Report Alea Blog Abnormal Returns Brett Steenbarger Trading Psychology My own!

Trader forums Elite Trader Wealth-Lab

Newspaper and magazines Stocks, Futures and Options magazine

See also my FinancialTools page Ernest Chang's blog Quantitative Trading Quantitative investment and trading

ideas, research, and analysis FOSS Trading Algorithmic Trading with Free Open Source Software Automated Trading 2009: Backtesting and Optimization October 2009 The Misbehavior of Markets : A Fractal View of Financial Turbulence by

Richard L. Hudson, Benoit B. Mandelbrot, Basic Books first edition 2004 o recommended by Rgomes from JQuantLib o review of The (Mis)behavior of Markets by Ian Kaplan, 2004 o The (Mis)Behavior of Markets: A Fractal View of Risk, Ruin and

Return 2004 mms://media-wm.cac.washington.edu/msr/11598/asf/

11598.asf direct link (mms format) trading-shim Frequently Asked Questions Automated Trading System (ATS)

o see FinancialTools.AutomatedTradingSystem Communities

o QuantCode Quantitative Finance Resume and Jobs Board o Sharing Resources: Let's Not Reinvent the Wheel in the Automated

Trading section of EliteTrader Forums o wikinvest Investing Wiki with Research about Companies, Investment

Concepts, and more... started in 2006

Yale Financial Markets (ECON 252) o Financial Markets with Professor Robert Shiller at Open Yale Courses o last watched : course 10

Street Smarts CNBC.com 2007 o Hedge funds using computer models to invest are taking a hit of late,

with Ernest Chan, Quantitative trading consultant and CNBC's Dylan Ratigan

E. P. Chan & Associates Research page, including MATLAB source code Advances in Machine Learning for Computational Finance (AMLCF '09 ,

London 2009 http://en.wikipedia.org/wiki/Computational_finance Journal of Computational Finance including its latest issue

Page 11: Quant Links

Statistical Arbitrage: Algorithmic Trading Insights and Techniques by Andrew Pole, Wiley 2007

Automated Trader Algorithmic Trading Magazine kaChing world's first marketplace to find great investors to emulate.

o SEC Registered Investment Advisor, started in 2007 o as of March 2010 requiring for people to mirror to hold the

Wikipedia:Uniform Investment Adviser Law Examination also called the Series 65

Covestor Follow proven investors on Covestor Quants: The Alchemists of Wall Street Marije Meerman, VPRO Backlight

2010 A.I. Stock Market Forum USA Today: “The Machines Took Over (Wall Street)” , Cyberpunk Review

May 2010 academic research

o Computational Finance Research @ Centre for Computational Finance and Economic Agents (CCFEA) Essex

o Mathematical Finance , Imperial College London o Financial Mathematics , King's College London

[[#DesMathematiciensBoulevardDesItaliens]Des mathématiciens boulevard des Italiens by Emmanuel Ferrand, Images des mathématiques May 2010

o publish your results? yes to influence other actors in a predicable way

to build consensus no to keep a competitive advantage applied research

implemented and used internally first and foremost

o see also Seedea:Research/StrategicalEpistemology Computer-trading worries grow as NYSE builds new datacenter by Jon

Stokes, ars technica 2009

Tools mentioned InteractiveBrokers API operates through the Trader Workstation

o Commissions 0.1 % of trade value Seeking Alpha Stock Market News, Opinion & Analysis, Investing Ideas

Overall remarks and questions this? that?

Synthesis

So in the end, it was about X and was based on Y.

Critics

Point A, B and C are debatable because of e, f and j.

Page 12: Quant Links

Vocabulary

(:new_vocabulary_start:) new_word (:new_vocabulary_end:)

Post-reading model

Draw a schema (using PmGraphViz or another solution) of the situation of the area in the studied domain after having read the book. Link it to the pre-reading model and align the two to help easy comparison.

Categories Finance Information

hursday, November 18, 2010

Columbia Workshop on Financial Engineering Our readers in New York may be interested in this finance workshop at Columbia University tomorrow.I am particularly interested in the talk by Kent Daniel on "Characterizing Momentum", and by Doug Borden (of Knight Equity Markets) on "Stochastic Control Theory in High-Frequency Trading". Doug's talk can be downloaded here.

Posted by Ernie Chan at 11:48 AM 6 comments

Sunday, October 10, 2010

Data mining and artificial intelligence update Long time readers of this blog know that I haven't found data mining or artificial intelligence techniques to be very useful for my own trading, for they typically overfit to non-recurring past patterns. (Not surprisingly, they are much more useful for driverless cars.) Nevertheless, one must keep an open mind and continues to keep tabs on new developments in this field.

To this end, here is a new paper written by an engineering student at UC Berkeley which uses "supportvector machine" together with 10 simple technical indicators to predict the SPX index, purportedly with 60% accuracy. If one includes an additional indicator which measures the number of news articles on a stock in the previous day, then the accuracy supposedly goes up to 70%.

I did not have the chance to reproduce and verify this result yet, but I invite you to try it out and share your findings here. If you do so, you may find this new data mining product called 11Ants Analytics useful. It is an Excel-based software that includes 11 machine learning algorithms including the aforementioned support vector machines. It also includes decision trees which are sometimes quite useful in automatically generating a small set of trading rules from an input set of technical indicators.

Page 13: Quant Links

(Whether those rules remain profitable in the future is another question!) If you have tried this product, I would also appreciate your comments here.

(If you are a die-hard MATLAB fan, support vector machines are available in their Bioinformatics Toolbox, and classification and decision trees in their Statistics Toolbox.) Posted by Ernie Chan at 11:33 AM 44 comments

Saturday, October 02, 2010

The main virtue of buying options I realized that I have omitted the most obvious virtue of trading options instead of stocks in my last post: the much more attractive reward-risk ratio for options.

Suppose your stock strategy generated a buy signal. You can either buy the stock now, or you can buy an ATM call. If you buy the stock, you are of course benefiting from 100% of the upside potential of the stock price movement, but you are similarly exposed to 100% of the downside risk. Indeed you can lose the entire market value of the stock. If you buy the call, you will benefit from > 50% of the upside potential of the stock price, assuming that your holding period is so short that the time value will not dissipate much. As the stock price rises, so does your delta. (It increases from 0.5 to 1.) But what about the downside risk? All you can lose is the option premium, usually << 50% of the market value of the stock.

In other words, while one may be tempted to hedge a large stock position with stock index futures, there is no need to hedge an equivalent call option position. This should simplify your strategy implementation and reduce risk management costs (i.e. the probable loss on your short futures position).

Given that I am a short-term trader anyway, I can't figure out why I have been trading stocks instead of options all these years! (Aside from the caveats detailed in the previous post.) Posted by Ernie Chan at 2:06 PM 18 comments

Saturday, September 25, 2010

Implementing stock strategies using options There are many stock trading strategies that are quite attractive in terms of Sharpe ratios, but not very attractive in terms of returns. (Pairs trading comes to mind. But in general, any market neutral strategy suffers from this problem.)  Certainly, one cannot feed a family with annualized returns in the single or low double digits, unless one already has millions of dollars of capital. One way to solve this dilemma is of course to join a proprietary trading group, where we would have access to perhaps x30 leverage. Another way is to implement a stock trading strategy using options instead, though there are a sizable number of issues to consider. (I recently brushed up on my options know-how by reading the popular "Options as a Strategic Investment".)

1. Using options will allow you to increase your leverage beyond the Reg T x2 leverage (or even the day trading x4 leverage) only if you buy options only, but not selling them. For example, to implement a pairs trading strategy on 2 different stocks, you would have to buy call options on the long side, and buy put options on the short side (but not sell call options). Otherwise the margin

Page 14: Quant Links

requirement for selling calls is as onerous as shorting the underlying stock itself.

2. The effective leverage is computed by multiplying the delta of the option by the underlying stock price divided by the option premium. If you buy an out-of-money (OTM) option, the delta will be small (smaller than 0.5), but the option premium is small also. Vice versa for an in-the-money (ITM) option. So you would have to find the optimal strike price so that the effective leverage is maximized. I personally choose to buy an at-the-money (ATM) call or slightly ITM call without actually computing the optimized strike, but perhaps you have reached a different conclusion?

3. Naturally, the shorter the time-to-expiration, the cheaper the option and higher the effective leverage. Additionally, for ITM options, their deltas increase as we get closer to expiration, which also contributes to higher effective leverage. However, the time-to-expiration must of course be longer than the expected holding period of your position, otherwise you would incur the transaction cost of rolling over to the further-month options.

4. The discussion of finding the right strike price based on its delta is moot if your brokerage's API does not provide you with delta for your automated trading system. In theory, Interactive Brokers's API provide deltas for whole options chains, and quant2ib's MATLAB API will pass these on to your MATLAB exeuction program too. However, I have not been successful in retrieving deltas using quant2ib's API. If you have encountered a similar problem, and perhaps have found the reason/cure for this, please let me know. For now, I am reduced to assuming that all my near ATM calls for different stocks have the same delta, and I increase this common value from 0.5 to close to 1 as time passes.

5. Options don't have MOO, LOO, MOC or LOC order types. If one uses market orders to buy at the open or close, one would incur significant transaction costs due to the much wider bid-ask spread compared to stocks. I try to use limit orders on options orders as much as possible.

If you have used options to implement stock trading strategies, and have experiences with these or other issues, please do share them here.

====

Reminder: my next pairs trading workshop will take place in New York on October 26-27th. Posted by Ernie Chan at 11:26 AM 26 comments

Sunday, August 22, 2010

Phantom quotes Have you ever got the feeling that your market orders are often filled at prices worse than the NBBO displayed on your trading screen? Apparently, this may be the result of deliberate manipulation of the market by high frequency traders. These HF traders submit thousands of quotes per second to the NYSE ("quote stuffing") and then cancel them within 50 ms. This slows down the exchange data queue so much that by the time a quote is transmitted to you, it is stale already, even if your trading server is collocated at the exchange. (Checking the time stamp of the quote is of no help: the time stamp is based on the time the quote enters the queue, not when it exits the queue.)

Page 15: Quant Links

If you can no longer believe in the quotes, is there any integrity left in the market? Much as I think that HFT may be useful liquidity providers, I can't see how this specific practice could be good for anyone over the long term.

(Hat tip: Jim Liew of Alpha Quant Club.) Posted by Ernie Chan at 11:57 AM 31 comments

Saturday, August 14, 2010

What are we to do with Sharpe ratio? I wrote several times before how useless Sharpe ratio is for certain types of strategies: see here and here. Not only is a high Sharpe ratio quite useless in telling you what damage extreme events can do to your equity, a low Sharpe ratio is also quite useless in telling you what spectacular gain your strategy might enjoy in the event of a catastrophe. I came across another brilliant example of the latter category in the best-selling book "The Big Short", where the author tells of the story of the fund manager Mike Burry.

Mike Burry started buying credit default swaps in 2005, essentially an insurance policy on mortgage-backed securities, betting that there will be widespread defaults on mortgages. Of course, we now know how this story would turn out: Mike Burry made $750 million in 2007 alone.  But there was nothing but pain for the fund manager and his investors in 2005-2006, since they had to pay an annual premium of 8% of the portfolio.  Investors who measured the performance of this strategy using Sharpe ratio, without knowing the details of the strategy itself, would be quite justified to think that it was an utter disaster prior to 2007. And indeed, many of them lost no time in trying to pull out their investments.

So what are we to do with Sharpe ratio, with its inherent reliance on Gaussian distributions? Clearly, it is useful for measuring high frequency strategies which you can count on to generate consistent returns every day, but which has limited catastrophic risks. But it is less useful for measuring statistical arbitrage strategies that hold positions over multiple days, since there may well be substantial hidden catastrophic risks in these strategies that would not be revealed by their track record and standard deviation of returns alone. As for strategies that are designed to benefit from catastrophes, such as Mike Burry's CDS purchases or Nassim Taleb's options purchases, it is completely useless. If I were to allocate my assets over different hedge funds, I would be sure to include some funds in the first category to generate cash flows for my daily needs, as well as funds in the last category to benefit from the infrequent black-swan events. As for the funds in the middle category, I am increasingly losing my enthusiasm. Posted by Ernie Chan at 1:39 PM 17 comments

Friday, July 30, 2010

Pair trading technologies update Pair trading was invented two decades ago, but automating its implementation has only recently become fashionable with independent traders. But once the spotlight is on, innovations come fast and furious. Here are a number of recent developments that I find interesting:

Page 16: Quant Links

1. I mentioned previously the software called quant2ib. It is an API which allows us to get market data and send orders from a Matlab program to Interactive Brokers (IB). I have used it extensively for our trading, and it is as reliable as IB's native API. Their latest version now includes functions for constructing a "combo" security. This combo security can be pairs of stocks, ETF's, futures, etc. (with the notable exception of currencies), and the API allows you to get market data as well as to submit orders on a combo. This is a huge improvement because you can now automatically trade a pair of securities as one unit by submitting limit orders on the combo. (Previously, you would have had to submit market order on at least one side of the pair, and this would have required your program to continuously monitor the market prices and send orders when appropriate. Or else you had to give up using the API and manually enter a "generic combo" limit order in IB's TWS.)

2. Alphacet Discovery also has the ability to send limit orders on pairs, due to its partnership with Knight Trading. Besides, based on a demo that I have recently seen, they also now have great pairs portfolio and execution reporting functionality. (Full disclosure: I used to consult for them.)

3. IB itself has released a "Scale Trader" algorithm that can be applied to combos (see 1. above. Hat tip: Mohamed.) I can't explain this better than their press release: "... ScaleTrader algorithm allows clients to create conditions under which a long position in one stock is built while simultaneously creating an offsetting short position in the other. The ScaleTrader is named because investors can 'scale-in' to market weakness by setting orders to buy as the market moves lower. Similarly, sell orders can be 'scaled' into when a market is rising. The ScaleTrader algorithm can be programmed to buy the spread and subsequently take profit by selling the spread if the difference reaches predetermined levels set by the user." In other words, it allows us to automatically implement the "parameterless trading" or the "averaging-in" strategy that I blogged about previously without any programming on our part!

Speaking of pair trading, I will be teaching my first New York workshop in October.  (My editor inevitably picks touristy locations for these workshops. My London workshop takes place across the street from the Tower of London, my New York workshop is across from the new World Trade Center, and my Hong Kong workshop is in the "Golden Mile" shopping district of Tsim Sha Tsui.) Posted by Ernie Chan at 12:17 PM 47 comments

Saturday, May 29, 2010

The Quants Once in a while, a book about trading written for the general public contains some useful nuggets even for professionals.  Fortune's Formula was one. It introduced me to the world of Kelly's formula, Universal Portfolios, and the maximization of compounded growth rate. The Quants, by WSJ reporter Scott Patterson, is another. (Hat tip to my partner Steve for telling me about it.)

What is the most important take-away in The Quants? No, it is not that you should learn to become a master poker player or chess player before hoping to make it big, though you would think that given Patterson's exhaustive coverage of poker games played by the top quants. Among my own professional acquaintances, trader-poker-players are still a minority.

The most important take-away is what ex-employees said about Renaissance

Page 17: Quant Links

Technologies: "there is no secret formula for the fund's success, no magic code discovered decades ago by geniuses .... Rather, Madallion [Fund]'s team of ninety or so Ph.D.'s are constantly working to improve the fund's systems, ..."

In other words, though you may not have 90 Ph.D.'s  at your disposal, you can still work on continuously improving/refining your strategies, improving the engineering of your trading environment, and increasing the diversity of your strategies. And though you may still not archive 60-70% annualized returns every year, you will nevertheless enjoy stable returns year after year.

By the way, it is good to see my ex-colleagues Lalit Bahl, Vincent and Stephen Della Pietra mentioned in the book, all of whom left IBM to join Renaissance many years ago, and who are extraordinarily nice and friendly guys, quite in contrast to the norm on Wall Street. Posted by Ernie Chan at 9:54 AM 20 comments