Pairs Trading: Algorithmic Trading

In this week’s article we bring you a new financial concept of Pairs trading. Pairs trading is a concept which if implemented with the help of a computer algorithm would give huge benefits to the investor.

Pairs trading refers to opposite positions in two different stocks or indices, that is, a long (bullish) position in one stock and another short (bearish) position in another stock. The objective is to make money on the relative price movements between them. The two stocks might both go up, but the stock you are long will go up more and faster than the stock you are short. Or, the two stocks might both go down, but the stock you are short will drop more and faster than the stock you are long. One half of the pairs trade may be profitable, and the other half of the pairs trade may lose money, but the goal is for the profits to exceed the losses.

Pairs trading can be simple in concept, but can be one of the most complex types of trading in practice. This article will outline the basic approach of pairs trading, and some ideas of how to apply the strategy.

What you do in a pairs trade is try to profit from a situation where one stock looks cheap or expensive relative to another. You buy the stock that is relatively cheap and sell the stock that is relatively expensive, speculating that the long position will rise relative to the short position. To make the trade more intuitive, I look at the price of one stock minus the price of another. I then try to see whether that

difference is historically high or low, or if I expect it to move in one direction or another given stronger performance in one stock over another. Generally, I look at the historical spread between the two stocks to see if there is any consistent relationship. That is, does the spread fluctuate back and forth around an average number (revert to a mean), or does it seem to trend up or down? If there is an average or mean spread price over a particular period of time, I can judge whether I should sell one stock and buy the other based on whether the current spread price is higher or lower than the average. For example, if the average difference between daily closing prices of stock A and stock B (stock A minus stock B) is $1.00, and if the current price of stock A is $53 and stock B is $49, then the current difference is $4.00. That $4.00

is 3.00 points higher than the average difference. So, expecting that the difference will revert back to the mean of $1.00, a trader could infer that either stock A is overpriced at $53 or stock B is under-priced at $49. Either way, the idea would be to sell stock A and buy stock B. If the spread comes back to its average of $1.00, there is the possibility of making $3.00 on that pairs trade. Alternatively, if I expected that stock A would continue to outperform stock B, I would buy stock A and sell stock B. The stocks or indices that make good candidates for the pairs trade should have some measurable relationship.

Ideally, the stocks or indices in the pairs trade should have a positive correlation and betas that are stable over time. Correlation is a statistical coefficient that measures the strength, within a range of +1 to -1, of the relationship between two variables. In this case, the variables are stocks or indices. The idea of correlation as it relates to trading is best described by an example.  If stock A and stock B both move up and down at the same time, then stock A and B have a high positive correlation (close to +1). If stock A moves up and stock B moves down at the same time, then stock A and B have a high negative correlation (close to -1). If stock A and B move up and down completely randomly, then stock A and B have zero correlation. Correlation is calculated by dividing the covariance of the percentage changes of each stock or index divided by the product of the standard deviations for the two stocks. Covariance is a measure of the tendency of the two stocks or indices to move together, and dividing the covariance by the standard deviations sets the correlation between +1 and -1. Many trading software packages include correlations between stocks, but you can use a spreadsheet function to perform the calculation using historical stock and index data. The correlation will indicate the strength of the relationship between the changes of the two stocks for the time covered by the data.


Mapping investor behavior to portfolio optimization model

Project Summary

The allocation of limited capital to the different financial assets available is one of the most important problems in financial management. This allocation is usually based on a previous returns and return variance. Our project goes beyond previous approaches by adding more criteria for portfolio building and optimization. We include criteria such as ESG Index (Ethical Social Governance Index), ethnocentrism and long term fundamental analysis to create a personalized portfolio for a user. We have taken investor behavior from the user in the form of a questionnaire and have mapped certain variables associated with risk, return, stability and ESG index from the answers received. The algorithm for portfolio optimization then consists of a Genetic Algorithm which uses the values calculated from the questionnaire in the fitness function. The algorithm’s output states how much investment must be made in each security. In our web tool we also provide ranking of stock based on risk, return and long term fundamental analysis. Novice users can also try out our system without actually investing real money to get used to the idea of investment. Also tutorials provided in the web tool can be of immense help to first time investors. Advanced users can try our derivative pricing tool which helps give a fair price for market derivatives.

Project Perspective

The project comes with a portfolio manager which helps the user in keeping track of his investments. The portfolio manager also comes with an optimizer which helps in optimizing the various investments of the portfolio. The optimizer also takes into account the user investor behavior for optimization of the investments. This financial product is basically acting as consultancy for the user for managing his or her investments in the financial market. It’s a tool that provides facilities of leveraging ones profits and reducing ones risks when it comes to investments in the stock market.


