Hi All,
I’m brainstorming ideas for a problem right now, let me try explain:
Background
The Australian electricity market trades in 5 minute blocks - with pricing being finalised generally in the 1st 30 seconds of each interval. Each interval starts/finishes on the 5min (ie 9:00 - 9:05, 9:05 - 9:10, etc)
Problem Statement
The Amber API has a flag in the stanza for current pricing, indicating whether or not the price has been finalised, ie:
{
"type": "CurrentInterval",
"date": "2025-06-07",
"duration": 5,
"startTime": "2025-06-07T07:10:01Z",
"endTime": "2025-06-07T07:15:00Z",
"nemTime": "2025-06-07T17:15:00+10:00",
"perKwh": 32.51091,
"renewables": 109.565,
"spotPerKwh": 15.18,
"channelType": "general",
"spikeStatus": "none",
"tariffInformation": {
"period": "shoulder",
"season": "default"
},
"descriptor": "veryLow",
"estimate": false
},
The problem is that until the price is finalises, the ‘Current’ price cannot be trusted for automations.
possible solution
- Continue to refresh every 1 minute.
- If current price has estimate == true, startup another scheduler for 15 second refresh and once estimate == false, cancel this scheduler
Any other ideas? The Amber API is ratelimited - so I need to be somewhat mindful of not hammering their API.
The other thought is some way to schedule refreshes around the 5 minute intervals, and sleeping once estimate == false until the next 5 minute interval starts?