GeniusTrader

First use of GeniusTrader

You'll find step by step instructions here that will help you setup and use GeniusTrader for the first time. But before embarking on that task we suggest you skim over this page to get a general sense of stuff to be done. Contemplate it for a bit and make the needed up-front decisions about prices data, etc and then start the 'install'. In addition, a lot of this information is also presented in the gt wiki Users Wiki. It might be better organized and presented there, since it is a gt user maintained document.

Notice: GT is a complex application that requires a working Perl along with a lot of Perl add-on modules some of which require additional c based libraries plus a market prices database for use by GT itself. Installing Perl and the add-on modules and libraries is beyond the scope of this webpage but there is guidance below and on other GT webpages that should aid you in the setup of GT and a sample market prices database. In addiition the Users Wiki has sections on setting up a practical market prices database.

For users of the mainstream *dows OS see the section at the bottom. The installer wizbang thingy might be all you need.

Get the code via tarball or make an svn clone repository. The details are at Get the Code

General GT Installation Guidance

Gotchas to be aware of when you let CPAN and Perl and other 'programs' do the system upgrading and installing for you, instead of understanding what needs to be done and then doing it yourself.

GT was developed using an old version of Perl (pre 5.6, likely 5.0.x) and had/has its original perl package naming scheme defined long before the CPAN committee came along and began ''community organizing''. So you need to be aware that the two GT forks: the original and the CPAN'ed version differ. Their parts (e.g. files) are not interchangeable. In addition a CPAN'ed GT installation will likely over-ride any local set of the original GT perl modules (the GT toolkit files) that are installed.

GT, the original (e.g. trunk and exp branches), is primary focus of this site, and has this recommended directory/file hierarchy structure:

   gt_top_level_dir/    # the name is insignificant by convention 'gt' or 'geniustrader'
      GT/               # the GT toolkit (perl modules) dir (case significant)
      Scripts/          # the GT script applications and report templates dir (case significant)

This GT file organization scheme foregoes 'installation' in the Perl sense and it therefore requires a users environment be correctly configured to allow the user to:

  1. run the GT applications located in the gt_top_level_dir/Scripts directory.
  2. and
  3. that one of the following conditions are met:

Condition 1. can be achieved by putting the absolute path of gt_top_level_dir/Scripts in the users $PATH envvar, or with a "dot" in the $PATH envvar and the current working direectory being gt_top_level_dir/Scripts.

In the recommended file layout, condition 2.b isn't necessary because condition 2.a is met by default. However, as an example of the pathname to add to a users $PERL5LIB envvar to meet condition 2.b would be something like this:

/usr/local/source/gt_top_level_dir
where 'gt_top_level_dir' is the name of the directory that the directory GT/ is located in. Note that the original contents of $PERL5LIB must be retained, the new GeniusTrader path is only being added to the envvar.

For specific information about the CPAN'ed GT fork refer to the installation and use instructions from that package. Because of the differences between the two naming models used in these GT forks if you are using the CPAN'ed GT you must discount everything you see on this website regarding installation paths, file locations and the like.

for the bold and adventurous or anyone just now starting with gt

There is an experimental perl GT prerequisite and now your GT configuration file ($HOME/.gt/options) checking utility Build.PL that you can download into the gt_top_level_dir/Scripts dir and run.

   $   pwd
   /path/to/gt_top_level_dir/Scripts
   $   ./Build.PL

It does not install GT, but instead expects that you have already unrolled the gt tarballs, have cwd set to Scripts and have the appropriate operating environment. If it finds the users GT configuration file it will analyze it for the two essential configuration key-values:

In each instance it verifies the value assigned is valid. It will also list the details associated with the config item.

It is intended to make the perl prerequisite stuff easier to manage. It will scan your system hunting for the modules GT needs to work. It outputs gobs of verbiage about what it finds or doesn't find. It will change nothing on your system unless you agree, even then the only things it will do are fairly limited:
  1. installs in each gt app script the shebang line recommended by your perl
  2. creates symlinks for each gt app script without the .pl extension if your platform has symlinks
