… is from pages 533-534 of the especially brilliant Book IV, Chapter 5  of the 1981 Liberty Fund edition  of Adam Smith’s 1776 An Inquiry Into the Nature and Causes of the Wealth of Nations :
But if a merchant ever buys up corn, either going to a particular market or in a particular market, in order to sell it again soon after in the same market, it must be because he judges that the market cannot be so liberally supplied through the whole season as upon that particular occasion, and that the price, therefore, must soon rise. If he judges wrong in this, and if the price does not rise, he not only loses the whole profit of the stock which he employs in this manner, but a part of the stock itself, by the expence and loss which necessarily attend the storing and keeping of corn. He hurts himself, therefore, much more essentially than he can hurt even the particular people whom he may hinder from supplying themselves upon that particular market day, because they may afterwards supply themselves just as cheap upon any other market day. If he judges right, instead of hurting the great body of the people, he renders them a most important service. By making them feel the inconveniencies of a dearth somewhat earlier than they otherwise might do, he prevents their feeling them afterwards so severely as they certainly would do, if the cheapness of price encouraged them to consume faster than suited the real scarcity of the season. When the scarcity is real, the best thing that can be done for the people is to divide the inconveniencies of it as equally as possible through all the different months, and weeks, and days of the year. The interest of the corn merchant makes him study to do this as exactly as he can: and as no other person can have either the same interest, or the same knowledge, or the same abilities to do it so exactly as he, this most important operation of commerce ought to be trusted entirely to him; or, in other words, the corn trade, so far at least as concerns the supply of the home market, ought to be left perfectly free.
In short, speculators perform a vital function. This reality is true not only for those who speculate in grain (“corn”) and other foodstuffs, but for any product or even service the marginal values of which vary over time (whether because of changes in supply or in demand or in both).