Empyrial icon indicating copy to clipboard operation
Empyrial copied to clipboard

Error with stocks data

Open sebvalton67116 opened this issue 9 months ago • 3 comments

First and foremost, I wanted to let you know how much I adore your work and how big of a fan I am of your Empyrial library on Python! I use it quite often for my analyses.

I'm reaching out today because I've been facing an issue when running the code, regardless of the date I choose: it indicates there's a data problem. The specific issue is as follows:

ValueError Traceback (most recent call last) in <cell line: 27>() 25 ) 26 benchmark=["SPY"] ---> 27 empyrial(portfolio) 28 29

1 frames /usr/local/lib/python3.10/dist-packages/empyrial/main.py in get_returns(stocks, wts, start_date, end_date) 148 initial_alloc = wts/assets.iloc[0] 149 if initial_alloc.isna().any(): --> 150 raise ValueError("Some stock is not available at initial state!") 151 portfolio_value = (assets * initial_alloc).sum(axis=1) 152 returns = portfolio_value.pct_change()[1:]

ValueError: Some stock is not available at initial state!

I've tried to resolve it by using more recent dates to download titles, but it still doesn't work.

sebvalton67116 avatar Sep 24 '23 21:09 sebvalton67116