Finance-Quote-1.65/0000775000175000017500000000000015003302667013735 5ustar bschuckbschuckFinance-Quote-1.65/Changes0000644000175000017500000016173315003302667015241 0ustar bschuckbschuck1.65 2025-04-26 18:17:38-07:00 America/Los_Angeles
* Added EXCHANGE feature to Sinvestor.pm and some fixes - PR #481
* Added EXCHANGE feature to OnVista.pm - PR #480
* Added EXCHANGE feature to Consorsbank.pm and some fixes - PR #479
* Enabled usage count in Quote.pm. Removed DWS.pm. Improved check that divident is a number in YahooJSON.pm by adding regex anchors.
* Added ssl_opts to user agent in Union.pm to account for bad certificate chain - Issue #482
* Added ETFs search, more labels and EXCHANGE feature to Comdirect.pm - PR #478
* GoogleWeb - Add support for Hong Kong Exchange - PR #476
* YahooJSON - Adjust other currency fields when data is returned in GBp, ZAc, or ILA.
* Added label wkn, ìsin, close, ask, bid, p_change, time to OnVista.pm
* Modified OnVista.pm to enable search by ISIN and WKN and search for ETFs
* Added methodinfo hash to Tradegate.pm - PR #465
* Added label isin, open, ask, bid, time to Tradegate.pm - PR #465
* Fixed Tradegate.pm - Search for ETFs - PR #465
* Removed MorningstarAU - Issue #405
* Fixed malformed character in YahooWeb.pm - Issue #468
* Changed useragent in YahooJSON.pm - Issue #467
* Added methodinfo hash to AEX.pm - PR #466
* Added label exchange, close, time to AEX.pm - PR #466
* Fixed XETRA.pm - Issue #460
* Added methodinfo hash to Fool.pm
* Fixed MorningstarJP.pm - Issue #443 - PR #451
1.64 2024-11-27 18:11:09-08:00 America/Los_Angeles
* Update AlphaVantage.pm - Issue #447
* Fix to Stooq.pm - Issue #445
* Updated ASX.pm - Issue #404
* Added more fields to CSE.pm and exposed all labels.
* Changed parsing in Comdirect.pm - Issue #413
* Complete rewrite of OnVista.pm - Issue #414
* Minor fix to FinanceAPI decoding JSON - Issue #434
* Modified YahooJSON to deal with "nan" as dividend yield in JSON.
* New CurrencyRates module, CurrencyRates/FinanceAPI - Issue #427
* Fixed Bourso.pm - Issue #417
* Allowed Currency Rates modules Fixer.pm and OpenExchange.pm to read their API keys from environment variables - Issue #426
1.63 2024-09-21 12:47:39-07:00 America/Los_Angeles
* Fixed TesouroDireto.pm - Using different source URL - PR #424
* Added FinanceAPI.pm - Requires API key from https://financeapi.net/. US and other exchange data available.
* Fixed BVB.pm - Issue #409
* Fixed BSEIndia.pm - Issue #410 and removed Unzip as quotes file is now a CSV file
* Fixed NSEIndia.pm - Issue #410
* Fixed NZX.pm - Issue #401
1.62 2024-05-16 18:19:12-07:00 America/Los_Angeles
* Fixed AEX.pm
* Removed throttling from AlphaVantage.pm - Issue #363
* Added CurrencyFreaks.pm - new currency module
* YahooJSON.pm - added more error handling - Issue #390
* Fixed MarketWatch.pm module - Issue #389
* Fool.pm - Rewrote Fool.pm and added back to F::Q. Issue #379.
* New Module! StockData.pm. Methods stockdata, nyse, nasdaq.
* Modified yahooJSON.pm module in order handle EU consent redirects better.
* TwelveData.pm - Added "last" to data being returned
* BorsaItaliana.pm - New module for Borsa Italiana, Italian traded bonds using ISIN
* YahooWeb.pm - Issue #377. Modified YahooWeb to account for changes from Yahoo.
1.61 2024-04-18 21:34:24-07:00 America/Los_Angeles
* SIX.pm - Changed lookup for currency, added lookups for symbol and last. Issue #380
* YahooJSON.pm - URLs to retrieve required cookies and crumbs were changed to allow EU based users to use the module. Issue #373
1.60 2024-04-15 17:34:46-07:00 America/Los_Angeles
* Removed not working modules. Issues #346, #366, and #368.
Fidelity.pm, Cdbfundlibrary.com, Fundata.pm, and Fool.pm.
* YahooJSON.pm - Added code to retrieve cookies and a "crumb" required
to continue to utilize the v11 API. Issue #369.
The YahooJSON.pm currency module was changed to use the v8 API.
* Added initial version of CONTRIBUTING.pod that metacpan.org utilizes.
It will completely replace the Hacker's Guide in the future.
* Bloomberg.pm - Changed module to extract data from JSON structure embedded within the HTML - Issue #360
* NSEIndia.pm - Eliminated need to use temp folders by storing file data from URL into a variable.
1.59 2023-12-31 14:52:12-08:00 America/Los_Angeles
* Fixed XETRA, Tradegate and SInvestor after webpage was restructured - Issue #350
* Fidelity.pm temporarily disabled - Issue #346
* Finanzpartner.pm - Fix scraper, did not work if quote was higher than the previous day's quote.
* GoogleWeb.pm - Updated to retrieve mutual fund and BATS prices - Issue #355
* BSEIndia.pm - Updated to use standardized data file at URL
https://www.bseindia.com/download/BhavCopy/Equity/BSE_EQ_BHAVCOPY_{DDMMYYYY}.ZIP
Eliminated need to use temp folders by storing standardized file data from URL into a variable.
Updated names of source fields to conform to those in the standardized data file
* IndiaMutual.pm - Eliminated need to use temp folders by storing nav file data from URL into a variable.
* TMX.pm - Correct a self-reference in documentation - PR #345
* Stooq.pm - Added new currencies and a fix for commodities' prices
* YahooWeb.pm - Skip rows in the price table where the prices are "-".
This seems to happen sometimes with TIAA (and perhaps other) securities
including TILIX and QCILIX
* TSP.pm - Was not returning hash when the HTTP GET failed completely
or the content did not contain the expected CSV file. - Issue #338
* BSEIndia.pm - Removed print when symbol not found - Issue #335
1.58 2023-08-12 10:59:05-07:00 America/Los_Angeles
* Consorsbank.pm - New module - PR #329
* Stooq.pm - New module - Issue #203
* Bloomberg.pm - Changed modules to utilize cookie jar - PR #331 - Issue #324
* AlphaVantage.pm - Apply currency scaling (GBp -> GBP) when symbol
had additional ".X" suffix - Issue #281
Fixed check for "Information" JSON usually returned when daily API
limit has been reached.
* YahooWeb.pm - Fixed incorrect pricing for single character symbols
and changed URL to get trade date - Issues #314 #319
* Another fix to the URL in YahooJSON and CurrencyRates/YahooJSON - Issue #318
1.57 2023-07-01 12:37:07-07:00 America/Los_Angeles
* Correct set exchange in YahooJSON.pm - Issue #306
* Added close, change and p_change to Tradegate, XETRA and Sinvestor
Added optional parameter INST_ID to specify the institute id.
Fixed bug in Tradegate, XETRA and Sinvestor for numbers equal or higher than 1.000 - PR #304
* Added GoogleWeb Module
* YahooWeb module added - PR #296
* Added MarketWatch Module
* Replaced cached file with IO::String object in IndiaMutual.pm
* Fixed missing date in AEX.pm - Issue #298
* Fixed Examples in POD Documentation in a few modules - PR #295
* move use strict to be the first statement in TreasuryDirect.pm and TwelveData.pm #290
* remove old perl version requirement statements from TreasuryDirect.pm and TwelveData.pm #290
* removed Data::Dumper that caused another test to fail from TreasuryDirect.pm #290
* Fixed Fool.pm and fool.t - PR #289
1.56 2023-05-29 14:56:23-07:00 America/Los_Angeles
* Replaced Tradeville.pm with BVB.pm - Issue #269
* Added new TwelveData module
* Updated YahooJSON.pm and CurrencyRates/YahooJSON.pm to use https://query2.finance.yahoo.com/v11 - PR #284
* Bourso.pm - Squash anything but numbers and period in quote values.
* Renamed MStarUK.pm to MorningstarUK.pm
* Added get_features method - PR #260
1.55 2023-05-13 12:22:00-07:00 America/Los_Angeles
* Added YahooJSON currency rate module PR #270
* Added TRV => CAD in AlphaVantage.pm. Issue #265 - PR #267
* Quick fix for YahooJSON.pm API
* URL Change for MorningstarJP. Issue #261
* Regex fix in FTfunds.pm and changed test cases ftfunds.t. PR #262
1.54 2022-12-26 15:25:02-08:00 America/Los_Angeles
* Fix to AEX.pm - Issue #235 - PR #244
* New modules Sinvestor.pm Tradegate.pm and XETRA.pm PR #243
* Updates to TMX.pm (Toronto Stock Exchange) PR #248 and #253
* Reverted API change (PR #230) in
CurrencyRates/AlphaVantage.pm PR #249
* Fix to Fondsweb.pm PR #250
1.53 2022-10-08 18:11:07-07:00 America/Los_Angeles
* dist.ini - changed bugtracker.web to
https://github.com/finance-quote/finance-quote/issues
* DWS.pm - Set $info{$symbol, 'symbol'} to $symbol.
* Union.pm - #231 - reworked for a different CSV file.
* CurrencyRates/AlphaVantage.pm - API CURRENCY_EXCHANGE_RATE
no longer accepts free API keys. Changed to use FX_DAILY API.
Issue #229 PR #230
* Set minimum version for LWP::UserAgent in dist.ini to
honor redirects.
* CurrencyRates/AlphaVantage.pm - Added logic to account
for empty JSON returned from currency exchange fetch.
* Bourso.pm - Added Europe and France back as failover
methods. These were removed some time ago in commit e26484b.
* Tradeville.pm - Changed hostname in URL to tradeville.ro.
Added logic to better account for the symbol not being
found.
* YahooJSON.pm - #202 - Account for symbols with '&'.
* Minor change to isoTime function in Quote.pm.
* Updated TSP.pm - PR #227 - update URL and handling of dates.
1.52 2022-07-03 15:15:38-07:00 America/Los_Angeles
* Quote.pm - Fixed logic for FQ_LOAD_QUOTELET starting with "-defaults"
reported in issue #197. PR #199.
* AlphaVantage currency module: Don't recurse infinitely when exchange
rate is less than .001 (PR 193)
* Bourso.pm - Fixed data bug reported in issue #174 with PR #194.
* TSP.pm - Minor fix for URL used to retrieve data. PR #195.
Note: URL was changed after the PR was merged.
Module remains in a non-working status.
* TesouroDireto.pm - New module for Brazilian's National Treasury
public bounds. PR #198.
* Bloomberg.pm - Update Bloomberg class names #205. Correct html
parsing errors.
* MorningstarCH.pm - Re-enabled and fixed in #207.
* ZA.pm - Change to return price from sharenet in major denomination.
PR #208.
* Changes to SourceForge project website HTML files.
* Add [Prereqs] to dist.ini. #215
1.51 2021-07-04 14:41:59-07:00 America/Los_Angeles
* Fix bugs in t/fq-object-methods.t
* Add code to hide warning in t/currency_lookup.t
1.50 2021-06-26 20:52:16-07:00 America/Los_Angeles
* New modules: CurrencyRates
* Updated modules: ASX, TIAA-CREF, Fool, Currencies
* Corrected some POD issues (thanks to the Debian Perl Group)
1.49 2019-06-30 12:20:58+02:00 Europe/Brussels
* Alphavantage: Removed Time::HiRes dependency due to mswin32
not supporting clock_gettime calls.
1.48 2019-06-30 01:19:14+02:00 Europe/Brussels
* Alphavantage: Add a waiting mechanism to comply to
alphavantage use terms
* Alphavantage: Added several stock exchange support and
currency
* Updated modules: Union, Deka, Indiamutual, ASX, Yahoojson,
TSP, AEX, Fool
* New modules: IEXTrading, MorningstarAU, MorningstarCH,
IEXCloud
* Yahoo: removed modules referring to yahoo API, which yahoo
stopped
* BUGFIX: 'use of uninitialized value' returned by perl could
make gnucash fail when more than 15 quotes where requested
* BUGFIX: MS Windows does not support %T in strftime call
* Added new documentation files: Release.txt, Hackers-Guide,
Modules-README.yml
* We started moving known failing tests into TODO blocks
* This release is the result of hard work by Bruce Schuck,
Vincent Lucarelli, Pieter-Jan Vandormael, Manuel Friedli,
Jalon Avens, Chris Good, Mark J. Cox, Eelco Dolstra, Henrik
Ahlgren, Vinay Shastry, Mike Alexander, Erik Colson.
* Special thanks go to Bruce Schuck and Vincent Lucarelli
which joined the maintainers team!
1.47 2017-11-12 17:19:42+01:00 Europe/Brussels
* Use AlphaVantage for currency quotes instead of Yahoo (Mike Alexander)
1.46 2017-11-12 17:13:15+01:00 Europe/Brussels
* Drop long-obsolete debian directory (Florian Schlichting)
* AlphaVantage:
- added support for .IL => USD currency and division (Adriano Baldi)
- graceful error catchup (Mike Alexander)
* Yahoojson:
- module adapted to new URL and returned json (Rafael Casali)
1.45 2017-11-08 21:35:51+01:00 Europe/Brussels
* alphavantage
* more suffix - currency pairs added
* GBP and GBX divided by 100
1.44 2017-11-07 21:57:57+01:00 Europe/Brussels
* Added currencies for .SA (Brazil) and .TO (Canada/Toronto) markets
* Setup a pause of .7s between queries in AlphaVantage.pm to limit queries
1.43 2017-11-06 23:41:47+01:00 Europe/Brussels
* Added currency for .DE market
* BUGFIX in currency determination regex
1.42 2017-11-06 19:04:25+01:00 Europe/Brussels
* more tests in alphavantage.t
* BUG resolved: removed time from $last_refresh when markets are open
1.41 2017-11-06 16:06:41+01:00 Europe/Brussels
* return symbol for AlphaVantage data
1.39
* added AlphaVantage module (Matthew Patterson)
* some other module changes: yahoojson, Morningstar, Bourso, TSX (not working)
1.38 2015-08-22 13:22:56+02:00 Europe/Brussels
* module updates: tiaacref, yahooJSON, FTfunds, MStaruk, USFedBonds, GoldMoney
* new modules: fidelityfixed (Peter Ratzlaff), yahooYQL
* removed modules: MTGox
* more tests: yahoo_speed.t, tiaacref.t
1.37 2015-02-01 20:24:32+01:00 Europe/Brussels
* modified 00-use.t to show more info
* Remove Crypt::SSLeay dependency in favor of LWP::Protocol::https (Geert Janssens)
* Updated HU.pm and test file to current website (Kristof Marussy)
1.36 2015-01-31
* MorningstarJP : changed dependency from Date::Calc to DateTime
1.35 2014-06-17 08:06:14+02:00 Europe/Brussels
* BUGFIX: VWD - currency returned.
1.34 2014-06-15 21:30:03+02:00 Europe/Brussels
* VWD adapted to recent website change.
1.33 2014-06-01 11:24:24+02:00 Europe/Brussels
* BUGFIX: yahoo_json never returns currency. so don't set a default.
yahoo_json returned current timestamp instead of quote date.
1.32 2014-05-18 21:55:12+02:00 Europe/Brussels
* return "symbol" for yahoo_json module
* allow to retrieve ISIN codes with VWD module
1.31 2014-05-04 22:56:45+02:00 Europe/Brussels
* Case mismatch in ZA_UnitTrusts pod
1.30 2014-05-04 21:56:34+02:00 Europe/Brussels
* Bourso.pm works on current website changes. Thanks to Guillaume
* New module CSE.pm by Hiranya Samarasekera. Covers Colombo Stock
Exchange (CSE) in Sri Lanka.
1.29 2014-04-08 08:28:25+02:00 Europe/Brussels
* New module za_unittrusts. kudos to Rolf Endres.
* Indiamutual patched to current website. kudos to Vinay S Shastry.
1.28 2014-03-16 12:05:19+01:00 Europe/Brussels
* Removed some unnecessary dependencies
1.27 2014-03-05 15:04:22+01:00 Europe/Brussels
* New module YahooJSON added (Abhijit Kshirsagar)
* mtgox.t should not create errors when ONLINE_TEST is not defined
1.26 2014-03-03 22:24:58+01:00 Europe/Brussels
* VWD adapted to current website (skaringa)
* Boursorama module mostly fixed (Arnaud Gardelein)
1.25 2014-03-02 23:18:23+01:00 Europe/Brussels
* AEX.pm : Some checking added. Not working yet
* Quote.pm : readded sub parse_csv_semicolon.
1.24 2014-03-02 21:39:00+01:00 Europe/Brussels
* Added module Citywire.pm written by Martin Sadler
* Added module FTfunds.pm written by Martin Sadler
* Added module MStaruk.pm written by Martin Sadler
* Added module TNetuk.pm written by Martin Sadler
* Data::Dumper is no more required to build
1.23_02 2014-03-02 14:46:41+01:00 Europe/Brussels (TRIAL RELEASE)
TEST RELEASE
1.22 2014-03-02 10:38:18+01:00 Europe/Brussels (TRIAL RELEASE)
TEST RELEASE
1.21 2014-03-02 09:56:38+01:00 Europe/Brussels (TRIAL RELEASE)
* ASX.pm now supports querying more than 10 symbols (goodvibes2)
* Travis config added for automated test build
* BUILD: Updated to use Dist::Zilla
2014-02-17 Erik Colson
* INSTALLATION FIX: Install Date::Calc as dependency
2014-02-16 Erik Colson
* MtGox support added by Sam Morris
* MorningstarJP support added by Christopher Hill
* Yahoo modules changed due to site change
2010-02-16 Erik Colson
* TSP.pm updated. Patch from Kevin Ryde.
* YAHOO/Base.pm added conversion from 'B' billions to
numbers. Patch from Kevin Ryde.
* Billions support moved to Quote.pm
2009-10-05 Erik Colson
* Lots of tests added
2009-10-04 Erik Colson
* IndiaMutual.t tests added
* Yahoo_europe: Bug 44245 solved. Wrong fields returned.
* Documentation: Bug 48818 corrected.
2009-10-03 Erik Colson
* yahoo_europe.t tests corrected
2009-09-30 Erik Colson
* Bourso.t tests corrected
2009-09-29 Erik Colson
* AEX.pm removed code for options and futures. (didn't work)
2009-07-19 Erik Colson
* Bug in Yahoo::Base corrected. Sometimes year range is wrongly returned.
2009-07-19 Giles Robertson
* Bug in Yahoo::Base corrected. GBp wrongly interpreted.
2009-07-19 Stephan Ebelt
* Goldmoney.pm patched. support for platinum added.
2009-07-18 Zoltan Levardy
* New module HU.pm (Hungarian stocks)
2009-06-14 Divakar Ramachandran
* Bug RT 46155 solved by modifying link in IndiaMutual.pm
2009-06-14 Stephan Ebelt
* Cominvest URL modified
2009-06-14 Erik Colson
* currencies adapted to yahoo denomination
2009-06-13 Sattvik
* currency retrieval updated (yahoo website changed)
2009-04-27 Bradley Dean
* ASX.pm updated due to website change
2009-04-13 Erik Colson
* Release 1.16
2009-04-12 Erik Colson
* BUGFIX: Bourso.pm allmost completely rewritten due to website change.
* BUGFIX: Morningstar.pm patched by Fredrik Persson.
* BUGFIX: AEX.pm patched by Herman van Rink.
2009-03-19 Erik Colson
* BUGFIX: 12:XXpm formatted time handling.
2009-03-04 Erik Colson
* RENAMED ITE is now RZR
2009-03-02 Erik Colson
* BUGFIX: ZA.pm patched.
2009-03-01 Erik Colson
* BUGFIX: Stephen Ebelt patch applied for goldmoney.pm
* BUGFIX: Encoding problem solved by Ashwin
2009-02-16 Bradley Dean
* NEW: Function fetch_live_currencies.
2009-02-15 Bradley Dean
* NEW: Module Finance::Quote::Currencies created for use in
currency_lookup.
2008-12-05 Erik Colson
* Finanzpartner module adapted to site updated. By Jan Wilamowius.
* Morningstar patched by Fredrik Persson.
2008-11-09 Erik Colson
* Bourso.pm updated due to website update. By Bernard Fuentes
2008-10-26 Erik Colson
* BUG correction : IndiaMutual.pm: symbol not set it module.
* Release 1.15
2008-10-21 Erik Colson
* BUG correction : function isoTime - make sure $hours and $mins are treated as numbers
* use sprintf in isoTime
2008-10-15 Erik Colson
* Release 1.14
2008-10-13 Erik Colson
* Finanzpartner.pm added by Jan Willamowius
2008-10-12 Erik Colson
* isoTime function added
* added quote.t
* yahoo time is now format using isoTime
2008-10-11 Erik Colson
* added prerequisite for HTML::TreeBuilder
* union.t from todo
2008-10-10 Paul Fenwick
* TEST: Ensure Data::Dumper is not accidently left in
F::Q code.
2008-10-07 Erik Colson
* Root README added
* BUGFIX: asx.t
2008-10-05 Erik Colson
* Added Cominvest module from Stephan Ebelt
2008-10-04 Erik Colson
* Failing tests moved to todo-state for trustnet, usfedbonds,
bourso, deka, union
* BUGFIX: currency.t
* BUGFIX: lerevenu.t - index ID corrected
2008-10-02 Erik Colson
* Failing tests moved to todo-state for ftportfolios, aiahk, nzx,
maninvestments.
2008-09-30 Paul Fenwick
* BUGFIX: Applied patch from Bill Carlson to fix Tiaacref.pm.
Thanks Bill, you rock!
2008-09-28 Erik Colson
* StockHouseCanada.pm updated to new site layout
* DWS.pm updated
2008-09-27 Erik Colson
* VWD.pm updated to new site layout
* TSX.pm added
2008-09-27 Paul Fenwick
* DOCUMENTATION: Fixed malformed formatting in authors
email addresses in Fiannce/Quote.pm.
2008-09-26 Erik Colson
* AEX.pm updated to new site layout (comma used in numbers)
2008-09-22 Paul Fenwick
* BUILD: Module::Install 0.77 is now used for building
and installation. (PJF)
* TESTING: Finance::Quote's test system has been restructured.
Tests are now run during installation, but online and author
tests are skipped by default. (PJF)
2008-09-21 Erik Colson
* lib/Finance/Quote/Yahoo/Brasil.pm: Enable semicolon.
2007-05-13 David Hampton
* lib/Finance/Quote/SEB.pm: Patch from Henrik Riomar to fix a problem finding quotes for funds with the Swedish
chars åäö in the name.
* lib/Finance/Quote/IndiaMutual.pm: Patch from Devendra Gera to remove white space when splitting the results in the
AMFI data file.
2007-01-07 David Hampton
* CVSTAG: finance_quote_1_13
* lib/Finance/Quote.pm: Update version to 1.13.
* lib/Finance/Quote.pm: Update the store_date() function for the
case when the year isn't explicitly stated. If the specified
month would put the quote in the future, then consider this a
quite from last year. manly intended to handle the rollover from
December to January on web sites that don't specify the year.
Suggestion from Christian Lupien.
* lib/Finance/Quote/BMONesbittBurns.pm: Enhance module to support
mutual fund quotes (which have less data than stock quotes).
Correct date format parsing. Fix from Christian Lupien .
* lib/Finance/Quote/StockHouseCanada.pm: The fund name seems to be
a moving target. Search all tables of depth one looking for it.
2007-01-01 David Hampton
* lib/Finance/Quote/FTPortfolios.pm: Rewrite this module for the
new web site design.
* lib/Finance/Quote/TSP.pm: Strip spaces around the dollar values.
* lib/Finance/Quote/FinanceCanada.pm: Rewrite this module for the
new web site design.
* test/*.t: Some restructuring of tests. Add a couple more tests
on dates. Replace a couple of test stocks that are no longer
valid.
* test/*.t: Accept last year as a valid date. Comes in hand when
testing modules at the start of the new year.
* lib/Finance/Quote/ZA.pm: Update for changes in the display of
the web site.
2006-12-31 David Hampton
* lib/Finance/Quote/StockHouseCanada.pm:
* test/stockhousecanada.t: New module for getting Canadian Mutual
fund quotes from Chris Carton .
* lib/Finance/Quote/Deka.pm: Update for changes in the display
of the web site. Now uses an https url.
* lib/Finance/Quote/LeRevenu.pm: Updates from Dominique Corbex for
changes in the display of the web site.
* lib/Finance/Quote/Trustnet.pm: Update for changes in the display
of the web site.
2006-09-11 David Hampton
* Move AIA.pm to AIAHK.pm since AIA has sites in multiple
countries.
2006-09-10 David Hampton
* lib/Finance/Quote/AIA.pm:
* test/aia.pm: New module to access American International
Assurance fund information. Based on perl script from Wouter van
Marle .
* lib/Finance/Quote/Bourso.pm: Update the URL to track changes on
the web site.
2006-07-10 David Hampton
* lib/Finance/Quote.pm: Update version to 1.12.
* CVSTAG: finance_quote_1_12
2006-06-27 David Hampton
* Makefile.PL: State the dependency on Crypt::SSLeay that several
modules now have.
* lib/Finance/Quote/Yahoo/Base.pm: Don't set fields that are
defined but are empty..
* test/yahoo_brasil.t: Update the test module to have more cases
and use better stocks.
* lib/Finance/Quote/Yahoo/Brasil.pm: Update for the change of the
data separator from a semicolon to a comma.
* test/financecanada.t:
* test/hex.t: Add new test cases to cover the last untested
modules. All modules are now tested.
* lib/Finance/Quote/FinanceCanada.pm: Don't set the success flag
if the lookup failed.
* lib/Finance/Quote/Platinum.pm: Use the new url of the pricing
information.
* lib/Finance/Quote/ManInvestments.pm: Update for the new table
format on the web site.
* test/indiamutual.t:
* test/aex.t: Update the test cases to use currently listed funds.
* lib/Finance/Quote/ManInvestments.pm: The url for updating
quotes has changed, as has the table header.
* lib/Finance/Quote/Bourso.pm:
* lib/Finance/Quote/LeRevenu.pm:
* test/bourso.t:
* test/lerevenu.t: Updated modules from Dominique Corbex
. The name field now returns the real name
and not ticker symbols, and other small fixes.
2006-04-08 David Hampton
* lib/Finance/Quote/Trustnet.pm: Work around the fact that gnucash
escapes the ampersand character when passing stock names to F::Q.
* lib/Finance/Quote/DWS.pm: Updated module from Klaus Dahlke
to retrieve quotes from the new DWS web
page.
* lib/Finance/Quote/Tiaacref.pm: Explicitly state in the code that
this module requires ssl support (it uses an https:// url). This
prevents perl from trying to run the code when ssl support isn't
present.
* lib/Finance/Quote.pm:
* lib/Finance/Quote/HEX.pm:
* test/hex.t: New module from Mika Laari
to fetch quote information from
the Helsinki stock exchange.
* Documentation/Hackers-Guide: Add a section on the q->store_date()
function. All modules should use this function to set the 'date'
and 'isodate' fields based on the retrieved textual date (or lack
thereof).
* test/lerevenu.t: Test the right module.
2006-04-07 David Hampton
* lib/Finance/Quote.pm:
* lib/Finance/Quote/LeRevenu.pm:
* test/lefrevenu.t: New module from Dominique Corbex
to fetch information from the
LeRevenu.com site in France.
* t/yahoo_europe.t: New test cases for non-GBP London exchange
stocks. Use new stock for test of the XETRA exchange. (Can't
find a non-Euro stock there, so remove those tests.)
* lib/Finance/Quote/Yahoo/Base.pm: Patch from p1n0@sourceforge.net
to only divide London exchange values by 100 if they are
denominated in pence.
2006-04-06 David Hampton
* lib/Finance/Quote.pm:
* lib/Finance/Quote/Bourso.pm:
* test/bourso.t: New module from Dominique Corbex
to fetch information from the "Paris
Stock Exchange", http://www.boursorama.com.
* lib/Finance/Quote/VWD.pm: Updated module from Jörg Sommer that
is more tolerant of the advertising added to the web page.
2006-01-11 David Hampton
* CVSTAG: finance_quote_1_11
* lib/Finance/Quote.pm: Updated $VERSION to 1.01
2006-01-10 David Hampton
* test/dws.t:
* test/maninvestments.t:
* test/yahoo_brasil.t: Accept dates in both the previous and
current year as valid responses.
* test/aex.t: Change test currency to one still on the exchange.
* lib/Finance/Quote/VWD.pm: Jörg Sommer's patch to work better
with invalid WKNs and to extract the exchange information from its
new location.
2005-11-18 David Hampton
* lib/Finance/Quote/AEX.pm: Use the store_date function.
* lib/Finance/Quote/ASX.pm:
* lib/Finance/Quote/Cdnfundlibrary.pm:
* lib/Finance/Quote/Platinum.pm:
* lib/Finance/Quote/Trustnet.pm:
* lib/Finance/Quote/Yahoo/Base.pm: Add code to protect against
empty tables, data fields, etc.
* test/aex.t: Correct the number of test cases. Changed test
stock to one that is still on the exchange. Site no longer
provides time (date only) so remove tests for time of quote.
Futures quotes don't always have bid/ask values so comment out
those tests.
* test/indiamutual.t:
* test/trustnet.t:
* test/union.t:
* test/yahoo.t: Changed test stock to one that is still on the
exchange.
* test/yahoo_brasil.t: All returned prices (for all stocks I
tried) return a price of zero, so comment out the test for
non-zero.
2005-10-23 David Hampton
* lib/Finance/Quote/VWD.pm: Put back the call to the
HTML::TableExtract first_table_state_found() function for now. At
some point this should be removed and the 2.0 version of
HTML::TableExtract required.
* lib/Finance/Quote.pm: Make note of an alternate yahoo URL that
can be used to obtain currency quotes. From Gerry Barksdale .
2005-10-22 David Hampton
* lib/Finance/Quote/Tiaacref.pm:
* test/tiaacref.t: Add Support for TIAA-CREF mutual funds from
Brandon .
* lib/Finance/Quote/VWD.pm: Remove the thousands separator
character from quote values.
* lib/Finance/Quote/TSP.pm:
* test/tsp.t: Frank Mori Hess's change
to add support for the TSP lifecycle L funds.
* ChangeLog: Archive pre-2005 data into a separate file.
* lib/Finance/Quote/Deka.pm: Add a new module to retrieve German
investment fund prices from Deka. Module from Knut Franke
* lib/Finance/Quote/USFedBonds.pm:
* test/usfedbonds.t: Add a new US Federal Bonds stock quote module
from Stephen Langenhoven .
2005-10-21 David Hampton
* lib/Finance/Quote.pm: Updated to work with new Yahoo currency
conversion pages.
* lib/Finance/Quote/Tiaacref.pm: New URL from Kevin Foss. Uses
https, so the Crypt::SSLeay module is now required for TIAA-CREF
quotes.
* lib/Finance/Quote/ZI.pm: Zürich Invest has been purchased by
Deutsche Bank and integrated into DWS. The DWS.pm module should
now be used in place of the ZI.pm module.
* lib/Finance/Quote/VWD.pm: Patch from Rainer Dorsch to return the
current price as 'last'. The HTML::TableExtract
first_table_state_found() function has been deprecated. Accept
both the old and new values as correct answers.
* lib/Finance/Quote/ZA.pm:
* test/za.t: Add a new South African stock quote module from
Stephen Langenhoven .
2005-08-10 David Hampton
* lib/Finance/Quote/VWD.pm: Handle invalid ISINs better. VWD
delivers a 404 error instead of a blank page. Fix suggested by
Uwe Simon
2005-07-04 Paul Fenwick
* lib/Finance/Quote.pm: Bumped $VERSION to 1.10, primarily
to work around a problem with CPAN distributions.
* CVSTAG: finance_quote_1_10
2005-06-29 David Hampton
* lib/Finance/Quote/VWD.pm: Updated module from Jörg Sommer
.
* lib/Finance/Quote/cdnfundlibrary.pm: Changes inspired by
kalaleq@users.sourceforge.net allow retrieval of more data.
* lib/Finance/Quote.pm:
* lib/Finance/Quote/Yahoo/NZ.pm: New module from Stephen Judd
.
* lib/Finance/Quote/NZX.pm: Tweak to allow both NZX and Yahoo:NZ
to get quotes for New Zealand Stocks (use method nz).
* CVSTAG: finance_quote_1_09
2005-05-30 Paul Fenwick
* MANIFEST: Updated with files intended for distribution.
* lib/Finance/Quote.pm: Updated $VERSION to 1.09
* CVSTAG: Updated finance_quote_1_09 tag on MANIFEST and
lib/Finace/Quote.pm
* Released updated version 1.09 with new MANIFEST and Quote.pm
to Sourceforge.
* lib/Finance/Quote/VWD.pm: Re-enabled $VERSION and bumped
to 1.01 to allow correct indexing on CPAN, however the
older version currently remains in the 1.09 release.
2005-05-04 David Hampton
* lib/Finance/Quote/FTPortfolios.pm: Update for changes in the
website.
* t/ftportfolios.t: New test module.
* TSP.pm: Replace core parsing with tighter code. Support the
symbols used by both Frank Mori Hess' and Trent Piepho's TSP
modules. Make the symbols case insensitive.
* lib/Finance/Quote/Cdnfundlibrary.pm: Find table by headers
instead of by index.
* test/asegr.t: New module
* lib/Finance/Quote/ASEGR.pm: New module
* lib/Finance/Quote/ASX.pm: Skip any blank lines in the table.
Pass an extra parameter to TableExtract to keep it from doing
unnecessary work that produces warnings.
2005-03-19 David Hampton
* lib/Finance/Quote/Trustnet.pm: Encode the '&' character before
calling the user agent GET function. Fixes bug 747080.
2005-03-19 David Hampton
* almost all files: Collapsed all date parsing code into a single
function. This function handles the date formats provided by all
current quote sources and converts them all into the F::Q standard
of a US date format. It also adds an ISO format date to all
quotes in the new isodate field. Added lots of test functions to
check date formats.
2005-03-19 David Hampton
* lib/Finance/Quote/AEX.pm: Spelling correcting from Frank Mori
Hess.
* lib/Finance/Quote.pm: Documentation correction from Trent
Piepho.
* lib/Finance/Quote/Yahoo/Base.pm (yahoo_request): Fix an
undefined reference when Yahoo ocassionally returns an empty
field.
2005-03-01 David Hampton
* lib/Finance/Quote.pm: New modules. New function to parse files
separated by semicolons instead of commas.
* lib/Finance/Quote/AEX.pm: Worked over modules from Johan van
Oostrum. Most of the old AEX data has migrated elsewhere.
* lib/Finance/Quote/ASX.pm:
* lib/Finance/Quote/Trustnet.pm: Got the modules working again.
* lib/Finance/Quote/ManInvestments.pm:
* lib/Finance/Quote/Platinum.pm: New modules for Australian
investment price sources from Ian Dall .
* lib/Finance/Quote/NZX.pm: New modules for fetching quotes the
from the New Zealand stock exchange. Provided by Michael Curtis.
* lib/Finance/Quote/SEB.pm: New modules for fetching quotes from
the Swedish Bank. Submitted by Tomas Carlsson.
* lib/Finance/Quote/TSP.pm: New modules for fetching quotes from
the US Govt. Thrift Service Plan. Submitted by Frank Mori Hess.
* lib/Finance/Quote/Yahoo/Base.pm: Corrected currency tags for Vienna and Valence.
* lib/Finance/Quote/Yahoo/Brasil.pm: Add new Yahoo Brasil module
from Ismael Orenstein .
* t/*: Various new test modules.
2005-02-09 David Hampton
* lib/Finance/Quote/Fidelity.pm:
* lib/Finance/Quote/Union.pm: Got the modules working again.
* lib/Finance/Quote/Yahoo/Base.pm: Extract the currency directly
from Yahoo, instead of looking it up in an exchange/currency
mapping table.
* t/*: Various new test and updated modules.
2005-02-06 David Hampton
* lib/Finance/Quote/BMONesbittBurns.pm: Got the modules working again.
2005-01-14 David Hampton
* lib/Finance/Quote/Cdnfundlibrary.pm: Got the module working again.
2004-07-02 Paul Fenwick
* Added Finance/Quote/Tdefunds.pm thanks to David Grant.
* Added t/tdefunds.t basic regression test (3 tests).
* Fixed bug #916966, TASE prices were 100 times their true
price. Thanks to Eldad Zack for the patch.
2004-02-08 David Hampton
* Yahoo/Base.pm: Added suffixes for the Brussels and Dublin
exchanges.
2003-09-20 Pawel Konieczny
* AEX module: major update: fetching of futures quotes
implemented. POD and test script updated as well.
2003-09-15 Pawel Konieczny
* AEX module: major update: additional labels for options available:
volume, oi, and other. Subframes cache implemented, resulting in
substantial speedup for repeating (intraday) requests of individual
options.
2003-09-12 David Hampton
* Yahoo/Base.pm: Added suffixes for 1) the US Options, 2) US
exchanges when using a non-US Yahoo site, and 3) the Zurich
exchange.
2003-08-31 David Hampton
* Yahoo/Base.pm: Added entry for the Lisbon Portugal stock
exchange.
2003-08-31 Pawel Konieczny
* AEX module: major update: fetching of stock and index options
implemented. POD and test script updated as well.
2003-08-27 Pawel Konieczny
* AEX module: following a suffestion of Paul Fenwick, value
'undef' is returned if no valid data could be dowloaded
(previously it was returning empty strings in such cases).
2003-07-07 Pawel Konieczny
* AEX module: added label 'symbol'
2003-07-06 Pawel Konieczny
* Update of F::Q::AEX module: added a remap functionality
which translates the official stock ticker to AEX CGI
symbol
* Update of F::Q::AEX module: Distiguishing indices and stocks:
indices will have "currency" label undefined, stocks will have
value "EUR". This fixes the currency conversion problem for
indices.
* Update of F::Q::AEX module: Cleanup of labels: "offer" renamed to
"ask" ("ask" is more common, besides, it can be
currency-converted). Label "offer" stays for backward
compatibility.
* Update of F::Q::AEX module: Cleanup of garbage in some fields.
(Ocassionally, the http fetch & parse will return garbage for
some values).
2003-07-04 Paul Fenwick
* Fixed currency conversion problems. (#232075)
* Fixed ASX problems whereby quotes were not being obtained.
Thanks to Rik Harris for bringing this issue to light,
and providing a correct URL. (#653025)
* Fixed problem where no symbol tag was being defined in ASX.
Thanks again to Rik Harris. (#653035)
* Fixed problem where undefined currencies would be returned
as zero, and not undefined as occured in previous versions.
* Fixed tests in currency.t which assumed that conversion
could be done between EUR and former European currencies.
These are no longer supported due to a change in the
lookups provided by Yahoo.
* Updated Fidelity.pm to indicate its current non-working status.
* Added T. Rowe Price patches by David Hampton, which provide
a troweprice_direct method. (#666351)
* As above, for the Fidelity module. (#666353)
* Accepted David Hampton's patch to Yahoo currencies.
The correct currency will now be flagged on stocks regardless
of the module used to grab them. (#666361)
* Added Keith Refson's module to obtain quotes from
First Trust Portfolios L.P. Thanks to David Hampton
(again!) for supplying this. (#670202)
* Added Ganesan Rajagopal's excellent IndiaMutal module.
(#720896)
* Fixed Cdnfundlibrary to correctly set the success flag
when successful. Thanks to Robert Clark for finding
this bug. (#752395)
* Updated Tdwaterhouse.pm with Robert Clark's changes to
work with the new TD Waterhouse website. Many thanks
to Robert Clark again. (#750843)
* Added the BM Nesbitt Burns module provided by Robert
Clark, including test cases. (#752423).
* Updated BMONesbittBurns module to provide better date
handling, screening out of high-ascii characters from
fields, and removal of spurious debug output.
* CVSTAG: finance_quote_1_08
2003-02-04 Paul Fenwick
* Fixed VWD problem whereby no symbol was being returned.
Many thanks to Joachim Breitner for this fix. (#600698)
* Updated TrustNet documentation, thanks to David Hampton.
(#666349)
2002-06-25 Paul Fenwick
* Added ZI.pm and Union.pm modules. Thanks to Rainer Dorsch
for providing these.
2002-04-18 Paul Fenwick
* Patched Quote.pm after currency conversion started to fail.
Many thanks to Sean Wenzel for the fix.
* Updated documentation in ASX.pm and Trustnet.pm to note their
current functional unhappiness.
* CVSTAG: finance_quote_1_07
2001-12-19 Paul Fenwick
* Added Finance::Quote::Yahoo::Asia to provide lookup of
Asian stock quotes (not including Japan). Many thanks
to M.R.Muthu Kumar for this patch.
2001-07-23 Paul Fenwick
* Updated Yahoo::Europe.pm so that stocks fetched from the
Stockholm exhcnage (.ST) are correctly listed as being in
Swedish Krona (SEK).
2001-07-04 Paul Fenwick
* Confirmed debian packages release with Ross Peachey.
* Moved cvs tags in debian/* so that finance_quote_1_06
point to the files used in building 1.06, not those building
1.05.
2001-06-26 Paul Fenwick
* Added AEX module courtesy of Rob Sessink.
* Updated ASX module to use the new (again!) ASX website.
* Updated ASX module to use HTML::TableExtract. Code is much
simplier now.
* Updated Fidelity module to make use of the new fidelity website.
* Updated the Fidelity test to always test the fidelity_direct method.
* Bumped version number on F::Q to 1.06.
* Updated Trustnet module to assume GBP if no currency explicitly
shown.
* Updated Trustnet test because one of the funds we were looking
for had changed its name, causing the test to fail.
* Added AEX test suite to repository.
* Removed failover into Fool.pm support, as I'd like to do more
testing before it enters the failover system.
* Updated the FAQ.
* Updated the INSTALL file.
* Moved regression tests from /t to /test. Updated MANIFEST
file accordingly. This means that autoamtic installs from
CPAN won't run the regression tests, which was causing
installation to fail on some systems.
* Updated lists of copyright holders, SEE ALSO sections
in man-pages.
* CVSTAG: finance_quote_1_06
2001-06-25 Linas Vepstas
* Added Tdwaterhouse module from James A. Treacy.
2001-06-04 Brent Neal
* Fixed Tiaacref.pm to reflect new CGIs at www.tiaa-cref.org
New symbols available for the module - check the POD
documentation for more info.
2001-05-11 Paul Fenwick
* Tweaked VWD.pm to strip whitespace from currency and
remove asterisks from names.
2001-05-10 Volker Stuerzl
* Updated VWD.pm to account for changes in VWD website.
2001-05-09 Paul Fenwick
* Fixed strange behaviour which could occur when using
FQ_LOAD_QUOTELET environment variable. This now works
as intened.
* Added Jasmin Bertovic's Cdnfundlibrary module.
2001-05-08 Paul Fenwick
* Applied Leigh Wedding's patch to ASX.pm, after ASX changed
their website yet again! All is working happily once
more. Thanks Leigh.
* Added Tobias Vancura's F::Q::Fool module.
* Added Fool as a automatically loaded loaded module from
F::Quote.pm.
2001-04-05 Paul Fenwick
* Updated ASX.pm module to reflect changed location of
information on the ASX's website. (Still doesn't
help when the ASX site is totally broken, as is
too often the case.)
* Updated Trustnet.pm module to reflect changes to the
Trustnet site.
2001-02-16 Paul Fenwick
* Updated to repsect formatting changes in data fed to the
currency function.
* Updated Quote.pm to include updated information on
FQ_LOAD_QUOTELET
* CVSTAG: finance_quote_1_05
2001-01-22 Paul Fenwick
* Updated to respect the FQ_LOAD_QUOTELET environment variable
to auto-load custom Quotelet.
2001-12-05 Paul Fenwick
* Updated the Yahoo::USA source to finance.yahoo.com as
the quote.yahoo.com may become depreciated in the future.
Thanks to Iain Lea for spotting this.
2000-11-29 Paul Fenwick
* Updated the URL we obtain currency information to
http://uk.finance.yahoo.com/m5?"
* Updated docs in Yahoo/Europe.pm to note the Xtera exchange
moving from FX to DE.
* Thanks to Jan Willamowius for the above two changes.
2000-11-21 Paul Fenwick
* Extra code to ensure that currency-fields returned by a
Quotelet are unique. This prevents the potential bug of
a field undergoing currency conversion multiple times and
hence being quite off-track.
2000-11-05 Paul Fenwick
* BUG 121557: Fixed bug where the 40th symbol in a Yahoo lookup
would fail.
* F::Q::UserAgent is now ready for release, but is still considered
experimental. Users must explicitly turn it on by setting
$Finance::Quote::USE_EXPERIMENTAL_UA = 1;
* Updated the FAQ.
* Added MANIFEST file.
* CVSTAG: finance_quote_1_04
2000-10-29 Paul Fenwick
* F::Q now makes use of a custom F::Q::UserAgent to fetch
information. This is capable of doing proxy authentication
and other arbitary http-headers.
2000-10-27 Paul Fenwick
* Updated yahoo_europe test suite as one of the symbols we were
using for testing has since dissapeared. (Bankrupt? Merged?)
2000-10-20 Paul Fenwick
* Much better discovery of non-existant stocks in ASX.pm.
* Checks for possible divide-by-zero problems in ASX.pm.
Thanks to Stephen Stebbing for catching this.
* Updated ASX testing.
* Updated all test scripts to remove spurious warnings under
Perl 5.6.
* Updated ASX module to deal with stocks when they have market
announcements. Previously this would result in garbage being
returned for that stock.
* Updated VWD module so it can parse information from the new
VWD site.
* Updated F::Q version to 1.03.
* CVSTAG: finance_quote_1_03
2000-09-27 Paul Fenwick
* Updated Trustnet module with patch from Keith Refson.
2000-09-16 Paul Fenwick
* Added Volker's VWD module and testing script.
* Updated Makefile to check for HTML::TableExtract.
* Updated INSTALL file to provide infomation on how to install
modules that F::Q depends upon.
* Updated Quote.pm to load VWD, DWS and Trustnet by default.
* Updated README file to mention the webpage.
* Added Trustnet regression testing program.
* CVSTAG: finance_quote_1_02
2000-09-12 Paul Fenwick
* Mention of Bill Bell's java library in the FAQ.
2000-09-04 Paul Fenwick
* Keith Refson's patch to Trustnet to avoid premature returns
in case of a bad symbol.
2000-09-01 Paul Fenwick
* Tweaked ASX.pm to avoid divide-by-zero errors and dodgy
bogus-looking label values.
2000-08-31 Paul Fenwick
* Added Keith Refson's Trustnet module.
* Added .cvsignore file to reduce spam for developers using CVS.
* Updated Yahoo/USA.pm to provide more compatible returns when
called as a fidelity failover.
* Tweaked DWS.t testing script so that it loads the module
correctly.
2000-08-29 Paul Fenwick
* Rejiggered ASX module to try and make it work again after
an ASX site rewrite.
* Updated Quote.pm so that if a method was called directly
(old-style) not through fetch, then it would do the right
thing if called via an object. This means that things
like $q->asx(@stocks) work correctly again.
* Updated fetch() method so that it returns the empty list
rather than undef when called in an array context.
* fetch() now returns a hashref if called in a scalar context.
2000-08-22 Volker Stuerzl
* Added DWS test script.
2000-08-21 Paul Fenwick
* Improved documentation in the yahoo_europe test script.
2000-08-16 Paul Fenwick
* Added DWS.pm module to the CVS repository, courtesy of
Volker Stuerzl. This module fetches information from the
Deutsche Bank Gruppe.
* Updated asx.t script because it really hurts the entire
"make test" thing when ASX is unhappy. Now it still hurts
(because the ASX module sucks), but less.
2000-08-14 Paul Fenwick
* Updated chkshares script so that it can deal with any market,
not just the ASX.
2000-08-06 Paul Fenwick
* Updated regression testing scripts to make sure that spurious
percentage signs are no longer returned.
2000-08-04 Paul Fenwick
* Patched Yahoo::Base to no longer return spurious percentage signs.
2000-07-31 Paul Fenwick
* The currency function no longer makes an expensive HTTP
request if both the to and from currencies are identical.
2000-07-25 Paul Fenwick
* Finance::Quote::Yahoo::Base now removes more HTML-ish guff that
Yahoo tries to place in CSVs.
* Updated yahoo_europe.t to check that stocks from London are in
GBP.
* Finance::Quote::Yahoo::Europe now returns London stocks in
GBP. Previously it was incorrectly returning them in pence
and calling it Euros.
* Finance::Quote has a new scale_field() function that is used in
currency conversion and by some sub-modules (Yahoo::Europe). This
may be useful for future module writers.
* CVSTAG: finance_quote_1_01
2000-07-16 Paul Fenwick
* Documented the list of possible markets in Yahoo::Europe.
* Many many small syntax fixes in documentation.
* Expanded and improved webpage.
* Updated revision to 1.00
* Updated INSTALL documentation.
* CVSTAG: finance_quote_1_00
2000-07-15 Paul Fenwick
* Wrote documentation for Yahoo::Europe (incomplete) and
Yahoo::USA. Changed modules to require perl 5.005 because
we make use of some of its features (like hash slices).
* Improved labels documentation in Finance::Quote.
* Added exchange and method information (where possible)
to the various sub-modules.
* Improved chkshares example script to check for errors.
* Removed bad test in currency.t and replaced it with a better
one.
2000-07-13 Paul Fenwick
* Improved fidelity module such that it doesn't return information
about stocks we did not request.
2000-07-08 Paul Fenwick
* Added POD for TIAA-CREF and T. Rowe Price sub-modules.
2000-07-02 Paul Fenwick
* Many more documentation improvements in both the Finance::Quote
POD and the sub-modules.
2000-06-25 Paul Fenwick
* Documented many of the new 0.19 functions in the Finance::Quote
POD.
2000-06-24 Paul Fenwick
* Updated currency regression testing script.
* Updated currency fetching routines to handle different date
formats returned by Yahoo!
* Updated automatic currency conversion routines to avoid
spurious warnings.
2000-06-23 Paul Fenwick
* Cleaned up the hacker's guide.
* Updated Examples/stockdump.pl to allow currency to be specified.
* Automatic currency conversion now works.
* Updated ASX and Yahoo::USA to not tag indexes with currency
labels.
* Updated Yahoo::Base to automatically accomodate suffixes for
when we wish to add them automatically.
* Added Yahoo::Australia to look up Australian stocks.
* Tested failover of Yahoo::Australia to Yahoo::ASX.
2000-06-22 Paul Fenwick
* Added sections on currency conversion to the hacker's guide.
Now I just need to write the code. :)
# Added currency conversion code, but haven't tested it yet.
2000-06-21 Paul Fenwick
* Rolled all the Yahoo functions into a base pseudo-class.
* Fixed bug whereby large lookups in the yahoo functions would
overflow the maximum URL length of some proxies/servers.
* Expanded the number of fields available via Yahoo::Europe.
2000-06-17 Paul Fenwick
* Re-added currency lookups to Quote.pm
* Added regression testing script for currency.
* Added automatic currency conversion stub.
* Removed TODO file as we now keep track of outstanding jobs
in SourceForge.
2000-06-16 Paul Fenwick
* Added webpage to CVS repository.
2000-06-03 Jacinta Richardson
* Changed modules so they return undef in scalar context,
empty list in list context, on failure.
* Changed modules so they return a hashref when in scalar
context, and a hash in list context.
* Reviewed/corrected hackers guide.
* Added currency tags to existing modules to signal currency type
(AUD, EUR, USD)
* Added tests to check currency tags.
2000-06-03 Paul Fenwick
* Revived dead vanguard method by rolling it through Yahoo.
* Added labels method to everything.
* Added price labels to everything.
* Updated Quote.pm to query new labels methods.
* Provided a failover method for fidelity via Yahoo.
* Added failover functionality.
2000-05-31 Paul Fenwick
* Added Documentation/TODO.
2000-05-27 Paul Fenwick
* Added Documentation/Hackers-Guide.
* Tweaked Quote.pm to provide an AUTOLOAD method for those people
who don't want to go through the fetch() methods.
2000-05-14 Paul Fenwick
* Huge re-write and change of everything so that it should be easy
to plug in new modules without changing any existing code.
2000-05-13 Paul Fenwick
* Added Documentation/FAQ file.
2000-04-30 Paul Fenwick
* Updated POD.
* Improved returned error messages.
* Updated the README file.
* Updated the INSTALL file.
* Tagged files as finance_quote_0_18 for release.
2000-04-25 Paul Fenwick
* Rolled changes together when CVS got a little out-of-whack. :)
* Return many new fields from yahoo() which we previously fetched
but did not use. These include avg_vol, day_range, year_range,
div_date, div, and div_yield.
* Fixed typo in docs s/yeild/yield/;
* Added ex_div for Ex-Divident Date in yahoo().
2000-04-24 Brent Neal
* Finished updating error-checking for tiaacref. The tiaacref
function now returns a success/failure flag for every symbol
passed to it. It also checks that the data is valid. Returns
meaningful error messages for these failures.
2000-04-24 Paul Fenwick
* Updated in-line code regarding checking for Yahoo!
successes.
* Added meaningful error-messages to Yahoo! when stock
lookups fail.
2000-04-23 Paul Fenwick
* Added success/fail tests to asx, fidelity, troweprice, yahoo
and yahoo_europe.
* Updated appropriate testing functions.
* Updated documentation to include fetch and list of known
bugs.
* Updated yahoo_europe to return undef's instead of N/As.
* Removed HTML from returns from yahoo_europe.
* Fixed logic bug in process yahoo_* N/As into undefs.
2000-04-21 Brent Neal
* Added checking for bogus symbols in tiaacref
* Added checking of the LWP::UserAgent->is_success method
* tiaacref() now supports $stocks{$sym,'success'} notation.
* Updated t/tiaacref.t and Examples/Quote_example.pl for
the changes
2000-04-21 Paul Fenwick
* Added extra methods to fetch (nasdaq, nyse) which act as
aliases to yahoo.
* Added stockdump.pl example script, which is handy in debugging.
* fetch is now an exportable function.
* yahoo() function no longer returns entries for fields that
used to be returned as 'N/A'.
* yahoo() now supports the $stocks{$sym,'success'} notation.
2000-04-20 Paul Fenwick
* Removed misleading comments from Finance::Quote.pm
2000-04-18 Paul Fenwick
* Added fetch() function to provide a cleaner interface to fetching
quotes from a variety of sources.
* Added tests for fetch() to the asx.t test script.
2000-04-16 Paul Fenwick
* Added yahoo_europe test script.
* Removed depreciated vanguard function.
2000-04-14 Paul Fenwick
* Added TIAA-CREF testing script.
* Added troweprice testing script.
2000-04-13 Paul Fenwick
* Fidelity private functions renamed to indicate they are private.
* Small optimisations in fidelity functions to avoid spurious warnings
and un-needed processing of non-useful lines.
* Functions now quickly return undef when not passed a list of stocks.
Previously they would waste time looking up nothing.
* Documentation additions and corrections.
* Added test files (Use.t, asx.t, yahoo.t, fidelity.t)
* Added experimental function (currency) to look-up conversion
rates between currencies.
* Added an example script (currency-lookup.pl) to test said
currency conversion.
2000-04-10 Paul Fenwick
* Changed Examples/chkshares.pl to print a pretty table.
* Incorporated Cooper Vertz's patch to add high, low and net change
to quotes obtained from Yahoo!
2000-04-08 Paul Fenwick
* Integrated TIAA-CREF changes from Brent Neal.
* Changes to Makefile.PL to check dependancies, etc.
* Updated Examples/Quote_example.pl to include TIAA-CREF examples.
* CVSTAG: finance_quote_0_17
2000-04-06 Paul Fenwick
* CVSTAG: finance_quote_0_16
* Initial public release.
Finance-Quote-1.65/Examples/0000775000175000017500000000000015003302667015513 5ustar bschuckbschuckFinance-Quote-1.65/Examples/stockdump.pl0000755000175000017500000000076415003302667020071 0ustar bschuckbschuck#!/usr/bin/perl -w
use strict;
use lib '../lib';
use Finance::Quote;
use Data::Dumper;
use Getopt::Std;
# A very very simple script. Takes a source and a symbol, looks it up,
# and dumps it to STDOUT. Useful for debugging.
my %options = ('c' => '');
getopts('c:',\%options);
die "Usage: $0 [-c currency] source symbol\n" unless (defined $ARGV[1]);
my $q = Finance::Quote->new;
if ($options{'c'}) {
$q->set_currency($options{'c'});
}
my %quotes = $q->fetch(@ARGV);
print Dumper(\%quotes);
Finance-Quote-1.65/Examples/currency-lookup.pl0000755000175000017500000000076315003302667021220 0ustar bschuckbschuck#!/usr/bin/perl -w
use strict;
use lib '../lib';
use Finance::Quote;
# This script demonstrates how currencies can be converted using
# Finance::Quote.
# Example usage: currency-lookup.pl USD AUD
# (Converts from US Dollars to Australian Dollars)
die "Usage: $0 FROM TO\n" unless defined($ARGV[1]);
my $q = Finance::Quote->new();
my $exchange_rate = $q->currency($ARGV[0],$ARGV[1]);
die "Urgh! Nothing back\n" unless $exchange_rate;
print $ARGV[0]."->".$ARGV[1]." = ".$exchange_rate."\n";
Finance-Quote-1.65/Examples/Quote_example.pl0000755000175000017500000000477015003302667020671 0ustar bschuckbschuck#!/usr/bin/perl -w
#
# example script showing how to use the Quote perl module.
# gets prices for some stocks, for some mutual funds
#
# This script was originally part of GnuCash.
use lib '../lib';
use Finance::Quote;
my $q = Finance::Quote->new();
# -----------------------------------
# get quotes for two stocks ...
%quotes = $q->yahoo ("IBM", "SGI");
# print some selected values
print "NYSE by Yahoo: ", $quotes {"IBM", "name"},
" last price: ", $quotes {"IBM", "last"}, "\n";
print "NYSE by Yahoo: ", $quotes {"SGI", "name"},
" last price: ", $quotes {"SGI", "last"}, "\n";
# loop over and print all values.
# Notes that values are stored ion a multi-dimensional associative array
foreach $k (sort (keys %quotes)) {
($sym, $attr) = split ($;, $k, 2);
$val = $quotes {$sym, $attr};
# $val = $quotes {$k}; # this also works, if desired ...
print "\t$sym $attr =\t $val\n";
}
print "\n\n";
# -----------------------------------
# get quotes from Fidelity Investments
@funds = ("FGRIX", "FNMIX", "FASGX", "FCONX");
%quotes = $q->fidelity (@funds);
foreach $f (@funds) {
$name = $quotes {$f, "name"};
$nav = $quotes {$f, "nav"};
print "Fidelity Fund $f $name \tNAV = $nav\n";
}
print "\n\n";
# -----------------------------------
@funds = ("FGRXX");
%quotes = $q->fidelity (@funds);
print "Not all funds have a NAV; some have Yeilds:\n";
foreach $f (@funds) {
$name = $quotes {$f, "name"};
$yield = $quotes {$f, "yield"};
print "\tFidelity $f $name 30-day Yield = $yield percent\n";
}
print "\n\n";
# -----------------------------------
# demo T. Rowe Price -- same as above
@funds = ("PRFDX", "PRIDX");
%quotes = $q->troweprice (@funds);
foreach $f (@funds) {
$nav = $quotes {$f, "nav"};
$dayte = $quotes {$f, "date"};
print "T. Rowe Price $f NAV = $nav as of $dayte\n";
}
print "\n\n";
# -----------------------------------
# demo for ASX. Grab the price of Coles-Myer and Telstra
@funds = ("CML","TLS");
%quotes = $q->asx(@funds);
foreach $f (@funds) {
print "ASX Price of $f is ".$quotes{$f,"last"}." at ".
$quotes{$f,"date"}."\n";
}
print "\n\n";
# Demo for TIAA-CREF.
@funds = qw/CREFstok BOGOname TIAAreal CREFmony/;
%quotes = $q->tiaacref(@funds);
foreach $f (@funds) {
if ($quotes{$f,"success"} == 1) {
print "TIAA-CREF Price of ".$quotes{$f,"name"}." is ".$quotes{$f,"nav"}.
" at ".$quotes{$f,"date"}."\n";
} else {
print "Error: ".$quotes{$f,"errormsg"}." for ".$f."\n";
}
}
print "\n\n";
Finance-Quote-1.65/Examples/chkshares.pl0000755000175000017500000000247415003302667020033 0ustar bschuckbschuck#!/usr/bin/perl -w
use strict;
use lib '../lib';
use Finance::Quote qw/asx/;
=head1 NAME
chkshares.pl - Check share information.
=head1 USAGE
chkshares.pl australia TLS CML ITE
=head1 NOTES
Example program. Demonstrates how to use one of the interface to
Finance::Quote. The first argument must be the market.
=cut
my ($name, $date, $last, $p_change, $high, $low, $volume, $close);
format STDOUT_TOP =
STOCK REPORT
TICKER DATE LAST %CHANGE HIGH LOW VOLUME CLOSE
----------------------------------------------------------------------------------
.
format STDOUT =
@<<<<<< @>>>>>>>>>> @####.### @###.### @####.### @####.### @>>>>>>>> @####.###
$name, $date, $last, $p_change, $high, $low, $volume, $close
.
my $quoter = Finance::Quote->new();
my $market = shift || die "Usage: $0 market stocks\n";
my %quote = $quoter->fetch($market,@ARGV);
foreach my $code (@ARGV) {
unless ($quote{$code,"success"}) {
warn "Lookup of $code failed - ".$quote{$code,"errormsg"}."\n";
next;
}
$name = $code;
$date = $quote{$code,'date'};
$last = $quote{$code,'last'};
$p_change = $quote{$code,'p_change'};
$high = $quote{$code,'high'};
$low = $quote{$code,'low'};
$volume = $quote{$code,'volume'};
$close = $quote{$code,'close'};
write;
}
Finance-Quote-1.65/META.yml0000644000175000017500000000656215003302667015215 0ustar bschuckbschuck---
abstract: 'Get stock and mutual fund quotes from various exchanges'
author:
- 'Erik Colson '
- 'Bruce Schuck '
- 'Paul Fenwick '
- 'Vincent Lucarelli '
- 'David Hampton '
- 'moenny <>'
- 'jvolkening '
- 'Pawel Konieczny '
- 'Mike Alexander '
- 'AndreJ '
- 'Vinay S Shastry '
- 'Bradley Dean '
- 'Brent Neal '
- 'Jacinta Richardson '
- 'e-dorigatti '
- 'goodvibes2 '
- 'Paul Howarth '
- 'Sam Morris '
- 'Linas Vepstas '
- 'Rajan Vaswani <111571283+bgr22112@users.noreply.github.com>'
- 'Hiranya Samarasekera '
- 'Manuel Friedli '
- 'Przemysław Kryger '
- 'Achim Winkler '
- 'Diego Marcolungo '
- 'John Haiducek '
- 'alex314159 '
- 'gregor herrmann '
- 'Gustavo R. Montesino '
- 'Jalon Avens '
- 'Sigve Indregard '
- 'bgr22112 <111571283+bgr22112@users.noreply.github.com>'
- 'goodvibes2 '
build_requires:
Date::Manip: '0'
Date::Range: '0'
Date::Simple: '0'
DateTime: '0'
DateTime::Duration: '0'
DateTime::Format::ISO8601: '0'
File::Spec: '0'
Module::CPANTS::Analyse: '0'
String::Util: '0'
Test::Kwalitee: '0'
Test::More: '0'
Test::Perl::Critic: '0'
feature: '0'
open: '0'
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 0
generated_by: 'Dist::Zilla version 6.030, CPAN::Meta::Converter version 2.150010'
license: gpl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: '1.4'
name: Finance-Quote
requires:
Carp: '0'
Compress::Zlib: '0'
Date::Parse: '0'
DateTime::Format::Strptime: '0'
Encode: '0'
Exporter: '0'
HTML::Entities: '0'
HTML::TableExtract: '0'
HTML::TokeParser: '0'
HTML::TreeBuilder: '0'
HTML::TreeBuilder::XPath: '0'
HTTP::CookieJar::LWP: '0.014'
HTTP::Cookies: '0'
HTTP::Headers: '0'
HTTP::Request: '0'
HTTP::Request::Common: '0'
HTTP::Status: '0'
IO::Handle: '0'
IO::String: '0'
IO::Uncompress::Unzip: '0'
JSON: '0'
LWP::Protocol::http: '0'
LWP::Protocol::https: '0'
LWP::Simple: '0'
LWP::UserAgent: '6.48'
Module::Load: '0.36'
Mozilla::CA: '0'
POSIX: '0'
Readonly: '0'
Scalar::Util: '0'
Spreadsheet::XLSX: '0'
String::Util: '0'
Test2: '1.302167'
Text::Template: '0'
Time::Piece: '0'
Time::Seconds: '0'
Try::Tiny: '0'
URI::Escape: '3.31'
Web::Scraper: '0'
XML::LibXML: '0'
base: '0'
constant: '0'
if: '0'
perl: v5.10.1
strict: '0'
utf8: '0'
vars: '0'
warnings: '0'
resources:
bugtracker: https://github.com/finance-quote/finance-quote/issues
homepage: http://finance-quote.sourceforge.net/
repository: git://github.com/finance-quote/finance-quote
version: '1.65'
x_generated_by_perl: v5.34.0
x_serialization_backend: 'YAML::Tiny version 1.73'
x_spdx_expression: GPL-2.0-only
Finance-Quote-1.65/lib/0000775000175000017500000000000015003302667014503 5ustar bschuckbschuckFinance-Quote-1.65/lib/Finance/0000775000175000017500000000000015003302667016046 5ustar bschuckbschuckFinance-Quote-1.65/lib/Finance/Quote.pm0000644000175000017500000015440215003302667017505 0ustar bschuckbschuck#!/usr/bin/perl -w
#
# vi: set ts=2 sw=2 noai ic showmode showmatch:
#
# Copyright (C) 1998, Dj Padzensky
# Copyright (C) 1998, 1999 Linas Vepstas
# Copyright (C) 2000, Yannick LE NY
# Copyright (C) 2000, Paul Fenwick
# Copyright (C) 2000, Brent Neal
#
# 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.
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA
#
#
# This code derived from Padzensky's work on package Finance::YahooQuote,
# but extends its capabilites to encompas a greater number of data sources.
#
# This code was developed as part of GnuCash
package Finance::Quote;
use strict;
use constant DEBUG => $ENV{DEBUG};
use if DEBUG, 'Smart::Comments', '###';
use Module::Load;
use Exporter ();
use Carp;
use Finance::Quote::UserAgent;
use HTTP::Request::Common;
use Encode;
use JSON qw( decode_json );
use vars qw/@ISA @EXPORT @EXPORT_OK @EXPORT_TAGS
$TIMEOUT @MODULES %MODULES %METHODS $AUTOLOAD
@CURRENCY_RATES_MODULES $USE_EXPERIMENTAL_UA/;
our $VERSION = '1.65'; # VERSION
@CURRENCY_RATES_MODULES = qw/
AlphaVantage
CurrencyFreaks
ECB
FinanceAPI
Fixer
OpenExchange
YahooJSON
/;
@MODULES = qw/
AEX
ASEGR
ASX
AlphaVantage
BSEIndia
Bloomberg
BorsaItaliana
Bourso
BVB
CSE
Comdirect
Consorsbank
Currencies
Deka
FinanceAPI
Finanzpartner
Fondsweb
Fool
FTfunds
GoldMoney
GoogleWeb
HU
IndiaMutual
MarketWatch
MorningstarCH
MorningstarJP
MorningstarUK
NSEIndia
NZX
OnVista
Oslobors
SEB
SIX
Sinvestor
StockData
Stooq
TesouroDireto
Tiaacref
TMX
Tradegate
TreasuryDirect
Troweprice
TSP
TwelveData
Union
XETRA
YahooJSON
YahooWeb
ZA
/;
@ISA = qw/Exporter/;
@EXPORT = ();
@EXPORT_OK = qw/troweprice asx tiaacref
currency_lookup/;
@EXPORT_TAGS = ( all => [@EXPORT_OK]);
$USE_EXPERIMENTAL_UA = 0;
################################################################################
#
# Private Class Methods
#
################################################################################
# Autoload method for obsolete methods. This also allows people to
# call methods that objects export without having to go through fetch.
sub AUTOLOAD {
my $method = $AUTOLOAD;
(my $name = $method) =~ s/.*:://;
# Force the dummy object (and hence default methods) to be loaded.
_dummy();
if (exists($METHODS{$name})) {
no strict 'refs'; ## no critic
*$method = sub {
my $this = ref($_[0]) ? shift : _dummy();
$this->fetch($name, @_);
};
return &$method;
}
carp "$AUTOLOAD does not refer to a known method.";
}
# Dummy destroy function to avoid AUTOLOAD catching it.
sub DESTROY { return; }
# _convert (private object method)
#
# This function converts between one currency and another. It expects
# to receive a hashref to the information, a reference to a list
# of the stocks to be converted, and a reference to a list of fields
# that conversion should apply to.
{
my %conversion; # Conversion lookup table.
sub _convert {
my $this = shift;
my $info = shift;
my $stocks = shift;
my $convert_fields = shift;
my $new_currency = $this->{"currency"};
# Skip all this unless they actually want conversion.
return unless $new_currency;
foreach my $stock (@$stocks) {
my $currency;
# Skip stocks that don't have a currency.
next unless ($currency = $info->{$stock,"currency"});
# Skip if it's already in the same currency.
next if ($currency eq $new_currency);
# Lookup the currency conversion if we haven't
# already.
unless (exists $conversion{$currency,$new_currency}) {
$conversion{$currency,$new_currency} =
$this->currency($currency,$new_currency);
}
# Make sure we have a reasonable currency conversion.
# If we don't, mark the stock as bad.
unless ($conversion{$currency,$new_currency}) {
$info->{$stock,"success"} = 0;
$info->{$stock,"errormsg"} =
"Currency conversion failed.";
next;
}
# Okay, we have clean data. Convert it. Ideally
# we'd like to just *= entire fields, but
# unfortunately some things (like ranges,
# capitalisation, etc) don't take well to that.
# Hence we pull out any numbers we see, convert
# them, and stick them back in. That's pretty
# yucky, but it works.
foreach my $field (@$convert_fields) {
next unless (defined $info->{$stock,$field});
$info->{$stock,$field} = $this->scale_field($info->{$stock,$field},$conversion{$currency,$new_currency});
}
# Set the new currency.
$info->{$stock,"currency"} = $new_currency;
}
}
}
# =======================================================================
# _dummy (private function)
#
# _dummy returns a Finance::Quote object. I'd really rather not have
# this, but to maintain backwards compatibility we hold on to it.
{
my $dummy_obj;
sub _dummy {
return $dummy_obj ||= Finance::Quote->new;
}
}
# _load_module (private class method)
# _load_module loads a module(s) and registers its various methods for
# use.
sub _load_modules {
my $class = shift;
my $baseclass = ref $class || $class;
my @modules = @_;
# Go to each module and use them. Also record what methods
# they support and enter them into the %METHODS hash.
foreach my $module (@modules) {
my $modpath = "${baseclass}::${module}";
unless (defined($MODULES{$modpath})) {
eval {
load $modpath;
$MODULES{$modpath} = 1;
my %methodhash = $modpath->methods;
my %labelhash = $modpath->labels;
my $curr_fields_func = $modpath->can("currency_fields") || \&default_currency_fields;
my @currency_fields = &$curr_fields_func;
my %seen;
@currency_fields = grep {!$seen{$_}++} @currency_fields;
foreach my $method (keys %methodhash) {
push (@{$METHODS{$method}},
{ name => $module,
modpath => $modpath,
function => $methodhash{$method},
labels => $labelhash{$method},
currency_fields => \@currency_fields});
}
};
carp $@ if $@;
}
}
}
# _smart_compare (private method function)
#
# This function compares values where the method depends on the
# type of the parameters.
# val1, val2
# scalar,scaler - test for substring match
# scalar,regex - test val1 against val2 regex
# array,scalar - return true if any element of array substring matches scalar
# array,regex - return true if any element of array matches regex
sub _smart_compare {
my ($val1, $val2) = @_;
if ( ref $val1 eq 'ARRAY' ) {
if ( ref $val2 eq 'Regexp' ) {
my @r = grep {$_ =~ $val2} @$val1;
return @r > 0;
}
else {
my @r = grep {$_ =~ /$val2/} @$val1;
return @r > 0;
}
}
else {
if ( ref $val2 eq 'Regexp' ) {
return $val1 =~ $val2;
}
else {
return index($val1, $val2) > -1
}
}
}
# This is a list of fields that will be automatically converted during
# currency conversion. If a module provides a currency_fields()
# function then that list will be used instead.
sub get_default_currency_fields {
return qw/last high low net bid ask close open day_range year_range
eps div cap nav price/;
}
sub get_default_timeout {
return $TIMEOUT;
}
# get_methods returns a list of sources which can be passed to fetch to
# obtain information.
sub get_methods {
# Create a dummy object to ensure METHODS is populated
my $t = Finance::Quote->new();
return(wantarray ? keys %METHODS : [keys %METHODS]);
}
# return hash:
#
# quote_methods => hash of
# method_name => array of module names
# quote_modules => hash of
# module_name => array of parameters
# currency_modules => hash of
# module_name => array of parameters
#
# {
# 'quote_methods' => {'group' => ['module', 'module'], ...},
# 'quote_modules' => {'abc' => ['API_KEY'], ...},
# 'currency_modules' => {'xyz' => [], 'lmn' => ['USER_NAME', 'API_KEY']},
# }
sub get_features {
# Create a dummy object to ensure METHODS is populated
my $t = Finance::Quote->new(currency_rates => {order => \@CURRENCY_RATES_MODULES});
my $baseclass = ref $t;
my %feature = (
'quote_methods' => {map {$_, [map {$_->{name}} @{$METHODS{$_}}]} keys %METHODS},
'quote_modules' => {map {$_, []} @MODULES},
'currency_modules' => {map {$_, []} @CURRENCY_RATES_MODULES},
);
my %mods = ('quote_modules' => $baseclass,
'currency_modules' => "${baseclass}::CurrencyRates");
while (my ($field, $base) = each %mods) {
foreach my $name (keys %{$feature{$field}}) {
my $modpath = "${base}::${name}";
if ($modpath->can("parameters")) {
push (@{$feature{$field}->{$name}}, $modpath->parameters());
}
}
}
return %feature;
}
# =======================================================================
# new (public class method)
#
# Returns a new Finance::Quote object.
#
# Arguments ::
# - zero or more module names from the Finance::Quote::get_sources list
# - zero or more named parameters, passes as name => value
#
# Named Parameters ::
# - timeout # timeout in seconds for web requests
# - failover # boolean value indicating if failover is acceptable
# - fetch_currency # currency code for fetch results
# - required_labels # array of required labels in fetch results
# - # hash specific to various Finance::Quote modules
#
# new() # default constructor
# new('a', 'b') # load only modules a and b
# new(timeout => 30) # load all default modules, set timeout
# new('a', fetch_currency => 'X') # load only module a, use currency X for results
# new('z' => {API_KEY => 'K'}) # load all modules, pass hash to module z constructor
# new('z', 'z' => {API_KEY => 'K'}) # load only module z and pass hash to its constructor
#
# Enivornment Variables ::
# - FQ_LOAD_QUOTELET # if no modules named in argument list, use ones in this variable
#
# Return Value ::
# - Finanace::Quote object
sub new {
# Create and bless object
my $self = shift;
my $class = ref($self) || $self;
my $this = {};
bless $this, $class;
# To add a named parameter:
# 0. Document it in the POD for new
# 1. Add a default value for $this->{object-name}
# 2. Add the 'user-visible-name' => [type, object-name] to %named_parameter
# Check for FQ_CURRENCY - preferred currency module
# Set to AlphaVantage if not set or not in @CURRENCY_RATES_MODULES
my $CURRENCY_MODULE;
if (!$ENV{FQ_CURRENCY}) {
$CURRENCY_MODULE='AlphaVantage';
} else {
if ( grep( /^$ENV{FQ_CURRENCY}$/, @CURRENCY_RATES_MODULES ) ) {
$CURRENCY_MODULE=$ENV{FQ_CURRENCY}
} else {
$CURRENCY_MODULE='AlphaVantage';
}
}
# Default values
$this->{FAILOVER} = 1;
$this->{REQUIRED} = [];
$this->{TIMEOUT} = $TIMEOUT if defined($TIMEOUT);
$this->{currency_rates} = {order => [$CURRENCY_MODULE]};
# Sort out arguments
my %named_parameter = (timeout => ['', 'TIMEOUT'],
failover => ['', 'FAILOVER'],
fetch_currency => ['', 'currency'],
required_labels => ['ARRAY', 'REQUIRED'],
currency_rates => ['HASH', 'currency_rates']);
$this->{module_specific_data} = {};
my @load_modules = ();
for (my $i = 0; $i < @_; $i++) {
if (exists $named_parameter{$_[$i]}) {
die "missing value for named parameter $_[$i]" if $i + 1 == @_;
die "unexpect type for value of named parameter $_[$i]" if ref $_[$i+1] ne $named_parameter{$_[$i]}[0];
$this->{$named_parameter{$_[$i]}[1]} = $_[$i+1];
$i += 1;
}
elsif ($i + 1 < @_ and ref $_[$i+1] eq 'HASH') {
$this->{module_specific_data}->{$_[$i]} = $_[$i+1];
$i += 1;
}
elsif ($_[$i] eq '-defaults') {
push (@load_modules, @MODULES);
}
else {
push (@load_modules, $_[$i]);
}
}
# Honor FQ_LOAD_QUOTELET if @load_modules is empty
if ($ENV{FQ_LOAD_QUOTELET} and !@load_modules) {
@load_modules = split(' ',$ENV{FQ_LOAD_QUOTELET});
if ($load_modules[0] eq '-defaults') {
shift @load_modules;
push(@load_modules, @MODULES);
}
}
elsif (@load_modules == 0) {
push(@load_modules, @MODULES);
}
$this->_load_modules(@load_modules);
# Load the currency rate methods
my %currency_check = map { $_ => 1 } @CURRENCY_RATES_MODULES;
$this->{currency_rate_method} = [];
foreach my $method (@{$this->{currency_rates}->{order}}) {
unless (defined($currency_check{$method})) {
carp "Unknown curreny rates method: $method";
return;
}
my $method_path = "${class}::CurrencyRates::${method}";
eval {
autoload $method_path;
my $args = exists $this->{currency_rates}->{lc($method)} ? $this->{currency_rates}->{lc($method)} : {};
my $rate = $method_path->new($args);
die unless defined $rate;
push(@{$this->{currency_rate_method}}, $rate);
};
if ($@) {
next;
}
}
return $this;
}
sub set_default_timeout {
$TIMEOUT = shift;
}
################################################################################
#
# Private Object Methods
#
################################################################################
# _require_test (private object method)
#
# This function takes an array. It returns true if all required
# labels appear in the arrayref. It returns false otherwise.
#
# This function could probably be made more efficient.
sub _require_test {
my $this = shift;
my %available;
@available{@_} = (); # Ooooh, hash-slice. :)
my @required = @{$this->{REQUIRED}};
return 1 unless @required;
for (my $i = 0; $i < @required; $i++) {
return 0 unless exists $available{$required[$i]};
}
return 1;
}
################################################################################
#
# Public Object Methods
#
################################################################################
# If $str ends with a B like "20B" or "1.6B" then expand it as billions like
# "20000000000" or "1600000000".
#
# This is done with string manipulations so floating-point rounding doesn't
# produce spurious digits for values like "1.6" which aren't exactly
# representable in binary.
#
# Is "B" for billions the only abbreviation from Yahoo?
# Could extend and rename this if there's also millions or thousands.
#
# For reference, if the value was just for use within perl then simply
# substituting to exponential "1.5e9" might work. But expanding to full
# digits seems a better idea as the value is likely to be printed directly
# as a string.
sub B_to_billions {
my ($self,$str) = @_;
# B_to_billions() $str
if ($str =~ s/B$//i) {
$str = $self->decimal_shiftup ($str, 9);
}
return $str;
}
# $str is a number like "123" or "123.45"
# return it with the decimal point moved $shift places to the right
# must have $shift>=1
# eg. decimal_shiftup("123",3) -> "123000"
# decimal_shiftup("123.45",1) -> "1234.5"
# decimal_shiftup("0.25",1) -> "2.5"
#
sub decimal_shiftup {
my ($self, $str, $shift) = @_;
# delete decimal point and set $after to count of chars after decimal.
# Leading "0" as in "0.25" is deleted too giving "25" so as not to end up
# with something that might look like leading 0 for octal.
my $after = ($str =~ s/(?:^0)?\.(.*)/$1/ ? length($1) : 0);
$shift -= $after;
# now $str is an integer and $shift is relative to the end of $str
if ($shift >= 0) {
# moving right, eg. "1234" becomes "12334000"
return $str . ('0' x $shift); # extra zeros appended
} else {
# negative means left, eg. "12345" becomes "12.345"
# no need to prepend zeros since demanding initial $shift>=1
substr ($str, $shift,0, '.'); # new '.' at shifted spot from end
return $str;
}
}
# =======================================================================
# fetch (public object method)
#
# Fetch is a wonderful generic fetcher. It takes a method and stuff to
# fetch. It's a nicer interface for when you have a list of stocks with
# different sources which you wish to deal with.
sub fetch {
my $this = ref($_[0]) ? shift : _dummy();
my $method = lc(shift);
my @stocks = @_;
unless (exists $METHODS{$method}) {
carp "Undefined fetch-method $method passed to ".
"Finance::Quote::fetch";
return;
}
{
no strict 'vars';
our $VERSION = '0.00' unless defined $VERSION;
unless ($ENV{"FQ_NOCOUNT"}) {
# Temporary Counting - not concerned about return code
my $COUNT_URL =
'http://www.panix.com/~hd-fxsts/finance-quote.html?' . $VERSION . '&' . $method;
my $count_ua = LWP::UserAgent->new(timeout => 10);
my $count_response = $count_ua->head($COUNT_URL);
### COUNT_URL: $COUNT_URL
### Code: $count_response->code
}
}
# Failover code. This steps through all available methods while
# we still have failed stocks to look-up. This loop only
# runs a single time unless FAILOVER is defined.
my %returnhash = ();
foreach my $methodinfo (@{$METHODS{$method}}) {
my $funcref = $methodinfo->{"function"};
next unless $this->_require_test(@{$methodinfo->{"labels"}});
my @failed_stocks = ();
%returnhash = (%returnhash,&$funcref($this,@stocks));
foreach my $stock (@stocks) {
push(@failed_stocks,$stock)
unless ($returnhash{$stock,"success"});
}
$this->_convert(\%returnhash,\@stocks,
$methodinfo->{"currency_fields"});
last unless $this->{FAILOVER};
last unless @failed_stocks;
@stocks = @failed_stocks;
}
return wantarray() ? %returnhash : \%returnhash;
}
sub get_failover {
my $self = shift;
return $self->{FAILOVER};
}
sub get_fetch_currency {
my $self = shift;
return $self->{currency};
}
sub get_required_labels {
my $self = shift;
return $self->{REQUIRED};
}
sub get_timeout {
my $self = shift;
return $self->{TIMEOUT};
}
sub get_user_agent {
my $this = shift;
return $this->{UserAgent} if $this->{UserAgent};
my $ua;
if ($USE_EXPERIMENTAL_UA) {
$ua = Finance::Quote::UserAgent->new;
} else {
$ua = LWP::UserAgent->new;
}
$ua->timeout($this->{TIMEOUT}) if defined($this->{TIMEOUT});
$ua->env_proxy;
$this->{UserAgent} = $ua;
return $ua;
}
sub isoTime {
my ($self,$timeString) = @_ ;
$timeString =~ tr/ //d ;
$timeString = uc $timeString ;
my $retTime = "00:00"; # return zero time if unparsable input
if ($timeString=~m/^(\d+)[\.:UH](\d+) *(AM|am|PM|pm)?/) {
my ($hours,$mins)= ($1-0,$2-0) ;
$hours-=12 if ($hours==12 && $3 && ($3 =~ /AM/i));
$hours+=12 if ($3 && ($3 =~ /PM/i) && ($hours != 12));
if ($hours>=0 && $hours<=23 && $mins>=0 && $mins<=59 ) {
$retTime = sprintf ("%02d:%02d", $hours, $mins) ;
}
}
return $retTime;
}
sub set_failover {
my $self = shift;
$self->{FAILOVER} = shift;
}
sub set_fetch_currency {
my $self = shift;
$self->{currency} = shift;
}
sub set_required_labels {
my $self = shift;
$self->{REQUIRED} = shift;
}
sub set_timeout {
my $self = shift;
$self->{TIMEOUT} = shift;
}
# =======================================================================
# store_date (public object method)
#
# Given the various pieces of a date, this functions figure out how to
# store them in both the pre-existing US date format (mm/dd/yyyy), and
# also in the ISO date format (yyyy-mm-dd). This function expects to
# be called with the arguments:
#
# (inforef, symbol_name, data_hash)
#
# The components of date hash can be any of:
#
# usdate - A date in mm/dd/yy or mm/dd/yyyy
# eurodate - A date in dd/mm/yy or dd/mm/yyyy
# isodate - A date in yy-mm-dd or yyyy-mm-dd, yyyy/mm/dd, yyyy.mm.dd, or yyyymmdd
# year - The year in yyyy
# month - The month in mm or mmm format (i.e. 07 or Jul)
# day - The day
# today - A flag to indicate todays date should be used.
#
# The separator for the *date forms is ignored. It can be any
# non-alphanumeric character. Any combination of year, month, and day
# values can be provided. Missing fields are filled in based upon
# today's date.
#
sub store_date
{
my $this = shift;
my $inforef = shift;
my $symbol = shift;
my $piecesref = shift;
my ($year, $month, $day, $this_month, $year_specified);
my %mnames = (jan => 1, feb => 2, mar => 3, apr => 4, may => 5, jun => 6,
jul => 7, aug => 8, sep => 9, oct =>10, nov =>11, dec =>12);
### store_date symbol: $symbol
### store_date pieces: $piecesref
# Default to today's date.
($month, $day, $year) = (localtime())[4,3,5];
$month++;
$year += 1900;
$this_month = $month;
$year_specified = 0;
# Process the inputs
if ((defined $piecesref->{isodate}) && ($piecesref->{isodate})) {
if ($piecesref->{isodate} =~ /^([0-9]{4})([0-9]{2})([0-9]{2})$/) {
($year, $month, $day) = ($1, $2, $3);
}
else {
($year, $month, $day) = ($piecesref->{isodate} =~ m|([0-9]{4})\W+(\w+)\W+(\w+)|);
}
$year += 2000 if $year < 100;
$year_specified = 1;
### format: printf "isodate %s -> Day %d, Month %s, Year %d\n", $piecesref->{isodate}, $day, $month, $year
}
if ((defined $piecesref->{usdate}) && ($piecesref->{usdate})) {
($month, $day, $year) = ($piecesref->{usdate} =~ /(\w+)\W+(\d+)\W+(\d+)/);
$year += 2000 if $year < 100;
$year_specified = 1;
### format: printf STDERR "usdate %s -> Day %d, Month %s, Year %d\n", $piecesref->{usdate}, $day, $month, $year
}
if ((defined $piecesref->{eurodate}) && ($piecesref->{eurodate})) {
($day, $month, $year) = ($piecesref->{eurodate} =~ /(\d+)\W+(\w+)\W+(\d+)/);
$year += 2000 if $year < 100;
$year_specified = 1;
### format: printf STDERR "eurodate %s -> Day %d, Month %s, Year %d\n", $piecesref->{eurodate}, $day, $month, $year
}
if (defined ($piecesref->{year})) {
$year = $piecesref->{year};
$year += 2000 if $year < 100;
$year_specified = 1;
### format: printf "year %s -> Year %d\n", $piecesref->{year}, $year
}
if (defined ($piecesref->{month})) {
$month = $piecesref->{month};
### format: printf "month %s -> Month %s\n", $piecesref->{month}, $month
}
if (defined ($piecesref->{day})) {
$day = $piecesref->{day};
### format: printf "day %s -> Day %d\n", $piecesref->{day}, $day
}
$month = $mnames{lc(substr($month,0,3))} if ($month =~ /\D/);
$year-- if (($year_specified == 0) && ($this_month < $month));
### format: printf STDERR "Final Year-Month-Day -> %04d-%02d-%02d\n", $year, $month, $day
$inforef->{$symbol, "date"} = sprintf "%02d/%02d/%04d", $month, $day, $year;
$inforef->{$symbol, "isodate"} = sprintf "%04d-%02d-%02d", $year, $month, $day;
}
################################################################################
#
# Public Class or Object Methods
#
################################################################################
# =======================================================================
# Helper function that can scale a field. This is useful because it
# handles things like ranges "105.4 - 108.3", and not just straight fields.
#
# The function takes a string or number to scale, and the factor to scale
# it by. For example, scale_field("1023","0.01") would return "10.23".
sub scale_field {
shift if ref $_[0]; # Shift off the object, if there is one.
my ($field, $scale) = @_;
my @chunks = split(/([^0-9.])/,$field);
for (my $i=0; $i < @chunks; $i++) {
next unless $chunks[$i] =~ /\d/;
$chunks[$i] *= $scale;
}
return join("",@chunks);
}
# =======================================================================
# currency (public object method)
#
# currency allows the conversion of one currency to another.
#
# Usage: $quoter->currency("USD","AUD");
# $quoter->currency("15.95 USD","AUD");
#
# undef is returned upon error.
sub currency {
my $this = ref($_[0]) ? shift : _dummy();
my ($from_code, $to_code) = @_;
return unless ($from_code and $to_code);
$from_code =~ s/^\s*(\d*\.?\d*)\s*//;
my $amount = $1 || 1;
$to_code = uc($to_code);
$from_code = uc($from_code);
return $amount if ($from_code eq $to_code); # Trivial case.
my $ua = $this->get_user_agent;
foreach my $rate (@{$this->{currency_rate_method}}) {
### rate: ref($rate)
my $final = eval {
my ($from, $to) = $rate->multipliers($ua, $from_code, $to_code);
die("Failed to find currency rates for $from_code or $to_code") unless defined $from and defined $to;
### to weight : $to
### from weight: $from
### amount : $amount
# Is from closest to (amount, to, amount * to)?
# (amount * to) / from
my $delta = abs($amount - $from);
my $result = ($amount/$from) * $to;
### amount/from -> delta/result : ($delta, $result)
if ($delta > abs($to - $from)) {
$delta = abs($to - $from);
$result = ($to/$from) * $amount;
### to/from -> delta/result : ($delta, $result)
}
if ($delta > abs($amount*$to - $from)) {
$delta = abs($amount*$to - $from);
$result = ($amount * $to)/$from;
### (amount * to)/from -> delta/result : ($delta, $result)
}
return $result;
};
if ($@) {
### Rate Error: chomp($@), $@
next;
}
return $final;
}
return;
}
# =======================================================================
# currency_lookup (public object method)
#
# search for available currency codes
#
# Usage:
# $currency = $quoter->currency_lookup();
# $currency = $quoter->currency_lookup( name => "Dollar");
# $currency = $quoter->currency_loopup( country => qw/denmark/i );
# $currency = $q->currency_lookup(country => qr/united states/i, number => 840);
#
# If more than one lookup parameter is given all must match for
# a currency to match.
#
# undef is returned upon error.
sub currency_lookup {
my $this = ref $_[0] ? shift : _dummy();
my %params = @_;
my $currencies = Finance::Quote::Currencies::known_currencies();
my %attributes = map {$_ => 1} map {keys %$_} values %$currencies;
for my $key (keys %params ) {
if ( ! exists $attributes{$key}) {
warn "Invalid parameter: $key";
return;
}
}
while (my ($tag, $check) = each(%params)) {
$currencies = {map {$_ => $currencies->{$_}} grep {_smart_compare($currencies->{$_}->{$tag}, $check)} keys %$currencies};
}
return $currencies;
}
# =======================================================================
# parse_csv (public object method)
#
# Grabbed from the Perl Cookbook. Parsing csv isn't as simple as you thought!
#
sub parse_csv
{
shift if (ref $_[0]); # Shift off the object if we have one.
my $text = shift; # record containing comma-separated values
my @new = ();
push(@new, $+) while $text =~ m{
# the first part groups the phrase inside the quotes.
# see explanation of this pattern in MRE
"([^\"\\]*(?:\\.[^\"\\]*)*)",?
| ([^,]+),?
| ,
}gx;
push(@new, undef) if substr($text, -1,1) eq ',';
return @new; # list of values that were comma-separated
}
# =======================================================================
# parse_csv_semicolon (public object method)
#
# Grabbed from the Perl Cookbook. Parsing csv isn't as simple as you thought!
#
sub parse_csv_semicolon
{
shift if (ref $_[0]); # Shift off the object if we have one.
my $text = shift; # record containing comma-separated values
my @new = ();
push(@new, $+) while $text =~ m{
# the first part groups the phrase inside the quotes.
# see explanation of this pattern in MRE
"([^\"\\]*(?:\\.[^\"\\]*)*)";?
| ([^;]+);?
| ;
}gx;
push(@new, undef) if substr($text, -1,1) eq ';';
return @new; # list of values that were comma-separated
}
###############################################################################
#
# Legacy Class Methods
#
###############################################################################
sub sources {
return get_methods();
}
sub default_currency_fields {
return get_default_currency_fields();
}
###############################################################################
#
# Legacy Class or Object Methods
#
###############################################################################
# =======================================================================
# set_currency (public object method)
#
# set_currency allows information to be requested in the specified
# currency. If called with no arguments then information is returned
# in the default currency.
#
# Requesting stocks in a particular currency increases the time taken,
# and the likelyhood of failure, as additional operations are required
# to fetch the currency conversion information.
#
# This method should only be called from the quote object unless you
# know what you are doing.
sub set_currency {
if (@_ == 1 or !ref($_[0])) {
# Direct or class call - there is no class default currency
return;
}
my $this = shift;
if (defined($_[0])) {
$this->set_fetch_currency($_[0]);
}
return $this->get_fetch_currency();
}
# =======================================================================
# Timeout code. If called on a particular object, then it sets
# the timout for that object only. If called as a class method
# (or as Finance::Quote::timeout) then it sets the default timeout
# for all new objects that will be created.
sub timeout {
if (@_ == 1 or !ref($_[0])) {
# Direct or class call
Finance::Quote::set_default_timeout(shift);
return Finance::Quote::get_default_timeout();
}
# Otherwise we were called through an object. Yay.
# Set the timeout in this object only.
my $this = shift;
$this->set_timeout(shift);
return $this->get_timeout();
}
###############################################################################
#
# Legacy Object Methods
#
###############################################################################
# =======================================================================
# failover (public object method)
#
# This sets/gets whether or not it's acceptable to use failover techniques.
sub failover {
my $this = shift;
my $value = shift;
$this->set_failover($value) if defined $value;
return $this->get_failover();
}
# =======================================================================
# require_labels (public object method)
#
# Require_labels indicates which labels are required for lookups. Only methods
# that have registered all the labels specified in the list passed to
# require_labels() will be called.
#
# require_labels takes a list of required labels. When called with no
# arguments, the require list is cleared.
#
# This method always succeeds.
sub require_labels {
my $this = shift;
my @labels = @_;
$this->set_required_labels(\@labels);
return;
}
# =======================================================================
# user_agent (public object method)
#
# Returns a LWP::UserAgent which conforms to the relevant timeouts,
# proxies, and other settings on the particular Finance::Quote object.
#
# This function is mainly intended to be used by the modules that we load,
# but it can be used by the application to directly play with the
# user-agent settings.
sub user_agent {
my $this = shift;
return $this->get_user_agent();
}
1;
__END__
=for comment README.md generated from lib/Finance/Quote.pm
=head1 NAME
Finance::Quote - Get stock and mutual fund quotes from various exchanges
=head1 SYNOPSIS
use Finance::Quote;
$q = Finance::Quote->new;
%quotes = $q->fetch("nasdaq", @stocks);
=head1 DESCRIPTION
This module gets stock quotes from various internet sources all over the world.
Quotes are obtained by constructing a quoter object and using the fetch method
to gather data, which is returned as a two-dimensional hash (or a reference to
such a hash, if called in a scalar context). For example:
$q = Finance::Quote->new;
%info = $q->fetch("australia", "CML");
print "The price of CML is ".$info{"CML", "price"};
The first part of the hash (eg, "CML") is referred to as the stock.
The second part (in this case, "price") is referred to as the label.
=head2 LABELS
When information about a stock is returned, the following standard labels may
be used. Some custom-written modules may use labels not mentioned here. If
you wish to be certain that you obtain a certain set of labels for a given
stock, you can specify that using require_labels().
ask Ask
avg_vol Average Daily Vol
bid Bid
cap Market Capitalization
close Previous Close
currency Currency code for the returned data
date Last Trade Date (MM/DD/YY format)
day_range Day's Range
div Dividend per Share
div_date Dividend Pay Date
div_yield Dividend Yield
eps Earnings per Share
errormsg If success is false, this field may contain the reason why.
ex_div Ex-Dividend Date.
exchange The exchange the information was obtained from.
high Highest trade today
isin International Securities Identification Number
isodate ISO 8601 formatted date
last Last Price
low Lowest trade today
method The module (as could be passed to fetch) which found this information.
name Company or Mutual Fund Name
nav Net Asset Value
net Net Change
open Today's Open
p_change Percent Change from previous day's close
pe P/E Ratio
success Did the stock successfully return information? (true/false)
time Last Trade Time
type The type of equity returned
volume Volume
year_range 52-Week Range
yield Yield (usually 30 day avg)
If all stock lookups fail (possibly because of a failed connection) then the
empty list may be returned, or undef in a scalar context.
=head1 INSTALLATION
Please note that the Github repository is not meant for general users
of Finance::Quote for installation.
If you downloaded the Finance-Quote-N.NN.tar.gz tarball from CPAN
(N.NN is the version number, ex: Finance-Quote-1.50.tar.gz),
run the following commands:
tar xzf Finance-Quote-1.50.tar.gz
cd Finance-Quote-1.50.tar.gz
perl Makefile.PL
make
make test
make install
If you have the CPAN module installed:
Using cpanm (Requires App::cpanminus)
cpanm Finance::Quote
or
Using CPAN shell
perl -MCPAN -e shell
install Finance::Quote
=head1 SUPPORT AND DOCUMENTATION
After installing, you can find documentation for this module with the
perldoc command.
perldoc Finance::Quote
You can also look for information at:
=over
=item Finance::Quote GitHub project
https://github.com/finance-quote/finance-quote
=item Search CPAN
http://search.cpan.org/dist/Finance-Quote
=item The Finance::Quote home page
http://finance-quote.sourceforge.net/
=item The Finance::YahooQuote home page
http://www.padz.net/~djpadz/YahooQuote/
=item The GnuCash home page
http://www.gnucash.org/
=back
=head1 PUBLIC CLASS METHODS
Finance::Quote implements public class methods for constructing a quoter
object, getting or setting default class values, and for listing available
methods.
=head2 new
my $q = Finance::Quote->new()
my $q = Finance::Quote->new('-defaults')
my $q = Finance::Quote->new(timeout => 30)
my $q = Finance::Quote->new('YahooJSON', fetch_currency => 'EUR')
my $q = Finance::Quote->new('alphavantage' => {API_KEY => '...'})
my $q = Finance::Quote->new(currency_rates => {order => ['ECB', 'Fixer'], 'fixer' => {API_KEY => '...'}});
Finance::Quote modules access a wide range of sources to provide quotes. A
module provides one or more methods to fetch quotes. One method is usually the
name of the module in lower case. Other methods, if provided, are descriptive
names, such as 'canada', 'nasdaq', or 'nyse'.
A Finance::Quote object uses one or more methods to fetch quotes for
securities.
C constructs a Finance::Quote object and enables the caller to load only
specific modules, set parameters that control the behavior of the fetch method,
and pass method specific parameters.
=over
=item C T> sets the web request timeout to C seconds
=item C B> where C is a boolean value indicating if failover in
fetch is permitted
=item C C> sets the desired currency code to C for fetch
results
=item C H> configures the order currency rate modules are
consulted for exchange rates and currency rate module options
=item C A> sets the required labels for fetch results to
array C
=item C<> as a string is the name of a specific
Finance::Quote::Module to load
=item C< => H> passes hash C to methodname during fetch to
configure the method
=back
With no arguments, C creates a Finance::Quote object with the default
methods. If the environment variable FQ_LOAD_QUOTELET is set, then the
contents of FQ_LOAD_QUOTELET (split on whitespace) will be used as the argument
list. This allows users to load their own custom modules without having to
change existing code. If any method names are passed to C or the flag
'-defaults' is included in the argument list, then FQ_LOAD_QUOTELET is ignored.
When new() is passed one or more class name arguments, an object is created with
only the specified modules loaded. If the first argument is '-defaults', then
the default modules will be loaded first, followed by any other specified
modules. Note that the FQ_LOAD_QUOTELET environment variable must begin with
'-defaults' if you wish the default modules to be loaded.
Method names correspond to the Perl module in the Finance::Quote module space.
For example, Cnew('ASX')> will load the module
Finance::Quote::ASX, which provides the method "asx".
Some methods require API keys or have unique options. Passing 'method => HASH'
to new() enables the caller to provide a configuration HASH to the corresponding
method.
The key 'currency_rates' configures the Finanace::Quote currency rate
conversion. By default, to maintain backward compatibility,
Finance::Quote::CurrencyRates::AlphaVantage is used for currency conversion.
This end point requires an API key, which can either be set in the environment
or included in the configuration hash. To specify a different primary currency
conversion method or configure fallback methods, include the 'order' key, which
points to an array of Finance::Quote::CurrencyRates module names.
Setting the environment variable FQ_CURRENCY will change the default
endpoint used for currency conversion.
See the documentation for the individual Finance::Quote::CurrencyRates
modules to learn more.
=head2 get_default_currency_fields
my @fields = Finance::Quote::get_default_currency_fields();
C returns the standard list of fields in a quote
that are automatically converted during currency conversion. Individual modules
may override this list.
=head2 get_default_timeout
my $value = Finance::Quote::get_default_timeout();
C returns the current Finance::Quote default timeout in
seconds for web requests. Finance::Quote does not specify a default timeout,
deferring to the underlying user agent for web requests. So this function
will return undef unless C was previously called.
=head2 set_default_timeout
Finance::Quote::set_default_timeout(45);
C sets the Finance::Quote default timeout to a new value.
=head2 get_methods
my @methods = Finance::Quote::get_methods();
C returns the list of methods that can be passed to C when
creating a quoter object and as the first argument to C.
=head2 get_features
my %features = Finance::Quote::get_features();
C returns a hash with three keys: quote_methods, quote_modules, and currency_modules.
$features{quote_methods} is a hash with key/value pairs of method_name => [array of module names]
$features{quote_modules} is a hash with key/value pairs of module_name => [array of parameter names]
$features{currency_modules} is a hash with key/value pairs of currency_module_name => [array of paramater names]
Parameter names are values that the module needs to function, such as API_KEY. Most
modules will have an empty list. Modules with a parameter are configured when creating
the Finance::Quote by passing the argument
'module_name_in_lower_case' => {paramter => value}
to Finance::Quote->new().
The keys of the $features{currency_modules} hash are the names of currency
modules that can be used for currency conversion and the order in which the
modules are used is controlled by the argument
currency_rates => {order => [subset of $features{currency_modules}]}
to Finance::Quote->new(). By default, AlphaVantage in used for
currency conversion, "order" can be set to use other currency modules.
The currency module used can also be changed by setting the FQ_CURRENCY
environment variable. Please note that some of the alternate currency
modules require API keys.
=head1 PUBLIC OBJECT METHODS
=head2 B_to_billions
my $value = $q->B_to_billions("20B");
C is a utility function that expands a numeric string with a "B"
suffix to the corresponding multiple of 1000000000.
=head2 decimal_shiftup
my $value = $q->decimal_shiftup("123.45", 1); # returns 1234.5
my $value = $q->decimal_shiftup("0.25", 1); # returns 2.5
C moves a the decimal point in a numeric string the specified
number of places to the right.
=head2 fetch
my %stocks = $q->fetch("alphavantage", "IBM", "MSFT", "LNUX");
my $hashref = $q->fetch("nasdaq", "IBM", "MSFT", "LNUX");
C takes a method as its first argument and the remaining arguments are
treated as securities. If the quoter C<$q> was constructed with a specific
method or methods, then only those methods are available.
When called in an array context, a hash is returned. In a scalar context, a
reference to a hash will be returned. The keys for the returned hash are
C<{SECURITY,LABEL}>. For the above example call, C<$stocks{"IBM","high"}> is
the high value for IBM.
$q->get_methods() returns the list of valid methods for quoter object $q. Some
methods specify a specific Finance::Quote module, such as 'alphavantage'. Other
methods are available from multiple Finance::Quote modules, such as 'nasdaq'.
The quoter failover over option determines if multiple modules are consulted
for methods such as 'nasdaq' that more than one implementation.
=head2 get_failover
my $failover = $q->get_failover();
Failover is when the C method attempts to retrieve quote information for
a security from alternate sources when the requested method fails.
C returns a boolean value indicating if the quoter object will
use failover or not.
=head2 set_failover
$q->set_failover(False);
C sets the failover flag on the quoter object.
=head2 get_fetch_currency
my $currency = $q->get_fetch_currency();
C returns either the desired currency code for the quoter
object or undef if no target currency was set during construction or with the
C function.
=head2 set_fetch_currency
$q->set_fetch_currency("FRF"); # Get results in French Francs.
C method is used to request that all information be
returned in the specified currency. Note that this increases the chance
stock-lookup failure, as remote requests must be made to fetch both the stock
information and the currency rates. In order to improve reliability and speed
performance, currency conversion rates are cached and are assumed not to change
for the duration of the Finance::Quote object.
See the introduction to this page for information on how to configure the
source of currency conversion rates.
=head2 get_required_labels
my @labels = $q->get_required_labels();
C returns the list of labels that must be populated for a
security quote to be considered valid and returned by C.
=head2 set_required_labels
my $labels = ['close', 'isodate', 'last'];
$q->set_required_labels($labels);
C updates the list of required labels for the quoter object.
=head2 get_timeout
my $timeout = $q->get_timeout();
C returns the timeout in seconds the quoter object is using for
web requests.
=head2 set_timeout
$q->set_timeout(45);
C updated the timeout in seconds for the quoter object.
=head2 store_date
$quoter->store_date(\%info, $stocks, {eurodate => '06/11/2020'});
C is used by modules to consistent store date information about
securities. Given the various pieces of a date, this function figures out how to
construct a ISO date (yyyy-mm-dd) and US date (mm/dd/yyyy) and stores those
values in C<%info> for security C<$stock>.
=head2 get_user_agent
my $ua = $q->get_user_agent();
C returns the LWP::UserAgent the quoter object is using for web
requests.
=head2 isoTime
$q->isoTime("11:39PM"); # returns "23:39"
$q->isoTime("9:10 AM"); # returns "09:10"
C returns an ISO formatted time.
=head1 PUBLIC CLASS OR OBJECT METHODS
The following methods are available as class methods, but can also be called
from Finance::Quote objects.
=head2 scale_field
my $value = Finance::Quote->scale_field('1023', '0.01')
C is a utility function that scales the first argument by the
second argument. In the above example, C is C<'10.23'>.
=head2 currency
my $value = $q->currency('15.95 USD', 'AUD');
my $value = Finance::Quote->currency('23.45 EUR', 'RUB');
C converts a value with a currency code suffix to another currency
using the current exchange rate as determined by the
Finance::Quote::CurrencyRates method or methods configured for the quoter $q.
When called as a class method, Finance::Quote::AlphaVantage is the default,
which requires an API key. See the introduction for information on configuring
currency rate conversions and see Finance::Quote::CurrencyRates::AlphaVantage
for information about the API key.
=head2 currency_lookup
my $currency = $quoter->currency_lookup();
my $currency = $quoter->currency_lookup( name => "Caribbean");
my $currency = $quoter->currency_loopup( country => qw/denmark/i );
my $currency = $q->currency_lookup(country => qr/united states/i, number => 840);
C takes zero or more constraints and filters the list of
currencies known to Finance::Quote. It returns a hash reference where the keys
are ISO currency codes and the values are hash references containing metadata
about the currency.
A constraint is a key name and either a scalar or regular expression. A
currency satisfies the constraint if its metadata hash contains the constraint
key and the value of that metadata field matches the regular expression or
contains the constraint value as a substring. If the metadata field is an
array, then it satisfies the constraint if any value in the array satisfies the
constraint.
=head2 parse_csv
my @list = Finance::Quote::parse_csv($string);
C is a utility function for splitting a comma separated value string
into a list of terms, treating double-quoted strings that contain commas as a
single value.
=head2 parse_csv_semicolon
my @list = Finance::Quote::parse_csv_semicolon($string);
C is a utility function for splitting a semicolon separated value string
into a list of terms, treating double-quoted strings that contain semicolons as a
single value.
=head1 LEGACY METHODS
=head2 default_currency_fields
Replaced with get_default_currency_fields().
=head2 sources
Replaced with get_methods().
=head2 failover
Replaced with get_failover() and set_failover().
=head2 require_labels
Replaced with get_required_labels() and set_required_labels().
=head2 user_agent
Replaced with get_user_agent().
=head2 set_currency
Replaced with get_fetch_currency() and set_fetch_currency().
=head1 ENVIRONMENT
Finance::Quote respects all environment that your installed version of
LWP::UserAgent respects. Most importantly, it respects the http_proxy
environment variable.
=head1 USAGE COUNTER
A simple usage counter has been enabled. Other than the user's IP address, Finance::Quote version, and which method was used, no other data is collected. To opt out of your usage being counted, set the environment variable "FQ_NOCOUNT".
=head1 BUGS
The caller cannot control the fetch failover order.
The two-dimensional hash is a somewhat unwieldly method of passing around
information when compared to references
=head1 COPYRIGHT & LICENSE
Copyright 1998, Dj Padzensky
Copyright 1998, 1999 Linas Vepstas
Copyright 2000, Yannick LE NY (update for Yahoo Europe and YahooQuote)
Copyright 2000-2001, Paul Fenwick (updates for ASX, maintenance and release)
Copyright 2000-2001, Brent Neal (update for TIAA-CREF)
Copyright 2000 Volker Stuerzl (DWS)
Copyright 2001 Rob Sessink (AEX support)
Copyright 2001 Leigh Wedding (ASX updates)
Copyright 2001 James Treacy (TD Waterhouse support)
Copyright 2008 Erik Colson (isoTime)
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.
Currency information fetched through this module is bound by the terms and
conditons of the data source.
Other copyrights and conditions may apply to data fetched through this module.
Please refer to the sub-modules for further information.
=head1 AUTHORS
The following list are those contributors with 5 or more commits in the
GitHub repository.
Please see the Git log for all the authors who have helped with
Finance::Quote.
Erik Colson
Bruce Schuck