calculate gains from csv input transactions, both LIFO and FIFO