-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add market Summary #2175
Add market Summary #2175
Conversation
What is Summary class providing beyond just returning the dict? |
Sorry, thought thats how it was wanted. How do you want it? Currently it returns a |
@ValueRaider let me know what you want it to return and then I'll mark it for review |
My mistake, I meant to question the |
Yes I suppose it could be a typed dict. It was meant to help provide type hints and the keys available. It also changes some of the keys names. What do you want changed? |
What happens if Yahoo adds/changes a key, or changes a type? Python variables are already typed, don't need to keep the hints they're for parsing the JSON. Use |
I can only see the type of dict. Not what each of the value types are?
There is still |
Here:
Reserve the Python type hints for function arguments (and return type). |
Sorry misunderstood you. I thought you meant static type hints in the editor.
Ok, can I ask why though? Surely more type hints and documentation is better? |
Our code yes, but not the data structures returned by Yahoo - that's Yahoo's job. They can change their data structure/naming at any time without warning breaking your previous code. |
Ok, anyway all done. Is there anything else or shall I mark ready for review? |
I'm not sure on the refresh logic, especially because |
I disagree as it does have data that changes daily:
Didn't you ask for it to not be unpacked? How do you want the data returned? |
This what I have in mind (only thought to combine your branches today): https://github.com/ranaroussi/yfinance/blob/draft/market-info/yfinance/domain/market.py
The periodic refresh logic is better handled by |
Surely if self._status is not None:
return self._status and if self._summary is not None:
return self._summary defeat the purpose of caching: It is only requested once not once an hour or once a day? You might as well just have it be a getter function? I like what you did with I think storing the data in I would also want to parse the data in What do you think?
Forgot about that... |
That's how lazy initialization works, nice side effect as a spam guard. Use other tools to refresh, yfinance focuses on the fetch. Parse status like this? 63698c5 Btw any way to get status fetch working with other regions beside US? |
Sorry, no. Was getting confused with #2176
I believe region doesn't effect the results and is only used for tracking, so shouldn't matter to the user. It might be that certain regions don't have access to certain data (geo blocking) but I don't know. |
@ValueRaider You have merged this pr with #2176. Is that what you want or do you want them as 2 separate classes? |
Merge was deliberate - only way to justify a new custom class, and make sense. |
What would you think of market being a class - |
Abandon |
@ValueRaider How about this? |
Interesting. Why do they need to be synced? |
If you have some data, I think it would be best if they were synced. It seems weird to have summary from time x and then maybe 30 minutes later status. With them being synced it allows better compatibility with the data. @ValueRaider. It also means that the class is all synced when accessing data and so if that matters then it gets it. Would be annoying to fetch some data on the border of a timer period and then have it swap before you can fetch the status. Also its better to have them synced for those that need it rather than not. |
ee27725
to
966473f
Compare
Supersedes #2172