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

Fix #49, #140, #142, #144, #145 and index for wk/mo intervals #141

Merged
merged 6 commits into from
Feb 14, 2023

Conversation

maread99
Copy link
Contributor

@maread99 maread99 commented Feb 3, 2023

Fixes #140 by forcing index for a single daily price to 'object' dtype.

Fixes dpguthrie#140 by forcing index for a single daily price to 'object' dtype.
Fixes `ZeroDivisionError` being raised when yahoo split data has
'denominator' as 0. Represents this circumstance with a `float('inf')`
value in the splits column (as behavior prior to v2.3).
Changes dtype of index of DataFrame returned by `Ticker.history` when
interval is in terms of weeks or months. Changes dtype from tz-aware
'datetime64' to 'object' that represents dates and live indice in the
same manner as for a daily interval.

This behaviour should have been implemented in dpguthrie#129.
@maread99
Copy link
Contributor Author

maread99 commented Feb 5, 2023

Hi @dpguthrie, I've added another couple of commits to fix things that have cropped up. They are both simple one-line changes.

The first offers a way to resolve #144.

The second relates to an oversight on my part that should have been implemented in #129 (sorry!). When the interval is weekly or monthly the price data should be indexed on the same basis as for daily data, although it's currently indexing as if it were intraday data, with ugly tz-aware pd.Timestamps.

@maread99 maread99 changed the title Fix FutureWarning Fix #140, #144 and index for wk/mo intervals Feb 5, 2023
Fixes dpguthrie#49 and at least part fixes dpguthrie#142 .
@maread99 maread99 changed the title Fix #140, #144 and index for wk/mo intervals Fix #49, #140, #144 and index for wk/mo intervals Feb 10, 2023
@maread99
Copy link
Contributor Author

...one more commit (_convert_to_timestamp) to fix an issue described here in 142, which is actually the same as #49.

Fixes a v2.3 bug due to wrongly assuming that
 `pd.Timestamp.fromtimestamp` converts based on UTC by default
(actually converts based on system time).
@maread99 maread99 changed the title Fix #49, #140, #144 and index for wk/mo intervals Fix #49, #140, #142, #144 and index for wk/mo intervals Feb 11, 2023
@maread99
Copy link
Contributor Author

...one more, final, commit (Fix 142) to resolve a bug that came to light in #142 (detail there and on commit message).

Collectively this PR now resolves bugs and oversights with the v2.3 changes together with fixing a preexisting bug in _covert_to_timestamp.

All tests passing locally.

Fixes dpguthrie#145 by accounting for possibility that yahoo does not
hold data for last trade time. In this unusual case last row
will be indexed  as  if session is closed (it may be, it may  not be).
@maread99 maread99 changed the title Fix #49, #140, #142, #144 and index for wk/mo intervals Fix #49, #140, #142, #144, #145 and index for wk/mo intervals Feb 11, 2023
@maread99
Copy link
Contributor Author

Crumbs, another commit (Fix 145). This fixes a bug for edge cases where yahoo does not have last trade data for a symbol, as raised in #145.

Also, I've offered an extension to the Ticker.history doc to clarify what should be expected in terms of indexing.

Still passing all tests locally.

@dpguthrie
Copy link
Owner

@maread99 You're a machine! Can't thank you enough for your contributions to this project! I'll get this merged in and cut another release here shortly.

@dpguthrie dpguthrie merged commit 48db2c7 into dpguthrie:master Feb 14, 2023
@maread99
Copy link
Contributor Author

No worries @dpguthrie, most of the commits concerned bugs / oversights introduced in #129 so I felt responsible for fixing!

Also, if you're looking to assign anyone as a collaborator to help out with maintenance I'd be more than happy to. I maintain a couple of my own libraries (including market-prices which depends on yahooquery) and am a collaborator for exchange-calendars to which I've contributed extensively. If you wanted to drop me an email, address is on my profile page.

Cheers
Marcus

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

Successfully merging this pull request may close these issues.

FutureWarning when requesting most recent days' daily prices
2 participants