Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> KISSQ General Support
Author Message
fmanjo
New Member
New Member



Joined: Feb 09, 2004
Posts: 7

PostPosted: Tue Feb 10, 2004 10:00 am Reply with quote

As promised, here is my post about portfolio calculations. I have some suggestions.

I think the calculation of (+/-), the variable $glPercent, is not the best approach for the real percentage of gain/loss, and I would prefer to redefine the Current Value too ($curValue).

In fact you buy 50 shares today for $120 each. The total value of the shares you have is 50X$120=$6000. If you pay $200 of fees, The total cost for you is $6200. If the share value rises to $150, your portfolio value would be 50X$150=$7500. The gain/loss must be calculated by market value of your shares - total purchase cost(incl. fees) = $7500-$6200=$1300. This represents a gain of 1300/6200=20.96%

According to your variable definition, the variable $glPercent is actually calculating the gain/loss as a percentage of the current value, and I also think that there is no need for a vaiable like $curValue. The current value is being calculated by market value of shares - fees. I think it is better to have a variable calculating purchase price + fees, instead of that.

What I propose is renaming the variable $curValue to, for example, $totalCost. Define $totalCost=$origCost+fees_ Change the variable $gainLoss=$curPrice-$totalCost and $glPercent=($curPrice-$totalCost)/$totalCost.

I would like to know the opinions of someone else about this. I have changed my index.php file. If someone wants to see, just let me know.
 
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Tue Feb 10, 2004 11:24 am Reply with quote

This was debated when it was first written. I had at least 2 stock savvy people directing me on this. That's one of the reasons that there are 2 different configurable ways for calculation open/close prices. I will leave the disucssion open to see what others think. OTOH, this is the joy of OpenSource - you can customize it for your purposes!
 
View user's profile Send private message
fmanjo







PostPosted: Tue Feb 10, 2004 11:35 am Reply with quote

Ok. I prefer to do this in the way I posted here. If anyone is interested and prefer to have the script configured in the way I said, I will be more than happy to help, providing my configuration.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> KISSQ General Support

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©