App-Chart

 view release on metacpan or  search on metacpan

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

# a newline as a download message.  This differs from an ordinary C<print> in
# that on a TTY it first erases anything from C<status> above (or checks the
# message itself is long enough to overwrite).
# 
# =back
# 
# =head1 PARSING FUNCTIONS
# 
# =over 4
# 
# =item App::Chart::Download::split_lines ($str)
# 
# Return a list of the lines in C<$str> separated by CR or LF, with trailing
# whitespace stripped, and blank lines (entirely whitespace) removed.
# 
# =item App::Chart::Download::trim_decimals ($str, $want_decimals)
# 
# Return C<$str> with trailing zero decimal places trimmed off to leave
# C<$want_decimals>.  If C<$str> doesn't look like a number, or is undef, then
# it's returned unchanged.
# 
# =item App::Chart::Download::str_is_zero ($str)
# 
# Return true if C<$str> is a zero number, like "0", "00", "0.00", ".000".
# 
# =item C<< App::Chart::Download::cents_to_dollars ($str) >>
# 
# C<$str> is a number like "12.5" in cents.  Return it with the decimal point
# shifted to be expressed in dollars like "0.125".
# 
# =back
# 
# =head1 DATE/TIME FUNCTIONS
# 
# =over 4
# 
# =item App::Chart::Download::month_to_nearest_year ($month)
# 
# C<$month> is in the range 1 to 12.  Return a year, as a number like 2007, to
# go with that month, so that the combination is within +/- 6 months of today.
# 
# =item C<< App::Chart::Download::Decode_Date_EU_to_iso ($str) >>
# 
# 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>
#



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