[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GT] SVN Commit r700 - in branches/CPAN: lib/Finance/GeniusTrader t t/data t/prices
Author: clkao
Date: 2009-11-06 14:33:06 +0100 (Fri, 06 Nov 2009)
New Revision: 700
Added:
branches/CPAN/lib/Finance/GeniusTrader/Test.pm
branches/CPAN/t/data/TX_5min.txt
branches/CPAN/t/data/TX_day.txt
branches/CPAN/t/prices/
branches/CPAN/t/prices/basic.t
Log:
add basic prices tests and initial sketch of test helpers.
Added: branches/CPAN/lib/Finance/GeniusTrader/Test.pm
===================================================================
--- branches/CPAN/lib/Finance/GeniusTrader/Test.pm (rev 0)
+++ branches/CPAN/lib/Finance/GeniusTrader/Test.pm 2009-11-06 13:33:06 UTC (rev 700)
@@ -0,0 +1,66 @@
+package Finance::GeniusTrader::Test;
+use strict;
+use warnings;
+use base 'Test::More';
+use FindBin;
+use File::Temp;
+use Finance::GeniusTrader::Conf ();
+use Finance::GeniusTrader::Eval ();
+our @EXPORT = qw(play_prices_until);
+
+=head1 NAME
+
+Finance::GeniusTrader::Test - Test helpers for Finance::GeniusTrader
+
+=head1 SYNOPSIS
+
+ use Finance::GeniusTrader::Test
+ tests => 1,
+ gt_config => sub {
+ my $test_base = shift;
+ my $db_path = File::Spec->catdir($test_base, 'data');
+ return "DB::module Text\nDB::text::directory $db_path\n"
+ };
+
+ my ($calc, $first, $last) = Finance::GeniusTrader::Tools::find_calculator(Finance::GeniusTrader::Test->gt_db, 'TX', $PERIOD_5MIN, 1)
+ ok($calc);
+
+=head1 DESCRIPTION
+
+This module provides helper functions for writing GT tests.
+
+=cut
+
+my ($gt_options, $gt_db);
+sub import_extra {
+ my ($class, $args) = @_;
+
+ $class->setup(@$args);
+ Test::More->export_to_level(2);
+}
+
+sub setup {
+ my ($class, %args) = @_;
+ my ($test_base) = $FindBin::Bin =~ m{(.*/t/)};
+ my $dir = File::Spec->catdir($test_base, 'data');
+ $class->prepare_gt_conf($dir, $args{gt_config}->($test_base));
+ Finance::GeniusTrader::Conf::load($class->gt_options);
+ return;
+}
+
+sub gt_options {
+ my ($class) = @_;
+ $gt_options ||= File::Temp->new;
+}
+
+sub gt_db {
+ $gt_db ||= Finance::GeniusTrader::Eval::create_db_object();
+}
+
+sub prepare_gt_conf {
+ my ($self, $db_path, $gt_config) = @_;
+ open my $fh, '>', $self->gt_options or die $!;
+ print $fh $gt_config;
+}
+
+1;
Added: branches/CPAN/t/data/TX_5min.txt
===================================================================
--- branches/CPAN/t/data/TX_5min.txt (rev 0)
+++ branches/CPAN/t/data/TX_5min.txt 2009-11-06 13:33:06 UTC (rev 700)
@@ -0,0 +1,180 @@
+7538 7614 7522 7596 3758 2009-10-01 08:50:00
+7595 7600 7519 7559 2461 2009-10-01 08:55:00
+7559 7567 7553 7564 744 2009-10-01 09:00:00
+7562 7573 7543 7549 1405 2009-10-01 09:05:00
+7548 7570 7538 7567 1483 2009-10-01 09:10:00
+7567 7570 7548 7557 943 2009-10-01 09:15:00
+7558 7586 7556 7569 1736 2009-10-01 09:20:00
+7569 7576 7525 7530 1747 2009-10-01 09:25:00
+7530 7545 7518 7525 1800 2009-10-01 09:30:00
+7526 7542 7520 7535 1046 2009-10-01 09:35:00
+7535 7543 7531 7541 464 2009-10-01 09:40:00
+7541 7543 7522 7523 662 2009-10-01 09:45:00
+7523 7541 7522 7538 760 2009-10-01 09:50:00
+7537 7541 7531 7533 346 2009-10-01 09:55:00
+7533 7540 7505 7506 1306 2009-10-01 10:00:00
+7506 7519 7495 7502 1758 2009-10-01 10:05:00
+7504 7514 7500 7509 808 2009-10-01 10:10:00
+7509 7515 7509 7511 577 2009-10-01 10:15:00
+7509 7522 7507 7518 679 2009-10-01 10:20:00
+7519 7520 7512 7515 400 2009-10-01 10:25:00
+7515 7519 7511 7517 352 2009-10-01 10:30:00
+7517 7529 7516 7523 551 2009-10-01 10:35:00
+7523 7525 7509 7511 630 2009-10-01 10:40:00
+7512 7512 7484 7487 1252 2009-10-01 10:45:00
+7487 7495 7478 7489 1371 2009-10-01 10:50:00
+7488 7502 7482 7499 1003 2009-10-01 10:55:00
+7498 7500 7494 7496 429 2009-10-01 11:00:00
+7498 7500 7496 7498 315 2009-10-01 11:05:00
+7499 7499 7464 7471 1342 2009-10-01 11:10:00
+7471 7480 7455 7466 1365 2009-10-01 11:15:00
+7466 7482 7461 7480 1063 2009-10-01 11:20:00
+7479 7495 7476 7492 914 2009-10-01 11:25:00
+7491 7492 7486 7488 425 2009-10-01 11:30:00
+7488 7502 7486 7500 1018 2009-10-01 11:35:00
+7500 7502 7495 7501 590 2009-10-01 11:40:00
+7501 7518 7498 7513 1217 2009-10-01 11:45:00
+7511 7516 7508 7511 565 2009-10-01 11:50:00
+7511 7512 7504 7510 390 2009-10-01 11:55:00
+7510 7517 7509 7512 583 2009-10-01 12:00:00
+7512 7522 7511 7518 599 2009-10-01 12:05:00
+7519 7520 7508 7510 471 2009-10-01 12:10:00
+7510 7516 7509 7516 314 2009-10-01 12:15:00
+7515 7516 7510 7513 280 2009-10-01 12:20:00
+7511 7535 7511 7534 1270 2009-10-01 12:25:00
+7534 7535 7528 7532 787 2009-10-01 12:30:00
+7532 7542 7517 7520 1084 2009-10-01 12:35:00
+7520 7523 7516 7521 504 2009-10-01 12:40:00
+7521 7522 7514 7520 356 2009-10-01 12:45:00
+7521 7528 7518 7526 440 2009-10-01 12:50:00
+7526 7531 7521 7528 516 2009-10-01 12:55:00
+7528 7531 7524 7529 343 2009-10-01 13:00:00
+7529 7530 7522 7527 353 2009-10-01 13:05:00
+7527 7528 7521 7524 302 2009-10-01 13:10:00
+7525 7525 7518 7521 361 2009-10-01 13:15:00
+7521 7524 7516 7519 329 2009-10-01 13:20:00
+7519 7521 7517 7519 376 2009-10-01 13:25:00
+7518 7527 7518 7527 525 2009-10-01 13:30:00
+7527 7537 7524 7535 1133 2009-10-01 13:35:00
+7534 7538 7534 7537 567 2009-10-01 13:40:00
+7537 7540 7534 7538 939 2009-10-01 13:45:00
+7418 7423 7380 7419 2868 2009-10-02 08:50:00
+7419 7420 7408 7412 794 2009-10-02 08:55:00
+7415 7421 7412 7421 620 2009-10-02 09:00:00
+7420 7425 7402 7419 1757 2009-10-02 09:05:00
+7419 7433 7418 7423 1321 2009-10-02 09:10:00
+7422 7435 7422 7434 980 2009-10-02 09:15:00
+7433 7437 7420 7424 877 2009-10-02 09:20:00
+7424 7430 7423 7428 507 2009-10-02 09:25:00
+7427 7429 7413 7414 639 2009-10-02 09:30:00
+7414 7420 7408 7419 748 2009-10-02 09:35:00
+7419 7429 7418 7429 652 2009-10-02 09:40:00
+7429 7431 7423 7423 765 2009-10-02 09:45:00
+7426 7433 7422 7424 642 2009-10-02 09:50:00
+7424 7448 7422 7444 1382 2009-10-02 09:55:00
+7444 7447 7438 7445 1027 2009-10-02 10:00:00
+7444 7450 7440 7441 952 2009-10-02 10:05:00
+7440 7448 7438 7438 540 2009-10-02 10:10:00
+7438 7442 7432 7433 720 2009-10-02 10:15:00
+7433 7437 7432 7433 260 2009-10-02 10:20:00
+7434 7442 7432 7440 380 2009-10-02 10:25:00
+7440 7444 7437 7441 354 2009-10-02 10:30:00
+7441 7441 7432 7435 330 2009-10-02 10:35:00
+7435 7435 7424 7426 521 2009-10-02 10:40:00
+7427 7431 7422 7427 566 2009-10-02 10:45:00
+7428 7428 7420 7424 506 2009-10-02 10:50:00
+7424 7425 7414 7421 598 2009-10-02 10:55:00
+7420 7429 7417 7428 423 2009-10-02 11:00:00
+7428 7434 7427 7431 535 2009-10-02 11:05:00
+7430 7436 7428 7431 377 2009-10-02 11:10:00
+7431 7431 7426 7427 224 2009-10-02 11:15:00
+7427 7428 7423 7425 267 2009-10-02 11:20:00
+7425 7430 7424 7428 221 2009-10-02 11:25:00
+7427 7435 7427 7432 339 2009-10-02 11:30:00
+7432 7433 7414 7421 646 2009-10-02 11:35:00
+7421 7425 7408 7414 979 2009-10-02 11:40:00
+7414 7420 7411 7413 483 2009-10-02 11:45:00
+7412 7417 7387 7391 1722 2009-10-02 11:50:00
+7391 7403 7387 7402 1149 2009-10-02 11:55:00
+7402 7408 7398 7403 550 2009-10-02 12:00:00
+7403 7406 7401 7405 371 2009-10-02 12:05:00
+7405 7412 7404 7408 637 2009-10-02 12:10:00
+7408 7413 7407 7410 357 2009-10-02 12:15:00
+7409 7410 7405 7408 275 2009-10-02 12:20:00
+7408 7410 7397 7400 586 2009-10-02 12:25:00
+7400 7408 7397 7408 417 2009-10-02 12:30:00
+7407 7408 7395 7398 424 2009-10-02 12:35:00
+7399 7400 7390 7395 716 2009-10-02 12:40:00
+7394 7404 7393 7399 540 2009-10-02 12:45:00
+7398 7400 7391 7396 335 2009-10-02 12:50:00
+7396 7408 7396 7406 362 2009-10-02 12:55:00
+7404 7406 7394 7396 327 2009-10-02 13:00:00
+7395 7397 7385 7393 966 2009-10-02 13:05:00
+7393 7395 7360 7362 2284 2009-10-02 13:10:00
+7363 7372 7357 7367 1301 2009-10-02 13:15:00
+7368 7371 7344 7348 1534 2009-10-02 13:20:00
+7346 7367 7346 7366 1203 2009-10-02 13:25:00
+7366 7373 7364 7371 957 2009-10-02 13:30:00
+7369 7377 7367 7367 1067 2009-10-02 13:35:00
+7368 7370 7366 7369 595 2009-10-02 13:40:00
+7368 7370 7351 7352 1084 2009-10-02 13:45:00
+7358 7368 7346 7355 1108 2009-10-05 08:50:00
+7356 7363 7354 7359 485 2009-10-05 08:55:00
+7359 7366 7358 7365 529 2009-10-05 09:00:00
+7366 7376 7353 7356 1182 2009-10-05 09:05:00
+7356 7375 7353 7374 977 2009-10-05 09:10:00
+7375 7386 7372 7385 1108 2009-10-05 09:15:00
+7384 7388 7375 7376 1005 2009-10-05 09:20:00
+7377 7381 7372 7379 548 2009-10-05 09:25:00
+7378 7386 7371 7374 862 2009-10-05 09:30:00
+7374 7376 7353 7354 882 2009-10-05 09:35:00
+7355 7356 7331 7343 2073 2009-10-05 09:40:00
+7343 7348 7338 7338 861 2009-10-05 09:45:00
+7338 7345 7326 7330 1493 2009-10-05 09:50:00
+7331 7345 7329 7343 883 2009-10-05 09:55:00
+7343 7348 7341 7347 617 2009-10-05 10:00:00
+7345 7357 7343 7353 968 2009-10-05 10:05:00
+7353 7363 7352 7355 779 2009-10-05 10:10:00
+7358 7358 7351 7354 485 2009-10-05 10:15:00
+7353 7360 7353 7359 485 2009-10-05 10:20:00
+7359 7363 7354 7361 417 2009-10-05 10:25:00
+7360 7371 7360 7369 811 2009-10-05 10:30:00
+7369 7370 7355 7356 690 2009-10-05 10:35:00
+7355 7356 7350 7354 461 2009-10-05 10:40:00
+7354 7362 7352 7362 412 2009-10-05 10:45:00
+7362 7374 7361 7368 813 2009-10-05 10:50:00
+7368 7369 7363 7368 356 2009-10-05 10:55:00
+7368 7370 7364 7366 419 2009-10-05 11:00:00
+7366 7367 7358 7365 349 2009-10-05 11:05:00
+7365 7373 7362 7369 336 2009-10-05 11:10:00
+7369 7372 7352 7355 667 2009-10-05 11:15:00
+7353 7358 7350 7355 510 2009-10-05 11:20:00
+7355 7361 7355 7360 249 2009-10-05 11:25:00
+7358 7360 7353 7357 269 2009-10-05 11:30:00
+7355 7366 7355 7361 365 2009-10-05 11:35:00
+7361 7368 7359 7364 260 2009-10-05 11:40:00
+7364 7368 7362 7364 315 2009-10-05 11:45:00
+7365 7365 7354 7355 290 2009-10-05 11:50:00
+7355 7365 7353 7361 394 2009-10-05 11:55:00
+7361 7368 7358 7366 272 2009-10-05 12:00:00
+7364 7366 7359 7366 224 2009-10-05 12:05:00
+7366 7366 7348 7352 739 2009-10-05 12:10:00
+7352 7355 7345 7347 730 2009-10-05 12:15:00
+7347 7356 7345 7352 441 2009-10-05 12:20:00
+7351 7353 7348 7352 377 2009-10-05 12:25:00
+7352 7360 7346 7359 519 2009-10-05 12:30:00
+7358 7359 7353 7357 206 2009-10-05 12:35:00
+7356 7357 7353 7355 160 2009-10-05 12:40:00
+7357 7357 7348 7353 267 2009-10-05 12:45:00
+7353 7356 7352 7355 169 2009-10-05 12:50:00
+7355 7355 7349 7354 201 2009-10-05 12:55:00
+7353 7354 7344 7346 405 2009-10-05 13:00:00
+7346 7356 7346 7353 475 2009-10-05 13:05:00
+7352 7373 7348 7367 1031 2009-10-05 13:10:00
+7368 7383 7366 7381 1395 2009-10-05 13:15:00
+7380 7383 7371 7373 658 2009-10-05 13:20:00
+7372 7379 7371 7372 447 2009-10-05 13:25:00
+7372 7378 7372 7376 392 2009-10-05 13:30:00
+7377 7397 7375 7396 1650 2009-10-05 13:35:00
+7396 7398 7391 7392 696 2009-10-05 13:40:00
+7392 7394 7390 7392 888 2009-10-05 13:45:00
Added: branches/CPAN/t/data/TX_day.txt
===================================================================
--- branches/CPAN/t/data/TX_day.txt (rev 0)
+++ branches/CPAN/t/data/TX_day.txt 2009-11-06 13:33:06 UTC (rev 700)
@@ -0,0 +1,191 @@
+4722 4797 4634 4670 97901 2009-01-05
+4699 4735 4638 4706 90329 2009-01-06
+4758 4802 4711 4752 90885 2009-01-07
+4650 4650 4434 4452 95701 2009-01-08
+4447 4495 4405 4421 90308 2009-01-09
+4362 4425 4344 4374 56215 2009-01-10
+4386 4472 4350 4429 93281 2009-01-12
+4361 4524 4360 4518 93835 2009-01-13
+4490 4552 4478 4510 82268 2009-01-14
+4222 4300 4222 4239 75818 2009-01-15
+4277 4329 4250 4323 78421 2009-01-16
+4330 4358 4306 4349 38490 2009-01-17
+4378 4394 4325 4357 58908 2009-01-19
+4266 4269 4205 4240 52093 2009-01-20
+4114 4265 4113 4254 36615 2009-01-21
+4199 4199 4106 4161 50727 2009-02-02
+4168 4328 4161 4275 77684 2009-02-03
+4327 4375 4285 4351 68432 2009-02-04
+4315 4389 4269 4270 82511 2009-02-05
+4362 4479 4356 4443 94693 2009-02-06
+4500 4522 4425 4456 71256 2009-02-09
+4456 4499 4435 4497 60664 2009-02-10
+4385 4578 4372 4558 91929 2009-02-11
+4520 4564 4398 4445 112991 2009-02-12
+4459 4590 4451 4571 109267 2009-02-13
+4569 4588 4534 4575 69481 2009-02-16
+4521 4559 4437 4494 91320 2009-02-17
+4455 4519 4426 4517 45601 2009-02-18
+4411 4524 4334 4468 118698 2009-02-19
+4405 4453 4345 4363 105149 2009-02-20
+4332 4433 4296 4426 102528 2009-02-23
+4327 4395 4313 4381 83737 2009-02-24
+4435 4520 4408 4466 105000 2009-02-25
+4520 4538 4440 4477 89516 2009-02-26
+4472 4528 4452 4510 73633 2009-02-27
+4422 4459 4303 4331 101313 2009-03-02
+4270 4377 4238 4367 104158 2009-03-03
+4336 4516 4322 4511 109861 2009-03-04
+4541 4646 4539 4595 120308 2009-03-05
+4550 4638 4540 4628 109500 2009-03-06
+4672 4675 4543 4624 93692 2009-03-09
+4601 4669 4567 4656 91653 2009-03-10
+4775 4785 4715 4758 77516 2009-03-11
+4752 4779 4724 4748 66848 2009-03-12
+4820 4942 4813 4900 98336 2009-03-13
+4938 4985 4907 4962 79029 2009-03-16
+4966 5070 4946 5057 94430 2009-03-17
+5082 5096 5024 5067 59723 2009-03-18
+5045 5105 4975 4980 105836 2009-03-19
+5006 5040 4922 4950 106431 2009-03-20
+5032 5132 4991 5131 95403 2009-03-23
+5201 5270 5188 5262 99502 2009-03-24
+5254 5389 5232 5360 114172 2009-03-25
+5349 5434 5317 5385 130922 2009-03-26
+5434 5454 5336 5353 110172 2009-03-27
+5346 5360 5143 5175 111500 2009-03-30
+5225 5295 5175 5201 105649 2009-03-31
+5228 5344 5222 5314 135958 2009-04-01
+5400 5517 5400 5511 115854 2009-04-02
+5562 5567 5475 5509 103180 2009-04-03
+5228 5344 5222 5314 135958 2009-04-01
+5400 5517 5400 5511 115854 2009-04-02
+5562 5567 5475 5509 103180 2009-04-03
+5560 5619 5493 5525 105000 2009-04-06
+5503 5587 5464 5583 97735 2009-04-07
+5501 5583 5416 5456 134387 2009-04-08
+5538 5718 5525 5712 113141 2009-04-09
+5762 5830 5696 5827 127509 2009-04-10
+5835 5876 5786 5846 108378 2009-04-13
+5825 5901 5785 5858 106808 2009-04-14
+5858 5895 5782 5861 57688 2009-04-15
+5999 6047 5950 5994 112966 2009-04-16
+6046 6060 5684 5775 150477 2009-04-17
+5772 5815 5668 5765 128665 2009-04-20
+5667 5899 5654 5896 132016 2009-04-21
+5865 5928 5833 5847 115857 2009-04-22
+5870 5906 5755 5901 138442 2009-04-23
+5915 5998 5791 5904 146131 2009-04-24
+5930 5950 5676 5710 147704 2009-04-27
+5766 5784 5576 5580 159423 2009-04-28
+5648 5664 5584 5623 109869 2009-04-29
+6015 6015 5995 6015 29390 2009-04-30
+6363 6436 6301 6436 22625 2009-05-04
+6637 6720 6426 6542 88812 2009-05-05
+6510 6585 6412 6536 69129 2009-05-06
+6606 6630 6446 6613 63095 2009-05-07
+6570 6598 6506 6572 53559 2009-05-08
+6549 6697 6522 6597 57457 2009-05-11
+6562 6586 6385 6447 70303 2009-05-12
+6454 6499 6420 6469 46343 2009-05-13
+6355 6419 6315 6321 50271 2009-05-14
+6372 6509 6356 6476 55158 2009-05-15
+6424 6573 6402 6561 59080 2009-05-18
+6715 6804 6623 6693 57033 2009-05-19
+6710 6745 6585 6697 44349 2009-05-20
+6629 6695 6605 6671 50918 2009-05-21
+6605 6732 6595 6692 52362 2009-05-22
+6751 6837 6647 6724 62862 2009-05-25
+6700 6761 6633 6646 51842 2009-05-26
+6720 6997 6699 6932 67252 2009-05-27
+6980 7010 6900 6954 44319 2009-06-01
+7037 7050 6864 6916 50692 2009-06-02
+6928 6933 6842 6898 45281 2009-06-03
+6860 6897 6696 6784 62484 2009-06-04
+6811 6827 6735 6790 42618 2009-06-05
+6777 6853 6775 6833 24331 2009-06-06
+6865 6884 6612 6643 55151 2009-06-08
+6668 6668 6390 6413 68367 2009-06-09
+6458 6504 6385 6459 52021 2009-06-10
+6490 6545 6335 6516 71080 2009-06-11
+6530 6558 6411 6437 59688 2009-06-12
+6390 6390 6174 6208 66134 2009-06-15
+6173 6251 6133 6208 57409 2009-06-16
+6218 6294 6195 6204 36186 2009-06-17
+6130 6205 5994 6090 69820 2009-06-18
+6090 6150 6045 6138 53631 2009-06-19
+6137 6264 6075 6206 55117 2009-06-22
+6088 6150 6059 6072 45975 2009-06-23
+6089 6494 6073 6311 81506 2009-06-24
+6306 6427 6295 6389 59640 2009-06-25
+6405 6432 6361 6391 43370 2009-06-26
+6415 6436 6305 6345 52417 2009-06-29
+6421 6450 6301 6383 54441 2009-06-30
+6414 6546 6361 6517 60505 2009-07-01
+6525 6626 6517 6590 53579 2009-07-02
+6547 6633 6520 6602 51175 2009-07-03
+6619 6631 6527 6588 50896 2009-07-06
+6588 6710 6578 6665 53945 2009-07-07
+6621 6637 6558 6627 49200 2009-07-08
+6627 6778 6625 6724 55739 2009-07-09
+6735 6755 6676 6755 41518 2009-07-10
+6739 6765 6443 6469 63531 2009-07-13
+6540 6609 6507 6580 42098 2009-07-14
+6630 6782 6625 6763 38079 2009-07-15
+6748 6785 6661 6709 49770 2009-07-16
+6736 6802 6700 6756 44506 2009-07-17
+6839 6884 6758 6859 49020 2009-07-20
+6900 6912 6795 6874 50201 2009-07-21
+6870 6959 6847 6885 51782 2009-07-22
+6873 6955 6818 6881 52525 2009-07-23
+6950 6963 6875 6897 40805 2009-07-24
+6950 7010 6896 6967 44098 2009-07-27
+6962 7088 6951 7080 46486 2009-07-28
+7099 7132 7021 7037 46488 2009-07-29
+7025 7043 6870 6963 56923 2009-07-30
+7009 7083 6955 7028 51697 2009-07-31
+7024 7028 6907 6982 50784 2009-08-03
+7056 7070 6821 6881 64869 2009-08-04
+6882 6948 6749 6772 62294 2009-08-05
+6799 6833 6702 6803 65360 2009-08-06
+6820 6854 6733 6814 49508 2009-08-10
+6818 6895 6755 6895 49451 2009-08-11
+6849 6898 6815 6839 44392 2009-08-12
+6865 7031 6862 7013 56310 2009-08-13
+7049 7112 7020 7063 43262 2009-08-14
+7010 7034 6899 6914 50005 2009-08-17
+6900 6908 6723 6817 60792 2009-08-18
+6824 6844 6786 6795 26378 2009-08-19
+6722 6733 6590 6693 59789 2009-08-20
+6700 6770 6553 6592 65748 2009-08-21
+6754 6835 6711 6808 53809 2009-08-24
+6798 6827 6742 6760 49378 2009-08-25
+6785 6802 6616 6703 69760 2009-08-26
+6673 6727 6610 6645 57862 2009-08-27
+6677 6810 6656 6754 59739 2009-08-28
+6765 6808 6701 6756 51772 2009-08-31
+6757 7034 6736 7027 69884 2009-09-01
+6951 7049 6937 7026 57760 2009-09-02
+7020 7123 6979 7094 59981 2009-09-03
+7121 7169 7071 7155 53819 2009-09-04
+7186 7227 7145 7221 44856 2009-09-07
+7250 7367 7181 7316 65856 2009-09-08
+7316 7344 7248 7257 45571 2009-09-09
+7334 7758 7285 7360 91628 2009-09-10
+7329 7370 7291 7353 38067 2009-09-11
+7307 7344 7204 7252 51978 2009-09-14
+7289 7385 7253 7357 43744 2009-09-15
+7428 7460 7375 7444 32370 2009-09-16
+7500 7517 7436 7466 51018 2009-09-17
+7441 7502 7408 7467 40269 2009-09-18
+7481 7556 7398 7466 51237 2009-09-21
+7484 7506 7425 7454 35882 2009-09-22
+7460 7520 7311 7347 64331 2009-09-23
+7364 7375 7235 7295 52521 2009-09-24
+7250 7340 7235 7338 44558 2009-09-25
+7276 7327 7215 7280 43336 2009-09-28
+7330 7431 7328 7405 47839 2009-09-29
+7427 7515 7411 7493 46605 2009-09-30
+7538 7614 7455 7538 52071 2009-10-01
+7418 7450 7344 7352 45504 2009-10-02
+7358 7398 7326 7392 38020 2009-10-05
Added: branches/CPAN/t/prices/basic.t
===================================================================
--- branches/CPAN/t/prices/basic.t (rev 0)
+++ branches/CPAN/t/prices/basic.t 2009-11-06 13:33:06 UTC (rev 700)
@@ -0,0 +1,52 @@
+#!/usr/bin/perl -w
+use strict;
+use Finance::GeniusTrader::DateTime;
+use Finance::GeniusTrader::Calculator;
+use Finance::GeniusTrader::Prices;
+use Finance::GeniusTrader::Test
+ tests => 23,
+ gt_config => sub {
+ my $test_base = shift;
+ my $db_path = File::Spec->catdir($test_base, 'data');
+<<"EOF";
+DB::module Text
+DB::text::file_extension _\$timeframe.txt
+DB::text::directory $db_path
+EOF
+ };
+
+# 5min
+{
+ my ($calc, $first, $last) = Finance::GeniusTrader::Tools::find_calculator(Finance::GeniusTrader::Test->gt_db, 'TX', $PERIOD_5MIN, 1);
+
+ ok($calc);
+ is($first, 0);
+ is($last, 179);
+ is($calc->prices->count, 180);
+ is($calc->prices->at(179)->[$DATE], '2009-10-05 13:45:00');
+ ok( !$calc->prices->has_date('2009-10-05 08:45:00') );
+ ok( $calc->prices->has_date('2009-10-05 08:50:00') );
+ is( $calc->prices->date('2009-10-05 08:45:00'), undef );
+ is( $calc->prices->date('2009-10-05 08:50:00'), 120 );
+ my $p = $calc->prices->at_date('2009-10-05 08:50:00');
+ is( $p->[$DATE], '2009-10-05 08:50:00' );
+ is( $p->[$OPEN], 7358);
+ is( $p->[$HIGH], 7368);
+ is( $p->[$LOW], 7346);
+ is( $p->[$CLOSE], 7355);
+}
+
+# day
+{
+ my ($calc, $first, $last) = Finance::GeniusTrader::Tools::find_calculator(Finance::GeniusTrader::Test->gt_db, 'TX', $DAY, 1);
+ ok($calc);
+ is($first, 0);
+ is($last, 190);
+ is($calc->prices->count, 191);
+ is($calc->prices->at(190)->[$DATE], '2009-10-05 00:00:00');
+ ok( !$calc->prices->has_date('2009-10-03') );
+ ok( $calc->prices->has_date('2009-10-05 00:00:00') );
+ is( $calc->prices->date('2009-10-03'), undef );
+ is( $calc->prices->date('2009-10-05 00:00:00'), 190 );
+
+}