Building Tradebase

Prerequisites

Tradebase is a web application based on the Ruby on Rails framework.

In order to run Tradebase from the source you must have the following software installed:

  • Setup Rails and Ruby
    • Ruby on Rails version 1.2.3
      • Install rubygems http://rubygems.org/read/chapter/3#page13
      • Run this command to install the rails:
        sudo gem install rails -v=1.2.3 --include-dependencies
        
      • Install the additional needed gems:
        sudo gem install tzinfo daemons stomp
        
    • Ruby interpreter version 1.8.4 or greater. It often comes standard with most Unix/MacOSX installations, or install it yourself
    • Verify that you have rake in your path (this should be installed as part of Rails)
  • Quickfix for Ruby - see how to build your own Quickfix library for Ruby
  • Have MySQL database configured

Checkout the source

Change to the directory into which you would like to checkout the source. Then use SVN to get the source from the public Marketcetera repository:

svn co http://code.marketcetera.org/root/trunk/source/tradebase/ tradebase

This will create directory tradebase containing the code for the Tradebase Web Application.
Naturally, you can use any other database - Rails supports them all. Just make sure to modify the tradebase/config/environment.rb file accordingly.

Configure Database

The Rail application is setup to use a MySQL 5.0 database named marketcetera with logon of marketcetera/marketcetera.
If you don't have MySQL installed, you should download and install it (a very straightforward process). You then need to configure it to create the development and test databases and to allow the marketcetera user to log in:

CREATE USER 'marketcetera'@'localhost' IDENTIFIED BY 'marketcetera';
CREATE DATABASE marketcetera;
CREATE DATABASE marketcetera_test;

GRANT ALL PRIVILEGES ON marketcetera.* TO 'marketcetera'@'localhost';
GRANT ALL PRIVILEGES ON marketcetera_test.* TO 'marketcetera'@'localhost';

You may want to use the MySQLAdministrator GUI tool if you prefer that to the SQL prompt.

Then, prep the database by running this command:

/opt/marketcetera/tradebase$> rake db:migrate

If you ever need to remove all the tables (say you made some changes and need to re-migrate) just use the

/opt/marketcetera/tradebase$> rake db:migrate VERSION=0

and then do the regular rake db:migrate to bring it back up.

Run Tradebase

At this point you should have a working Rails application. If you are not familiar with Rails, check out the docs for quick overview, or read the book.

You can start the web app by typing the following in the tradebase directory. It'll run on port 3000

/opt/marketcetera/tradebase$> script/server

And you should be able to navigate to the application by looking at http://machinename:3000

If you make any modifications, don't forget to run the unit tests by typing rake in the directory!

Trade Recorder

See the section on Trade Recorder to see how to setup the Tradebase to automatically record trades from the OMS.

Tradebase Modifications

See the development notes for more information on how to modify Tradebase.