PHP Web Host - Quality Web Hosting For All PHP Applications $35/month $250/year (Unlimited) - $25/month - 200,000 impressions - Your Ad Could be Here - Click For Details
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
fmanjo
New Member
New Member


Joined: Feb 09, 2004
Posts: 7

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

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: 15211
Location: Kansas

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

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 Visit poster's website AIM Address Yahoo Messenger
fmanjo
New Member
New Member


Joined: Feb 09, 2004
Posts: 7

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

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.
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic

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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2008 by Raven
Proud to be listed at Lobo Links Web Directory

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::

:: fisubice Theme Recoded To 100% W3C CSS & HTML 4.01 Transitional Compliance by Raven and 64bitguy ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum