Repository navigation
Fix Distro day-ahead submissions rejected with 400 - #106
Merged
Merged
Conversation
The day-ahead endpoint lives under /api/v1 on the Distro host, so the default base URL without it hit the wrong path.
Log the day, interval count and creationTimestamp at FINE, and the full JSON payload at FINEST, so a rejected request can be compared against the API spec.
The API rejected every submission with a 400: - The order array was serialised as submissionData; the API requires it as data. - creationTimestamp was sent in epoch milliseconds; the API expects seconds and must not be in the future. - Days up to 14 ahead were submitted; the API accepts at most five days after today. The window is now the API limit rather than a defensive ceiling, so reaching it is no longer a warning. - Volumes carried full double precision; the API only accepts multiples of 0.01.
The forecast is the average net power in kW over each quarter-hour, but the API expects the energy in kWh, so every volume was four times too large. The sign was also inverted: positive powerNet is import, which is a buy, and the API signs buys negative. The fill tests keep reasoning in forecast kW through a volume() helper; a separate test pins the conversion itself.
denniskuijs
approved these changes
Sep 28, 2026
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.
Distro rejected every day-ahead submission with a 400. The payload did not match their API spec: the order array was sent as
submissionDatainstead ofdata,creationTimestampwas in milliseconds instead of seconds, days up to 14 ahead were posted where the API allows five, and volumes were not rounded to 0.01.Volumes were also wrong in value. We sent average kW per quarter-hour, and the API expects kWh, so every order was four times too large. The sign was inverted as well, since import is a buy and Distro signs buys negative.
The base URL now includes
/api/v1, and the submission is logged before posting. Details per change are in the commits.