Daily energy cost calculation using variable wholesale energy tariff derived from NEM

I am wanting to simulate the costs associated with using the Localvolts or Amber type of access to the wholesale market in NSW.

I have sensors that record daily import and export in kWh. I have created a sensor that represents the current actual purchase or sell price based on the NEM Spot market plus the distributor fees.

I can’t figure out how to correctly account for daily costs of energy based on the constantly changing wholesale price.

Any hints on how to achieve this will be very welcome.