LINQ query \ LAMBDA expression - complex requirement
I have the below datatable created through my C# code:
Stock TotalPrice Qty TransactionType
XYZ 400 10 BUY
ABC 800 20 BUY
XYZ 800 20 SELL
ABC 400 10 SELL
I want this datatable to be processed by LINQ / LAMBDA expressions in such a way that will give me the below output in another datatable.
BASICALLY, THE NEED IS TO SHOW THE NET POSITIONS ON THE TRANSACTIONS MADE ON THE STOCK.
Stock Avg Price Qty TransactionType
XYZ 40 10 SELL
ABC 40 10 BUY
Can anybody please help me in writing a LINQ query \ LAMBDA expression for the above case.
Thanks in advance,