Exported electricity calculated with nordpool prices

Hi!
I am using a notification to my phone when my solar stops producing, where I get the total imported electricity, exported, produced, etc…
How can I get the latest nordpool price per hour * sold electricity, once every hour the price changes and then when the automation runs, it uses the latest price to get the electricity price, it should use every price from 00:00 to 24:00
I want to have the total costs at the end of the day or until I manually run the action (total costs * sold energy)
So:
00:00-01:00=0.347 * electricity sold=
01:00-02:00=0.261 * electricity sold=
02:00-03:00=0.211 * electricity sold=
03:00-04:00=0.194 * electricity sold=
04:00-05:00=0.211 * electricity sold=
and so on…

This is todays prices:
0.347, 0.261, 0.211, 0.194, 0.211, 0.285, 0.438, 0.779, 0.809, 0.843, 0.794, 0.761, 0.684, 0.681, 0.643, 0.682, 0.707, 0.744, 0.784, 0.864, 0.929, 0.775, 0.725, 0.552

So we say the clock is 05:00 it needs to add all the first 5 hours when i run the actions and that sums up to 1,22€.
Now with the code i have it works so it uses the last nordpool price in all the previous hours (5 * 0.211=1,055 * kwh i sell and that is not correct.

The Energy Management in Home Assistant calculates this when using the nordpool entity
grid_export_solar_daily_energy shows 1,14€ and that is correct.

alias: Producerat, sålt, köpt idag
description: ""
trigger:
  - platform: template
    value_template: "{{ (states('sensor.active_power') | float(0) * 1000.0) < 1 }}"
    for: "00:00:00"
condition: []
action:
  - service: notify.notify
    data:
      message: >-
        Energiproduktionen upphörde idag.   Producerad El idag: 
        {{states('sensor.daily_yield')}} kwh.   Köpt idag: 
        {{states('sensor.grid_import_solar_daily_energy')}} kWh.   Sålt idag: 
        {{states('sensor.grid_export_solar_daily_energy')}} kWh.  Pris för köpt
        energi:  {{ '%.2f' |
        format(states('sensor.grid_import_solar_daily_energy') | float(0) *
        0.18) }} €  Pris för såld energi:  {{ '%.2f' |
        format(states('sensor.grid_export_solar_daily_energy') | float(0) *
        states('sensor.nordpool_kwh_fi_eur_3_10_024') |float) }}€
mode: restart

Did you solve this?
I have a similar thought where I want to measure my PV energy use each hour and multiply with the applicable hour rate from Nordpool.
All 24 hours should be added for a “daily saving”
Then 7 days could be added for a “weekly saving”, “monthly saving” etc etc…