[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GT] SVN Commit r613 - trunk/Scripts



Author: thomas
Date: 2008-04-21 01:16:26 +0200 (Mon, 21 Apr 2008)
New Revision: 613

Modified:
   trunk/Scripts/backtest_multi.pl
Log:
Optimize BackTest.pm to leverage find_calculator in a more expedient manner.

Modified: trunk/Scripts/backtest_multi.pl
===================================================================
--- trunk/Scripts/backtest_multi.pl	2008-04-20 16:26:38 UTC (rev 612)
+++ trunk/Scripts/backtest_multi.pl	2008-04-20 23:16:26 UTC (rev 613)
@@ -21,12 +21,12 @@
 use GT::Calculator;
 use GT::Report;
 use GT::BackTest;
+use GT::BackTest::Spool;
 use GT::Eval;
 use Getopt::Long;
 use GT::Conf;
 use GT::DateTime;
 use GT::Tools qw(:conf :timeframe);
-use GT::BackTest::SpoolNew;
 use Pod::Usage;
 
 GT::Conf::load();
@@ -137,18 +137,10 @@
 	create_standard_object("MoneyManagement::Basic"));
 $pf_manager->finalize;
 
-# Set up the calculators
-my @calc = ();
-$cnt = 0;
-foreach my $code ( keys %{$data->{'code'}} ) {
-  my ($calc, $first, $last) = find_calculator($code, $timeframe, $full, $start, $end, $nb_item, $max_loaded_items);
-  $calc[$cnt] = $calc;
-  $calc[$cnt]->set_code($code);
-  $cnt++;
-}
+my @codes = keys %{$data->{'code'}};
 
 # Now the hard part...
-my $analysis = backtest_multi($pf_manager, \
AT
sys_manager, \
AT
brokers, \
AT
calc, $start, $end, $full, $init);
+my $analysis = backtest_multi($pf_manager, \
AT
sys_manager, \
AT
brokers, \
AT
codes, $timeframe, $full, $start, $end, $nb_item, $max_loaded_items, $init);
 
 # Print the analysis
 GT::Report::Portfolio($analysis->{'portfolio'}, 1);
@@ -159,7 +151,7 @@
 
 
 if ($set) {
-    my $bkt_spool = GT::BackTest::SpoolNew->new($outputdir);
+    my $bkt_spool = GT::BackTest::Spool->new($outputdir);
     my $stats = [ $analysis->{'real'}{'std_performance'},
 		  $analysis->{'real'}{'performance'},
 		  $analysis->{'real'}{'max_draw_down'},