Closed karim1104 closed 3 years ago
Hey,
You can change that by doing empyrial(your_portfolio, rf=0.1)
for example.
Hope it helps
Hi Santosh, It worked as a code, but it broke the Sharpe Ratio. When I use "empyrial(portfolio, rf=0.0)", I get a Sharpe Ratio of 1.33 which is realistic. When I use "empyrial(portfolio, rf=0.01)", I get a Sharpe Ratio of -7.06 which is unrealistic.
Can you share the whole code please so I can try it out?
start_date = datetime.datetime(2010, 1, 1) df = pd.read_csv('Portfolio1.csv')
x = df.to_string(header=False, index=False, index_names=False).split('\n') names = [','.join(ele.split()) for ele in x]
portfolio = Engine(
start_date= start_date,
portfolio= names,
benchmark = ["SPY"]
)
empyrial(portfolio, rf=0.01)
Ok just modified it a little bit with the new version (1.5.5).
Should work now as you can see in this notebook: https://colab.research.google.com/drive/1CKMf1YudMsf8ryD5tOYddVU0fRaQJnWx?usp=sharing
The sharpe ratio is credible. Is it fine?
Confirmed it's working fine. Issue is fixed in version 1.5.5.
Thanks!
The risk-free rate is hard-coded in empyrial.py in line 197 (rf = 0.0). Please change it to a variable so we can adjust it as needed.