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

Code seems faulty #1305

Closed
paulmcq opened this issue Jan 15, 2023 · 2 comments
Closed

Code seems faulty #1305

paulmcq opened this issue Jan 15, 2023 · 2 comments

Comments

@paulmcq
Copy link

paulmcq commented Jan 15, 2023

I have not seen a bug in execution, but reading this code in ranaroussi/yfinance/feature/prune-info/yfinance/scrapers/quote.py, it appears wrong to me.

I do not understand where this k gets a value in _scrape_complementary()
line 293: if k not in key_stats:

ranaroussi/yfinance/feature/prune-info/yfinance/scrapers/quote.py: 290 .. 299

            json_data = json.loads(json_str)
            key_stats = json_data["timeseries"]["result"][0]
            if k not in key_stats:
                # Yahoo website prints N/A, indicates Yahoo lacks necessary data to calculate
                v = None
            else:
                # Select most recent (last) raw value in list:
                v = key_stats[k][-1]["reportedValue"]["raw"]
            self._info[k] = v
@ValueRaider
Copy link
Collaborator

Should be in a for k in keys: . Do you mind submitting a fix?

@paulmcq
Copy link
Author

paulmcq commented Jan 15, 2023

I would not mind submitting a fix, but I am not now set up to do development on yfinance. I know it is basically a git clone, then edit the file, push, and test. However, my code files and virtual environments are such a mess that it will take a while before that can be sanitary.
I just noticed this whilst browsing the code. I do not even have a test case.
I will eventually get straightened out, but thought it best to expose the issue sooner.

coskos-ops added a commit to coskos-ops/yfinance that referenced this issue Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants