Optimal load scheduling based on day a head energy price and peak load limit

I am searching for an cost optimization algoritm to optimize a schedule on when to run the SPA/Jacuzzi heater and pumps, water boiler , heating etc based on day a head energy prices and peak load.

“slow loads” that have to run a number of hours a day but not nessesary continiuosly can be splittet into several timeslots

any one that have a suggestion for a good solution ?

Start with finding an API you can read the what the price is in the near future.

Have you found a good solution for this?