[R-SIG-Finance] high frequency data
jeff.a.ryan at gmail.com
Sun Jul 19 05:08:45 CEST 2009
The 'real-time' (15 min delayed) from Yahoo is available in quantmod
with getQuote. You can loop over this and 'capture' your data that
way. Horrible sounding to me...but it has been done.
AFAIK there is no free historical data access for intraday bars. Many
external providers that you can grep this list archive to find though.
Spit adjusted data is available from Yahoo in the 'Adjusted' column,
accessible with the Ad() function in quantmod. (assuming a yahoo
The newest versions of TTR and quantmod on R-forge (soon to be on
CRAN) have a very nice new feature courtesy of Josh's handiwork.
getSymbols on yahoo, with adjust=TRUE will adjust OHLC based on
downloaded split and dividend data. That function is in TTR, but
enabled via the getSymbols.yahoo interface.
quantmod also has a less robust, though often perfectly adequate
mechanism as well in 'adjustOHLC', one if its methods actually makes
use of the 'better' TTR routine. Due note that the TTR name has
changed, though the quantmod docs don't yet reflect. The CRAN version
will be correct...
adjustOHLC package:quantmod R Documentation
Adjust Open,High,Low,Close Prices For Splits and Dividends
This function calculates the adjusted Open, High, Low, and Close
prices according to split and dividend information.
There are three methods available to calculate the new OHLC object
By default, getSplits and getDividends are called to retrieve the
respective information. These may dispatch to custom methods
following the "." methodology used by quantmod dispatch. See
'getSymbols' for information related to extending quantmod. This
information is passed to 'adjSplitDiv' from the 'TTR' package, and
the resulting ratio calculations are used to adjust to observed
historical prices. This is the most precise way to adjust a
The second method works only on standard Yahoo! data containing an
explicit Adjusted column.
A final method allows for one to pass a 'ratio' into the function
All methods proceed as follows:
New columns are derived by taking the ratio of adjusted value to
original Close, and multiplying by the difference of the
respective column and the original Close. This is then added to
the modified Close column to arrive at the remaining 'adjusted'
Open, High, Low column values.
If no adjustment is needed, the function returns the original data
An object of the original class, with prices adjusted for splits
Using 'use.Adjusted = TRUE' will be less precise than the method
that employs actual split and dividend information. This is due to
loss of precision from Yahoo! using Adjusted columns of only two
decimal places. The advantage is that this can be run offline, and
for short series or those with few adjustments the loss of
precision will be small.
The resulting precision loss will be from row observation to row
observation, as the calculation will be exact for intraday values.
On Sat, Jul 18, 2009 at 7:12 PM, zubin<binabina at bellsouth.net> wrote:
> hello, using R for some high frequency research.
> -loading data using getSymbols method, but see no options for fetching a
> current data query in 1 minute increments, looks like day is lowest level.
> Maybe back 100 minutes or such, with the ability to split by Premarket,
> active, post market trading. Google does provide this real time data, i
> notice it when i get a quote at google before 9:30AM and after 4:00PM.
> Google also seems to provide real time pricing that reconciles pretty well
> to other feeds i see.
> -which vendor (google or yahoo) provide split adjusted data: example test
> with symbol (FAS, it recently split) both do not using getSymbols('FAS') or
> basically my question, before I write this code, does this feature exist
> already in a package?
> R-SIG-Finance at stat.math.ethz.ch mailing list
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
jeffrey.ryan at insightalgo.com
ia: insight algorithmics
More information about the R-SIG-Finance