Stock Quote Options

Yahoo Finance allows users to obtain various information on a stock through the use of the f query string parameter. The Yahoo Finance api PHP interface library has defined constants for use in setting the variables so that you do not need to know what each of the ambiguous character options mean. Below is a breakdown of what stock information you can return in your quote as well as the appropriate constant to use in the Library.

Variable Description Library Constant
a ask YahooFinance_Options::ASK
a2 average daily volume YahooFinance_Options::AVERAGE_DAILY_VOLUME
a5 ask size YahooFinance_Options::ASK_SIZE
b bid YahooFinance_Options::BID
b2 ask real time YahooFinance_Options::ASK_REAL_TIME
b3 bid real time YahooFinance_Options::BID_REAL_TIME
b4 book value YahooFinance_Options::BOOK_VALUE
b6 bid size YahooFinance_Options::BID_SIZE
c change and percent change YahooFinance_Options::CHANGE_AND_PERCENT_CHANGE
c1 change YahooFinance_Options::CHANGE
c3 commision YahooFinance_Options::COMMISION
c6 change real time YahooFinance_Options::CHANGE_REAL_TIME
c8 after hours change real time YahooFinance_Options::AFTER_HOURS_CHANGE_REAL_TIME
d dividend per share YahooFinance_Options::DIVIDEND_PER_SHARE
d1 last trade date YahooFinance_Options::LAST_TRADE_DATE
d2 trade date YahooFinance_Options::TRADE_DATE
e earnings per share YahooFinance_Options::EARNINGS_PER_SHARE
e1 error indication YahooFinance_Options::ERROR_INDICATION
e7 EPS estimate current year YahooFinance_Options::EPS_ESTIMATE_CURRENT_YEAR
e8 EPS estimate next year YahooFinance_Options::EPS_ESTIMATE_NEXT_YEAR
e9 EPS estimate next quarter YahooFinance_Options::EPS_ESTIMATE_NEXT_QUARTER
f6 float shares YahooFinance_Options::FLOAT_SHARES
g days low YahooFinance_Options::DAYS_LOW
h days high YahooFinance_Options::DAYS_HIGH
j 52 week low YahooFinance_Options::FIFTY_TWO_WEEK_LOW
k 52 week high YahooFinance_Options::FIFTY_TWO_WEEK_HIGH
g1 holdings gain percent YahooFinance_Options::HOLDINGS_GAIN_PERCENT
g3 annualized gain YahooFinance_Options::ANNUALIZED_GAIN
g4 holdings gain YahooFinance_Options::HOLDINGS_GAIN
g5 holdings gain percent real time YahooFinance_Options::
g6 holdings gain real time YahooFinance_Options::HOLDINGS_GAIN_REAL_TIME
i more info YahooFinance_Options::MORE_INFO
i5 order book real time YahooFinance_Options::ORDER_BOOK_REAL_TIME
j1 market capitalization YahooFinance_Options::MARKET_CAPITALIZATION
j3 market capitalization real time YahooFinance_Options::
j4 EBITDA YahooFinance_Options::EBITDA
j5 change from 52 week low YahooFinance_Options::
j6 percent change from 52 week low YahooFinance_Options::
k1 last trade with time (real time) YahooFinance_Options::LAST_TRADE_WITH_REAL_TIME
k2 change percent real time YahooFinance_Options::CHANGE_PERCENT_REAL_TIME
k3 last trade size YahooFinance_Options::LAST_TRADE_SIZE
k4 change from 52 week high YahooFinance_Options::
k5 percent change from 52 week high YahooFinance_Options::
l last trade with time YahooFinance_Options::LAST_TRADE_WITH_TIME
l1 last trade YahooFinance_Options::LAST_TRADE
l2 high limit YahooFinance_Options::HIGH_LIMIT
l3 low limit YahooFinance_Options::LOW_LIMIT
m days range YahooFinance_Options::DAYS_RANGE
m2 days range real time YahooFinance_Options::DAYS_RANGE_REAL_TIME
m3 50 day moving average YahooFinance_Options::
m4 200 day moving average YahooFinance_Options::
m5 change from 200 day moving average YahooFinance_Options::
m6 percent change from 200 day moving average YahooFinance_Options::
m7 change from 50 day moving average YahooFinance_Options::
m8 percent change from 50 day moving average YahooFinance_Options::
n name YahooFinance_Options::NAME
n4 notes YahooFinance_Options::NOTES
o open YahooFinance_Options::OPEN
p previous close YahooFinance_Options::PREVIOUS_CLOSE
p1 price paid YahooFinance_Options::PRICE_PAID
c2 change in percent YahooFinance_Options::CHANGE_IN_PERCENT
p5 price per sales YahooFinance_Options::PRICE_PER_SALES
p6 price per book YahooFinance_Options::PRICE_PER_BOOK
q ex-dividend date YahooFinance_Options::EX_DIVIDEND_DATE
r price earnings ratio YahooFinance_Options::PRICE_EARNINGS_RATIO
r1 dividend pay date YahooFinance_Options::DIVIDEND_PAY_DATE
r2 price earnings ratio real time YahooFinance_Options::PRICE_EARNINGS_RATIO_REAL_TIME
r5 PEG ratio YahooFinance_Options::PEG_RATIO
r6 price per EPS estimate current year YahooFinance_Options::
r7 price per EPS estimate next year YahooFinance_Options::
s symbol YahooFinance_Options::SYMBOL
s1 shares owned YahooFinance_Options::SHARES_OWNED
s7 short ratio YahooFinance_Options::SHORT_RATIO
t1 last trade time YahooFinance_Options::LAST_TRADE_TIME
t6 trade links YahooFinance_Options::TRADE_LINKS
t7 ticker trend YahooFinance_Options::TICKER_TREND
t8 1 year target price YahooFinance_Options::ONE_YEAR_TARGET_PRICE
v volume YahooFinance_Options::VOLUME
v1 holdings value YahooFinance_Options::HOLDINGS_VALUE
v7 holdings value real time YahooFinance_Options::HOLDINGS_VALUE_REAL_TIME
w 52 week range YahooFinance_Options::FIFTY_TWO_WEEK_RANGE
w1 days value change YahooFinance_Options::DAYS_VALUE_CHANGE
w4 days value change real time YahooFinance_Options::DAYS_VALUE_CHANGE_REAL_TIME
x stock exchange YahooFinance_Options::STOCK_EXCHANGE
y dividend yield YahooFinance_Options::DIVIDEND_YEILD

Comments & Questions

  1. Hi,

    Does anyone know what the “YahooFinance_Options::NOTES” option is for?

  2. Agree with that, replacing it with “p2” did the trick for me.

  3. Looks like this is wrong:
    c2 change in percent YahooFinance_Options::CHANGE_IN_PERCENT
    should be
    p2 change in percent YahooFinance_Options::CHANGE_IN_PERCENT

Add Your Comment