Conversation
… range - raise ValueError when latest_value_only=True is combined with start_date/end_date, which the API ignores (WFP-VAM#42) - default start_date to 7 days before today instead of today, avoiding a zero-length default date range (WFP-VAM#39) - extract RFC3339_DATE_FORMAT constant used for all date formatting (WFP-VAM#40) - add unit tests covering validation, defaults, and date formatting Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012LeVhWqMdzPDFCpvLKazLB
Bloom79
requested review from
AlexGherardelli and
paololucchino
as code owners
August 31, 2026 14:17
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.
Description
Three small related improvements to
MarketPricesApi.get_prices(), coming from the review comments in #36:latest_value_onlymean start and end date are ignored? If so, I suggest adding a validation that raises an error if use sets both latest_value_only and the dates. #42):latest_value_only=Truecombined withstart_date/end_datenow raises aValueErrorinstead of silently ignoring the dates.start_dateis the same as forend_date, creating a time range of length 0. Is that intended? Could a more helpful defaultstart_datebetoday - N(7?) days? #39): when nostart_dateis given it now defaults to 7 days before today (constantDEFAULT_DATE_RANGE_DAYS) instead of today, avoiding a zero-length default date range. Happy to change N if you prefer a different window."%Y-%m-%dT%H:%M:%S+01:00"and using throughout to avoid typo bugs #40): the repeated"%Y-%m-%dT%H:%M:%S+01:00"literal is extracted intoRFC3339_DATE_FORMATand used for all date formatting.Added
tests/unit/test_market_prices.py(6 tests, pure mocks — no API credentials needed) covering the validation, the defaults and the RFC 3339 formatting. Docstring updated (new default,Raisessection).Developed with AI assistance (Claude Code); all changes reviewed and tested locally (
make codestyleclean, unit suite green).Related Issue
Closes #42
Closes #39
Closes #40
Type of Change
Checklist
make codestyle.fix:,feat:,chore:, etc.).