I'm new to java and was wondering how you would suggest I solve this problem.
Basically I have database with a ton of portfolio date such as:
portfolio date ticker size price
1 2011-06-07 agf.b 0 20
1 2011-06-07 ibm 0 5
1 2011-06-07 gs 0 10
1 2011-06-07 msft 0 2
1 2011-06-07 c 30 4
2 2011-06-07 agf.b 0 20
2 2011-06-07 ibm 0 5
2 2011-06-07 gs 0 10
2 2011-06-07 msft 2 2
2 2011-06-07 c 29 4
3 2011-06-07 agf.b 0 20
3 2011-06-07 ibm 0 5
3 2011-06-07 gs 0 10
3 2011-06-07 msft 4 2
3 2011-06-07 c 28 4
I want to put all this into an array for each portfolio of stocks(everyday the database creates several million portfolios.
My problem is, I know the number of portfolios in the system(via sql command), and I create an array with a fixed size based on that, but I don't know the number of stocks within the portfolios(as some are zero). I am testing with 4 stocks but in a live situation it could have any number of stocks.
To give some context, my ultimate goal is to get two arrays, one of today's portfolios and one of yesterdays(studying the relationship between portfolios and not individual stocks) and analyze each one against the others in the list(and then assign certain fitness scores to each one).
I'm not sure how to approach this problem, but I suspect the first thing to do is to get both in an array. Any help would be appreciated.
Thanks!