NAME

App::Chart -- various shared Chart things

SYMBOL FUNCTIONS

%App::Chart::option

Various program options.

verbose (default false)

Print more things (mainly during downloads). This is the --verbose command line option.

d_fmt (default from langinfo())

strftime format string for a date. Non-ASCII can be included as Perl wide-chars.

The default is from langinfo(D_FMT) if the I18N::Langinfo and I18N::Langinfo::Wide modules are available. Otherwise the default is %Y-%m-%d which gives an ISO style YYYY-MM-DD.

wd_fmt (default %a and d_fmt)

strftime format string for a weekday name and date.

http_get_cost (default 3000)

Byte cost reckoned for each separate HTTP request. This is used when choosing between an individual download per symbol or a whole-day download of everything at the exchange.

If your connection is badly lagged you could increase this to prefer the single big file. If you want to minimize downloaded bytes then reduce this to roughly HTTP per-request overhead (packet and headers each way), which might be a few hundred bytes.

App::Chart::symbol_sans_suffix ($symbol)

Return $symbol without its suffix. Eg.

App::Chart::symbol_sans_suffix ('BHP.AX')   # gives 'BHP'
App::Chart::symbol_sans_suffix ('GM')       # gives 'GM'
App::Chart::symbol_suffix ($symbol)

Return the suffix part of $symbol, or an empty string if no suffix. Eg.

App::Chart::symbol_suffix ('BHP.AX')   # gives '.AX'
App::Chart::symbol_suffix ('GM')       # gives ''
$cmp = App::Chart::symbol_cmp ($s1, $s2)

Return -1, 0 or 1 according to $s1 less than, equal to, or greater than $s2.

Symbols are compared alphabetically, except "^" index symbols come before ordinary symbols.

DATE/TIME FUNCTIONS

App::Chart::hms_to_seconds ($hour, $minute, [$second])

Return a count of seconds since midnight for the given $hour, $minute and $seconds. $seconds is optional and defaults to 0. $hour is in 24-hour format, so for instance 16 for 4pm.

App::Chart::seconds_to_hms ($seconds)

Return three values ($hour, $minute, $seconds) split from $seconds which is a count of seconds since midnight. $hour is in 24-hour format, so for instance 16 for 4pm.

MISC FUNCTIONS

App::Chart::collapse_whitespace ($str)

Return $str with leading and trailing whitespace stripped, and any runs of whitespace within the string collapsed down to a single space character each.

App::Chart::decimal_sub ($x, $y)

Calculate the difference $x - $y of two decimal number strings $x and $y and return such a string. For example,

App::Chart::decimal_sub ('2.55', '1.15')  # gives '1.40'
App::Chart::decimal_sub ('60.5', '1.05')  # gives '59.45'

The number of decimal places used and returned is whichever of the two values has the most places.

App::Chart::count_decimals ($str)

Return the number of decimal places in the number string $str, ie. how many digits after the decimal point, or 0 if no decimal point. Eg.

App::Chart::count_decimals ('123')    # is 0
App::Chart::count_decimals ('123.')   # is 0
App::Chart::count_decimals ('123.5')  # is 1
App::Chart::count_decimals ('2.500')  # is 3
App::Chart::max_maybe ($num, $num, ...)
App::Chart::min_maybe ($num, $num, ...)

Return the maximum or minimum (respectively) among the given numbers. undefs in the arguments are ignored and if there's no arguments, or only undef arguments, the return is undef.

SEE ALSO

chart

HOME PAGE

http://user42.tuxfamily.org/chart/index.html

LICENCE

Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2014, 2015, 2016, 2017 Kevin Ryde

Chart is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

Chart is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Chart; see the file COPYING. Failing that, see http://www.gnu.org/licenses/.