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

[GT] SVN Commit r625 - trunk/GT/DB



Author: thomas
Date: 2008-06-10 06:43:34 +0200 (Tue, 10 Jun 2008)
New Revision: 625

Modified:
   trunk/GT/DB/Text.pm
Log:
get_prices: Added explanatory comment in get_prices. 
get_last_prices: Commented out warning messages that is often 
disruptive in output but serves no purpose.
had_code: Fix. Need to look into the correct directory to find files.


Modified: trunk/GT/DB/Text.pm
===================================================================
--- trunk/GT/DB/Text.pm	2008-06-10 04:36:32 UTC (rev 624)
+++ trunk/GT/DB/Text.pm	2008-06-10 04:43:34 UTC (rev 625)
@@ -174,9 +174,12 @@
     my ($self, $code, $timeframe) = @_;
     $timeframe = $DAY unless ($timeframe);
 
-    return GT::Prices->new() if ($timeframe > $DAY);
+    my $prices = GT::Prices->new;
 
-    my $prices = GT::Prices->new;
+    # WARNING: Can only load data that is in daily format or smaller
+    # Trying to load weekly or monthly data will fail.
+    return $prices if ($timeframe > $DAY);
+
     $prices->set_timeframe($timeframe);
 
     my %fields = ('open' => $self->{'open'}, 'high' => $self->{'high'},
@@ -207,8 +210,8 @@
 sub get_last_prices {
     my ($self, $code, $limit, $timeframe) = @_;
 
-    warn "$limit parameter ignored in DB::Text::get_last_prices. loading entire dataset." if ($limit > -1);
-    return get_prices($self, $code, $timeframe,-1);
+    ### warn "$limit parameter ignored in DB::Text::get_last_prices. loading entire dataset." if ($limit > -1);
+    return get_prices($self, $code, $timeframe, -1);
 }
 
 sub has_code {
@@ -216,7 +219,7 @@
     my $extension = $self->{'extension'};
     $extension =~ s/\$timeframe/\.\*/g;
     my $file_exists = 0;
-    my $file_pattern = "$code$extension";
+    my $file_pattern = $self->{'directory'} . "/$code$extension";
 
     if ($extension =~ /\*/) {
         eval "use File::Find;";