Skip to content

R to common lisp translator

5 messages · Joshua Ulrich, Andres Susrud, Brian G. Peterson +1 more

#
Hi Andres,
On Tue, Jan 25, 2011 at 8:16 AM, Andres Susrud <andres.susrud at gmail.com> wrote:
Your question on Nuclear Phynance indicates you're trying to increase
calculation speed.
http://www.nuclearphynance.com/Show%20Post.aspx?PostIDKey=148722

What bottlenecks are you running into?  Nearly all the heavy lifting
in quantmod, TTR, xts, etc. is done in C, so moving to LISP probably
wouldn't be much faster.

Best,
--
Joshua Ulrich  |  FOSS Trading: www.fosstrading.com
#
On 01/25/2011 10:01 AM, Andres Susrud wrote:
We run backtests in R on complex indicators on tick data where the 
indicator updates every tick.  These complete backtests, including the 
path dependent trade generation rules run (for us) in seconds to a few 
minutes per day of tick data per instrument.  All our code is R (mostly) 
or C/C++ (either implied, like with TTR, or specific to our proprietary 
indicators).
This is a known performance bottleneck in R, and there is quite a lot of 
literature about either reworking this to a vectorized formulation, or 
moving such calculations which *must* be looped to C, Fortran, Java, or 
C++ (for which good integration options already exist in R).
R-help would be a better place to see if people are doing Lisp in R in 
any repeatable, scalable, manner.

Regards,

    - Brian
#
One aside that Brian didn't mention is that 'quantstrat' (on R-forge,
and discussed heavily on this list) is making serious strides in
getting the backtesting times down.  Coupled with further xts
optimizations we've been making you are able to do many orders of
magnitude better than na?ve loops in R.

Vectorizing code isn't easy, but it generally means you are running in
C at that point.  One of the critical issues about 'faster than R' is
that you are going to miss 'R'.  You could code the fastest
implementation in Fortran, but are you "able to" really ---  from top
to bottom?  Fortran is the extreme case, but LISP is pretty close in
terms of nowhere near complete.  Plus you'll suffer from miserable
adoption rates - no offense to the language or its enthusiasts (I am
one), but if it hasn't met with success yet... I'm not putting much
money or time into it.

Use R for prototyping, spool up some more machines to backtest if need
be, and if you really need to, write some faster bits in
C/C++/Fortran2003 ;-).  The idea of xts 'speed at all costs' is to
make the bits we all use over and over as fast as possible, and to let
the R-based logic have a bit more breathing room.

Migrating to another language in search of the holy grail of speed
isn't probably the best route at the end of the day.

My 2c,
Jeff
On Tue, Jan 25, 2011 at 10:09 AM, Brian G. Peterson <brian at braverock.com> wrote: