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

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



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