[jonah] portfolio value?
Guil Barros
listmail at metathusalan.com
Mon Oct 13 17:19:09 PDT 2003
ignore the previous one, ive added portfolioDelta to show change in value :)
<<<<<<<begin
ala:/usr/local/horde-cvs/horde/jonah/lib# cvs diff -u Jonah.php
Index: Jonah.php
===================================================================
RCS file: /repository/jonah/lib/Jonah.php,v
retrieving revision 1.83
diff -u -r1.83 Jonah.php
--- Jonah.php 5 Oct 2003 15:48:53 -0000 1.83
+++ Jonah.php 14 Oct 2003 00:16:41 -0000
@@ -307,6 +307,8 @@
}
$i = 0;
+ $portfolioValue = 0;
+ $portfolioDelta = 0;
foreach ($quotes as $symbol => $quote) {
$html .= '<tr class="item' . ($i % 2) . '"><td>';
$html .=
Horde::link(Util::addParameter(Horde::applicationUrl('stockchart.php'),
'ticker', $symbol),
@@ -340,10 +342,30 @@
$html .= '</td><td>';
if (!empty($counts[$symbol]) && !empty($quote['lastPrice'])) {
$html .= '$' . number_format($counts[$symbol] *
$quote['lastPrice'], 2);
+ $portfolioValue += ($counts[$symbol] * $quote['lastPrice']);
+ $portfolioDelta += ($counts[$symbol] * $quote['changePrice']);
+
}
$html .= '</td></tr>';
$i++;
}
+ /**
+ * Print Portfolio Value from $portfolioValue.
+ */
+ $html .= '<tr class="item' . ($i %2) . '"><td><td><td>';
+ $html .= 'Portfolio Value:';
+ $html .= '<td><td>';
+ if ($portfolioDelta > 0) {
+ $html .= '<span style="color:green">+';
+ } elseif ($portfolioDelta < 0) {
+ $html .= '<span style="color:red">';
+ }
+ $html .= number_format($portfolioDelta, 2) .'<td>';
+ if ($portfolioDelta != 0) {
+ $html .= '</span>';
+ }
+ $html .= '$' . number_format($portfolioValue, 2);
+ $html .= '</td></td></td></td></td></td></tr>';
$html .= '</table>';
return $html;
>>>>>>>>>>>>end
-guil
Quoting Guil Barros <listmail at metathusalan.com>:
> No problem. I have the ejse db in the works and should have it done by the
> morning... also looking at fixing the sorting problem with genie :) im
> hooked!
>
> <<<<<<<begin
> ala:/usr/local/horde-cvs/horde/jonah/lib# cvs diff -u Jonah.php
> Index: Jonah.php
> ===================================================================
> RCS file: /repository/jonah/lib/Jonah.php,v
> retrieving revision 1.83
> diff -u -r1.83 Jonah.php
> --- Jonah.php 5 Oct 2003 15:48:53 -0000 1.83
> +++ Jonah.php 13 Oct 2003 22:49:14 -0000
> @@ -307,6 +307,7 @@
> }
>
> $i = 0;
> + $portfolioValue = 0;
> foreach ($quotes as $symbol => $quote) {
> $html .= '<tr class="item' . ($i % 2) . '"><td>';
> $html .=
> Horde::link(Util::addParameter(Horde::applicationUrl('stockchart.php'),
> 'ticker', $symbol),
> @@ -340,10 +341,19 @@
> $html .= '</td><td>';
> if (!empty($counts[$symbol]) && !empty($quote['lastPrice'])) {
> $html .= '$' . number_format($counts[$symbol] *
> $quote['lastPrice'], 2);
> + $portfolioValue += ($counts[$symbol] * $quote['lastPrice']);
> }
> $html .= '</td></tr>';
> $i++;
> }
> + /**
> + * Print Portfolio Value from $portfolioValue.
> + */
> + $html .= '<tr class="item' . ($i %2) . '"><td><td><td>';
> + $html .= 'Portfolio Value:';
> + $html .= '<td><td><td>';
> + $html .= '$' . number_format($portfolioValue, 2);
> + $html .= '</td></td></td></td></td></td></tr>';
>
> $html .= '</table>';
> return $html;
> >>>>>>end
>
> -guil
>
> Quoting Chuck Hagenbuch <chuck at horde.org>:
>
> > Quoting Guil Barros <listmail at metathusalan.com>:
> >
> > > here's the diff... how/what format do i send a patch in and where to?
> >
> > diff -u (or cvs diff -u, if you're working off of a CVS checkout), and
> > sending
> > it to this list is just fine.
> >
> > Thanks!
> >
> > -chuck
> >
> > --
> > Charles Hagenbuch, <chuck at horde.org>
> > Born right the first time.
> >
> > --
> > Jonah mailing list
> > Frequently Asked Questions: http://horde.org/faq/
> > To unsubscribe, mail: jonah-unsubscribe at lists.horde.org
> >
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-keys
Size: 997 bytes
Desc: PGP Public Key
Url : http://lists.horde.org/archives/jonah/attachments/20031013/1c0746e9/attachment.bin
More information about the jonah
mailing list