Skip to content
All library documents

Accounting for Shorts, Cash Flows, Costs, and Beta in Long–Short Backtests

Article Quant Q&A · Author: Andrei

Summary

The document discusses how to calculate returns for a long–short equity portfolio. One response recommends tracking long positions, short positions, and cash as separate components. Cash can capture borrowing costs, other expenses, and flows; alternatively, costs can be included directly in the long and short return calculations, with margin reflected in the return denominator. Returns should be computed for periods separated by position changes and then linked over time to obtain a time-weighted result.

A second response focuses on market exposure: estimate each stock’s beta and weight the long and short holdings so that portfolio beta is near zero when the goal is to isolate stock-selection views from broad market moves. The discussion offers accounting approaches, not a worked spreadsheet example, and does not specify a universal treatment of margin or financing. Beta neutrality is an objective that requires estimates and may not remove every source of market risk.

Key ideas

  • Separate long, short, and cash P&L to account for financing, costs, and cash flows.
  • Returns can be calculated after costs, with margin handled in the return denominator.
  • Define return periods around changes in portfolio positions, then chain-link period returns.
  • Estimate stock betas and weight positions to target a portfolio beta near zero when seeking market neutrality.
  • The suggested accounting and beta approaches are guidance, not a worked example or guarantee of risk removal.

Tags

Full text
# Long/Short Backtesting Set up


# Long/Short Backtesting Set up












I am going to be backtesting a Long/Short equity strategy and need some guidance on how best to deal with the short book. I was thinking that for each portfolio I would go long 50 equities and go short 50 equities. I plan on doing this test in excel by the way.

I am trying to wrap my brain around how to appropriately handle this.

My thought was:

Portfolio 1

Longs MSFT CSCO ORCL AMZN Portfolio Returns Benchmark Returns Out/Under-performance

Shorts HII HP BBBY YHOO Portfolio Returns Benchmark Returns Out/Under-performance

My first question is whether I would simply flip the sign on the short book in order to get performance for that piece of the portfolio. And secondly whether I would simply add short performance to long performance to get net performance. I would like to include some assumptions about margin but not sure how to appropriately do this -- If you have any suggestions I would appreciate it.

## Answer by RndmSymbl (score 1)

https://quant.stackexchange.com/a/15452

You should first determine whether you want to look at relative or absolute returns. You may want to use position weights relative to the benchmark rather than market value if interested in relative value.

For absolute returns consider your three components (long, short and cash - where cash includes borrowing, other costs and in/out flows) P&L and compute simple returns for each period. A period would be created when a change occurs to any position within any of the three components. An alternative would be to compute simple returns after all costs for only long and short positions rather then managing costs through the cash components. This second approach would consider your margin in the divisor (compare this demonstration).

Once all period returns are known you would typically chain-link the period returns to compute the time-weighted return.

## Answer by jaamor (score 0)

https://quant.stackexchange.com/a/15456

To add an important point to existing answers, the overall portfolio beta should be 0.

The usual motivation of a long short strategy is to invest in a portfolio that captures your view of individual equities, but is immune to overall market movements. For example you have reason to believe that MSFT is going to perform better than HP, but you do not want your portfolio to be affected by (for example) the release of macro-economic data would cause all stocks to drop (or go up) by some amount.

The main risk factor for every stock is the market, usually approximated by the S&P 500 index. To create a long short strategy that is immune to the S&P 500, you have to estimate the beta's of each of the stocks. You can either calculate it or get it Google finance.

Long equities will have positive beta and short equities negative beta. The portfolio value weighted beta should be close to zero. This strategy, can theoretically offer a great Treynor ratio, if there is value added by the stock picking!

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.