Skip to content

Fix historical price resolutions on pandas 3 - #376

Merged
bug-or-feature merged 2 commits into
ig-python:masterfrom
prbprbprb:fix-375-conv-resol-aliases
Aug 16, 2026
Merged

Fix historical price resolutions on pandas 3#376
bug-or-feature merged 2 commits into
ig-python:masterfrom
prbprbprb:fix-375-conv-resol-aliases

Conversation

@prbprbprb

Copy link
Copy Markdown
Contributor

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
@bug-or-feature

Copy link
Copy Markdown
Member

Should pass checks now if you rebase off latest

@bug-or-feature
bug-or-feature merged commit ea0956a into ig-python:master Aug 16, 2026
3 checks passed
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

2 participants