Whats the best way to obtain average grid power for the last 10 days, for each hour of the day?

I’m a bit lost, between sql sensor, history integration, or statistics sensor. Can someone point me in the right direction please?

So you want 24 sensors, one for each hour?