[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GT] SVN Commit r636 - branches/exp/GT
Author: thomas
Date: 2008-06-14 07:25:10 +0200 (Sat, 14 Jun 2008)
New Revision: 636
Modified:
branches/exp/GT/Report.pm
Log:
Add a function to provide a concise report for Portfolio.
Modified: branches/exp/GT/Report.pm
===================================================================
--- branches/exp/GT/Report.pm 2008-06-12 05:58:47 UTC (rev 635)
+++ branches/exp/GT/Report.pm 2008-06-14 05:25:10 UTC (rev 636)
@@ -92,6 +92,28 @@
}
}
+=item C<< GT::Report::PortfolioShort($portfolio) >>
+
+Prints the content of a portfolio in concise textual format.
+
+=cut
+sub PortfolioShort {
+ my ($p) = @_;
+
+ my $db = create_db_object();
+
+ foreach my $position (@{$p->{'history'}}) {
+ foreach my $order ($position->list_detailed_orders) {
+ my $text = swrite('@<<<<<<<<< @<<< @>>>>>> at @<<<<<<<<<',
+ $order->submission_date,
+ $order->is_buy_order ? "Buy" : "Sell",
+ $order->quantity,
+ sprintf("%.4f", $order->price));
+ print OUT "$text\n";
+ }
+ }
+}
+
=item C<< GT::Report::PortfolioHTML($portfolio) >>
Prints the content of a portfolio in HTML format.