NAME

GT::Prices - A serie of prices


DESCRIPTION

GT::Prices stores all historic prices (open, high, low, close, volume, date).

my $p = GT::Prices->new()

Create an empty GT::Prices object.

$p->at(i)

Get the prices of the corresponding day. The indice can be obtained from the dates by using $q->date('YYYY-MM-DD').

$p->at_date('YYYY-MM-DD')

Get the prices of the corresponding date.

$p->has_date('YYYY-MM-DD')

Return true if the object has prices for the corresponding date.

NOTE: If we test for an item that is larger than the last entry in the prices array, then a new empty entry is created (and numerous error messages as well).

$p->date('YYYY-MM-DD')

Get the indice corresponding to the date 'YYYY-MM-DD'.

$p->add_prices_array([@price_array])
$p->add_prices([$open, $high, $low, $close, $volume, $date])
$p->count()

Get the number of prices availables.

$p->set_timeframe($timeframe)
$p->timeframe()

Defines the time frame used for the prices. It's one of the value exported by GT::DateTime;

$p->sort()

Sort the prices by date.

$p->reverse()

Reverse the prices list.

$p->convert_to_timeframe($timeframe)

Creates a new Prices object using the new timeframe by merging the required prices. You can only convert to a largest timeframe.

$p->find_nearest_following_date($date)
$p->find_nearest_preceding_date($date)
$p->find_nearest_date($date)

Find the nearest date available

$p->loadtxt("cotationsfile.txt")

Load the prices from the text file.

$p->savetxt("cotationsfile.txt")

Save the prices to the text file.

$p->dump;

Print the prices on the standard output.

$p->_binary_search($array_ref, $value)

Searches for the given $value in the $DATE position of the prices array. This is an internal function, meant to be used only inside this object.