Closed MacValley closed 1 month ago
'blockPriceAggregates': [{'averagePricePerArea': {'FI': {'average': 41.41,
'max': 129.35,
'min': 12.04}},
'blockName': 'Off-peak 1',
'deliveryEnd': '2024-10-15T06:00:00Z',
'deliveryStart': '2024-10-14T22:00:00Z'},
{'averagePricePerArea': {'FI': {'average': 50.37,
'max': 122.86,
'min': 27.24}},
'blockName': 'Peak',
'deliveryEnd': '2024-10-15T18:00:00Z',
'deliveryStart': '2024-10-15T06:00:00Z'},
{'averagePricePerArea': {'FI': {'average': 16.13,
'max': 20.24,
'min': 10.16}},
'blockName': 'Off-peak 2',
'deliveryEnd': '2024-10-15T22:00:00Z',
'deliveryStart': '2024-10-15T18:00:00Z'}],
These seem to be available in the API, but what's the actual use-case? I haven't found one and especially the min, max and average are so easy to calculate that I'd rather leave them out for the library user to calculate if needed.
I've been thinking about re-structuring the output to be more simple anyways, that's why I'm thinking these additions quite critically.
My current idea is that the output would drop to something like the following, as I've never found any use for the other stuff. I'd rather calculate the required values my self from a more simple format as needed, for example when calculating the total electricity cost.
{
"currency": "EUR",
"updated": "2024-10-14T12:07:23Z",
"areas": {
"FI": [
{"time": "2024-10-14T22:00:00Z", "value": 45.13},
{"time": "2024-10-14T23:00:00Z", "value": 27.31},
{"time": "2024-10-15T00:00:00Z", "value": 25.68},
{"time": "2024-10-15T01:00:00Z", "value": 16.71},
{"time": "2024-10-15T02:00:00Z", "value": 12.04},
{"time": "2024-10-15T03:00:00Z", "value": 26.56}
]
}
}
kipe, you are absolutely right! No need to extract extra data that can be calculated if needed. I used AVERAGE in a presentation more like a convenience since the number was there already. I fully respect your decision to abandon those extra numbers. In other words: This "issue" is really not an issue, shall we call it change n design? So feel free to close! Keep up the good work!
Yeah, I'd rather keep the response more simple and if more complex data is required, the user can always calculate it.
I found the documentation for calculating Off-Peak 1
, Off-Peak 2
and Peak
, leaving it here for future reference in case someone needs them:
For example those times don't correspond to the day/night grid tariff commonly used in Finland, which is typically from 22:00-06:59 -> those values are more or less useless depending on the country.
I experimented a bit in Jupyter with the code, and ended up with this code: ... import pandas as pd ...
se4_start = jsnordpool['start'] se4_updated = jsnordpool['updated'] se4_currency = jsnordpool['currency'] se4_values = jsnordpool['areas']['SE4']['values']
df_all = pd.DataFrame(se4_values) df_offpeak1 = pd.DataFrame(se4_values[:8]) df_peak = pd.DataFrame(se4_values[8:20]) df_offpeak2 = pd.DataFrame(se4_values[20:]) ...
Then I have the extra data if I need to do some stuff with it: MIN is df_all['value'].min() MAX is df_all['value'].max() AVERAGE is df_all['value'].mean() PEAK is df_peak['value'].mean() OFFPEAK1 is df_offpeak1['value'].mean() OFFPEAK2 is df_offpeak2['value'].mean()
I checked with the values from Nordpool's web site, and the values were the same. So once again, the decision to NOT calculate the extra data in the base code is absolutely correct.
I did not change my code at all, I just find that Min, Max etc are missing. Is there a way to get that data with an additional parameter or another function? Please advice