Skip to content

Fix historical price resolutions on pandas 3 - #376

Open
prbprbprb wants to merge 1 commit into
ig-python:masterfrom
prbprbprb:fix-375-conv-resol-aliases
Open

Fix historical price resolutions on pandas 3#376
prbprbprb wants to merge 1 commit into
ig-python:masterfrom
prbprbprb:fix-375-conv-resol-aliases

Conversation

@prbprbprb

Copy link
Copy Markdown

pandas 3.0 removes the 'H' and 'M' frequency aliases, so conv_resol() will raise ValueError for 1H, 2H, 3H, 4H and M, the resolutions that fetch_historical_prices docstrings advertise.

This change normalises them to 'h' and 'ME' before calling to_offset(), so both spellings work on pandas 2 and 3, and neither triggers the pandas 2 deprecation warning.

Partially fixes #375

Noted while testing that conv_resol fails anyway on pandas 2.0 and 2.1 so I'm planning to bump the minimum in the next (test matrix) PR as it doesn't make anything worse

pandas 3.0 removes the 'H' and 'M' frequency aliases, so
conv_resol() will raise ValueError for 1H, 2H, 3H, 4H and M, the
resolutions that fetch_historical_prices docstrings advertise.

This change normalises them to 'h' and 'ME' before calling
to_offset(), so both spellings work on pandas 2 and 3, and neither
triggers the pandas 2 deprecation warning.

Partially fixes ig-python#375

Noted while testing that conv_resol fails anyway on pandas 2.0 and
2.1 so I'm planning to bump the minimum in the next (test matrix) PR
as it doesn't make anything worse
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.

Optional dependencies broken on Python 3.13/3.14: munch unusable, and pandas capped below 3

1 participant