Consider a sales contract, called a swing contract, between a seller and a buyer concerning some underlying commodity, with the contract specifying that during some future time interval the buyer will purchase an amount of the commodity between some specified minimum and maximum values. The purchase price and capacity at each time point is also prespecified in the contract. Assuming a random market price process and ignoring the possibility of storage, we look for the maximal expected net gain for the buyer of such a contract, and the strategy that achieves this maximal expected net gain. We study the effects that various contract constraints and market price processes have on the optimal strategy and on the contract value. We show how we can reduce the general swing contract to a multiple exercising of American (Bermudan) style options. Also, in important special cases, we give explicit expressions for the optimal contract value function and the optimal strategy.