[R-SIG-Finance] query on adjRatios() function from TTR package

Enrico Schumann e@ @end|ng |rom enr|co@chum@nn@net
Mon Jun 8 14:47:23 CEST 2020


On Mon, 08 Jun 2020, Pitabas Mohanty writes:

> Hi
>
> Can anyone tell me how to find the adjusted closing price when there are
> multiple split events on the same day? In India, a few companies have
> announced stock split and stock dividend on the same day. When I use the
> adjRatios() function, it only adjusts for the first event and not the
> second event.
>
> Any help will be greatly appreciated.
>

Function 'split_adjust' in package 'PMwR' supports
several splits on a single timestamp.  Suppose a stock
split two times 2-for-1 on timestamp 2.  Then:

  split_adjust(x = c(100, 25, 25),  ## prices
               t = c(2, 2),         ## index when split occurs
               ratio = c(2, 2))     ## split ratio
  ## [1] 25 25 25

  split_adjust(x = c(100, 25, 49), t = c(2, 2),
               ratio = c(2,2), backward = FALSE)
  ## [1] 100 100 100
  
-- 
Enrico Schumann (maintainer of PMwR)
Lucerne, Switzerland
http://enricoschumann.net



More information about the R-SIG-Finance mailing list