Finance::YahooProfile - Get a stock profiles from Yahoo!
use Finance::YahooProfile; my $fyp = new Finance::YahooProfile ( timeout => $timeout ); my $profile = $fyp->profile( s => 'intc' ); ## for single stock my @profiles = $fyp->profile( s => ['intc', 'ibm'] ); ## for many stocks my $bookvalue = $res->{'book_value'};
WARNING: This module has not been fully tested all sorts of stocks so it may NOT always parse the page correctly and return any useful information. Any version number ending in a letter (as in v.0.12b, 0.12c) is a beta versions and have barely been tested. These versions are simply the previous version with a slight bug fix of some sort.
This module accesses the company profile from Yahoo! Finance and extracts the numbers from there so that they can be easily used in Perl programs. The following keys are available in the results hash:
52_week_change 52-Week percent change 52_week_change_sp500 52-Week percent change relative to the S&P 500 52_week_high 52-Week high 52_week_high_date Date on which 52-Week high was reached 52_week_low 52-Week low 52_week_low_date Date on which 52-Week high was reached beta Beta relative to S&P 500 current_ratio Current ratio (Current Assets / Current Liabilities) daily_volume_10da Average of the last 10 days' trading volume daily_volume_3ma Average of the last 3 months trading volume debt_equity Debt / Equity dividend Amount of the last dividend paid dividend_yield Yield of the last dividend fiscal_year_ends End of fiscal year last_split_date Date of the last split last_split_factor Factor of the last split (e.g. 2 for 1) last_updated Date when profile was last updated market Market on which the stock is traded market_capitalization Market capitalization (Stock Price x Shares Outstanding) most_recent_quarter most_recent_quarter_fe Most recent quarter - flash earnings (if available) operating_margin Operating Margin (Earnings / Operating Expenses) profit_margin Profit Margin (Earnings / Total Expenses) recent_price Price at which the stock was last traded return_on_assets Return on assets (Earnings / Total Assets) return_on_equity Return on equity (Earnings / Shareholder's Equity) sales Sales from the income statement part (usually ttm) shares_float Number of shares freely trading in the markets shares_outstanding Total number of shares issued short_daily_volume short_interest Number of shares sold short short_interest_date short_percent Short Interest / Floating Shares short_previous_month Short Interest previous month short_ratio success Whether the parsing was a success symbol total_cash Total current assets in the balance sheet
Creates a new Finance::YahooProfile object. Currently there are two options you can pass to it:
$fyp = new Finance::YahooProfile( expand => 0|1, dollar_symbol => 0|1 ); expand_number => If this option is set, number such as 3.14M will be converted to 3140000 before being passed back. expand_percent=> Something like 5.56% will be converted to 0.056 expand => sets both expand_number and expand_percent dollar_symbol => If you set expand to true, then this flag will determine whether the dollar symbol is kept in numbers such as $3.14M => $3140000.
None.
0.1 - - Initial Release. 0.11 - - Slight Changes 0.11b - 02/08/02 - Stopped parsing if the ticker symbol did not return valid a profile page. Added the 'success' and 'requested_symbol' keys to $res. Changed regex match for short_daily_volume from (.+) to ([\d\.KMB]) since the old regex did not work for ADRs like BF. 0.12 - 05/01/02 - Added conversion of percents to decimals in _expand() (5.82% => 0.0582) The options are now 'expand_number' for numerical expansion (K,M,B) and 'expand_percent' for decimal conversion or simply 'expand' for both.
Copyright 2002, Sidharth Malhotra
This program 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.
The information that you obtain with this library may be copyrighted by Yahoo! Inc., and is governed by their usage license. See http://www.yahoo.com/docs/info/gen_disclaimer.html for more information.
Sidharth Malhotra (smalhotra@redeyetg.com), Redeye Technology Group. Thanks to Ivo Welch for finding bugs and suggesting several improvements.
smalhotra@redeyetg.com
The Finance::YahooProfile home page will eventually be up at: http://www.redeyetg.com/projects/YahooProfile/
The Finance::YahooQuote home page can be found at http://www.padz.net/~djpadz/YahooQuote/ I used a lot from Finance::YahooQuote to build this module. LWP code, pod etc.
2 POD Errors
The following errors were encountered while parsing the POD:
'=item' outside of any '=over'
You forgot a '=back' before '=head1'
To install Finance::YahooProfile, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Finance::YahooProfile
CPAN shell
perl -MCPAN -e shell install Finance::YahooProfile
For more information on module installation, please visit the detailed CPAN module installation guide.