[R-sig-finance] Backtest trading strategies

Pijus Virketis pvirketis at hbk.com
Mon Nov 28 16:46:55 CET 2005


Much as I love R, I had occasion to contemplate its limitations vis-à-vis Python this weekend, when I had to scrape brutally malformed HTML and actually found it to be fairly painless thanks to BeautifulSoup (http://www.crummy.com/software/BeautifulSoup/). Reading through the neat code (a mere 1000 lines with comments), it seemed pretty clear that the R equivalent would be much more cumbersome (just the OO aspect would be hard to replicate, not to mention the libraries BeautifulSoup can count on). But thanks to Rpy (http://rpy.sourceforge.net/), one can have the best of all worlds! Use Python for general programming tasks and take advantage of existing libraries, use R for data analysis and visualisation, and have everything on the same page for maintainability and clarity.

Cheers, 

Pijus 

> -----Original Message-----
> From: r-sig-finance-bounces at stat.math.ethz.ch 
> [mailto:r-sig-finance-bounces at stat.math.ethz.ch] On Behalf Of 
> Gabor Grothendieck
> Sent: Saturday, November 26, 2005 8:14 AM
> To: paul sorenson
> Cc: r-sig-finance at stat.math.ethz.ch
> Subject: Re: [R-sig-finance] Backtest trading strategies
> 
> On 11/26/05, paul sorenson <sourceforge at metrak.com> wrote:
> > Gabor Grothendieck wrote:
> > > On 11/26/05, Rob Steele <rfin.20.phftt at xoxy.net> wrote:
> > >
> > >>Neuro LeSuperHéros wrote:
> > >>
> > >>>Hello,
> > >>>
> > >>>I understand the utility of MySQL for data storage.  But why is 
> > >>>Python essential?  What does it do that R can't do for system 
> > >>>creation/calculation?
> > >>>
> > >>>Thanks
> > >>
> > >>
> > >>Python is great for parsing data from wherever you get it and 
> > >>populating databases.  MySQL is ideal for the 
> > >>write-once-read-thereafter scenario that research 
> implies.  You can 
> > >>use R for the initial data marshaling if you'd rather not learn 
> > >>another language but Python seems like a better fit for 
> that sort of 
> > >>thing.  It's a scripting language that integrates more naturally 
> > >>into its host environment.  For analysis and 
> visualization however, R absolutely rules.
> > >
> > >
> > > I don't use MySQL so won't comment on that part but for 
> parsing data 
> > > I have found R to have everything I need.  I used to use perl
> > > but now use R exclusively.    R's string manipulation includes
> > > regular expressions and the vector processing often simplifies 
> > > string manipulation by eliminating loops over lines or vectors of 
> > > strings.
> > >
> > > To me its much easier to maintain code if its all in one language 
> > > and moving to R has enabled me to replace a bunch of perl, batch 
> > > files and other statistical software with R which really 
> helps clean 
> > > it all up.  (Actually I still have some Windows batch files, see 
> > > http://cran.r-project.org/contrib/extra/batchfiles/, but they are 
> > > only for generic configuration utilities and nothing 
> specific to any 
> > > application.)
> >
> > Each to their own I guess.  I happen to be much more familiar with 
> > Python than R and often use it to grab data in various 
> formats which R 
> > won't read.  I wouldn't dream of using an MSDOS batch file.  As I 
> > learn more about R, I tend to do more in it but I couldn't imagine 
> > myself parsing dodgy HTML, for example, with it.
> 
> Actually I use R for parsing HTML and for parsing XML too.  I 
> do agree by Rob that it would be nice if R worked better with 
> shells and also wish I could write small self contained 
> executables in R like one can in tcl and Python.
> 
> _______________________________________________
> R-sig-finance at stat.math.ethz.ch mailing list 
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> 
>



More information about the R-sig-finance mailing list