Loading...

Plus+ Python

Major Cryptocurrency Risk Adjusted Return Comparisons with Sharpe Ratios

Major Cryptocurrency Risk Adjusted Return Comparisons with Sharpe Ratios

Sharpe Ratio Importance
To clarify upfront about what exactly is the Sharpe Ratio... Sharpe is a commonly used metric that allows comparison of returns across risky assets. The simple idea is that if two assets, Asset A and Asset B, both offer 10% returns, it is preferable to invest in the asset that has a lower standard deviation of asset prices (less volatility). Higher Sharpe ratios are therefore preferred to a lower sharpe ratio. We will extend from our other example for how to extract the risk free rate from US Treasury par yield curve(s), as the RFR rates is a needed input to our Sharpe calculations. As an additional note, there are numerous other ratios or metrics that allow you to compare risky portfolios against one another that are not covered here... like the information ratio, Treynor Ratio and others. One recognized drawback of using the Sharpe Ratio is that it loses comparative value across portfolios that do not have normal return distributions (big fat tails). We avoid some of that criticism here because we are only using the ratio to compare within the same asset class (crypto to crypto).


S = the Sharpe Ratio
R = Asset Return
Rf = Risk Free Rate
σ = Standard Deviation



Defining Our Inputs
From the formula, there are roughly 3 inputs that we need to define to calculate the Sharpe Ratio:
1) Asset Return
2) Risk Free Rate
3) Asset Volatility

We follow the somewhat rigorous process that is outlined by Investopedia, which is slightly more complex than simply taking the return over the entire period and dividing it by the standard deviation of the entire period. The method prescribes calculating returns over intervals, and we will implement monthly intervals in our example. Similarly, for the Risk Free Rate (RFR), we pull all Par Yield Rates for that month and then take the average of the period intervals to arrive at a more accurate representation of the risk free rate as it changes through time. This requires us pulling live data from the US Treasury.gov website for Daily Treasury Par Yield Curve values. Please note that the result of this process/script is one metric; and not a rolling timeseries of Sharpe ratio calculations rolling through time.

Notes on Implementation
The implementation in Python requires more steps than usual to reach our solution as it meets the proper method of calculation outlined by Investopedia. The first step of the process is loading all asset data for BTCUSD, ETHUSD, LTCUSD, BNBUSD, and XRPUSD from the FTX data page using the daily time frame for all dates after January 2021. These returns are then transformed to represent the monthly return for each monthly interval(s). The next function will load all of the historical Par Yield Curve Rates for the 1 month tenor point from the US Treasury's website for each month that we have calculated cryptocurrency returns going back to 2021 (this process may take a few minutes to gather all of the data). For each month, the par yields are averaged together to reach one average value for the time period. We can then consider (Jan 2021 Return - Jan 2021 RFR ) as a "differential". All differentials between Return & RFR for each month are then averaged together to reach the value for the numerator of the equation. The last step is to divide our differential numerator by the prescribed standard deviation. As always, every line of code is commented and documented to make it clear what is being done!

Plus+ membership required

Create a Plus+ account to view the live codebase.

This article has a fully working, notebook-ready code block. Sign up for Plus+ to access it and the rest of the 20+ premium articles.

Subscribe to Plus+ Browse Plus+ articles