I. Overview
Part 1 of this project describes my procedure for installing a dedicated QuantLib web application server based on Linux and Ruby on Rails.

QuantLib is a free open-source software library for quantitative finance, financial modeling, trading, and risk management. Written in C++, this library is typically used in standalone applications at financial institutions. This project shows how the powerful features of QuantLib can be implemented in web applications. This capability allows firms to outsource their internal financial software development in favor of modern QuantLib web applications hosted by external application service providers (ASPs).
Ruby on Rails is a popular open source framework for developing web applications, and Linux is a robust and secure platform for hosting them.
II. Consulting
I do my best to explain the concepts and techniques behind my projects. If you like my work and can use my expertise in your projects, I am available for consulting at a competitive rate.
III. Procedure
1. Install LAMP Server
A basic LAMP (Linux, Apache, MySQL, PHP) server can be installed as follows:
a.) Download the latest version of Ubuntu Desktop Edition (currently 8.10) from ubuntu.com.
b.) Burn the iso image onto a CD and boot the server with that CD. Install with default options.
c.) Install packages with the following commands:
$ sudo apt-get install php5-mysql phpmyadmin
$ gksudo gedit /etc/php5/apache2/php.ini
extension=mysql.so <-- change this in php.ini
$ gksudo gedit /etc/apache2/httpd.conf
ServerName localhost <-- change this in httpd.conf
$ sudo /etc/init.d/apache2 restart
// install ssh, sftp, and Firestarter firewall
$ sudo apt-get install vsftpd ssh sysv-rc-conf firestarter
2. Install Ruby on Rails
a.) Install full Ruby from repository:
b.) Download and install the latest RubyGems package manager:
(Note: See http://rubyforge.org/frs/?group_id=126 for the latest RubyGems version)
$ tar -xzvf rubygems-1.3.5.tgz
$ cd rubygems-1.3.5
$ ruby setup.rb
c.) Install Rails via RubyGems:
Note: If this doesn’t work, try:
$ sudo apt-get install rails
$ gem install -v=2.2.2 rails
d.) Install Ruby MySQL driver:
$ sudo gem install mysql
3. Install QuantLib
a.) The Boost C++ libraries must be downloaded and installed first:
$ cd ~/install
$ wget http://downloads.sourceforge.net/project/boost/boost/1.38.0/boost_1_38_0.tar.bz2
$ tar -xjvf boost_1_38_0.tar.bz2
$ cd boost_1_38_0
$ ./configure
$ make
$ sudo make install
b.) Download and install the latest version of QuantLib:
$ wget http://downloads.sourceforge.net/quantlib/QuantLib-0.9.7.tar.gz
$ tar -xzvf QuantLib-0.9.7.tar.gz
$ sudo ln -s /usr/local/include/boost-1_38/boost /usr/local/include/boost
$ cd QuantLib-0.9.7
$ ./configure
$ make
$ sudo make install
c.) Download and install the latest version of QuantLib-SWIG. SWIG (Simplified Wrapper and Interface Generator) is a tool that connects C/C++ programs with web programming languages such as Ruby, PHP, Python, and Perl.
$ wget http://downloads.sourceforge.net/quantlib/QuantLib-SWIG-0.9.7.tar.gz
$ tar -xzvf QuantLib-SWIG-0.9.7.tar.gz
$ cd QuantLib-SWIG-0.9.7/Ruby
$ ruby setup.rb wrap
$ ruby setup.rb build
$ ruby setup.rb test
$ sudo ruby setup.rb install
Note: If these commands don’t work, try:
$ sudo apt-get install quantlib-ruby
4. Test and Verify
You should now be able to run the Ruby examples in QuantLib-SWIG-0.9.7/Ruby/examples:
$ ruby american-option.rb
$ ruby bermudan-swaption.rb
$ ruby european-option.rb
$ ruby swap.rb
IV. Future Enhancements
In Part 2 of this project, I will use this QuantLib Ruby platform to explore some simple design patterns used in developing QuantLib web applications for quantitative finance.
V. References
1. Ubuntu.com
http://www.ubuntu.com/
2. RubyOnRails.org
http://rubyonrails.org/download/
3. QuantLib.org
http://quantlib.org/extensions.shtml
4. SWIG
http://swig.sourceforge.net/

2 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.
Ray,
Excellent tutorial, clean and precise. Well done.
Thanks!