EVOLUTION-MANAGER
Edit File: adjustOHLC.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Adjust Open,High,Low,Close Prices For Splits and Dividends</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for adjustOHLC {quantmod}"><tr><td>adjustOHLC {quantmod}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2> Adjust Open,High,Low,Close Prices For Splits and Dividends </h2> <h3>Description</h3> <p>Adjust all columns of an OHLC object for split and dividend. </p> <h3>Usage</h3> <pre> adjustOHLC(x, adjust = c("split","dividend"), use.Adjusted = FALSE, ratio = NULL, symbol.name=deparse(substitute(x))) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p> An OHLC object </p> </td></tr> <tr valign="top"><td><code>adjust</code></td> <td> <p> adjust by split, dividend, or both (default) </p> </td></tr> <tr valign="top"><td><code>use.Adjusted</code></td> <td> <p> use the ‘Adjusted’ column in Yahoo! data to adjust </p> </td></tr> <tr valign="top"><td><code>ratio</code></td> <td> <p> ratio to adjust with, bypassing internal calculations </p> </td></tr> <tr valign="top"><td><code>symbol.name</code></td> <td> <p> used if x is not named the same as the symbol adjusting </p> </td></tr> </table> <h3>Details</h3> <p>This function calculates the adjusted Open, High, Low, and Close prices according to split and dividend information. </p> <p>There are three methods available to calculate the new OHLC object prices. </p> <p>By default, <code>getSplits</code> and <code>getDividends</code> are called to retrieve the respective information. These may dispatch to custom methods following the “.” methodology used by quantmod dispatch. See <code>getSymbols</code> for information related to extending quantmod. This information is passed to <code>adjRatios</code> from the <span class="pkg">TTR</span> package, and the resulting ratio calculations are used to adjust to observed historical prices. This is the most precise way to adjust a series. </p> <p>The second method works only on standard Yahoo! data containing an explicit Adjusted column. </p> <p>A final method allows for one to pass a <code>ratio</code> into the function directly. </p> <p>All methods proceed as follows: </p> <p>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. </p> <p>If no adjustment is needed, the function returns the original data unaltered. </p> <h3>Value</h3> <p>An object of the original class, with prices adjusted for splits and dividends. </p> <h3>Warning </h3> <p>Using <code>use.Adjusted = TRUE</code> 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. </p> <p>The resulting precision loss will be from row observation to row observation, as the calculation will be exact for intraday values. </p> <h3>Author(s)</h3> <p>Jeffrey A. Ryan </p> <h3>References</h3> <p>Yahoo Finance <a href="https://finance.yahoo.com">https://finance.yahoo.com</a> </p> <h3>See Also</h3> <p><code><a href="getSymbols.yahoo.html">getSymbols.yahoo</a></code> <code><a href="getSplits.html">getSplits</a></code> <code><a href="getDividends.html">getDividends</a></code> </p> <h3>Examples</h3> <pre> ## Not run: getSymbols("AAPL", from="1990-01-01", src="yahoo") head(AAPL) head(AAPL.a <- adjustOHLC(AAPL)) head(AAPL.uA <- adjustOHLC(AAPL, use.Adjusted=TRUE)) # intraday adjustments are precise across all methods # an example with Open to Close (OpCl) head(cbind(OpCl(AAPL),OpCl(AAPL.a),OpCl(AAPL.uA))) # Close to Close changes may lose precision head(cbind(ClCl(AAPL),ClCl(AAPL.a),ClCl(AAPL.uA))) ## End(Not run) </pre> <hr /><div style="text-align: center;">[Package <em>quantmod</em> version 0.4.20 <a href="00Index.html">Index</a>]</div> </body></html>