Deriving decisions from data typically involves a sequential process with two components, forecasting and optimization. Forecasting models learn by minimizing a loss function that stands as a proxy for task-specific costs (e.g., trading, scheduling) without considering the downstream optimization, which in practice creates a performance bottleneck and obscures the impact of data on decisions. This work proposes a single data-driven module that leverages the structure of the optimization component and directly learns a policy conditioned on explanatory data. For this purpose, we describe an algorithm to train ensembles of decision trees by directly minimizing taskspecific costs, and prescribe decisions via a weighted Sample Average Approximation of the original problem. We then develop a generic framework to assess the impact of explanatory data on prescriptive performance. To illustrate the efficacy of the proposed modeling approach, we consider two case studies related to trading renewable energy. First, we examine trading in a day-ahead market and propose strategies that balance optimal trading decisions and predictive accuracy. Next, we append a storage device and co-optimize the day-ahead offers and the operational policy, based on a tractable approximation using the linear decision rule approach. The empirical results demonstrate improved prescriptive performance compared to solutions derived under the standard stochastic optimization framework. Further, we provide valuable insights on how explanatory data impact optimization performance and how this impact evolves under different market designs.