App-Chart

 view release on metacpan or  search on metacpan

lib/App/Chart/Download.pm  view on Meta::CPAN

# Decode a date in the form day/month/year using
# C<Date::Calc::Decode_Date_EU>, and return an ISO format date string like
# "2007-10-26".
# 
# =item App::Chart::Download::Decode_Date_YMD ($str)
# 
# Decode a date in the form year/month/day and return C<($year, $month,
# $day)>, similar to what C<Date::Calc> does.
# 
# The month given can be a number or a name in English and is always returned
# as a number.  Any separator can be used between the components and leading
# and trailing whitespace is ignored.  If the string is unrecognised the
# return is an empty list C<()>.
# 
# =item App::Chart::Download::Decode_Date_YMD_to_iso ($str)
# 
# Decode a date using C<App::Chart::Download::Decode_Date_YMD> above and return
# an ISO format string "YYYY-MM-DD".  An error is thrown if C<$str> is
# invalid.
# 
# =item App::Chart::Download::date_parse_to_iso ($str)
#
# unused?
# 
# Apply Date::Parse::strptime() to C<$str> and return an ISO format date
# string like "2007-10-26" for the result.  An error is thrown if C<$str> is
# unrecognisable.
# 
# =back
# 
# =item weekday_date_after_time ($hour,$min, $timezone, [$offset])
# 
# Return an an ISO format date string like C<"2008-08-20"> which is a weekday,
# giving today on a weekday after C<$hour>,C<$min>, or the previous weekday if
# before that time or any time on a weekend.
# 
# C<$offset> is a number of weekdays to step forward (or negative for back) on
# the return value.
# 
# For example if today's trading data is available after 5pm then a call like
# 
#     weekday_date_after_time (17,0, $my_zone)
# 
# would give yesterday until 5pm, and today after that, and give Friday all
# through the weekend.  If trading data is not available until 9am the
# following weekday then a call like
# 
#     weekday_date_after_time (9,0, $my_zone, -1)
# 
# would return the day before yesterday until 9am, and yesterday after that,
# including returning Thursday all through the weekend.

# =head1 DATABASE FUNCTIONS
# 
# =over 4
# 
# =item C<< App::Chart::Download::write_daily_group ($hashref) >>
# 
# C<$hashref> is daily share price data.  Write it to the database.  The
# fields of C<$hashref> are as follows.  They are variously crunched to
# normalize and validate before being written to the database.
#
# =over
#
# =item C<data>
#
# Arrayref containing hashref records with fields
#
#     symbol        string
#     open          price
#     high          price
#     low           price
#     close         price
#     volume        number
#     openint       number
#
# Any C<symbol> not already in the database is ignored.
# 
# =item C<dividends>
#
#     symbol        string
#
# Any C<symbol> not already in the database is ignored.
# 
# =item C<splits>
#
#     symbol        string
#
# Any C<symbol> not already in the database is ignored.
# 
# =item C<names>
#
# =item C<currencies>
#
# =back
#
#
#
# =item App::Chart::Download::write_latest_group ($hashref)
# 
# ...
# 

# =item App::Chart::Download::crunch_number ($str)
# 
# =item App::Chart::Download::crunch_price ($price, $prefer_decimals)
# 
# =item App::Chart::Download::crunch_change ($change, $prefer_decimals)
# 
# ...
# 

# =item App::Chart::Download::set_symbol_name ($symbol, $name)
# 
# Set the company or commodity name recorded in the database for C<$symbol>,
# if C<$symbol> is already in the database.
# 
# =item App::Chart::Download::set_currency ($symbol, $currency)
# 
# Set the currency recorded in the database for C<$symbol>, if C<$symbol> is
# already in the database.  C<$currency> should be a three-letter currency



( run in 0.832 second using v1.01-cache-2.11-cpan-39bf76dae61 )