NAME
Finance::YahooJPN::Quote - fetch a quote of Japanese stock market
SYNOPSIS
use Finance::YahooJPN::Quote;
# get the quote of Sony Corp. at Tokyo market.
my @quote = Finance::YahooJPN::Quote->histrical('6758.t');
my $quote = join "\n", @quote;
print $quote;
DESCRIPTION
Historical quote data is basis for analyzing stock market. Here in Japan, standard quote data is indicated as a set of data: four prices (open, high, low, close) and volume for each day. This module provides module user some functions to get historical quote of a company.
METHODS
- historical($symbol [, 'start' => $start] [, 'noadjust' => 1])
-
This class method automatically
new()
andscan()
thenoutput()
a historical series of quote of the stock which specified with$symbol
argument.See the descriptions about the following methods for the argument and attributes:
$symbol
,start
andnoadjust
. - new($symbol)
-
Constructor class method. A stock
$symbol
should be given with 4-digit code number and optionaly followed by a letter extension (dot `.' and an alphabet). (i.e. `6758' or `6758.t')Japanese stock market use 4-digit code number as a stock symbol. Plus, add an alphabetical letter extention to indicate its exchange market. For example, the stock symbol code of Sony Corp. is '6758' and the letter extention of Tokyo Stock Exchange is '.t'. Hence, the stock quote of Sony Corp. at Tokyo Stock Exchange is specified as '6758.t'.
According to the Yahoo-Japan-Finance's description http://help.yahoo.co.jp/help/jp/fin/quote/stock/quote_02.html the letter extentions of each exchange market are:
.t: Tokyo Stock Exchange .o: Osaka Stock Exchange .n: Nagoya Stock Exchange .s: Sapporo Stock Exchange .f: Fukuoka Stock Exchange .q: JASDAQ .j: Nippon New Market (Hercules)
Letter extention is omittable. When it was omit, the default exchange market is chosen by Yahoo-Japan-Finance's server. It is not certain but I guess that a default one should be the main exchange market of a stock. Note: since almost symbols should work without letter extention, I have experienced certain problems with a few symbols those which have originally `.j' letter extention. This is of course not for the module but owe to the Yahoo-Japan-Finance server's behavior.
- scan(['start' => $start])
-
This object method scans the stock's historical quote pages of Yahoo-Japan-Finance from the
$start
date to the current date. And picks up quote data of each day from that pages.A
$start
date should be given in the format `YYYY-MM-DD' (ex. `2003-08-14'). Be careful, don't forget to quote the word, because bare word 2000-01-01 will be comprehend by Perl as '2000 - 1 - 1 = 1998'. This attribute is omittable. The default value of$start
is '1980-01-01'.You cannot specify the last date. Because, to find the splits you must scan all of the quote from the start date. Without the splits data, estimation of adjustment for the splits cannot be done exactly.
Note that a datetime for this module is based on JST (Japan Standard Time: GMT +09:00).
- output(['noadjust' => 1])
-
This object method returns the collected quote data as a list.
The
noadjust
option can turn on/off the function of value adjustment for the splits. If you omit this option or set this value '0', adjustment function is effective (default). If you set this value other than '0', adjustment function is ineffective.The data is formatted as TSV (Tab Separated Values). Each row represents quote of each day in the order with 1)date, 2)open, 3)high, 4)low, 5)close and 6)volume.
NOTES
The mudule calculates adjusted values originally including closing prices. The only adjusted values which Yahoo-Japan-Finance presents are closing prices, and those numbers are not rounded but cut for decimal fractions. For this reason, I have decided to ignore Yahoo-Japan-Finance's adjusted closing prices. That is why some adjusted closing prices are different from Yahoo-Japan-Finance's.
AUTHOR
Masanori HATA <lovewing@dream.big.or.jp> (Saitama, JAPAN)
COPYRIGHT
Copyright (c)2001-2003 Masanori HATA. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.