Final Project

Here is a video of our final project, split into 2 parts

part 1(introduction to the project)


As always your suggestions are welcome and we hope to see your feedback in helping making our website better and bigger.

Categories: Uncategorized

Does Corporate Social Responsibility Increase Profits?

Today we have a guest article by Ron Robins (copyright
It is generally held that corporate social responsibility (CSR) could increase company profits and thus most large companies are actively engaged in it. But few executives and managers are aware of the research on this important subject. And as I review here, the research does show that it may improve profits. However, linking profit growth to abstract variables that are frequently difficult to define is a challenging task.
Most executives believe that CSR can improve profits. They understand that CSR can promote respect for their company in the marketplace which can result in higher sales, enhance employee loyalty and attract better personnel to the firm. Also, CSR activities focusing on sustainability issues may lower costs and improve efficiencies as well. An added advantage for public companies is that aggressive CSR activities may help them gain a possible listing in the FTSE4Good or Dow Jones Sustainability Indexes, or other similar indices. This may enhance the company’s stock price, making executives’ stock and stock options more profitable and shareholders happier.
Substantiating some of these beliefs is a study, Corporate citizenship: Profiting from a sustainable business, by the Economist Intelligence Unit (EIU) published in November 2008. Corporate citizenship is another term roughly equivalent to CSR.
The EIU study said that, “corporate citizenship [CC] is becoming increasingly important for the long-term health of companies even though most struggle to show a return on their investment from socially responsible activities… 74 per cent of respondents to the survey say corporate citizenship can help increase profits at their company… Survey respondents who say effective corporate citizenship can help to improve the bottom line are also more likely to say their strategy is ‘very important’ to their business (33 per cent) compared with other survey respondents (8 per cent).”
At the heart of the debate as to whether CSR improves profits is first how you define it. Besides the terms CSR and CC, another frequently used and related term is corporate social performance (CSP). In the above quoted EIU study, it provides the following definition of CC: “corporate citizenship is defined as transcending philanthropy and compliance, and is addressing how companies manage their social and environmental impacts as well as their economic contribution. Corporate citizens are accountable not just to shareholders, but also to stakeholders such as employees, consumers, suppliers, local communities and society at large.”
The study of CSR and its relation to corporate profits is growing. The most recent study on this subject is by Cristiana Manescu. In her thesis, “Economic Implications of Corporate Social Responsibility and Responsible Investments,” at the University of Gothenburg’s School of Business, Economics and Law, Sweden, she wrote on December 6, 2010 that, “the results [of her thesis] reveal that CSR activities do not generally have a negative effect on profitability, but that in the few cases where they have a positive effect, this effect is rather small.” Other studies add further perspectives.
Defining the experience of CSR in relation to different industries is this study, The Economics and Politics of Corporate Social Performance, by David P. Baron, Maretno A. Harjoto, and Hoje Jo, published on April 21, 2009. The researchers found that, “For consumer industries, greater CSP [corporate social performance] is associated with better CFP [corporate financial performance], and the opposite is true for industrial industries… Empirical studies have examined the relation between CSR and corporate financial performance, and while the results are mixed, overall the research has found a positive but weak correlation.”
However, reviewing individual empirical studies can be confusing. But by using the technique of ‘meta-analysis,’ many studies can be statistically analysed to determine collective results. A meta-analysis on CSR and its link to profits won the famed socially responsible investing, Moskowitz Prize in 2004. The study, Corporate Social and Financial Performance: A Meta-Analysis, was compiled by researchers Marc Orlitzky, Frank L. Schmidt and Sara L. Rynes. It yielded encouraging data suggesting a positive link between CSR and increased profits.
Summing up their results, the researchers said, “we conduct[ed] a meta-analysis of 52 studies (which represent the population of prior quantitative inquiry) yielding a total sample size of 33,878 observations. The meta-analytic findings suggest that corporate virtue in the form of social responsibility and, to a lesser extent, environmental responsibility, is likely to pay off… CSP [corporate social performance] appears to be more highly correlated with accounting-based measures of CFP [corporate financial performance] than with market-based indicators, and CSP reputation indices are more highly correlated with CFP than are other indicators of CSP. This meta-analysis establishes a greater degree of certainty with respect to the CSP-CFP relationship than is currently assumed to exist by many business scholars.”
So the research generally indicates that CSR/CC/CSP, no matter how you define it, does offer potential benefit to corporate profits. But there is another unanswered problem, and that relates to causation.
Do high profits enable greater spending on CSR, or is it that CSR itself creates higher profits? Referring again to the study, The Economics and Politics of Corporate Social Performance, the researchers write that, “…the direction of causation remains an open question. That is, good CSP could cause good CFP, but good CFP could provide slack resources to spend on CSP. As the Economist wrote, ‘…whether profitable companies feel rich enough to splash out on CSR, or CSR [activity itself] brings profits.’” Hopefully, future research will be able to answer this question.
On balance, surveys and the research literature suggest that what most executives believe intuitively, that CSR can improve profits, is possible. And almost no large public company today would want to be seen unengaged in CSR. That is clear admission of how important CSR might be to their bottom line, no matter how difficult it may be to define CSR and link it to profits.

The Perfect Risk Profile

Well, to be honest, there isn’t a perfect risk profile or a questionnaire that can tell you your exact risk preferences. All investors have differing attitudes towards risk. When it comes to investing, it is important to consider your risk profile or tolerance carefully, including how comfortable you are with the possibility of losing money, or that returns on your investments could vary widely from year to year.

Basically, Risk profile is the degree to which various risks are important to a particular individual.

What questions should I ask myself as I prepare to develop my risk profile?

Ask yourself when you plan to use your investment–in a few years to buy a home, start a business, or pay for college, or in the future for retirement. After you have decided how long your money will work, the focus of your preparation should shift to personal preferences:

  1. Is capital preservation more important to you than outpacing inflation?
  2. Are you willing to accept fluctuating values when investing for the long term?
  3. Are you more comfortable with dividends and income, or with growth through capital appreciation?
  4. Will you accept above-average risk to generate above-average returns?
The answer to these questions should then guide you decisions. The basic decisions before an investor are:
  1. Which asset class do I invest in?
  2. How much do I invest in each asset class?
For example, a young professional, starting off with his career, can expect to take greater risks in volatile assets like stock. Even within stocks, he can find undervalued stock or growth stock and put his money behind strong but potentially profitable but risky companies.
A person in mid life, would like to invest towards his retirement. He would not be advised to take a lot of risks, but a balanced portfolio of stocks and bonds and mutual funds would probably be the best for his cause.
But real life investment decisions are never that simple and a one shot answer is never enough. Several variables are involved in the decision making process and the basic purpose of calculating one’s risk profile is to account for all the variables.
We will shortly provide our portfolio suggestion tool which will be preceeded by a Questionnaire, to map a persons Risk Profile.
As always, if there are any questions, please feel free to post or write at

What type of Investor are you?

Individual investors have different attitudes towards investment. Some people feel terrible when they have to endure losses. More experienced investors know that loss is a part of the investment learning curve. They invest more money so as to reduce their averages. Some people are confident investors and keep their portfolio fixed during times of losses. Another important area in which investors can be segmented is how the investors deal with risk and uncertainity.

Thus at large, investors can be distinguished on the basis of the following factors:

1. Long-term/short-term investment horizon.

2. Stability versus volatility.

3. Risk attitude.

4. Personalization of loss.

5. Confidence.

6. Control.

Based on the above factors, Wood and Zaichowsky [2004] , divided investors into 4 different clusters:

Cluster 1-Risk-Intolerant Traders. The primary characteristic of this group, which separates it from the other groups, is an extremely low risk tolerance. It has medium levels of confidence and control versus the other groups. Corresponding to their intolerance for risk, most members’ trade less than five times per year.

Cluster 2-Confident Traders. Cluster 2 investors have high levels of confidence and control. They are slightly older than the other groups, with most members’ older than thirty, and their portfolio values are greater than the other groups. As expected, with higher levels of confidence, control, trading activity, and monitoring of investments, cluster 2 investors own the most stocks. Since these members are trading more frequently, they have a shorter-term investment horizon than the other groups.

Cluster 3-Loss-Averse Young Traders. Cluster 3 is characterized as having the highest rating for personalization of loss while still having high risk ratings. In other words, this group does not mind taking risks, but feels terrible when they lose money. Cluster 3 investors have significantly lower levels of confidence and control than the confident traders in cluster 2. Cluster 3 is also the youngest segment of investors, As a result, the value of their portfolios is low. These investors probably personalize their losses more because they are young, relatively inexperienced at investing, and cannot afford to lose their money. Cluster 3 investors are also the most likely to use the Internet as their method of investment. As a result, they also trade quite frequently.

Cluster 4-Conservative Long-Term Investors. Cluster 4 investors have low confidence and control, but do not personalize losses. Cluster 4 also has a larger proportion of females. They also own the least number of stocks, and a high number of mutual funds. Because these investors trade less frequently and own a high proportion of mutual funds, they do not check their investments as frequently. Cluster 4 investors have a longer investment horizon than the other groups. They are conservative investors who take a stable approach to investing by using long-term growth strategies with the help of a financial advisor.

When we launch our portfolio optimization tool, we will incorporate investor attitudes in the form of a questionnaire so that we may suggest apt portfolio’s to our users. As always, if there are any questions, please feel free to post here or write at

Are risks and returns everything for an investor?

The reality of restaurants is that profits come from cocktails and wine, not from food or hospitality management. And the reality of investments is that the best way to achieve long-term success is not in stock picking and not in market timing and not even in changing portfolio strategy….The great pathway to long-term success comes via sound, sustained investment policy.

One lesson from a restaurant is that the appearance of the sources of profits is different from the reality. But restaurants teach another lesson: that the appearance of benefits is different from the reality. Investments, like restaurants, offer both utilitarian and expressive benefits. Diners want more than the utilitarian benefits of low cost and high nutrition when they choose restaurants. They want the utilitarian benefits of tastiness, ambiance, and conformance with culture. And they also want the expressive benefits of status, patriotism, and social responsibility. Similarly, investors want more than the utilitarian benefits of low risk and high expected returns when they choose investments; they want additional utilitarian benefits, and they want expressive benefits as well. Expressive characteristics in products and services let us identify our values, our social class, and our life-style, and convey them to ourselves and to others. Expressive characteristics also add meaning to products and services beyond utilitarian characteristics. Hard-earned money is different from windfall money; college money is different from vacation money; and dividend money is different from capital money.

Much of the distinction between rationality and irrationality in the investment context is a distinction between utilitarian and expressive characteristics. Investment practitioners and academicians are reluctant to acknowledge preferences for the expressive benefits of investment products and services, perhaps because they consider such preferences irrational, or perhaps because catering to such preferences might violate fiduciary responsibilities.

Low risk and high expected return are utilitarian benefits, and those who restrict their attention to them are considered rational. A new model is required for expected returns that recognize the role of all investment features, both utilitarian and expressive, not only risk. We have moved from the capital asset pricing model where beta measures risk to the three-factor model where size and book-to-market measure risk. But size and book-to-market probably measure affect, an expressive feature, rather than risk. The relationship between returns and size and book-to market likely reflects the preference of investors for admired companies with positive affect over companies they scorn. Other utilitarian and expressive characteristics, such as social responsibility, status, and patriotism, should have a place in the model.


Meir Statman, “What Do Investors Want?”, The journal of portfolio management,2004

Ethical Investing – Not all about Risk, Return

April 17, 2011 1 comment

In our past posts we have been explaining the details of risk and return based portfolio optimization. But these 2 criteria are not alone in the list of parameters that can define the ‘goodness’ of a portfolio. Each user has his own choices on what constitutes a portfolio that will not only give him the economic return, but also the mental return that he wants. Is he investing in the right companies. The right company for an investor could be the company which would maximize his portfolio, stabilize his portfolio against market crashes or follow the best governance practices. An investor could also be inclined to invest in a company which has impressed him the most in terms of quality products.

India joined the bandwagon of ethical investing with its first socially responsible investing (SRI) fund, the Amro Sustainable Development Fund, which favors companies with high-disclosure policies on environmental, social and corporate governance yardsticks. SRI generally means putting money in companies with wholesome corporate values whose products and services do not ruin health or the Earth. Some such funds are also tied to specific religions, such as Christian- and Islamic-based funds, while others reject companies discriminating against homosexual employees. If you would like to see which companies constitute the portfolio of such funds, go to BNP Paribas SRI.

These funds are opposed to “vice funds” on the “Devil’s Index” where only profit counts, not the manner of profit and damage caused. Vice funds target “recession-free” companies such as those in gaming, tobacco, alcohol, aerospace and defense, and are gloomily based on the principle that as long as there are humans there will be a market for harming oneself and others.

Taking this idea further is the S&P environmental, social, and corporate governing (ESG) Index.  Sponsored by the International Finance Corporation and developed by a consortium of Standard & Poor’s, CRISIL, and KLD, the index represents the first of its kind to measure the ESG practices based on quantitative as opposed to subjective factors. Now Crisil’s ESG evaluation is an annual exercise. Using its own methodology, Crisil and its parent company Standard and Poor’s devised the S&P ESG India index of 50 companies. The components of this index change once a year when Crisil runs its ESG parameters. More data about the index, methodology and its constituents can be found at S&P ESG.

For further exploration into this topic, check out “Why do we Invest ethically?” In the paper, the authors try to explain the reasons for ethical investment and explain terms such as psychic returns and investor happiness.

As always, if there are any questions, please feel free to post here or write at


Portfolio Management: Risk and Mitigation

April 10, 2011 1 comment

Modern Portfolio Theory(MPT) assumes that investors are risk averse, meaning that given two portfolios that offer the same expected return, investors will prefer the less risky one. Thus, an investor will take on increased risk only if compensated by higher expected returns. Conversely, an investor who wants higher expected returns must accept more risk. The exact trade-off will be the same for all investors, but different investors will evaluate the trade-off differently based on individual risk aversion characteristics. The implication is that a rational investor will not invest in a portfolio if a second portfolio exists with a more favorable risk-expected return profile – i.e., if for that level of risk an alternative portfolio exists which has better expected returns.

An investor can reduce portfolio risk simply by holding combinations of instruments which are not perfectly positively correlated. In other words, investors can reduce their exposure to individual asset risk by holding a diversified portfolio of assets. Diversification may allow for the same portfolio expected return with reduced risk. Diversification is one of two general techniques for reducing investment risk. The other is hedging. Diversification relies on the lack of a tight positive relationship among the assets’ returns, and works even when correlations are near zero or somewhat positive. It is important to remember that diversification only works because investment in each individual asset is reduced. If someone starts with $10,000 in one stock and then puts $10,000 in another stock, they would have more risk, not less. Diversification would require the sale of $5,000 of the first stock to be put into the second. There would then be less risk. Hedging, by contrast, reduces risk without selling any of the original position. The risk reduction from diversification does not mean anyone else has to take more risk. If person A owns $10,000 of one stock and person B owns $10,000 of another, both A and B will reduce their risk if they exchange $5,000 of the two stocks, so each now has a more diversified portfolio




Portfolio Optimization: An Introduction

Portfolio optimization is the process of changing the set of financial instruments held to meet various criteria most notably Financial Risk. Markowitz’ Modern portfolio theory states that an investor may choose to exchange risk for return along a curve.  But what does this mean? exchange a risk for a return? Let’s see,

First of all, Portfolios are an appropriate mix or collection of investments held by an institution or an individual.

Consider the following example:

Suppose you are at the casino and there are two games to play. In the 1st game, there is a probability of 5% of winning 1000 Rs.(Rupees) and a 95% chance of winning nothing. The second game also has a 5 percent winning chance, but you will win 5000 Rs. On the contrary, if you lose, then you have to pay the casino 200 Rs. The facts are listed below.

  • Game 1:
  1. 5%: +1000
  2. 95%: +0
  • Game 2
  1. 5%: 5000
  2. 95%: -200

You are allowed to play the game once. Which game will you choose?Most people will choose for game I. It is interesting to see why. The expectedreturn for the 1st game is (0.05 * 1000) + (0.95  0) = 50, while the expected return for game II is (0.05*5000)+(0.95*200) = 60. Looking at the expected return, it is more logical to play the second game! Nevertheless, in spite of this statistical fact, game I is the most popular. The explanation is that game II appears to be more risky than game I. But what is risk? Risk can be defined in many ways, and for each person this de nition of risk can be different. However,most people have one thing in common: they all are risk averse.

A risk averse investor doesn’t like to take risk. If he can choose between two investments with the same expected return, he will choose the less risky one. The opposite of a risk averse investor is a risk loving investor. If a risk lovinginvestor can choose between two investments with the same expected return,he will choose the most risky one. This seems a bit strange, but consider forexample a person who desperately needs 5000 Rs. He will strongly consider to take on the risky game II and is willing to take more risk to achieve his goal.

We said that game II is the more risky game.This seems plausible, but we have not de fined what risk is. As stated before, itcan be de fined in many ways. The more dispersion in the outcomes of the investment, the more risky it is. Dispersion can be measured by standard deviation. The higher the dispersion, the more the outcomes are expected to di ffer from the expectedvalue.

In the example, game 1 has a standard deviated of squareRoot(0.05 *(1000 – 50)^2 + 0.95 * (0 – 50)^2)=218.

Similarly game 2 has an SD of 1133.

So the dispersion of game II is more than  5 times higher than the dispersionof game I.

In the theory of portfolio optimization, the risk measure of standard deviation is very popular. In 1952 Harry Markowitz wrote a paper about modern portfolio theory, where he explained an optimization method for risk averse investors. He won the Nobel prize for his work in 1990. His mean-variance analysis(the variance is the squared standard deviation) is used in many papers since. Basic thought is fi nding the best combination of mean(expected return)and variance(risk) for each investor.

If you substitute the casino games we used in this example for stocks, mutual funds and bonds, then you can easily understand financial portfolio optimization.

As always, if there are any questions, please feel free to post or write at