Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Confused about returns and leverage in the presence of pairs-trading / short-selling

Dear Quantopian community,

once I started playing around with pairs-trading I noticed that I am confused about the concept of returns and leverage, because a pairs trading strategy does not need any initial investment as the short-sell of one asset finances the long-buy of the other asset, e.g. no initial capital is required (in principle).

How do you then extend the concept of returns? As return is C_t/C_0 (capital at time T over capital at time zero) and C_0=0.
For the moment I've decided for myself to extend the concept of returns by using the MAX_GROSS_EXPOSURE rather than C_0 and for pure long portfolios the value stays the same as before. But I guess that somebody else already thought about a more general way on how to think about returns once you start using short-selling in portfolios, is there?

In a similar way the concept of leverage becomes confusing. In a pure long portfolio I take the tangent to the efficiency frontier (I believe that the name for the tangent in English is capital allocation line (CAL)) and pick a point along the sigma coordinate. As long as I am between 0 and the tangent touch point I "lever down" my portfolio. Once I am to the right of the tangent touch point I "lever up" my portfolio using credit.
The following link includes a picture: https://analystnotes.com/cfa-study-notes-the-cal-and-cml.html
But how does this look like once I am using pair's trading? The portfolio still exists as a point in the mu-sigma plane, but no capital is required to trade on it? What would it even mean to pick a point between 0 and the tangent touch point as no capital is required to be invested? How do you extend these concepts in the presence of short selling?

Thanks a lot!
Christian

2 responses

Pairs trading relies on opening a 'long' position' in one security and a 'short' position in another (presumably correlated) security. The best way to think about a long position is one first buys a security and, at a later time, sells that security. A short position is just the opposite. One first sells a security and, at a later time, buys that security.

What is the definition of 'returns? Portfolio returns is simply the gain in portfolio value from time t_0 to the current time expressed as a percent. It can be represented like this

portfolio_value = cash + sum_of_long_positions + sum_of_short_positions
returns = (portfolio_value_today - portfolio_value_t_0) / abs(portfolio_value_t_0)

This definition of 'returns' is an arithmetic return (not log return) and is valid for long positions and short positions or even no positions.

What is the definition of 'leverage? Account leverage is the sum of the absolute value of long and short positions divided by the portfolio value. It can be represented like this

portfolio_value = cash + sum_of_long_positions + sum_of_short_positions
leverage = ( sum_of_long_positions + abs(sum_of_short_positions) ) / portfolio_value

Let's see how these values are calculated for a long-short portfolio. Perhaps a strategy trading a pair of stocks ABC and XYZ.

day 1 - starting balance of $100,000  
        cash: $100,000  
        long positions: $0  
        short positions: $0  
        portfolio value: $100,000  (100000 + 0 + 0)  
        leverage: 0   ((0  + abs(0)) / 100000)

day 2 - open long and short positions  
        buy 1000 shares XYZ @ $100/share  
        sell 500 shares ABC @ $200/share  
        cash: $100,000  (100000 -100000 + 100000)  
        long positions: $100,000  
        short positions: -$100,000  
        portfolio value: $100,000  (100000 + 100000 - 100000)  
        leverage: 2  (100000 + abs(-100000)) / 100000)  
        returns: 0%  (100000 - 100000) / abs(100000) 

day 3 - longs go up $1/share shorts go down $1/share  
        cash: $100,000  
        long positions: $101,000  (1000 x $101)  
        short positions: -$99,500  (-500 x $199)  
        portfolio value: $101,500    (100000 + 101000 -99500)  
        leverage: 1.98  (101000 + abs(-99500)) / 101500)  
        returns: 1.5%  (101500 - 100000) / abs(100000) 

day 4 - close all positions  
        sell 1000 shares XYZ @ $101/share  
        buy 500 shares ABC @ $199/share 

        cash: $101,500  (100000 + 101000 - 99500)  
        long positions: $0  
        short positions: $0  
        portfolio value: $101,500    (101500 + 0 - 0)  
        leverage: 0  (0 + abs(0)) / 101500)  
        returns: 1.5%  (101500 - 100000) / abs(100000) 

A couple of things to note. First, the cash in the account is always $100,000. Second, the leverage goes to 2 after the initial trades are made however, the portfolio value remains unchanged (at $100,000). After, the stock prices change (favorably) the leverage goes down a bit and the returns go up. I'll leave it up to the reader to do the math if the stock prices changed unfavorably, but in that case the leverage would go up (above 2) and the returns would go down (negative).

Hope that all makes sense?

One last issue I'd like to address. The statement was made "no initial capital is required (in principle)". While that may be true "in principal" it's definitely not true in the real world. Moreover, the values for returns and leverage become incalculable, which suggests something is wrong and therefore isn't even really true "in principal". Let's do the exact trades as above but start with $0 in cash.

day 1 - starting balance of $0  
        cash: $0  
        long positions: $0  
        short positions: $0  
        portfolio value: $0  (0 + 0 + 0)  
        leverage: 0   ((0  + abs(0)) / 0)

day 2 - open long and short positions  
        buy 1000 shares XYZ @ $100/share  
        sell 500 shares ABC @ $200/share  
        cash: $0  (0 -100000 + 100000)  
        long positions: $100,000  
        short positions: -$100,000  
        portfolio value: $0  (0 + 100000 - 100000)  
        leverage: infinite  (100000 + abs(-100000)) / 0)  
        returns: 0  (100000 - 100000) / abs(0) 

Notice the leverage is infinite (because of the division by zero). In practice the most leverage (ie margin) a broker would extend is 2. One would need at least $100,000 in an account to long and short $100,000 worth of stock and maintain a leverage of 2. This is the case in the first example. In developing trading strategies ensure you constrain leverage. Ideally, start by constraining leverage to 1. This not only ensures the strategy is realistic but also allows for more meaningful comparisons between strategies.

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Thanks for your answer! I'll think longer about it. It feels somehow unsatisfactory that depending on your starting cash you suddenly have different returns. How can you then compare 2 portfolios? What you've done above is somehow similar what I currently do when I say that I use as my comparison basis the MAX_GROSS_EXPOSURE (sum_of_long_positions + abs(sum_of_short_positions)).

Is there some sort of "textbook" where such topics are discussed in more detail? The textbooks I've seen so far do not talk much about how the situation looks like once short selling is included.

The other thing you mention is that once you start including short selling you have to work with percentage changes and cannot use log-normal any longer. My stomach feeling would tell me that it would be more "correct" to split the portfolio into one for long and one for short and then use log-normal for each one of them. Doesn't it somehow have a negative effect (for example for the "correctness" of the covariance matrix) if you work with percent changes rather than with log-normal (or even better log-student-t or similar)? A long position can never have -110% change, but your normal distribution for percent changes is not bounded at -100%. Similar for the short position, which has an upper limit for the percent change, but the normal distribution does not have such a constraint. All very confusing :)