Gain and holding period
The calculation first determines the difference between the entered sale amount and cost basis. It then uses the holding-period information to classify the result as short-term or long-term. This distinction matters because the two categories can receive different federal tax treatment. A negative difference represents a loss rather than a taxable gain.