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

Re: [GT] Trouble with backtest.pl and beancounter



Hi Robert,

Yes the disconnect in Tools.pm does appear to be causing this problem.

I've commented it out:

  #$db->disconnect;

and re-ran the backtest.pl. It works now!

Backtest_multi.pl is still having some issues but no long errors out on the mysql issue:

$ ./backtest_multi.pl --output-directory=/opt/GeniusTrader/backtest_multi/ --start=2007-04-16 --end=2008-04-28 ../market_file.txt ../system_file.txt
The beancounter DB module does not support intraday data.

I need to investigate why GT keeps throwing this beancounter intraday data error.

Thanks for your help!

Regards,
Nick

--
Nicholas Kuechler


On Tue, Apr 29, 2008 at 1:05 PM, Robert A. Schmied <ras AT acm.org> wrote:
Nicholas Kuechler wrote:
Hi,

I'm running in to some trouble with the backtest.pl and beancounter DB
module.  This is my first time in a very long time using backtest.pl.

Here's what I'm doing:

$ time ./backtest.pl --output-directory /opt/GeniusTrader/backtest
"Systems:ADX 30 | TradeFilters:FollowTrend | MoneyManagement:Basic" GOOG
## Analysis of SY:ADX 30|TF:FollowTrend 50|MM:Basic|MM:Basic
History of the portfolio :
--------------------------
DBD::mysql::st execute failed: MySQL server has gone away at ../GT/DB/
bean.pm line 161.
MySQL server has gone away at ../GT/DB/bean.pm line 161.
Long position
real    0m29.489s
user    0m28.410s
sys     0m0.090s


The times at the bottom are for debugging.

Initially I thought the beancounter query was taking a very long time to
execute, so I set the wait_timeout in my.cnf to 180 seconds and restarted my
mysql server.  So it would appear mysql server is not the issue, since
backtest.pl is failing in only 29 seconds.

The chunk of code this fails at:

sub get_db_name {
   my ($self, $code) = @_;

   my $sql = "SELECT name FROM stockinfo WHERE symbol = '$code'";
   my $sth = $self->{'_dbh'}->prepare($sql) || die $self->{'_dbh'}->errstr;
   $sth->execute() || die $self->{'_dbh'}->errstr;
   my $res = $sth->fetchrow_arrayref;
   return $res->[0];
}


Which seems pretty straight forward.  It just wants to grab the company name
of the ticker I'm backtesting.

Anyone run in to this problem before?  Or can suggest a fix?

Thanks!
Nick

--
Nicholas Kuechler



nick

could the new method find_calculator in GT/Tools.pm be part of the problem?

 my $db = GT::Eval::create_db_object();
 my ($prices, $calc) = get_timeframe_data($code, $timeframe, $db, $max_loaded_items);
 $db->disconnect;

ras