This manual documents version 0.7.2 of the get-quote utility.
get-quote is an utility which fetches stock data from on line sites, mainly Yahoo.com, and the various national Yahoos. It can be configured to fetch the desired stocks value, in one-shot or in polling mode. It computes stock variations if the user gives an initial stock value, both on per-stock basis or on portfolio-basis. For more advanced users, it's possible to use non-preconfigured Yahoo sites, providing the complete URL infos.
get-quote works in text mode, and produce an output (both on terminal, and on file, if requested) whose format can be easily imported by other programs, such as historical databases or graphical analysis software.
The rest of this manual is organized as follows. The first part presents a series of configurations (section Tutorial) which show almost all the possible program usages, then there's a complete reference (section get-quote Reference) of the program options, individually explaned, and a final section (section Installation and Customization) to explain how to install and customize the program.
This Chapter describes the use of get-quote utility using a series of examples, of increasing complexity. See section get-quote Reference, for a complete description of each used flag.
This tutorial chapter is structured as follows.
section Fetch one stock to get the plain value of 1 stock while section Fetch more stocks is the same for more than one stock; section Fetch and do some value variation computations and section Fetch and do some value variation computations show how to have the program do some value variation computation, and finally section Fetch using various currency show how to use differents currency.
The final sections, section Fetch in polling mode and section Output options, show some global program configurations for polling or setting output mode, while the last one, section Fetch from not preconfigured Yahoo sites, show how to fetch data from a not preconfigured site.
The program is tipically invoked by get-quote, which is a script calling the program iget-quote with the user's configuration. In the tutorial we will invoke iget-quote directly.
The basic usage of get-quote is simple. A typical invoking to iget-quote looks like:
# iget-quote -m NASDAQ -i AMZN "AMZN",52.4375,"4/25/2000","4:01PM",+2.625,51.8125,54.125,50.25,7150400, Tue Apr 4 23:23:19 2000 GMT,1.0, PORTFOLIO,Tue Apr 4 23:23:19 2000 GMT,-1.0000,-1.0000,-0.00%
The first argument, -m
, is the market name. The complete
supported market list can be seen invoking the command
with the -h
flag.
The main supported markets are NASDAQ (US), SBF (France), Xetra (Germany),
London (UK), Milan (Italy), FEF (an italian SIM the author was
interested in).
The second argument, -i
, is the stock name we are interested in:
this name is the symbol used by the indicated market. To find the
correct symbol, you can use the look up engine from the Yahoo site, to
have the symbol from the name.
For example the NASDAQ uses literal symbols (AMAZON.COM is AMZN), while the
SBF (France) uses a numeric symbol (NICOX is 7413.PA: 7413 is the code,
PA stands for Paris).
The conventions depends on the market.
The output is in the form of one line for each requested stock: the first block of data represents the info from yahoo databases "as is", in particular the 1st field is the stock name, and the second the current stock value. Then there's the time (as GMT) of the fetching operation, followed by the currency exchange coefficient (a coefficient of 1 indicates that the program uses the original currency).
In the same command line you can ask for more than one stock.
iget-quote -m NASDAQ -i AMZN -n -m SBF -i 7413.PA
Just repeat the same syntax for all the stocks you want, dividing
them with a -n
(i.e. --next
).
You can use get-quote to have a look to the stock variation, from a given initial value.
iget-quote -m SBF -i 7413.PA -p 40 -q 1 -P 50 -Q 1 7413.PA,Fri May 5 20:39:57 2000 GMT,1.0,25.00% PORTFOLIO,Fri May 5 20:39:57 2000,40.0000,50.0000,25.00%
As a general rule, the options referring to a stock are lower case letters if referred to the BUY operation, while are upper case letters if referred to a sell operation.
In this case you have: "BUY 1 stock (-q 1) for a price of 40 (-p 40) of 7413.PA on Paris stock market (-m SBF -i 7413.PA), and SELL it (-Q 1 is sell 1 stock) at a price of 50 (-P 50).
The program will compute a stock price variation of +25%: the variation is the last field of the line.
The same thing is accomplished in the following example:
iget-quote -m SBF -i 7413.PA -p 40 -q 1 -Q 1
where the selling price is not given: in this case the program will fetch the current price from Yahoo, and uses it to do the same computations.
You can set the commission price for each stock to compute the real variation for a BUY/SELL operation.
# iget-quote -m SBF -i "7413.PA" -p41.88 -q15 -f29.95 -c1.95 -P 50 -F29 -C1.9 7413.PA,Tue May 2 21:21:11 2000 GMT,1.0,9.13% PORTFOLIO,Tue May 2 21:21:11 2000,659.3750,719.5750,9.13%
In this case we have a fix buy commission of 29.95 (-f
), plus a percent
commission of 0.195% (-c
), i.e. the value of this buy operation is:
41.88 * 15 + 29.95 + (41.88 * 15) * 1.95 / 1000.
In the same way, in the sell operation, we have a fix commission
of 29 (-F
) and a percent commission of 0.19% (-C
).
This BUY/SELL operation give us a 9.13% gain.
If working on different market, it is possible to have the program computing the currency exchange:
iget-quote -m NASDAQ -i AMZN -p71.25 -q7 -f29.95 -t 0.9993 -F19 -T "USDEUR=X"
in this case the BUY operation currency was USDollar, but I wanted to refer it to the Euro currency.
The exchange rate for the BUY operation was 0.9993 (-t
),
i.e. 1 Dollar = 0.9993 Euro, while the exchange for the SELL operation
is fetched from Yahoo (-T
), where the symbol "USDEUR=X"
stands for USDollar to Euro exchange rate.
Using the currency converter of Yahoo site you can find the code for all the currency you are interested in.
To monitor some stock variation continually, you can use the -s
option:
iget-quote -m NASDAQ -i AMZN -n -m SBF -i 7413.PA -s 300
where you ask the program to fetch the data every 300 seconds (5 minutes). The program will continue to fetch data until you kill it.
You can log the data to a file using the -o
option:
the program will write to file the same data that outputs on
monitor.
iget-quote -m NASDAQ -i AMZN -n -m SBF -i 7413.PA -s 300 -o logging
The data is appended to the logging file, if it already exists.
iget-quote -M "ca.finance.yahoo.com" -i AC
With the option -M
we define the site to fetch data from:
data can be fetched by any Yahoo site as they use all the same
interface: NOTE that you cannot fetch data from an arbitrary
site.
In this chapter we describe the options of iget-quote:
as a general rule each option can be given in a short
or verbose form, i.e. the help option can be activated as
-h
or as --help
.
These options control the global program behaviour, i.e. are not stock specific. If an option is repeated more than once, the last one is the valid one.
-h
, --help
: gives a short help and exit
-l flag
, --longoutput flag
: if flag is 1 (default
value) the output is as described in the tutorial part.
If it is 0, the output on monitor is in a shortened form, i.e. it
prints just the stock name and the value variation.
-s time
, --sleep time
: the program fetch the
data every time seconds interval.
The default is to fetch just once.
-o filename
, --outputfile filename
:
the data is printed on stdout and stored in the file filename.
If the file is already present, the new data is appended to it.
The directory where the file is located must exists.
These options define the stock information: each stock can have all the options you need in the order you want. If an option is repeted more than once, the last option is the valid one.
-n
, --next
:
Used to separate a set of stock info from another.
-m marketname
, --market marketname
:
marketname is the name of the market of the stock: it is used to
find the correct market web site.
-M marketsite
, --MarketSite marketsite
:
marketsite is the name of the Yahoo web site to use to
fetch the data.
If both -m
and -M
are used, this one is
used.
-a option
, --anteriorOption option
:
-A option
, --ApostOption option
:
These flags are needed to build the command line to get the stock info,
if you are using non standard Yahoo site, or if you want to personalize
the format of the data you are fetching from Yahoo.
The data are fetched using marketsite, anterionoptions,
stockname, Apostoptions.
-i stockCode
, --idofstockMarket stockCode
:
The id of the stock you are interested in: it is the code of the stock
used by the market.
-I stockName
, --IdofstockVerbose stockName
:
This is a simbolic name you can use for readibility, specialy when
the stock id is a numeric code.
-p x
, --pricebuy x
:
It is the buy price of the stock
-p x
, --Pricesell x
:
It is the sell price of the stock
-q x
, --quantitybuy x
:
It is the quantity of stocks you have bought
-Q x
, --Quantitysell x
:
It is the quantity of stocks you own
-f x
, --fixcommissionbuy x
:
The commission to buy the stock (a fix value)
-F x
, --Fixcommissionsell x
:
The commission to sell the stock (a fix value)
-c x
, --commissionbuy x
:
The commission to buy the stock, depending on the
value of the operation, i.e. commission = value * x / 1000
-C x
, --Commissionsell x
:
The commission to sell the stock, depending on the
value of the operation, i.e. commission = value * x / 1000
-t x
, --tocurrencybuy x
:
A coefficient to get the currency you are working in.
x is the buy currency exchange rate.
-T s
, --Tocurrencysell s
:
A coefficient to get the currency you are working in.
If the parameter is a number, it is the sell currency exchange rate,
if it is a string, it is the currency id which will be
used to ask for the current currency exchange rate from Yahoo.
The output gives one line for each stock you asked info for, the informations are separated by commas. The line gives:
At the end of the stock information there's a line giving the global portfolio variation: this line is introduced by the id "PORTFOLIO" and gives
In the normal use these option should not be needed, (anyway, if you have to trace a bug, and need them ...).
-d
, --debug
: enable some debug output messages
-v
, --verbose
: print some messages describing what
the program is doing
-w flag
, --wget flag
: if the flag is 1 (default value)
the missing values are read from the web, otherwise are read
from standard input.
This chapter describes the installation and customization of get-quote: the latest version may be downloaded from the get-quote home page
The distributed program has been compiled and tested in a linux
box, running RedHat 6.0, using the gcc
compiler.
The program has been written in standard C.
The directory doc contains the documentation, both as source texi file and as final format (Postscript, PDF, HTML).
If you downloaded a precompiled package, the executable files are in the directory bin.
The provided Makefile compiles the iget-quote utility, which should be copied in a directory in the PATH, for example ~/bin. The provided get-quote shell script and the other scripts in the examples directory, are used to invoke the utility with the user requested options: the user should edit these files to define the info he/she wants See section Customizing the portfolio.
You can keep the scripts you need in the directory you want, or, by copying it in a directory in the PATH, you can have the information you want at hand.
The iget-quote utility can be compiled for Windows boxes, using the Cygnus GCC cross compiler for Linux: in a Windows box, you can keep both iget-quote.exe and the get-quote script in the same directory.
Note that I don't use Windows, so I don't know if there will be additional problems (and Windows surely have many problems ...): for example the scripts in the examples directory must be renamed so to end with the .bat extension.
The iget-quote utility wants all the parameters it needs from command line: the simpler mode to use it is to write your own invoking script, copying the example program invocations reported in this manual, and adapting to your own needs. Obviously, you can have as many invoking scripts as you need: one for stock, one for portfolio, one for market, and so on. The name get-quote I used in this manual can be changed to reflect the info it computes, or in general your tastes!
The project of get-quote was accomplished on a Linux
box, using the various tools from the GNU project, including
texinfo
.
The manual backbone structure was stolen by FFTW manual, a program by Matteo Frigo and Steven G. Johnson, downloaded from the FFTW home page
get-quote is copyright (C) 2000 Gianluca Moro
get-quote 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 2 of the License, or (at your option) any later version.
This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. You can also find the GPL on the GNU web site.
The information that you obtain with this utility may be copyrighted by Yahoo! Inc., and is governed by their usage license.
See the Yahoo copyright for more information.
Other copyrights and conditions may apply to data fetched through this utility.
For more informations, contact the author (giammy@artemide.dei.unipd.it)
Jump to: - - c - d - f - g - h - i - l - o - p - s - t - w
This document was generated on 3 June 2000 using texi2html 1.56k.