NAME
DB::HTTP - Retrieve prices from a CGI
DESCRIPTION
Overview
This access module enable you to download prices from a remote server using a CGI script (cf web/quotes.pl).
Configuration
Most configuration items have default values, to alter these defaults you must indicate the configuration item and its value in your $HOME/.gt/options file, especially for authentification purpose.
- DB::module HTTP
-
Informs gt you are using the HTTP.pm module. This configuration item is always required in your $HOME/.gt/options file.
- DB::HTTP::url : The URL that will be requested to download
- DB::HTTP::location : The location of the server (www.geniustrader.org)
- DB::HTTP::zone : The server zone (ie: admin)
- DB::HTTP::username : The user name (ie : guest)
- DB::HTTP::password : The password (ie : anonymous)
- DB::HTTP::marker string
-
Delimits fields in each row of the data file. The marker defaults to the tab character '\t'.
- DB::HTTP::header_lines number
-
The number of header lines in your data file that are to be skipped during processing. Lines with the either the comment symbol '#' or the less than symbol '<' as the first character do not need to be included in this value.. The header_lines default value is 0.
- DB::HTTP::format 0|1|2|3 (default is 3) The format of the date/time string. Valid values are: 0 - yyyy-mm-dd hh:nn:ss (the time string is optional) 1 - US Format (month before day, any format understood by Date::Calc) 2 - European Format (day before month, any format understood by Date::Calc) 3 - Any format understood by Date::Manip
- DB::HTTP::fields::datetime number
-
Column index where to find the period datetime field. Indexes are 0 based. For the particular case of datetime, can contain multiple indexes, useful when date and time are separate columns in the data file. The date time format is anything that can be understood by Date::Manip. A typical example would be YYYY-MM-DD HH:NN:SS. The default datetime index is 5.
- DB::HTTP::fields::open number
-
Column index where to find the period open field. Indexes are 0 based. The default open index is 0.
- DB::HTTP::fields::low number
-
Column index where to find the period low field. Indexes are 0 based. The default low index is 2.
- DB::HTTP::fields::high number
-
Column index where to find the period high field. Indexes are 0 based. The default high index is 1.
- DB::HTTP::fields::close number
-
Column index where to find the period close field. Indexes are 0 based. The default close index is 3.
- DB::HTTP::fields::volume number
-
Column index where to find the period volume field. Indexes are 0 based. The default volume index is 4.
You can set the DB::HTTP::directory configuration item to tell where the quotes are cached.
Functions
new()
-
Create a new DB object used to retry quotes from a CGI on a remote server.
$db->disconnect
-
Disconnects from the database.
$db->set_directory("/new/directory")
-
Indicate the directory containing all the cached data.
$db->get_prices($code, $timeframe)
-
Returns a Finance::GeniusTrader::Prices object containing all known prices for the symbol $code.
$db->get_last_prices($code, $limit, $timeframe)
-
NOT SUPPORTED for HTTP db.
Returns a Finance::GeniusTrader::Prices object containing the $limit last known prices for the symbol $code.