I am looking for a Python plugin that will calculate the implemented P & L for a series of stock transactions using the FIFO method.
For example, suppose we have the following three MSFT transactions:
+75 MSFT 25.10
+50 MSFT 25.12
-100 MSFT 25.22
The sale of 100 shares at a price of 25.22 will be completely clean against a purchase of 75 at 25.10 and partially clean against a purchase of 50 at 25.12 ie
Realized P & L = 75 * (25.22 - 25.10) + 25 * (25.22 - 25.12) = $ 11.50
Prominence:
+25 MSFT 25.12
source
share