Ruby programming

Discussion in 'Automated Trading' started by Nashequilibrium, Mar 15, 2010.

  1. Is anyone using Ruby to program trading strategies? I am just curious since i know that most people use c++ or java. I am currently reading through some stuff on it and it looks good so far. Its not as fast as c++ but is more fun. Therefore for HFT it would not be suitable but for lower frequency should be fun.
     
  2. 314

    314

    ActiveQuant (http://www.activequant.org/) offers Ruby scripting support in the form of an embedded JRuby interpreter, I believe. You might check into that.
     
  3. Thanks, taking a look at it. I just realised that Marketcera offers programming in multiple languages and it is opensource. Do u use this or have knowledge of it?
     
  4. 314

    314

    Whoops, you know what? I switched Marketcetera and ActiveQuant in my mind when I replied to you. It is the former that I am referring to in my reply above. :p
     
  5. Corey

    Corey

    Programming in Ruby is truly bliss. I love it. I have developed multiple strategies in it. The sheer number of gems (libraries) available makes it easy to solve almost any problem you run into without having to write too much code.

    I mainly use Ruby for I/O bound operations (scraping web-pages, writing to and cleaning databases, et cetera) where the bottleneck is disk-seeking or network latency, where the speedup of C++ or Java would be negligible anyway.

    Unfortunately, I never really got deep into data analysis with Ruby -- I still used tools like R and Matlab for that. I just found them easier to do the initial analysis with. But writing back-testing and implementing strategies? I never have had an issue with Ruby.

    Because of its 'meta programming' abilities, libraries are written so you can even do cool stuff like embed web-servers (e.g. using <a href="http://github.com/rtomayko/shotgun">Shotgun</a> with <a href="http://www.sinatrarb.com/">Sinatra</a>) for real-time web-reporting of how your strategy. It is so freaking easy, it is something you probably wouldn't dare do in a language like C++ or Java without great design consideration before-hand -- but with Ruby, you can sort of do it on the fly.

    Ironically, however, I find that once Ruby applications pass a few hundred lines, I end up writing so much test coverage code to ensure no run-time typing issues that I might as well have just used a statically typed language in the first place -- I end up spending pretty much the same amount of time either way. It really just comes down to where you find your coding bliss.
     
  6. byteme

    byteme

    Ruby is great. I use it mainly for web applications based on the Rails framework. I deploy to Heroku. Since Heroku understands Git and Rails it's as simple as:

    Code:
    git push heroku
    and Heroku will detect that a Rails app is being pushed up and deploy it accordingly.

    The closest analogue of Ruby Gems in the Java world would be Maven. What's wrong with running a Jetty-based embedded server?

    Code:
    mvn jetty:run
    is all you have to type once you have Maven installed to launch a Jetty server.

    SpringMVC is not much more complicated than Sinatra (ignoring Java syntax vs. Ruby syntax comparisons) and you get the static typing and all of the Spring features should you need it.

    There isn't necessarily any great design consideration needed before-hand.

    Admittedly it's still going to be faster to develop stuff in Ruby. Just wondering if you were familiar with the likes of Maven, Jetty, SpringMVC etc. before you came to your conclusion?
     
  7. Corey

    Corey

    Yep, and I consider them to be the devil :D No 'evidence' why, I just did not enjoy using them. Perhaps I didn't spend enough time, but I never particularly liked Java anyway.

    My post was meant to be my anecdotal experience using Ruby versus other languages. Everybody's mileage will vary.
     
  8. Makes sense to me......maybe couple yrs down the line we get a Ruby compiler and make Ruby speed competitive to c++, then there is no competition. I have looked at Marketcera and its perfect for what i need........i have not jumped into metaprogramming yet in Ruby but have watched a 1hr online lecture and i can't wait to cover it! Java really has nothing over ruby, then again i really hate java, if it didnt have Sun's backing, it would not be where it is today.
     
  9. gkishot

    gkishot

    Perl is great too.
     
  10. mark_mm

    mark_mm

    I would advise using C++, its the standard for writing automated systems for a number of reasons. If you have to use a toy language that is "easier" to develop in but makes you latest quad core run like a 386 then you should hire a real programmer.
     
    #10     Apr 13, 2010