It could do a lot more, but it is certainly better than nothing. It's a small (about 20kB) perl script built around perls Module::Build and is only needed one time ... but with the configuration file checking it might be used more frequently.

the latest perl module upgrade gotcha

The Date::Manip rewrite at version 6 appears to have changed an API GT uses and has caused problems -- refer to the geniustrader-devel message from Erik Colson dated 01/02/2011 subject: 'Re: [GT] GeniusTrader: any windows working version?' for what can be done to make it work.

The good news is that Date::Manip versions at 6.25 and up appear to have solved this problem. Date::Manip version 5.54 is known to work. Version 5.56, while not tested is expected to be fine and is still available in the 'Other Releases' pulldown here.


*nix Users

Novice *nix users, tilde ( ~ ) denotes the users $HOME directory, users of a shell that doesn't understand that will need to substitute $HOME for ~ in all command lines shown here. If this isn't clear run the following command:
   $   echo ~
   ~
if the result is like that shown above, you need to make the substitution.

Extract the archives

Once you have downloaded both GT.tar.gz and Scripts.tar.gz (tarballs) you must extract (unroll) them in a new directory. We recommend keeping both GT and Scripts in a common top level directory, such as 'geniustrader' or 'gt'.
   $   mkdir geniustrader
   $   cd geniustrader
   $   tar -xzf ~/GT.tar.gz
   $   tar -xzf ~/Scripts.tar.gz

In contrast to other Perl packages, GeniusTrader is not 'installed' in Perl installation terms, but run from either the Scripts dir or another convenient directory that might hold the result of the particular GT application. Also see the section above (General GT Installation Guidance) regarding the correct setting of the envvar $PERL5LIB if you unroll these GeniusTrader tarballs into different parent directories.

There isn't any trick with non-installation scheme other than ensuring that your shell can find the GT perl application scripts. This is controlled by the $PATH environmental variable (envvar). In general "dot", the current working directory, will be the last one in that search list, if it is not there you can just add it. But if you prefer to be able to run the GT applications scripts from directories other than the GT Scripts dir, you would want to add the absolute pathname of the GT Scripts dir instead.

examples using bash 3.00:
   $   echo $PATH
   /usr/bin:/usr/local/bin:.
to add '/usr/local/source/geniustrader/Scripts' to $PATH:
   $   $PATH=/usr/bin:/usr/local/bin:/usr/local/source/geniustrader/Scripts:.
   $   echo $PATH
   /usr/bin:/usr/local/bin:/usr/local/source/geniustrader/Scripts:.

Be sure to separate each pathname with a colon ':'.

Install the Perl dependencies

GeniusTrader uses a large number of external Perl modules. You have to install them. You can do that by hand, or you can use the CPAN Perl module to do it or you can use the corresponding packages of your linux distribution. Take care, some of these modules depend on other modules...

These lists are 'advisory', they should give you good information regarding the primary GT perl prerequisites, but the linux (debian) version package data is less reliable and likely very dated.

Conditionally required modules:

The experimental Build.PL utility mentioned above looks at this prerequisite stuff and reports on bits found or not.


Setup your source of stock prices data

In order to do something useful with GT, you have to have a source of stock symbol prices data. Various modules are available for that (see pod of modules in GT::DB::*). Since you may not have any data, a very limited flat file text based tarball of sample data is available for evaluation and test. Extract the 3 files in this tar archive in the gt directory:

   $    cd geniustrader
   $    tar zxf ~/data.tar.gz
That's all there is to do for a file based prices database.

Setup your GT configuration file

Now, you have to create the GT configuration file ($HOME/.gt/options):

   $    mkdir ~/.gt
   $    vim ~/.gt/options

Copy and paste the following text into the GT configuration file opened in the vim editor in above command sequence. Then be sure to change the sample data pathname and font directory pathnames so that they match your actual paths.

DB::module Text
DB::text::directory /home/rhertzog/geniustrader/data
# relying on DB::Text defaults for sample database access

