GT::Prices - A serie of prices


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

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

Create an empty GT::Prices object.


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


Get the prices of the corresponding date.


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).


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

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

Get the number of prices availables.


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


Sort the prices by date.


Reverse the prices list.


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


Find the nearest date available


Load the prices from the text file.


Save the prices to the text file.


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.