Closed sebvalton67116 closed 1 month ago
Could you give a minimal reproducible example, please?
Make sure the tickers are NYSE/NASDAQ and not international. Was getting the same error
Actually if they are tickers that can be found on yfinance in general they should work. You can also use custom data if needed (check the doc!)
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.