Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with stocks data #115

Open
sebvalton67116 opened this issue Sep 24, 2023 · 3 comments
Open

Error with stocks data #115

sebvalton67116 opened this issue Sep 24, 2023 · 3 comments

Comments

@sebvalton67116
Copy link

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.

@santoshlite
Copy link
Owner

Could you give a minimal reproducible example, please?

@dvolosh
Copy link

dvolosh commented May 30, 2024

Make sure the tickers are NYSE/NASDAQ and not international. Was getting the same error

@santoshlite
Copy link
Owner

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!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants