Energy flexibility platform connecting distributed assets with markets