Hello
I am trying to write this programme, any help will be good, I have solved upto some extent I will post the code. Now I am not sure how to use Multimap so that I can have one key associated with all values in a row.Please help.
"Customer Name","Trade Date","Symbol","Quantity","Price","Commissions"
"Rick","1/20/2005","JPP","5","85.56","2.5"
"Rick","2/20/2005","JPP","-9","100.58","2.5"
"Rick","8/1/2005","POL","7","2.3","1.3"
"Rick","8/1/2005","POL","2","2.2","1.3"
and it shoud produce the o/p
"Customer","Symbol","Quantity","Date Bought","Date Sold","Purchase Price","Selling Price","Gain/Loss","Status"
"Rick","JPP","4","","2/20/2005","","399.82","Unknown","B"
"Rick","JPP","5","1/20/2005","2/20/2005","430.3","500.4","70.1","M"
"Rick","POL","9","8/1/2005","","23.1","","Unknown","H"
Which is like selling buying of trades.
The rules of transformations are:
1. Customers can only sell stocks that they already own. (So if a person did not buy a stock in 2005 but then sold it in 2005 we assume that he bought it before 1/1/2005.)
2. Transactions done on the same date for the same stock should be combined together for the output, with commissions and sales or purchase prices added.
3. There are three resulting states:
M=stock bought in the current year and sold in the current year,
B=stock bought before the current year and sold in the current year,
H=stock bought in the current year and held thru the end of the year.
4. Sales price = quantity x price � commission
5. Purchase price = quantity x price + commission
6. Gain/Loss = Sales Price � Purchase Price