NAME
Finance::GeniusTrader::DB::genericdbi - Access to any database of quotes, as long as a dbi driver is available
DESCRIPTION
This module is used to retrieve quotes from your existing database
Configuration
You can put some configuration items in ~/.gt/options to indicate where the database is.
- DB::genericdbi::dbname : the name of the database
- DB::genericdbi::dbhost : the host of the database
- DB::genericdbi::dbport : the port where the server is running
- DB::genericdbi::dbuser : the user account on the database
- DB::genericdbi::dbpasswd : the password of the user account
- DB::genericdbi::db : the database being used (mysql|Pg|...) ("mysql" by default)
- DB::genericdbi::prices_sql : The query used to retrieve price data.
-
Make sure to retrieve the data in the following order: open, high, low, close, volume, date/time
Also, make sure to retrieve the data ordered by date/time descending Example:
SELECT period_open, period_high, period_low, period_close, volume, Concat(date, ' ', time) FROM stockprices WHERE symbol = '$code' AND timeframe='$timeframe' ORDER BY Concat(date, ' ', time) DESC LIMIT $limit
- DB::genericdbi::name_sql : The query used to retrieve a symbol's description.
-
Example:
SELECT name FROM stockinfo WHERE symbol = '$code';
Functions
Finance::GeniusTrader::DB::genericdbi->new()
$db->disconnect
-
Disconnects from the database.
$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)
-
Returns a Finance::GeniusTrader::Prices object containing the $limit last known prices for the symbol $code in the given $timeframe.
$db->get_db_name($code)
-
Returns the name of the stock designated by $code.