App-Chart
view release on metacpan or search on metacpan
doc/chart.texi view on Meta::CPAN
@item
@item @nisamp{.ST}
@cindex @code{.ST}
@cindex Stockholm Stock Exchange
@cindex Sweden
@tab Sweden @tab Stockholm
@item
@item @nisamp{.SW} @tab Switzerland
@cindex @code{.SW}
@cindex Swiss Exchange
@cindex SWX
@tab Swiss Exchange (SWX) @* @uref{http://www.swx.com}
@item
@item @nisamp{.VX} @tab
@cindex @code{.VX}
@cindex Virt-X Exchange
@tab Virt-X (part of the SWX Group) @* @uref{http://www.virt-x.com}
@item
@item @nisamp{.TW} @tab Taiwan
@cindex @code{.TW}
@cindex Taiwan Stock Exchange
@cindex TSE
@tab Taiwan Stock Exchange @* @uref{http://www.tse.com.tw/docs/eng_home.htm}
@item
@item @nisamp{.TWO} @tab
@cindex @code{.TWO}
@cindex Taiwan OTC
@cindex OTC, Taiwan
@tab Taiwan OTC
@item
@item @nisamp{.L} @tab UK
@cindex @code{.L}
@cindex London Stock Exchange
@cindex LSE
@tab London Stock Exchange (LSE) @* @uref{http://www.londonstockexchange.com}
@item
@item @nisamp{.IL} @tab
@cindex @code{.IL}
@cindex International Order Book
@cindex IOB
@tab London Stock Exchange International Order Book (IOB) @*
@uref{http://www.londonstockexchange.com/iob}
@end multitable
@end quotation
@c ---------------------------------------------------------------------------
@node Internationalization, Emacs, Data Sources, Top
@chapter Internationalization
@cindex Internationalization
@cindex Localization
@cindex Preferences, locale
Chart is written in English, but has support for various localizations,
selected by the usual system mechanisms.
@table @asis
@item Numbers
@cindex Decimal point
@cindex Thousands character
Numbers are shown with the locale decimal point and thousands separator. You
can also customize these in your @file{init.pl}.
@item Dates
@cindex Date format
Dates are shown in the locale format, or the usual C language default is
@samp{mm/dd/yy}. You can also customize this in your @file{init.pl} to set a
personal preference, like the month as a name instead of a number.
@item Messages
@cindex Message translations
@cindex Translations, messages
Message strings are translated into the selected language, when a translation
is available. Gtk has a good set of translations for the standard menus and
dialogs, but for Chart specifics there's almost nothing yet.
@c
@c @item
@c @cindex Gettext
@c Gettext (@CHARTpxreftop{gettext, GNU @command{gettext} utilities}). @*
@c @uref{http://www.gnu.org/software/gettext/}
@item Stock and commodity names
@cindex Stock name translations
@cindex Commodity name translations
@cindex Name translations
@cindex Weblink
Names are downloaded in the selected or highest preference language, when
there's a choice. Weblinks to company information or the exchange home page
likewise.
@item Annotations
@cindex Annotation locale
@cindex UTF-8
Annotation notes (@pxref{Annotations}) can be entered with unicode characters.
@c , Dividends
@c and dividends (@pxref{Dividends}) ...
@end table
@c @ifinfo
@c @sp 1
@c @end ifinfo
@section Locale Selection
@cindex Locale selection
@cindex Language
@cindex @env{LANG}
On a typical Unix/POSIX-style system the locale is selected with the
@env{LANG} environment variable, set to a language code and optional territory
and charset. For example US English,
@example
LANG=en_US
export LANG
@end example
This is often set by the system administrator, but you can do it yourself in
your @file{~/.profile} (@pxref{Bash Startup Files,,, bashref, Bash Features}).
@cindex Language codes
@cindex Country codes
Language and country codes can be found in @ref{Language Codes,,, gettext, GNU
@command{gettext} utilities}, and @ref{Country Codes,,, gettext, GNU
@command{gettext} utilities}. Usually there's only a few combinations
available on a system, run @samp{locale -a} to see them.
@cindex @env{LANGUAGE}
Additionally, on a GNU system the @env{LANGUAGE} environment variable gives a
list of language preferences for message translations (@pxref{Using
gettextized software,, User influence on @code{gettext}, libc, GNU C Library
Reference Manual}). For example to have Italian preferred, otherwise Spanish,
otherwise English,
@example
LANGUAGE=it_IT:es:en
export LANGUAGE
@end example
Chart looks at @env{LANGUAGE} too (on all systems) for the preferred language
for stock and commodity names.
@c ---------------------------------------------------------------------------
@node Emacs, Concept Index, Internationalization, Top
@chapter Emacs
@cindex Emacs
@uref{http://www.gnu.org/software/emacs/}
@cindex @file{chartprog.el}
@cindex XEmacs
@file{chartprog.el} shows the Chart watchlist and gets quotes within Emacs
(@CHARTpxreftop{emacs, The Emacs Editor}). It's designed for Emacs 21 and
higher, and also works with XEmacs 21 if you have the UTF-8 coding system (see
below).
@cindex Autoload @file{chartprog.el}
@cindex @file{chartprog-loaddefs.el}
@cindex @file{.emacs}
The Debian package has the following setups already. Otherwise, the best way
to use @file{chartprog.el} is with autoloads for the commands.
@file{chartprog-loaddefs.el} is a small file which sets this up. Add the
following to your @file{.emacs} file (@pxref{Init File,, The Init File
@file{~/.emacs}, emacs, The Emacs Editor}),
@lisp
(require 'chartprog-loaddefs)
@end lisp
@cindex @code{load-path}
@cindex @code{site-lisp}
The build system currently doesn't install @file{chartprog.el} into
@file{site-lisp}, so you should copy it and @file{chartprog-loaddefs.el} to
somewhere in your @code{load-path} (@pxref{Lisp Libraries,, Libraries of Lisp
Code for Emacs, emacs, The Emacs Editor}).
@c If Chart isn't installed in a standard location you'll need to add its lisp
@c directory (@file{$prefix/share/emacs/site-lisp}) to your Emacs
@c @code{load-path}
@section Watchlist and Quotes
@findex @code{chart-watchlist}
@kbd{M-x chart-watchlist} displays the Favourites list in a buffer. Key
@key{a} adds a symbol. @kbd{C-k} and @kbd{C-y} kill and yank symbols.
@key{g} refreshes the quotes. @key{L} selects a different list (like the
Alerts list). The usual @kbd{C-h m} mode help shows other key bindings.
Chart communicates changes to the lists between the Emacs display and a
running Chart GUI@. So if you have both open then changes in one are
reflected in the other a moment later.
@findex @code{chart-quote}
@kbd{M-x chart-quote} displays a quote for a given symbol in the message area.
It prompts for the symbol with default a symbol at point. @key{Tab}
completion is available (@pxref{Completion,,, emacs, The Emacs Editor}) using
the database symbols, favourites list, and previously requested symbols.
@findex @code{chart-quote-at-point}
@kbd{M-x chart-quote-at-point} displays a quote for the symbol at point,
without prompting.
The language, date formats, etc, follow the Chart locale selection described
in @ref{Internationalization}. Emacs @kbd{M-x set-language-environment} and
other Emacs setups don't influence the display.
@section UTF-8
@cindex Asian characters in Emacs
@cindex XEmacs UTF-8
UTF-8 is used in Emacs, the same as in the Gtk GUI display. This is easiest
to implement, and should mean whatever is seen in the GUI can be seen in
Emacs.
@table @asis
@cindex MULE-UCS
@item Emacs 21
If you use an Asian locale then you probably know Emacs 21 has limited support
for Asian parts of UTF-8. The typical symptom is @samp{\207}, @samp{\221} etc
in the display. Install the MULE-UCS package to add to the builtin
characters: @uref{http://www.m17n.org}
@item XEmacs 21
If you use XEmacs 21 you probably know it has no builtin UTF-8. To run
@code{chartprog.el} you must get one of the add-ons providing that. MULE-UCS
is recommended (@uref{http://www.m17n.org}), and @code{chartprog.el} will
attempt to load it automatically.
@end table
@section Lisp
@cindex Lisp
@defun chart-latest symbol &optional field scale
Return the latest price for @var{symbol} (a string) from Chart. If there's no
information available (an unknown stock, not online, nothing cached, etc) the
return is @code{nil}.
@example
(chart-latest "F") @result{} 19.55
@end example
@c SYMBOL: F
@var{field} is a lisp symbol for what data to return. The default is
@code{last} which is the last traded price. The fields are
@example
name string or nil
bid offer \ prices or nil
open high low last change /
quote-date last-date string like "2012-12-31", or nil
quote-time last-time string like "16:59:59", or nil
volume number or nil
note string or nil
@end example
Which fields actually have data depends on the data source. @code{name} is
the stock or commodity name as a string, or @code{nil} if not available.
Dates and times are in the timezone of the symbol. @code{note} is a string
with extra notes, such as ex-dividend or limit up, or @code{nil} if no other
notes.
@example
(chart-latest "F" 'volume) @result{} 10492900
@end example
@c SYMBOL: F
@var{scale} (an integer) is how many places to move the decimal point down.
For example if SCALE is 2 then price 1.23 is returned as 123. This is good
for working in cents when quotes are in dollars, etc.
@code{chart-latest} doesn't download new quotes but just returns existing
data.
@end defun
@c The @var{scale} argument is a power of 10 to apply to prices. For example if
@c @var{scale} is 2 then a price 2.75 is returned as 275. This can be useful for
@c instance if you want to work in cents but quotes are in dollars. The default
( run in 0.594 second using v1.01-cache-2.11-cpan-ceb78f64989 )