diff --git a/src/akkudoktoreos/prediction/price_forecast.py b/src/akkudoktoreos/prediction/price_forecast.py index 059f833..9e4d880 100644 --- a/src/akkudoktoreos/prediction/price_forecast.py +++ b/src/akkudoktoreos/prediction/price_forecast.py @@ -98,6 +98,7 @@ class HourlyElectricityPriceForecast: # Extract the price from 00:00 of the previous day previous_day_prices = [ + entry["marketprice"] # + self.charges entry["marketprice"] # + self.charges for entry in self.prices if previous_day_str in entry["end"] @@ -106,6 +107,7 @@ class HourlyElectricityPriceForecast: # Extract all prices for the specified date date_prices = [ + entry["marketprice"] # + self.charges entry["marketprice"] # + self.charges for entry in self.prices if date_str in entry["end"] @@ -117,6 +119,8 @@ class HourlyElectricityPriceForecast: return np.array(date_prices) / (1000.0 * 1000.0) + self.charges + return np.array(date_prices) / (1000.0 * 1000.0) + self.charges + def get_average_price_last_7_days(self, end_date_str: Optional[str] = None) -> np.ndarray: """Calculate the hourly average electricity price for the last 7 days. @@ -164,6 +168,12 @@ class HourlyElectricityPriceForecast: axis=0, weights=np.array([1, 2, 4, 8, 16, 32, 64]) / np.sum(np.array([1, 2, 4, 8, 16, 32, 64])), ) + return average_prices + average_prices = np.average( + price_matrix, + axis=0, + weights=np.array([1, 2, 4, 8, 16, 32, 64]) / np.sum(np.array([1, 2, 4, 8, 16, 32, 64])), + ) final_weights = np.linspace(1, 0, price_matrix.shape[1]) # Weight last known price linear falling