fix: normalize null timestamps in Kraken flat-rate export tariffs#3705
Merged
springfall2008 merged 1 commit intomainfrom Mar 30, 2026
Merged
fix: normalize null timestamps in Kraken flat-rate export tariffs#3705springfall2008 merged 1 commit intomainfrom
springfall2008 merged 1 commit intomainfrom
Conversation
Kraken's REST API returns valid_from=null and valid_to=null for flat-rate tariffs (e.g. E-1R-NEXT_EXPORT_EXCLUSIVE_V2-H). Unlike Octopus which always provides real timestamps, this causes minute_data() to skip the rate entirely, resulting in "metric_octopus_export not set correctly" errors for E.ON/EDF customers with fixed export tariffs. Add _normalize_rate_timestamps() to fill in null valid_from with a sensible default (48h in the past for pure flat rates, or the earliest valid_to when mixed with timestamped entries). valid_to=null is already handled by minute_data() so is left as-is. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
Author
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code |
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.
Summary
valid_from: null, valid_to: nullfor flat-rate export tariffs (e.g. fixed E.ON export rates)minute_data()inutils.pyexpectsvalid_fromto be a parsable ISO timestamp —str2time(None)throws an exception and silently skips the ratemetric_octopus_export not set correctlyerrors for Kraken/E.ON customers with flat-rate export tariffs_normalize_rate_timestamps()static method toKrakenAPIthat fills nullvalid_fromwith a sensible fallback (earliestvalid_toacross results, or 48h in the past)Test plan
🤖 Generated with Claude Code