What is the origin of "long" and "short" in finance?

Solution 1:

The terms sell short and short position seem to have arisen in US stock and commodity markets about 1850; the earliest use I have found is from The Merchant's Magazine, and Commercial Review, Vol. XXVI, Jan-Jun 1852, and it is already coupled with selling long:

selling short defended

Note that the writer (somewhat disingenuously) equates selling short with a contract for forward delivery. That’s the transaction; what has always been understood by a ‘short’ sale, however, is that the seller does not at the time of sale possess the commodity or stock which is sold. He is in fact, ‘short’ of the good in question, as is explained in this definition from The Bryant and Stratton Business Arithmetic, 1872.

selling short defined

Selling short had already a commercial history in the only somewhat different collocation “selling short weight” or “measure”. The earliest use I have found is from The Gentleman's Magazine and Hiſtorical Chronicle, Vol. XVII, 1748:

ſelling ſhort meaſure

Solution 2:

Perhaps it goes back to the use of tally sticks to record debt in medieval Europe. In this case a stick was used to record the debt. The stick was split in two and the two parties to the transaction each a part. The shorter part was called the foil as was held by the receiver of the funds while the longer part, also called the stock, was held by the advancing the funds. Hence the term stock market which dealt in the trade of debt and possibly the term long and short to identify which side you were trading.
https://en.m.wikipedia.org/wiki/Tally_stick