[R-SIG-Finance] Is the adjustOHLC function working correctly?
Ilya Kipnis
||y@@k|pn|@ @end|ng |rom gm@||@com
Tue Jul 8 17:40:43 CEST 2025
So, I'm not sure the adjustOHLC function is working correctly.
MRE:
[image: image.png]
That is, after using adjustOHLC, the adjusted close price for AAPL
(4.56e-08) very much does NOT match the actual adjusted closing price
column (.261).
I'm not sure if this function is a completely kosher fix because it simply
works off of the ratio between close and adjusted columns, but I'd think
the most important thing is to make sure that the adjusted closing price
matches, and that the same ratio should be used daily, no?
So, here's my function:
adjust <- function(x){
ratio <- Ad(x)/Cl(x)
x[,1] <- Op(x) * ratio
x[,2] <- Hi(x) * ratio
x[,3] <- Lo(x) * ratio
x[,4] <- Cl(x) * ratio
return(x)
}
Thanks.
-Ilya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20250708/669fcc71/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 38037 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20250708/669fcc71/attachment.png>
More information about the R-SIG-Finance
mailing list