dpguthrie / dpguthrie/yahooquery
Why is the last indice of daily price data a datetime and all the rest are date!!! ANSWERED...
- Dominant language
- Python
- Stars
- 920
- Forks
- 164
- PR merge metrics
- No merged PRs in 30d
Description
Since 2.3.0 there have been a few of issues raised that have this change at their root, including [here](https://github.com/dpguthrie/yahooquery/issues/169#issuecomment-1481837966) in #169, #175 and I feel like I've discussed it many times besides. So here's the answer in one place...
`yahooquery` indexes daily price data with date objects. However, if data is requested that includes a session that has yet to close then the last indice is a datetime object. One reason is that this removes the ambiguity of whether the row represents the end-of-day price or merely a price during the session. The more important reason is that I don't believe that **generally** it's possible to evaluate what date (i.e. session) the live indice datetime relates to without knowing the symbol's trading hours (this is explained in more detail [here](https://github.com/dpguthrie/yahooquery/issues/127#issuecomment-1324395424)).
@dpguthrie, to avoid this issue repeating I was thinking of offering a PR adding an explanation to the README? Ideally I'd include a link to [market_prices](https://github.com/maread99/market_prices) which sits on top of `yahooquery` and does resolve the live indice to a date (which it does by mapping symbols to calendars from [exchange_calendars](https://github.com/gerrymanoim/exchange_calendars) and then querying the trading hours). Perhaps you'd let me know if you think the addition to the README would be useful and if you have any objections to including a link to [market_prices](https://github.com/maread99/market_prices).
Or maybe leaving this as an open issue suffices?
Cheers
Marcus
Contributor guide
Research direction
Review the README and the existing daily price-data documentation. Explain why completed sessions use date indices while an open session uses a datetime, and consider linking to market_prices and exchange_calendars as proposed. Done means the behavior and rationale are documented clearly without reopening the underlying issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- pandas, python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100