0

I am trying to automate a Profit & Loss for stock trades. I have found that the package "accfifo" works neatly as described by Izkeros in his answer to this question:

How to calculate realized P&L of stock trades using the FIFO method?

However in his answer the trades are fixed and passed manually. What if I have a matrix of trades and prices of variable length? How can I pass it to the FIFO function?

I was thinking of list comprehension along the lines of the below code, but can't get it to work.

fifo = FIFO([Entry(trades[item], prices[item])] for item in trades)

Many thanks for any hint!

palliativo
  • 13
  • 2

0 Answers0