At one on the previous jobs I wrote a tool which takes a list of bonds/equities trades and ties buys and sells in order to count PnL. The idea was any sell should be connected with one or several buys/repos. Like, I sell 100 bonds , so I should take them from 5 buys in correct order (FIFO).
It seems easy to do this but there are tricky operations like REPOs when you have to 'borrow' papers from a reversal REPO to perform a sell or REPO operation. Then you should close this hole with a next papers arrival. I wanted to attach some web interface to visualize these crazy buys-sells-repos chains but at some moment I left that company.
I want to rewrite that tool as a side project but not sure if it would be helpful for anybody.