A Perl Script for Stock or Mutual Fund Quotes

(Disclaimer: Securities indicated below are just examples and are not recommendations by the author. Obtain and read the prospectus before investing. For SEC filings by companies and mutual funds, visit the EDGAR database.)

There is now a more up-to-date version of this script. Please visit this page to get it.

Note: Perl 5.0 or later is required.

This script obtains quotes from the Security APL quote server. It is a good demonstration of how to communicate with a CGI program, sending input using the POST method.

Change Log

October 7, 1996

January 10, 1997

December 4, 1997

Get the script.

Some examples follow:

[3/503] Sat Jan 11 23:15:28 (narf:cheah):~
$ quote.pl mqifx
Connecting to qs-alt.secapl.com port 80...
Connected.
Symbol        : MQIFX        ---Mutual Fund---
Description   : MUTUAL QUALIFIED INC FUND               
Net Asset Val : 32.76        Offering Price : 32.76     
$ Change      : 0.00         % Change       : 0.00    
52 Week Low   : 29.55        52 Week High   : 34.63    
This information was last updated on  1/10

[4/504] Sat Jan 11 23:15:36 (narf:cheah):~
$ quote.pl smnxx
Connecting to qs-alt.secapl.com port 80...
Connected.
Symbol                : SMNXX        ---Money Market Fund---
Description           : STRONG MONEY MARKET FUND                
Current Seven (7) Day Yield : 5.11      
Dollar Weighted Average Days to Maturity : 46
$ Change      : 2.550        % Change    : 99.61   
52 Week Low   : 5.050        52 Week High: 5.700    
This information was last updated on  1/10

[5/505] Sat Jan 11 23:15:43 (narf:cheah):~
$ quote.pl xon
Connecting to qs-alt.secapl.com port 80...
Connected.
                          EXXON CP (XON)                           
                  New York Stock Exchange (NYSE)                   

Last Traded at     105 3/4  Date/Time       Jan 10 4:02:11
$ Change             6 1/4  % Change              6.28
Volume (000)        2426.5  # of Trades           1374
Open               102 1/8  Previous Close      99 1/2
Day Low            101 7/8  Day High               106
52 Week Low         77 5/8  52 Week High           106

EPS                5.05  P/E Ratio         19.70  Annual Div         3.16
Market Cap      109,296  Beta               0.69  5Yr EPS Growth     3.30

[6/506] Sat Jan 11 23:15:49 (narf:cheah):~
$ 

Problems? Questions?

Send me e-mail and I'll look into it. If there is a formatting problem, especially with stocks, please send me the output of the query and also the output when you run the script with the -r option. For example: quote.pl -r xon

Back


Po Shan Cheah cheah@nic.com
Last updated: January 12, 1999

Copyright information is available.