Energy cost calculation

I’d like to know the consumption costs per device over a specific period. The device displays the current, energy, and power. I use Nord Pool for kWh per quarter hour. I want to set the period using Energy Period Selector Plus. Can anyone help me create an automation for this?