Day Change Computation
Previously, the day change shown on the main page of your personal portfolio was computed naively. It was simply how many shares of a stock you own at the end of the day multiply by the change in price (TodayClose - YesterdayClose).
DayChangeForAStock Previously = SharesYouOwn AtEndOfDay x (TodayClose - YesterdayClose)
This is fine on most days but it is wrong if you bought shares of that stock on that day. We should use the price you bought it for instead of yesterday's close for those shares.
DayChangeForAStock Now = [SharesYouOwn AtEndOfYesterday x (TodayClose - YesterdayClose)] + [SharesYouBoughtToday x (TodayClose - PurchasedPrice)]
What about days where I sold shares? This equation is only interested in the day change of the current portfolio (i.e. stocks that you are currently ...
...