autotrade::Market::Simulated, autotrade-sim.pl: Support for strategy simulation on...
[autotrade.git] / import-csv.pl
bloba052746a6c43338959224b404601aa51bfdcb6ef
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
5 use autotrade::MarketTools;
7 use autotrade::SQL;
8 use autotrade::RateHistory;
10 my $db = autotrade::SQL::db_connect();
11 my $rh = autotrade::RateHistory->new(dbh => $db);
12 my $lt = 0;
13 $db->do('BEGIN');
14 while (<>) {
15 chomp;
16 my ($t, $buy, $amount) = split(/,/);
17 $t - $lt > 20 or next;
18 $lt = $t;
19 $buy = str_curr($buy);
20 print "$t $buy ($amount)\n";
21 $rh->record($t, $buy, $buy);
23 $db->do('COMMIT');