A Dynamic Market Mechanism for the Integration of Renewables and Demand Response