+ 3
Problem with calculating Bitcoin financial metrics
Hello everyone! I need your help. For some reason, this code returns incorrect data in the section "Main metrics for Bitcoin". I compared the result of the code with data from the Internet and saw that they do not match. The program calculates the Sharpe ratio for Bitcoin higher than 1. But on the web resources you can find information that this ratio for Bitcoin should be negative at all: -0.37. I wrote this program in accordance with the course "Python for Finance" within Code Repo. Please help me fix it. If you can find an error in the calculations, I will be very grateful! https://code.sololearn.com/cZoe8RrfZdZM/?ref=app
3 Answers
+ 3
SharpeRatio = (Rp - Rf) / Dp
# where:
# Rp = return of portfolio
# Rf = risk-free rate
# Dp = standard deviation of the portfolioâs excess return
+ 2
JaScript , okay, what about volatility? And is return of portfolio the same as cumulative return and is calculated with .cumprod() function?
+ 2
Anton Panasiuk ,
Dp = âvolatilityâ and
all your answers can be found in web, for example here:
https://en.wikipedia.org/wiki/Sharpe_ratio