/[cvs.andrew.net.au]/stock/update_market.pl
ViewVC logotype

Contents of /stock/update_market.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (vendor branch)
Thu Mar 14 13:23:57 2002 UTC (20 years, 8 months ago) by apollock
Branch: MAIN, stock
CVS Tags: start, HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/plain
Error occurred while calculating annotation data.
Imported sources

1 #!/usr/bin/perl
2
3 use Pg;
4
5 $start = 0;
6 $db = "stock";
7 $db_user = "postgres";
8 $db_password = "ybgz004";
9
10 $conn = Pg::connectdb("dbname=$db user=$db_user password=$db_password");
11
12 while(<>) {
13 if ($start) {
14 chop;
15 ($code, $date, $open, $high, $low, $close, $volume) = split(",");
16 $date =~ /(..)(..)(..)/;
17 $date = "20${1}-${2}-${3}";
18 #print "$code,$date,$open,$high,$low,$close,$volume\n";
19 #print;
20 $query = "INSERT INTO market VALUES ('$code', '$date', $open, $high, $low, $close, $volume)";
21 #print "$query\n";
22 $result = $conn->exec($query);
23 }
24 if (/^-- CUT/) {
25 # sit up and take notice
26 $start = 1;
27 }
28 }

  ViewVC Help
Powered by ViewVC 1.1.22