Skip to content

fix(pricehistory): parse start/end datetime from epoch-ms or ISO 8601 + track uv.lock#8

Merged
rdemeritt merged 2 commits into
mainfrom
fix/pricehistory-datetime-and-lockfile-2026-06-17
Jun 17, 2026
Merged

fix(pricehistory): parse start/end datetime from epoch-ms or ISO 8601 + track uv.lock#8
rdemeritt merged 2 commits into
mainfrom
fix/pricehistory-datetime-and-lockfile-2026-06-17

Conversation

@rdemeritt

Copy link
Copy Markdown
Member

Summary

Fixes a critical bug in /v1/pricehistory endpoint where exo sends start_datetime and end_datetime as epoch-millisecond integers or ISO 8601 strings, but schwab-py 1.5.1 requires proper datetime objects. Without this fix, the endpoint silently fails to apply the datetime filters.

Adds _parse_datetime_param() utility to normalize both epoch-ms and ISO 8601 formats (with/without tz offset) into tz-aware UTC datetime objects. Wires this into the kwargs passed to schwab-py's pricehistory client method.

Also tracks uv.lock for reproducible local uv build environments (CI/Docker continue to use pip+requirements.txt).

QA Status

Approved 39/39 test criteria. Adds 9 new test cases covering:

  • epoch-ms integers (primary exo path)
  • epoch-ms strings
  • ISO 8601 with Z suffix
  • ISO 8601 with +HH:MM offset
  • naive ISO strings
  • null/None handling
  • malformed input rejection

Files Changed

  • app/schwab_data_proxy/rest_proxy.py: +31 lines (datetime parsing logic)
  • tests/test_pricehistory_datetime.py: new test file, 120 lines, 9 cases
  • uv.lock: tracked for reproducibility

Adds _parse_datetime_param() to accept epoch-ms integer strings (primary exo
path) and ISO 8601 strings (with/without tz offset) and wires it into the
start_datetime/end_datetime kwargs on /v1/pricehistory, satisfying schwab-py
1.5.1 which requires datetime objects, not raw strings.

Adds tests/test_pricehistory_datetime.py (9 cases, all passing).
@rdemeritt rdemeritt merged commit c53780e into main Jun 17, 2026
4 checks passed
@rdemeritt rdemeritt deleted the fix/pricehistory-datetime-and-lockfile-2026-06-17 branch June 17, 2026 17:36
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.

1 participant