Using http://quote.yahoo.com/d/quotes.csv
to display stock price information in CSV format

Yahoo.com has a free feature to allow you to view stock price information. Most users view this via http://finance.yahoo.com with the web pages generated by Yahoo.

However, there is a simpler way which will allow you to get data in the popular CSV (Comma-Separated Values) format for easy parsing by PHP or another programming language.

A typical URL to view data about Red Hat Linux (RHAT) might look like:

http://quote.yahoo.com/d/quotes.csv?f=sl1d1t1c1ohgv&s=rhat

This follows a basic schema of:

http://quote.yahoo.com/d/quotes.csv?f=format_codes&s=stock_symbol

You can have multiple values for s=stock_symbol in a single query for a very efficient method of displaying stock prices. For our sample, we will use one stock at a time.

The format codes known thus far include:

s	'Symbol'
n	'Name'
l	'Last Trade (With Time)'
l1	'Last Trade (Price Only)'
k3	'Last Trade Size'
c	'Change Percent'
c1	'Change'
t7	'Ticker Trend'
v	'Volume'
a2	'Average Daily Volume'
i	'More Info'
t6	'Trade Links'
b	'Bid'
b6	'Bid Size'
a	'Ask'
a5	'Ask Size'
p	'Previous Close'
o	'Open'
m	'Day's Range'
w	'52-week Range'
j5	'Change From 52-wk Low'
j6	'Pct Chg From 52-wk Low'
k4	'Change From 52-wk High'
k5	'Pct Chg From 52-wk High'
e	'Earnings/Share'
r	'P/E Ratio'
s7	'Short Ratio'
r1	'Dividend Pay Date'
q	'Ex-Dividend Date'
d	'Dividend/Share'
y	'Dividend Yield'
f6	'Float Shares'
j1	'Market Capitalization'
t8	'1yr Target Price'
e7	'EPS Est. Current Yr'
e8	'EPS Est. Next Year'
e9	'EPS Est. Next Quarter'
r6	'Price/EPS Est. Current Yr'
r7	'Price/EPS Est. Next Yr'
r5	'PEG Ratio'
b4	'Book Value'
p6	'Price/Book'
p5	'Price/Sales'
j4	'EBITDA'
m3	'50-day Moving Avg'
m7	'Change From 50-day Moving Avg'
m8	'Pct Chg From 50-day Moving Avg'
m4	'200-day Moving Avg'
m5	'Change From 200-day Moving Avg'
m6	'Pct Chg From 200-day Moving Avg'
s1	'Shares Owned'
p1	'Price Paid'
c3	'Commission'
v1	'Holdings Value'
w1	'Day's Value Change'
g1	'Holdings Gain Percent'
g4	'Holdings Gain'
d2	'Trade Date'
g3	'Annualized Gain'
l2	'High Limit'
l3	'Low Limit'
n4	'Notes'
k1	'Last Trade (Mkt with Time)'
b3	'Bid (Mkt)'
b2	'Ask (Mkt)'
k2	'Change Percent (Mkt)'
c6	'Change (Mkt)'
v7	'Holdings Value (Mkt)'
w4	'Day's Value Change (Mkt)'
g5	'Holdings Gain Percent (Mkt)'
g6	'Holdings Gain (Mkt)'
m2	'Day's Range (Mkt)'
j3	'Market Cap (Mkt)'
r2	'P/E (Mkt)'
c8	'After Hours Change (Mkt)'
i5 	'Order Book (Mkt)'