We consider a firm facing random demand at the end of a single period of random length. At any time during the period, the firm can either increase or decrease inventory by buying or selling on a spot market where price fluctuates randomly over time. The firm’s goal is to maximize expected discounted profit over the period, where profit consists of the revenue from selling goods to meet demand, on the spot market, or in salvage, minus the cost of buying goods, and transaction, penalty, and holding costs. We first show that this optimization problem is equivalent to a two-dimensional singular control problem. We then use a recently developed control-theoretic approach to show that the optimal policy is completely characterized by a simple price-dependent two-threshold policy. In a series of computational experiments, we explore the value of actively managing inventory during the period rather than making a purchase decision at the start of the period, and then passively waiting for demand. In these experiments, we observe that as price volatility increases, the value of actively managing inventory increases until some limit is reached.