Profit and Loss in a Stock Portfolio -byJ.. The.Netherlands Portfolio Stock Royal Du Date of transaction (yymmdd) 950101 950210 950326 950422 950425 Number of shares traded 142,800 -25,000 27,000 3,000 -25,000 Amount involved or balance 18,971,400 -5,280,000 5,568,120 618,900 -5,240,000 in a certain period of time is trivial when taking the algebraic sum of the values ofall stocks at the beginning of that period (balance), the values of the purchases and the values of the sales during that period. However, if one is interested in which part of the result is coming from or going into reservations for exchange rate differences, or which part may be considered as realized and which part is not, life is not that easy. In that case, the purchase value of the package sold is needed. Two special cases are discussed: 1. the results ofan entire portfolio during the financial year 2. the profit or loss on a particular stock in a FIFO~system. In both cases a recursive function is needed. CAsE 2 involves the technique of splitting and grabbing purchase packages of a particular stock, in order to assign the proper gains on any sale transaction. This requires a second recursive function.
/lp/association-for-computing-machinery/profit-and-loss-in-a-stock-portfolio-B7k4tuLD6o