Brokers::module SelfTrade

Path::Font::Arial /usr/X11R6/lib/X11/fonts/TrueType/arial.ttf
Path::Font::Courier /usr/X11R6/lib/X11/fonts/TrueType/couri.ttf
Path::Font::Times /usr/X11R6/lib/X11/fonts/TrueType/times.ttf

Analysis::ReferenceTimeFrame year

#Graphic::BackgroundColor black
#Graphic::ForegroundColor white

Aliases::Global::TFS    SY:TFS 50 10|CS:SY:TFS
Aliases::Global::TFS[]  SY:TFS #1 #2|CS:SY:TFS #1|CS:Stop:Fixed #3

This find command might be helpful in locating the font dirs on your system:

   $    find /usr -name \*ttf -print

Test GeniusTrader Installation and Setup

That's it, GeniusTrader should be working now. Let's try some tests:

   $    cd Scripts
   $    ./display_indicator.pl I:RSI 13000 | less
   [...]
   $    ./backtest.pl TFS 13000 | less
   [...]
   $    ./backtest.pl 'TFS[30,7,7]' 13000 | less
   [...]

   notes:
       *  --timeframe 'day' might also be a required option in the above command lines
       *  the quotes (e.g. 'TFS[30,7,7]') are required to escape [] from some shells

If you met with success, yea! Now you need to make sure graphics are working so go to Screenshots and make sure you get results that resemble those shown.

Refer to the pod at applications rtfm to learn all about the various gt application scripts, what they can do and how to use them.

Refer to the pod at tool kit rtfm to learn all about the various gt toolkit modules, and how to use them.

If you get errors, or strange results don't despair help is available in two ways. First you can try the self-help method and refer to the Users Wiki (wiki). Secondly, if you simply cannot figure out what is amiss you can plead for help from the hundreds of active gt users: just subscribe to the developers mailing list geniustrader-devel and post a support request.

When posting support requests on geniustrader-devel

Please provide sufficient information that will help the helper help you. Clearly state the problem you are having. Include the entire GT command line you are using plus any output (on the terminal) as well as in any command generated file(s) (images, text, html, etc).

Other information that may be significantly important includes:

If you are having problems getting your prices database to work please check the Users Wiki for database setup assistance. If that fails to solve the problem your support post message should identify the format of your prices data (a 5 line example is plenty if in character delimited format). If you are using a SQL database identify the engine you are using (e.g. mysql, sqlite3, etc.) and the support application if any (e.g. beancounter, etc). In the SQL case, if you are using the GT::DB::genericdbi module the SQL query statements are of significant importance ($HOME/.gt/options).

Have questions ?

If you have questions, see these pages: FAQ , Documentation , and Screenshots with examples. You can also join the mailing list, geniustrader-devel where the friendly user community will try to help you.

Test GeniusTrader

To test GeniusTrader, open a console window, and try the following command lines:

        $  display_indicator.pl I:RSI 13000
        $  backtest.pl TFS 13000
        $  backtest.pl 'TFS[30,7,7]' 13000

        notes:
            *  --timeframe 'day' might also be a required option in the above command lines
            *  the quotes (e.g. 'TFS[30,7,7]') are required to escape [] from some shells

You should now read the documentation of those scripts to understand what they can do.

*dows Users

Install Perl

Genius Trader requires Perl. You can download Perl from http://www.activestate.org at http://www.activestate.com/store/activeperl/download/.

Install GeniusTrader

After you have Perl installed in your system, the simplest way to use GeniusTrader is to run one of the various installer wizbang things such as Genius Trader Windows Install which will install all required dependencies as well as sample data.

However, the version of GeniusTrader (meaning the files in GT/ and Scripts/) installed in this way will be the one packaged with the installer version used. Also notice that the CPAN'ed windoze installer may not even install the CPAN'ed version of GeniusTrader.

A *dows User Suggested this GeniusTrader Install Guidance

Now skip up to the section entitled "Setup your source of stock prices data" and follow the rest of the instructions to complete and test your GT installation.