Yahoo splits up historical data compared to company infos, which I think makes sense, so this is also based upon such a split. Sorry; it&#39;s a bit long... But that&#39;s partly because copying from OO.org apparently likes to insert lots of extra lines...<br>
<br><br>


        <meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8">
        <title></title>
        <meta name="GENERATOR" content="OpenOffice.org 3.1  (Unix)">
        <style type="text/css">
        <!--
                @page { margin: 0.79in }
                P { margin-bottom: 0.08in }
        -->
        </style>

<p style="margin-bottom: 0in;">Intraday Quotes/Company
Info/Fundamentals: Query the backend with a ticker symbol and desired
parameter(s?); get results back.</p>

<p style="margin-bottom: 0in;">Input:</p>
<p style="margin-bottom: 0in;">Symbol</p>
<p style="margin-bottom: 0in;"><br>
</p>
<p style="margin-bottom: 0in;">Output Parameters: [What does everybody
want? What am I forgetting/don&#39;t know about? What kind of a balance
between “base” statistics and “derived” statistics are we
trying to achieve?]</p>
<p style="margin-bottom: 0in;"><br>
</p>
<p style="margin-bottom: 0in;">(high priority: required)</p>
<p style="margin-bottom: 0in;">struct (OHLCV) [Date/Time, Open, High,
Low, Close, Volume[, Open Interest]] (Should this strictly be a part of the historical backend, or also provided here for convenience?)<br></p>
<p style="margin-bottom: 0in;">struct (POHLCV) [[Previous] Date/Time,
Open, High, Low, Close, Volume[, Open Interest]] (Should this strictly be a part of the historical backend, or also provided here for convenience?)</p>
<p style="margin-bottom: 0in;">qstring Company Name (NAME)</p>
<p style="margin-bottom: 0in;">qstring Company Industry (INDUSTRY)</p>
<p style="margin-bottom: 0in;">qstring Market Capitalization (MKTCAP)
[string because Yahoo provides this as X.XXK/M/B]</p>
<p style="margin-bottom: 0in;"><br>
</p>
<p style="margin-bottom: 0in;">(high priority: Priorities are based
upon what I&#39;ve been told/read is important, but that&#39;s not saying
much. Anybody who knows what buy-and-hold-types find important and/or
knows their fundamental analysis should probably re-order/re-write
this list, because I *certainly* don&#39;t know my FA...)</p>
<p style="margin-bottom: 0in;">[Much of everything below has the
potential to be N/A, so this needs to be somehow gracefully handled.]</p>
<p style="margin-bottom: 0in;">--Annualized-- 
</p>
<p style="margin-bottom: 0in;">double Dividend Rate (DIVR) 
</p>
<p style="margin-bottom: 0in;">--Year over Year--</p>
<p style="margin-bottom: 0in;">double Quarterly Revenue Growth (QRG)
[This is a +/-percentage.]</p>
<p style="margin-bottom: 0in;">double Quartely Earnings Growth (QEG)
[This is a +/-percentage.]</p>
<p style="margin-bottom: 0in;">--Most Recent Quarter--</p>
<p style="margin-bottom: 0in;">qstring Total Cash (TC) [string because
Yahoo provides this as X.XXK/M/B]</p>
<p style="margin-bottom: 0in;">qstring Total Debt (TD) [string because
Yahoo provides this as X.XXK/M/B]</p>
<p style="margin-bottom: 0in;">double Profit Margin (PM) [This is a
+/-percentage.]</p>
<p style="margin-bottom: 0in;">double Operating Margin (OM) [This is a
+/-percentage.]</p>
<p style="margin-bottom: 0in;">double Return on Assets (ROA) [This is
a +/-percentage.]</p>
<p style="margin-bottom: 0in;">double Return on Equity (ROE) [This is
a +/-percentage.]</p>
<p style="margin-bottom: 0in;"><br>
</p>
<p style="margin-bottom: 0in;">(medium priority)</p>
<p style="margin-bottom: 0in;">qstring Shares Outstanding
(SOUTSTANDING) [string because Yahoo provides this as X.XXK/M/B]</p>
<p style="margin-bottom: 0in;">qstring Float (SFLOAT) [string because
Yahoo provides this as X.XXK/M/B]</p>
<p style="margin-bottom: 0in;">qstring Shares Short (SSHORT)</p>
<p style="margin-bottom: 0in;">double Percent Held by Insiders
(PINSIDERS)</p>
<p style="margin-bottom: 0in;">double Percent Held by Institutions
(PINSTITUTIONS)</p>
<p style="margin-bottom: 0in;">double Shares Short Percent of Float
(PSHORT) 
</p>
<p style="margin-bottom: 0in;">&lt;Other sentiment indicators,
especially some based on volume.&gt; [But Yahoo doesn&#39;t provide much
beyond these listed, so I need to do some research into a different
source.]</p>
<p style="margin-bottom: 0in;"><br>
</p>
<p style="margin-bottom: 0in;">(low priority.)</p>
<p style="margin-bottom: 0in;">double Trailing or Forward
Price/Earnings (TP/E, FP/E)</p>
<p style="margin-bottom: 0in;">double Earnings per Share (EPS)</p>
<p style="margin-bottom: 0in;">double Diluted Earnings per Share
(DEPS)</p>
<p style="margin-bottom: 0in;">double Price/Sales (P/S)</p>
<p style="margin-bottom: 0in;">double Price/Book (P/B)</p>
<p style="margin-bottom: 0in;">qstring Revenue (REV) [string because
Yahoo provides this as X.XXK/M/B]</p>
<p style="margin-bottom: 0in;">double Revenue Per Share (RPS)</p>
<p style="margin-bottom: 0in;">double Total Cash per Share (TCPS)</p>
<p style="margin-bottom: 0in;">double Book Value per Share (BVPS)</p>
<p style="margin-bottom: 0in;"><br>
</p>
<p style="margin-bottom: 0in;">(really low priority)</p>
<p style="margin-bottom: 0in;">&lt;Various derived price/history
performance stuffs.&gt;</p>
<p style="margin-bottom: 0in;">&lt;Other random stuffs from Yahoo&#39;s
Key Statistics page.&gt;</p>
<p style="margin-bottom: 0in;"><br>
</p>
<p style="margin-bottom: 0in;"><br>
</p>
<p style="margin-bottom: 0in;">(high priority: required)</p>
<p style="margin-bottom: 0in;">Historical Data: Downloaded and/or
imported locally from CSV. Support CSV export. Primary source
(Yahoo/OtherInternetz/local CSV directory) should be configurable (to
not exclude users who have paid for higher quality data sources than
Yahoo).</p>
<p style="margin-bottom: 0in;"><br>
</p>
<p style="margin-bottom: 0in;">Public interface: Provide a symbol,
time period, select absolute/adjusted prices, provide a end date/time
(today/now if none provided), the number of bars back from the end to
return (supporting both directly as an int or as a specified length
of time units eg 5 years), and (optionally) a maximum lookback period
so indicators can use “hidden” data; get results back. There is
the possibility for less bars than requested to be returned, so the
returned object must be able to accommodate such information. [Why
not just specify a start date? Mostly just because client views
(layout maths) should not need to be concerned with what the
source/resulting time period is; they should just be able to say how
much data they need (or will fit) in the easiest way possible and the
backend figures out the rest.]</p>
<p style="margin-bottom: 0in;"><br>
</p>
<p style="margin-bottom: 0in;">Internal Historical Stuffs: The
following is (somewhat) structured around the limitations of how/what
data Yahoo provides, but should still be flexible enough to
accommodate data from paid-providers or other sources.</p>
<p style="margin-bottom: 0in;"><br>
</p>
<p style="margin-bottom: 0in;">I imagine some form of a standard
historical container list that can accommodate storing any time
period&#39;s data (w/ each index containing the Open Date [or Time] and
the OHLCV data [plus Open Interest]). Each container should hold
everything from the IPO (or how every many years the user wants) up
through the most recent (partial) close available, and be generic
enough that any stored time period can serve as the input to any of
the price-manipulation algorithms listed below. Every watched symbol
(configurably) maintains multiple containers, each holding one of the
following “primary” time periods:</p>
<p style="margin-bottom: 0in;"><br>
</p>
<p style="margin-bottom: 0in;">Minutely - Unless somebody knows of a
free bulk source, as far as I&#39;m aware this data needs to be “ripped”
by sampling intraday quotes from the open through close (probably at
least twice a minute to ensure no single minute gets skipped?).</p>
<p style="margin-bottom: 0in;">Daily – Can be downloaded in bulk,
specifying a start and end date. Officially, Yahoo data only goes
back to the early 70s, but many symbols go back further and the
oldest I&#39;ve come across is 1929. Just using a global default of
1/1/1900 works fine. The end date, if unspecified, defaults to the
latest date available. [However, this doesn&#39;t include holidays or
days the market was closed for special circumstances. [See “time
period conversions” below for why this matters. Therefore, we also
store the following two primary time periods]:</p>
<p style="margin-bottom: 0in;">Weekly – Same download URL/conditions
as daily, but specifying weekly.</p>
<p style="margin-bottom: 0in;">Monthly – Same download
URL/conditions as daily, but specifying monthly.</p>
<p style="margin-bottom: 0in;"><br>
</p>
<p style="margin-bottom: 0in;">Time period conversions: The simplest
way I&#39;ve found to do this is to ignore the original time period and
just sum up the source data into the desired period. &gt;1 period
conversions should be relative to the oldest data available (or maybe
the first Monday or full new month/year?), otherwise the most recent
bar will always be a “full” period.. What I like most about this
approach is that the same algorithm can be used for converting each
primary time period into greater time periods, while simultaneously
providing a reasonable balance between memory usage and processing
resources. The biggest caveat to this method – which is really just
a matter of definition/preference – is that for example using a
time period of 5 on daily data will produce different results
compared to “real” weekly data. 
</p>
<p style="margin-bottom: 0in;"><br>
</p>
<p style="margin-bottom: 0in;">Adjusted Prices – Yahoo provides an
adjusted close alongside the absolute prices, but that&#39;s all. The
adjusted OHL still need to be calculated using dividends and/or
splits. 
</p>
<p style="margin-bottom: 0in;">Dividends – Same download
URL/conditions as daily, but specifying dividends. 
</p>
<p style="margin-bottom: 0in;">Splits – I&#39;m not aware of an easy way
to download splits in bulk, at least from Yahoo. They can, however,
(in theory) be calculated by “walking back” and comparing the
close to the adjusted close. If they&#39;re different, check to see if
it&#39;s because of a dividend. If so, adjust the OHL by the dividend (as
a % of the pre-dividend close to avoid negative prices) and keep
going. If not, calculate/store the split ratio, and adjust the OHL.
Proceed this way until the end of the data set is reached. However,
due to the combination of potential rounding-losses/loss-of-precision
when using percents and there occasionally being errors in the data
Yahoo provides, such an approach is potentially error-prone and
finding a way to parse split dates/ratios from some website would
probably be a much better way to go about calculating adjusted
prices... I need to some more research into this, as well as actually
try to get the aforementioned algorithm implemented to see how
reliable it actually is.</p>
<p style="margin-bottom: 0in;"><br>
</p>
<p style="margin-bottom: 0in;">Support for merging/updating:
Historical data from Yahoo doesn&#39;t include the latest close until
about 13-14 hours prior to the next open for that time period, so
there needs to be logic for merging the most recent close from the
appropriate shorter primary time period into each &gt;=daily primary
time period. Furthermore, the minimum number of historical
days/weeks/months that can be downloaded at a time is 10, so there
also needs to be logic for merging existing local data with
potentially overlapping downloaded data.</p>
<p style="margin-bottom: 0in;"><br>
</p>
<p style="margin-bottom: 0in;">(low priority)</p>
<p style="margin-bottom: 0in;">Public interface for historical
dividends and splits, based upon a symbol, start and end date. [The
most recent dividend and split ratio is available from the
symbol/infos interface above.]</p><p style="margin-bottom: 0in;"><br></p><p style="margin-bottom: 0in;">Well, I guess that&#39;s about what I think we&#39;d eventually want. But it&#39;s also probably *really* ambitious... at least to complete all of that within 3 months. But, I also have no intention of stopping after mid-August so, yea.<br>
</p>
<br>