I am trying to convert some pieces of C# code to F# in order to practice. While doing so, I stumbled on a position calculation. The logic is to group by counterparty and sec