The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Finance::YahooJPN::QuoteHist - fetch a historical quote of Japanese stock market

SYNOPSIS

  use Finance::YahooJPN::QuoteHist;
  
  # get the quote of Sony Corp. at Tokyo market.
  my @quote = Finance::YahooJPN::QuoteHist->quote('6758.t');
  
  my $quote = join "\n", @quote;
  print $quote;

DESCRIPTION

Historical quote data is basis for analyzing stock market. In Japan, standard quote data is indicated as a set of data: four prices (open, high, low, close) and volume of each day. This module provides user a list of historical quote of a company.

METHODS

quote($symbol [, 'start' => $start] [, 'noadjust' => 1])

This class method automatically new(), fetch() and extract() then output().

See the descriptions about the following methods for the attributes: $symbol, start and noadjust.

new($symbol)

Constructor class method. A stock $symbol should be given with 4-digit code number followed by letter extension (dot `.' and an alphabet). (ex. `6758.t' )

Japanese stock markets use 4-digit code number as stock symbol. Plus, add a alphabetical letter extention to indicate the exchange market. For example, the stock symbol code of Sony Corp. is '6758' and the letter extention of the Tokyo Stock Exchange is '.t'. Hence, the stock quote of the 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)
fetch(['start' => $start])

This object method fetches the stock's historical quote pages of Yahoo-Japan-Finance from the $start date to the current date.

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 do exactly.

extract(['noadjust' => 1])

This object method extracts the stock's historical quote data from the fetched pages of Yahoo-Japan-Finance.

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.

output()

This object method returns the extracted quote as a list.

NOTES

The mudule calculates adjusted values originally including closing price. The only adjusted values which Yahoo presents are closing prices, and those numbers are not rounded but cut for decimal fractions. For this reason, I decided to ignore Yahoo's adjusted values (that's why some adjusted closing prices are different from Yahoo's).

For non-Japanese users: this program includes some Japanese multi-byte character codes called `EUC-JP' for analyzing Yahoo-Japan-Finance's HTML pages.

AUTHOR

Masanori HATA <lovewing@geocities.co.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.