From: Jim on
Hello Matlab folks, I have a question and the answer may be be so glaringly obvious that I feel the need to apologize ahead of time if indeed it is. I am a Perl/Python person by training and have never used Matlab (although it does intrigue me)

I am working on a project to analyze stock purchases. That is to say...
X person makes a stock purchase on given date
X person makes another stock purchase of the same stock on given date
X person sells Z number of shares on a given date.......
.......
.......

Generally the info would look need to come out looking like this (CSV delimited)
stock,transDate,action,price,numberShares,closingPrice,gain,cumulativeVal,portfolioShares,avgPriceShare,portfolioPctChange
LNUX,1/1/10,Bought,$1.00,1000,$1.00,"-$1,000.00","$1,000.00",1000,$1.00,0.00%
LNUX,1/15/10,Bought,$1.50,1000,$1.50,"-$1,500.00","$3,000.00",2000,$1.25,16.67%
LNUX,1/31/10,Sell,$1.75,500,$2.00,"$1,000.00","$3,000.00",1500,$1.25,62.50%

Items in the above example that would need to be calculated include things like avgPriceShare and portfolioPctChange. These represent average price per share and the amount of the portfolio change since the last calculation.

We need to calculate this on about 25,000 accounts so any sort of solution would need to lend itself to batch processing (running on Linux). It seems like this sort of matrix calculation might be child's play for MatLab given what I've seen about it. It may even be possible in Excel but I don't want to use a Microsoft solution if I don't have to since we don't use Microsoft anywhere in the enterprise.

Can any MatLab power users shed any light on this?

Many thanks!
Jim
Flames go quietly to /dev/null
From: William on
"Jim " <craigscvg+nospam(a)gmail.com> wrote in message <i32ccd$hm4$1(a)fred.mathworks.com>...
> Hello Matlab folks, I have a question and the answer may be be so glaringly obvious that I feel the need to apologize ahead of time if indeed it is. I am a Perl/Python person by training and have never used Matlab (although it does intrigue me)
>
> I am working on a project to analyze stock purchases. That is to say...
> X person makes a stock purchase on given date
> X person makes another stock purchase of the same stock on given date
> X person sells Z number of shares on a given date.......
> ......
> ......
>
> Generally the info would look need to come out looking like this (CSV delimited)
> stock,transDate,action,price,numberShares,closingPrice,gain,cumulativeVal,portfolioShares,avgPriceShare,portfolioPctChange
> LNUX,1/1/10,Bought,$1.00,1000,$1.00,"-$1,000.00","$1,000.00",1000,$1.00,0.00%
> LNUX,1/15/10,Bought,$1.50,1000,$1.50,"-$1,500.00","$3,000.00",2000,$1.25,16.67%
> LNUX,1/31/10,Sell,$1.75,500,$2.00,"$1,000.00","$3,000.00",1500,$1.25,62.50%
>
> Items in the above example that would need to be calculated include things like avgPriceShare and portfolioPctChange. These represent average price per share and the amount of the portfolio change since the last calculation.
>
> We need to calculate this on about 25,000 accounts so any sort of solution would need to lend itself to batch processing (running on Linux). It seems like this sort of matrix calculation might be child's play for MatLab given what I've seen about it. It may even be possible in Excel but I don't want to use a Microsoft solution if I don't have to since we don't use Microsoft anywhere in the enterprise.
>
> Can any MatLab power users shed any light on this?
>
> Many thanks!
> Jim
> Flames go quietly to /dev/null





Im not sure what you mean exactly by overkill. It will make processing thousands of calculations in a fairly short simple code possible. Assuming this information is already recorded into some type of data file it will also make directly calling these values and making these calculations fairly simple. You could also make these calculations however frequently you wanted (perhaps online investment application if you were making that many transactions.). Hope this helps some.