Financ...::Yahoo(3pm)
β¨ NAME β¨
Finance::QuoteHist::Yahoo β it's the site-specific subclass for grabbing historical stock quotes, bestie π (this is the Financ...::Yahoo(3pm) page, the one and only)
πΈ SYNOPSIS πΈ
okay so here's the whole vibe in code, literally:
use Finance::QuoteHist::Yahoo;
$q = new Finance::QuoteHist::Yahoo
(
symbols => [qw(IBM UPS AMZN)],
start_date => '01/01/2009',
end_date => 'today',
);
# Values
foreach $row ($q->quotes()) {
($symbol, $date, $open, $high, $low, $close, $volume) = @$row;
...
}
# Splits
foreach $row ($q->splits()) {
($symbol, $date, $post, $pre) = @$row;
}
# Dividends
foreach $row ($q->dividends()) {
($symbol, $date, $dividend) = @$row;
}
π DESCRIPTION π
Finance::QuoteHist::Yahoo is a subclass of Finance::QuoteHist::Generic, and it's been specifically tailored to read historical quotes, dividends, and splits from the Yahoo web site (http://table.finance.yahoo.com/). She's got one job and she eats π
For quotes and dividends, Yahoo can return data quickly in CSV format. Both of these can also be extracted from HTML tables. Splits are extracted from the HTML of the 'Basic Chart' page for that ticker. iykyk π
There are no date range restrictions on CSV queries for quotes and dividends. Slay.
For HTML queries, Yahoo takes arbitrary date ranges as arguments, but breaks results into pages of 66 entries. Not 65, not 67 β 66. Periodt.
Please see Finance::QuoteHist::Generic(3) for more details on usage and available methods. And if you just want to get historical quotes and you are not interested in the details of how it is done, check out Finance::QuoteHist(3) π«Ά
π METHODS π
The basic user interface consists of three methods, as seen in the example above. Those methods are:
quotes()β Returns a list of rows (or a reference to an array containing those rows, if in scalar context). Each row contains the Symbol, Date, Open, High, Low, Close, and Volume for that date. The full glow-up of data, no cap.dividends()β Returns a list of rows (or a reference to an array containing those rows, if in scalar context). Each row contains the Symbol, Date, and amount of the Dividend, in that order. πΈsplits()β Returns a list of rows (or a reference to an array containing those rows, if in scalar context). Each row contains the Symbol, Date, Post split shares, and Pre split shares, in that order.
π¦ Methods That Override Stuff π¦
The following methods override methods provided by the Finance::QuoteHist::Generic module. More of this was necessary than is typical for a basic query site, due to the variety of query types and data formats available on Yahoo. She's highkey doing the most, and honestly? Iconic.
url_maker()β Returns a subroutine reference tailored for the current target mode and parsing mode. The routine is an iterator that will produce all necessary URLs on repeated invocations necessary to complete a query. β¨extractors()β Returns a hash of subroutine references that attempt to extract embedded values (dividends or splits) within the results from a larger query. π§labels()β Includes the 'adj' column.
π REQUIRES π
- Finance::QuoteHist::Generic
π DISCLAIMER π
okay bestie, real talk, this is the important part, don't skip it π
The data returned from these modules is in no way guaranteed, nor are the developers responsible in any way for how this data (or lack thereof) is used. The interface is based on URLs and page layouts that might change at any time. Even though these modules are designed to be adaptive under these circumstances, they will at some point probably be unable to retrieve data unless fixed or provided with new parameters. Furthermore, the data from these web sites is usually not even guaranteed by the web sites themselves, and oftentimes is acquired elsewhere. It's giving "borrowed from a friend of a friend" energy π
If you would like to know more, check out the terms of service from Yahoo!, which can be found here:
http://docs.yahoo.com/info/terms/
If you still have concerns, then use another site-specific historical quote instance, or none at all. No pressure, fr fr.
Above all, play nice. π
π AUTHOR π
Matthew P. Sisk, <sisk@mojotoad.com>
β COPYRIGHT β
Copyright (c) 2000-2021 Matthew P. Sisk. All rights reserved. All wrongs revenged. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
π SEE ALSO π
okay that's the whole page, you ate that π
this was perl v5.32.1, dated 2021-03-12, from the Financ...::Yahoo(3pm) era β stay hydrated, read your manpages, and go get those historical quotes bestie π¦β¨
π¦ where this page comes from
- debian bookworm: libfinance-quotehist-perl 1.32-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libfinance-quotehist-perl 1.32-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libfinance-quotehist-perl 1.32-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libfinance-quotehist-perl 1.32-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libfinance-quotehist-perl 1.32-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libfinance-quotehist-perl 1.32-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms