Calculating a Sharpe Ratio from Cumulative Dollar Returns
Summary
The document explains how to turn a cumulative dollar-return series from a pairs strategy into observations for a Sharpe ratio. One approach takes day-to-day differences in cumulative dollar returns; another divides each change by the prior cumulative value to form arithmetic returns. The proposed daily ratio is the mean excess return over its standard deviation, with the risk-free rate often set to zero, followed by annualization using the square root of the number of trading days in a year.
A second answer warns that using an arithmetic mean can give a misleading sign relative to compounded performance, and proposes calculating a geometric mean from log returns. The exchange does not settle which return basis is appropriate: dollar changes require a consistent capital or risk scale for meaningful comparison, while dividing by prior cumulative profit can be problematic when that value is near zero or changes sign. The presented code examples also contain assumptions that should be checked before applying the formulas to a real strategy.
Key ideas
- Daily observations can be formed from successive changes in cumulative dollar returns.
- Arithmetic returns can instead be calculated by scaling each change by the prior cumulative value.
- A Sharpe ratio compares average excess return with return variability and can be annualized.
- Return basis and compounding conventions affect interpretation, so the chosen series must fit the strategy's capital basis.
Tags
Full text
# How to calculate Sharpe Ratio from $ returns?
# How to calculate Sharpe Ratio from $ returns?
I have a pairs strategy that I am trying to calculate the sharpe ratio for. Currently I am using python for my analysis and calculation. I have a dataframe that contains the cumulative returns in $'s for each day. I am confused on how to convert this information into something that I can calculate the sharpe ratio from.
Could anyone point me in the right direction on how to use cumulative returns (in $'s) to find the sharpe ratio? Any help is appreciated! Thanks
## Answer by madilyn (score 11)
https://quant.stackexchange.com/a/39842
Let's say your cumulative return series is $\{R_i \mid i=0,1,...,N-1\}$ of length $N$ days.
There's 3 conventional ways to do this at this stage. You may convert the cumulative dollar return curve into arithmetic returns:
$\displaystyle{r_i}= \dfrac{R_i-R_{i-1}}{R_{i-1}}$
Or dollar returns:
$\displaystyle{r_i=R_i-R_{i-1}}$
Then take the ratio:
$\displaystyle{SR_{1d} = \dfrac{E\{r_i\}-r_f}{std\{r_i\}} }$
where the risk-free rate $r_f$ is often taken to be $0$. Finally, you annualize it:
$\displaystyle{SR_{1y}=SR \cdot \sqrt{252}}$
Here's an example of how you can do it in Python:
```
import numpy as np
import pandas as pd
# Simulate cumulative returns of 100 days
N = 100
R = pd.DataFrame(np.random.normal(size=100)).cumsum()
# Approach 1
r = (R - R.shift(1))/R.shift(1)
# Approach 2
r = R.diff()
sr = r.mean()/r.std() * np.sqrt(252)
```
## Answer by K. Do (score 0)
https://quant.stackexchange.com/a/69752
With the other answer, the Sharpe ratio might be positive although the returns are negative. This comes from the fact that geometric mean and arithmetic mean are different.
The following approach could be used:
```
returns = pd.DataFrame(np.random.normal(size=100))
mean_log_returns = (np.mean(np.log(returns + 1)))
mean_returns = np.exp(mean_log_returns) - 1
std = returns.std()
sharpe_ratio = mean_returns / std * np.sqrt(252)
```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.