[R-SIG-Finance] getSymbols() with various frequency

Henrique Ramos hpr@mo@4 @end|ng |rom gm@||@com
Wed Apr 3 22:49:42 CEST 2019


Maybe the package BatchGetSymbols may help you. The main function
(BatchGetSymbols) has a parameter for data frequency.



<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Livre
de vírus. www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>.
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Em qua, 3 de abr de 2019 às 16:41, Mario Pisa <mario.pisa using gmail.com>
escreveu:

>
> This may be an approximation:
>
> for(symbol in symbols){ # establish trade-able instruments
>     stock(symbol, currency="USD",multiplier=1)
>     ticker <- getSymbols(symbol, auto.assign = F)
>     assign(paste0(symbol, “_daily"), ticker)
>     ticker <-  to_weekly(ticker)
>     assign(paste0(symbol, “_weekly"), ticker)
> }
>
>
>
>
> > El 3 abr 2019, a las 20:48, Steve Hun via R-SIG-Finance <
> r-sig-finance using r-project.org> escribió:
> >
> > Hi,
> >
> > in this small code piece, the return stock prices are default to daily
> but
> > intended to be in weekly or monthly format:
> >
> > for(symbol in symbols){ # establish trade-able instruments
> >     stock(symbol, currency="USD",multiplier=1)
> >     getSymbols(symbol)
> > }
> >
> > One way to do that is use to.weekly() function. The issue is symbol (say,
> > symbol = "SPY") is a character class, not "xts zoo" class so
> > to.weekly(symbol) would incur errors. to.weekly(SPY) is fine. When the
> > symbols list is long, this'd become annoying.
> >
> > So are there better to convert daily price to weekly/monthly?
> >
> > Thanks
> >
> >       [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-SIG-Finance using r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> > -- Subscriber-posting only. If you want to post, subscribe first.
> > -- Also note that this is not the r-help list where general R questions
> should go.
>
> _______________________________________________
> R-SIG-Finance using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions
> should go.
>


-- 
--
Henrique P. Ramos

	[[alternative HTML version deleted]]



More information about the R-SIG-Finance mailing list