Repository navigation
fix(calendars): use the exchange date for equity session filtering - #89
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #88.
Select the provider schedule using the actual exchange's local date after interpreting the timestamp. The same NYSE trading instant now has the same session membership in UTC, New York, Tokyo and Sydney, including when the configured timezone is overridden. Preserve naive timestamps' configured-timezone interpretation, inclusive open/close boundaries, and the existing optional-provider fallback. Other calendar methods and public signatures are unchanged.
Reviewed head: 6299d8a. Base: 0a3acdc.
Regression command on both revisions:
uv run pytest tests/core/test_calendars.py -k 'keeps_exchange_rows or naive_timestamps_use_configured or missing_calendar_provider' -q -o addopts=''
The base produces five failures and nine passing controls. The fix passes all 14 cases. The tests use actual Polars timezone conversion and the real calendar provider, with winter/summer trading, before/after hours, open and inclusive close boundaries, July 3 early close, July 4 holiday, configured Tokyo timezone, naive inputs and four genuine missing-provider import controls. All 94 calendar and labeling tests pass, preserving the earlier CME repair.
Ruff check/format, ty, all-file hooks, lock validation, wheel/sdist build, import, twine metadata checks and strict MkDocs pass. Full suites pass with 4,266 tests, 57 intentional deselections and 17 known warnings on each of Python 3.12, 3.13 and 3.14. The isolated built wheel with pandas-market-calendars 5.5.0 passes both the original public reproduction and all ten expanded timezone/boundary workflows. Fresh current-head hosted qualification is required before merge; results on earlier revisions are not reused as current readiness.
Valid session rows previously dropped across timezone midnight are now retained. This behavioral correction belongs in the eventual qualified patch release; this PR does not release or deploy anything.
AI assistance: Codex reproduced the public filtering defect on the published package and current source, implemented this focused repair and permanent regressions, ran the recorded checks, and prepared this description.