[R-sig-finance] Backtest trading strategies

Rob Steele rfin.20.phftt at xoxy.net
Sat Nov 26 08:29:52 CET 2005


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.)
> 

Yeah, well, Perl.  :)

I take your point though.  Maybe someday R will play more nicely with 
shells and the command line so there will be no reason not to use it 
even for little jobs.

It's not totally bad now.  You can do stuff like:

#! /bin/sh

x=5

tmp=`R --vanilla --quiet << EOF
options(echo = FALSE)
y = $x * 1024 ^ 2
cat('\n', as.character(y), '\n')
q('no')
EOF`

y=`echo $tmp | awk '{print $NF}'`

echo $y


But you see what I mean.



More information about the R-sig-finance mailing list