The liberalization of electricity markets and the transformation of electric power systems to include large amounts of variable output generation, has led to a growing interest in flexible demand and demand response. Making demand response available on the wholesale market on a large scale is a challenge. Retailers and aggregators, providing services to individual consumers as well as bringing aggregated flexibility to the wholesale market, is foreseen to play important roles in this respect. This paper presents a aggregator decision support model for demand scheduling, including demand response and purchase bid optimization for day-ahead markets. Income from providing electricity to consumers, and costs related to imbalances, rescheduling and energy not served are also considered. The model includes risk management by applying the conditional value-at-risk risk measure. The feasibility of the developed model is validated through a case study using historical data from the Swedish power system and market.