My suspicion with the negative stock value is that it is determined by the price paid P for each stock S at the original time purchase (as a lump amount: P * S = X) so that X / S = the value of each stock. When you buy new stock, the P * S for the new stock is added to the original X, meaning (Po * So) + (Pn + Pn) = Xo + Xn = Xtotal and Xtotal / S = stock value... it averages the value of the new and old stock. However, when selling, the same formula can create negative numbers because if (Po * So) - (Pn * Sn) = Xo - Xn which means if Xn > Xo, then Xtotal / S will be a negative number. This would be the simplest method of storing that number.
Such that if it says I bought 10 stocks at $1 each originally and sold 5 for $3 each, we get:
(10 * 1) - (5 * 3) = 10 - 15 = -5 / 5 = -$1 in the price paid field.
Thanks for the suggestions.