[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GT] SVN Commit r608 - trunk/Scripts
Author: thomas
Date: 2008-04-20 05:38:37 +0200 (Sun, 20 Apr 2008)
New Revision: 608
Modified:
trunk/Scripts/analyze_backtest.pl
trunk/Scripts/backtest.pl
trunk/Scripts/backtest_many.pl
trunk/Scripts/backtest_multi.pl
trunk/Scripts/display_indicator.pl
trunk/Scripts/display_signal.pl
trunk/Scripts/manage_portfolio.pl
trunk/Scripts/scan.pl
trunk/Scripts/select_combination.pl
Log:
For all scripts, support --help and --options parameters.
Modified: trunk/Scripts/analyze_backtest.pl
===================================================================
--- trunk/Scripts/analyze_backtest.pl 2008-04-20 03:16:40 UTC (rev 607)
+++ trunk/Scripts/analyze_backtest.pl 2008-04-20 03:38:37 UTC (rev 608)
@@ -13,6 +13,7 @@
use GT::BackTest::Spool;
use GT::Eval;
use Getopt::Long;
+use Pod::Usage;
GT::Conf::load();
@@ -41,6 +42,13 @@
Each template can be predefined by including it into the options file
For example, Template::analyze_backtest analyze_backtest.mpl
+=item --options=<key>=<value>
+
+A configuration option (typically given in the options file) in the
+form of a key=value pair. For example,
+ --option=DB::Text::format=0
+sets the format used to parse markets via the DB::Text module to 0.
+
=back
=head1 DESCRIPTION
@@ -53,9 +61,17 @@
my ($set, $template) = ('', '');
-GetOptions("set=s" => \$set,
- 'template=s' => \$template);
+my $man = 0;
+my @options;
+GetOptions("set=s" => \$set, 'template=s' => \$template,
+ "option=s" => \
AT
options, "help!" => \$man);
+foreach (@options) {
+ my ($key, $value) = split (/=/, $_);
+ GT::Conf::set($key, $value);
+}
+
+pod2usage( -verbose => 2) if ($man);
my $outputdir = shift;
$outputdir = GT::Conf::get("BackTest::Directory") if (! $outputdir);
$outputdir = "." if (! $outputdir);
Modified: trunk/Scripts/backtest.pl
===================================================================
--- trunk/Scripts/backtest.pl 2008-04-20 03:16:40 UTC (rev 607)
+++ trunk/Scripts/backtest.pl 2008-04-20 03:38:37 UTC (rev 608)
@@ -24,6 +24,7 @@
use GT::Graphics::Object;
use GT::Graphics::Graphic;
use GT::Graphics::Tools qw(:axis :color);
+use Pod::Usage;
GT::Conf::load();
@@ -172,6 +173,13 @@
=item --verbose
+=item --options=<key>=<value>
+
+A configuration option (typically given in the options file) in the
+form of a key=value pair. For example,
+ --option=DB::Text::format=0
+sets the format used to parse markets via the DB::Text module to 0.
+
=back
=head2 Examples
@@ -201,6 +209,8 @@
# Manage options
my ($full, $nb_item, $start, $end, $timeframe, $max_loaded_items) =
(0, 0, '', '', 'day', -1);
+my $man = 0;
+my @options;
my ($verbose, $html, $display_trades, $template, $graph_file, $ofname, $broker, $system, $store_file, $outputdir, $set) =
(0, 0, 0, '', '', '', '', '', '', '', '');
my (@mmname, @tfname, @csname);
@@ -215,8 +225,16 @@
'money-management=s' => \
AT
mmname, 'graph=s' => \$graph_file,
'trade-filter=s' => \
AT
tfname, 'order-factory=s' => \$ofname,
'close-strategy=s' => \
AT
csname, 'broker=s' => \$broker,
- 'system=s' => \$system, "store=s" => \$store_file);
+ 'system=s' => \$system, "store=s" => \$store_file,
+ "option=s" => \
AT
options, "help!" => \$man);
+foreach (@options) {
+ my ($key, $value) = split (/=/, $_);
+ GT::Conf::set($key, $value);
+}
+
+pod2usage( -verbose => 2) if ($man);
+
if (! scalar(@mmname))
{
@mmname = ("Basic");
Modified: trunk/Scripts/backtest_many.pl
===================================================================
--- trunk/Scripts/backtest_many.pl 2008-04-20 03:16:40 UTC (rev 607)
+++ trunk/Scripts/backtest_many.pl 2008-04-20 03:38:37 UTC (rev 608)
@@ -21,6 +21,7 @@
use GT::DateTime;
use GT::Tools qw(:conf :timeframe);
use Getopt::Long;
+use Pod::Usage;
GT::Conf::load();
@@ -115,6 +116,13 @@
Stores the backtest results in the "backtests" directory (refer to your options file for the location of this directory) using the set name SETNAME. Use the --set option of analyze_backtest.pl to differentiate between the different backtest results in your directory.
+=item --options=<key>=<value>
+
+A configuration option (typically given in the options file) in the
+form of a key=value pair. For example,
+ --option=DB::Text::format=0
+sets the format used to parse markets via the DB::Text module to 0.
+
=back
=head2 Examples
@@ -135,6 +143,8 @@
# Manage options
my ($full, $nb_item, $start, $end, $timeframe, $max_loaded_items) =
(0, 0, '', '', 'day', -1);
+my $man = 0;
+my @options;
my ($verbose, $broker, $outputdir, $set, $nbprocess) =
(0, '', '', '', 1);
$outputdir = GT::Conf::get("BackTest::Directory") || '';
@@ -144,9 +154,17 @@
"timeframe=s" => \$timeframe,
'verbose' => \$verbose, 'output-directory=s' => \$outputdir,
'broker=s' => \$broker, 'set=s' => \$set,
- 'nbprocess=s' => \$nbprocess);
+ 'nbprocess=s' => \$nbprocess,
+ "option=s" => \
AT
options, "help!" => \$man);
$timeframe = GT::DateTime::name_to_timeframe($timeframe);
+foreach (@options) {
+ my ($key, $value) = split (/=/, $_);
+ GT::Conf::set($key, $value);
+}
+
+pod2usage( -verbose => 2) if ($man);
+
# Checks
if (! -d $outputdir)
{
Modified: trunk/Scripts/backtest_multi.pl
===================================================================
--- trunk/Scripts/backtest_multi.pl 2008-04-20 03:16:40 UTC (rev 607)
+++ trunk/Scripts/backtest_multi.pl 2008-04-20 03:38:37 UTC (rev 608)
@@ -27,6 +27,7 @@
use GT::DateTime;
use GT::Tools qw(:conf :timeframe);
use GT::BackTest::SpoolNew;
+use Pod::Usage;
GT::Conf::load();
@@ -34,6 +35,8 @@
# Gestion des options
my ($full, $nb_item, $start, $end, $timeframe, $max_loaded_items) =
(0, 0, '', '', 'day', -1);
+my $man = 0;
+my @options;
my ($outputdir, $set) =
('', '');
$outputdir = GT::Conf::get("BackTest::Directory") || '';
@@ -41,10 +44,18 @@
"start=s" => \$start, "end=s" => \$end,
"max-loaded-items" => \$max_loaded_items,
"timeframe=s" => \$timeframe,
- 'output-directory=s' => \$outputdir, 'set=s' => \$set );
+ 'output-directory=s' => \$outputdir, 'set=s' => \$set,
+ "option=s" => \
AT
options, "help!" => \$man);
$timeframe = GT::DateTime::name_to_timeframe($timeframe);
my $init = 10000;
+foreach (@options) {
+ my ($key, $value) = split (/=/, $_);
+ GT::Conf::set($key, $value);
+}
+
+pod2usage( -verbose => 2) if ($man);
+
# Checks
if (! -d $outputdir)
{
Modified: trunk/Scripts/display_indicator.pl
===================================================================
--- trunk/Scripts/display_indicator.pl 2008-04-20 03:16:40 UTC (rev 607)
+++ trunk/Scripts/display_indicator.pl 2008-04-20 03:38:37 UTC (rev 608)
@@ -93,6 +93,13 @@
loaded to satisfy dependencies, for example, correct results cannot be obtained.
This option is effective only for certain data base modules and ignored otherwise.
+=item --options=<key>=<value>
+
+A configuration option (typically given in the options file) in the
+form of a key=value pair. For example,
+ --option=DB::Text::format=0
+sets the format used to parse markets via the DB::Text module to 0.
+
=back
=head2 Examples
@@ -110,14 +117,25 @@
# Get all options
my ($full, $nb_item, $start, $end, $timeframe, $max_loaded_items) =
(0, 0, '', '', 'day', -1);
+my $man = 0;
+my @options;
my $last_record = 0;
Getopt::Long::Configure("require_order");
GetOptions('full!' => \$full, 'nb-item=i' => \$nb_item,
"start=s" => \$start, "end=s" => \$end,
"max-loaded-items" => \$max_loaded_items,
"timeframe=s" => \$timeframe,
- "last-record" => \$last_record);
+ "last-record" => \$last_record,
+ "option=s" => \
AT
options, "help!" => \$man);
$timeframe = GT::DateTime::name_to_timeframe($timeframe);
+
+foreach (@options) {
+ my ($key, $value) = split (/=/, $_);
+ GT::Conf::set($key, $value);
+}
+
+pod2usage( -verbose => 2) if ($man);
+
if ($last_record) {
$full = 0;
$start = '';
Modified: trunk/Scripts/display_signal.pl
===================================================================
--- trunk/Scripts/display_signal.pl 2008-04-20 03:16:40 UTC (rev 607)
+++ trunk/Scripts/display_signal.pl 2008-04-20 03:38:37 UTC (rev 608)
@@ -99,6 +99,13 @@
show on output only those dates that signal changed
+=item --options=<key>=<value>
+
+A configuration option (typically given in the options file) in the
+form of a key=value pair. For example,
+ --option=DB::Text::format=0
+sets the format used to parse markets via the DB::Text module to 0.
+
=back
=head2 Arguments
@@ -143,13 +150,24 @@
= (0, 0);
my ($full, $nb_item, $start, $end, $timeframe, $max_loaded_items) =
(0, 0, '', '', 'day', -1);
+my $man = 0;
+my @options;
Getopt::Long::Configure('require_order');
GetOptions('full!' => \$full, 'nb-item=i' => \$nb_item,
"start=s" => \$start, "end=s" => \$end,
"max-loaded-items" => \$max_loaded_items,
"timeframe=s" => \$timeframe,
- "change!" => \$change, "last-record" => \$last_record);
+ "change!" => \$change, "last-record" => \$last_record,
+ "option=s" => \
AT
options, "help!" => \$man);
$timeframe = GT::DateTime::name_to_timeframe($timeframe);
+
+foreach (@options) {
+ my ($key, $value) = split (/=/, $_);
+ GT::Conf::set($key, $value);
+}
+
+pod2usage( -verbose => 2) if ($man);
+
if ($last_record) {
$full = 0;
$start = '';
Modified: trunk/Scripts/manage_portfolio.pl
===================================================================
--- trunk/Scripts/manage_portfolio.pl 2008-04-20 03:16:40 UTC (rev 607)
+++ trunk/Scripts/manage_portfolio.pl 2008-04-20 03:38:37 UTC (rev 608)
@@ -134,6 +134,13 @@
Those two options are used to restrict the result of a "report" command to
a certain timeframe.
+=item --options=<key>=<value>
+
+A configuration option (typically given in the options file) in the
+form of a key=value pair. For example,
+ --option=DB::Text::format=0
+sets the format used to parse markets via the DB::Text module to 0.
+
=head1 COMMANDS
=item create
@@ -243,14 +250,23 @@
= (1);
my ($verbose) # app gets noisy
= (0);
+my $man = 0;
+my @options;
GetOptions("marged!" => \$marged, "source=s" => \$source,
"since=s" => \$since, "until=s" => \$until,
"confirm!" => \$confirm, "timeframe" => \$timeframe,
'template=s' => \$template, "detailed!" => \$detailed,
"backup!" => \$backup,
"verbose+" => \$verbose,
- );
+ "option=s" => \
AT
options, "help!" => \$man);
+foreach (@options) {
+ my ($key, $value) = split (/=/, $_);
+ GT::Conf::set($key, $value);
+}
+
+pod2usage( -verbose => 2) if ($man);
+
# Check the portfolio directory
#GT::Conf::default("GT::Portfolio::Directory", $ENV{'HOME'} . "/.gt/portfolio");
GT::Conf::default("GT::Portfolio::Directory", GT::Conf::_get_home_path()
Modified: trunk/Scripts/scan.pl
===================================================================
--- trunk/Scripts/scan.pl 2008-04-20 03:16:40 UTC (rev 607)
+++ trunk/Scripts/scan.pl 2008-04-20 03:38:37 UTC (rev 608)
@@ -183,6 +183,13 @@
If html output enabled then embed this url as href (default - http://finance.yahoo.com/l?s=<code>)
+=item --options=<key>=<value>
+
+A configuration option (typically given in the options file) in the
+form of a key=value pair. For example,
+ --option=DB::Text::format=0
+sets the format used to parse markets via the DB::Text module to 0.
+
=back
=head1 EXAMPLES (culled from devel archive)
@@ -204,6 +211,8 @@
(0, 0, '', '', 'day', -1);
my ($verbose, $nbprocess, $html, $url) =
(0, 1, 0, 'http://finance.yahoo.com/l?s=%s');
+my $man = 0;
+my @options;
GetOptions('full!' => \$full, 'nb-item=i' => \$nb_item,
"start=s" => \$start, "end=s" => \$end,
"max-loaded-items" => \$max_loaded_items,
@@ -212,8 +221,15 @@
'nbprocess=s' => \$nbprocess,
"html!" => \$html,
"url=s" => \$url,
- );
+ "option=s" => \
AT
options, "help!" => \$man);
+foreach (@options) {
+ my ($key, $value) = split (/=/, $_);
+ GT::Conf::set($key, $value);
+}
+
+pod2usage( -verbose => 2) if ($man);
+
# Create all the framework
my $list = GT::List->new;
Modified: trunk/Scripts/select_combination.pl
===================================================================
--- trunk/Scripts/select_combination.pl 2008-04-20 03:16:40 UTC (rev 607)
+++ trunk/Scripts/select_combination.pl 2008-04-20 03:38:37 UTC (rev 608)
@@ -12,6 +12,7 @@
use GT::Report;
use GT::Conf;
use Getopt::Long;
+use Pod::Usage;
GT::Conf::load();
@@ -28,9 +29,19 @@
=cut
my $set = '';
my ($limit_ratio, $limit_perf) = (0, 0);
+my $man = 0;
+my @options;
GetOptions("set=s" => \$set, "limit-ratio=s" => \$limit_ratio,
- "limit-performance=s" => \$limit_perf);
+ "limit-performance=s" => \$limit_perf,
+ "option=s" => \
AT
options, "help!" => \$man);
+foreach (@options) {
+ my ($key, $value) = split (/=/, $_);
+ GT::Conf::set($key, $value);
+}
+
+pod2usage( -verbose => 2) if ($man);
+
my $outputdir = shift;
$outputdir = GT::Conf::get("BackTest::Directory") if (! $outputdir);
$outputdir = "." if (! $outputdir);