[R-SIG-Finance] Monthly Midpoint return

Mark Knecht markknecht at gmail.com
Wed Jun 17 16:30:01 CEST 2015


On Wed, Jun 17, 2015 at 7:23 AM, Phil Steel <steelsteel25 at outlook.com> wrote:
>
>
>
> Hi Brian and everybody else,
> its downloaded stock prices I want to transform to middle of month stock price.
> endpoints give end of month doesn't it?if Im using endpoints I get a really strange result with a lot of NA:s My Data starts with the 15:th som my idea it transforming the data to.monthly somehow
> My function is ("provided" by Ulrich):
> monthly = function(x){  sym <- sub("\\..*$", "", names(x)[1])  Ad(to.monthly(x, indexAt = 'lastof', drop.time = TRUE, name = sym))}
>

Possibly put the month in an array, determine the size of the array
and then take the price/returns at the midpoint of the array? That way
number of days in the month, holidays, etc. wouldn't matter much?

- Mark



More information about the R-SIG-Finance mailing list