Getting Started with GeniusTrader

Discussion in 'Automated Trading' started by ctrader, Mar 15, 2008.

  1. ctrader

    ctrader

    I'm going to document my efforts with GeniusTrader http://GeniusTrader.org to move from fully manual trading to fully automatic. I will be managing this project using an Agile process.
     
  2. ctrader

    ctrader

    I'm going to use a spare PC. I have installed Ubuntu Linux 7.10.

    Table of Contents:
    1.0 Get Linux
    1.1 Get GeniusTrader
    1.2 Get Data Source
    1.3 Configure System to automatically update data


    1.0 Get Linux:

    You can get Ubuntu from http://www.ubuntu.com/getubuntu/download

    Alternatively, you could run ubuntu in a vmware virtual machine.

    Download free vmware player from vmware.com

    Download ubuntu virtual machine:

    http://www.vmware.com/appliances/directory/1068

    1.1 Get GeniusTrader (from first time tutorial: http://www.geniustrader.org/first_use.html )
    gt@yoda:~$ mkdir GeniusTrader
    gt@yoda:~$ cd GeniusTrader/
    gt@yoda:~/GeniusTrader$ mkdir tarballs
    gt@yoda:~/GeniusTrader$ cd tarballs/
    gt@yoda:~/GeniusTrader/tarballs$ wget http://www.geniustrader.org/cgi-bin/viewcvs.cgi/trunk/GT.tar.gz?view=tar
    --12:55:30-- http://www.geniustrader.org/cgi-bin/viewcvs.cgi/trunk/GT.tar.gz?view=tar
    => `GT.tar.gz?view=tar'
    Resolving www.geniustrader.org... 212.85.152.62
    Connecting to www.geniustrader.org|212.85.152.62|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: unspecified [application/octet-stream]

    Downloaded: 340,970 bytes in 1 files
    gt@yoda:~/GeniusTrader/tarballs$ mv GT.tar.gz\?view\=tar GT.tar.gz
    gt@yoda:~/GeniusTrader/tarballs$ wget http://www.geniustrader.org/cgi-bin/viewcvs.cgi/trunk/Scripts.tar.gz?view=tar
    --12:56:01-- http://www.geniustrader.org/cgi-bin/viewcvs.cgi/trunk/Scripts.tar.gz?view=tar
    => `Scripts.tar.gz?view=tar'
    Resolving www.geniustrader.org... 212.85.152.62
    Connecting to www.geniustrader.org|212.85.152.62|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: unspecified [application/octet-stream]

    [ <=> ] 95,596 68.98K/s

    12:56:03 (68.82 KB/s) - `Scripts.tar.gz?view=tar' saved [95596]

    gt@yoda:~/GeniusTrader/tarballs$ mv
    GT.tar.gz Scripts.tar.gz?view=tar
    gt@yoda:~/GeniusTrader/tarballs$ mv Scripts.tar.gz\?view\=tar Scripts.tar.gz
    gt@yoda:~/GeniusTrader/tarballs$ ls
    GT.tar.gz Scripts.tar.gz
    gt@yoda:~/GeniusTrader/tarballs$ cd ..
    gt@yoda:~/GeniusTrader$ tar xfz tarballs/GT.tar.gz
    gt@yoda:~/GeniusTrader$ tar xfz tarballs/Scripts.tar.gz
    gt@yoda:~/GeniusTrader$ ls
    GT Scripts tarballs

    gt@yoda:~/GeniusTrader$ sudo apt-get install libdate-calc-perl libgetargs-long-perl libxml-libxml-perl libcompress-zlib-perl libdate-manip-perl
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following extra packages will be installed:
    libbit-vector-perl libcarp-clan-perl libcompress-raw-zlib-perl
    libio-compress-base-perl libio-compress-zlib-perl liblog-agent-perl
    libxml-libxml-common-perl libxml-namespacesupport-perl libxml-sax-perl
    The following NEW packages will be installed:
    libbit-vector-perl libcarp-clan-perl libcompress-raw-zlib-perl
    libcompress-zlib-perl libdate-calc-perl libgetargs-long-perl
    libio-compress-base-perl libio-compress-zlib-perl liblog-agent-perl
    libxml-libxml-common-perl libxml-libxml-perl libxml-namespacesupport-perl
    libxml-sax-perl
    0 upgraded, 13 newly installed, 0 to remove and 195 not upgraded.
    Need to get 1317kB of archives.
    After unpacking, 5018kB of additional disk space will be used.
    Do you want to continue [Y/n]?
    Y


    Now get sample data:

    gt@yoda:~/GeniusTrader$ cd tarballs
    gt@yoda:~/GeniusTrader/tarballs$ wget http://www.geniustrader.org/examples/data.tar.gz
    --13:04:40-- http://www.geniustrader.org/examples/data.tar.gz
    => `data.tar.gz'
    Resolving www.geniustrader.org... 212.85.152.62
    Connecting to www.geniustrader.org|212.85.152.62|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 118,151 (115K) [application/x-gzip]

    100%[====================================>] 118,151 66.90K/s

    13:04:42 (66.73 KB/s) - `data.tar.gz' saved [118151/118151]

    gt@yoda:~/GeniusTrader/tarballs$ cd ..
    gt@yoda:~/GeniusTrader$ tar zxf tarballs/data.tar.gz
    gt@yoda:~/GeniusTrader$ ls
    data GT Scripts tarballs
    gt@yoda:~/GeniusTrader$ cd data/
    gt@yoda:~/GeniusTrader/data$ ls
    12040.txt 13000.txt 13330.txt
    gt@yoda:~/GeniusTrader/data$ cd ..
    gt@yoda:~/GeniusTrader$

    Now execute the instructions in the Setup your source of data section of http://www.geniustrader.org/first_use.html

    Note:
    If you get a permission denied message when running the perl scripts (the .pl files), run them with perl:

    perl display_indicator.pl I:RSI 13000 | less
     
  3. ctrader

    ctrader

    1.2 Get Data Source
    ==============

    Since I'm concerned only with EOD prices, I am going to use Beancounter. http://dirk.eddelbuettel.com/code/beancounter.html


    Following http://dirk.eddelbuettel.com/code/beancounter.howto.html

    gt@yoda:~/GeniusTrader/Scripts$ sudo apt-get install beancounter

    gt@yoda:~/GeniusTrader/Scripts$ sudo apt-get install mysql-server

    Set a mysql root password when prompted.

    Now run setup_beancounter -m -s

    *** Error: No mysql user 'gt'

    We were unable to start mysql as the user 'gt' does not exist
    You need to create a MySQL user 'gt' first:

    Change to super user (MySQL Admin): $ su -
    Start mysql program with mysql db: # mysql mysql
    Create the user: grant all privileges on *.* to gt@localhost;
    Exit from user mysql: > \q
    Exit from super user: # exit

    and then run this script again.

    Ok so now create the mysql user "gt' where 'gt' is your login name.

    gt@yoda:~/GeniusTrader/Scripts$ msqyl -u root -p
    bash: msqyl: command not found
    gt@yoda:~/GeniusTrader/Scripts$ mysql -u root -p
    Enter password: <# This is your mysql root password from above #>
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 2
    Server version: 5.0.45-Debian_1ubuntu3.1-log Debian etch distribution

    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

    mysql> grant all privileges on *.* to gt@localhost;
    Query OK, 0 rows affected (0.02 sec)

    mysql> \q
    Bye

    rerun setup_beancounter -m -s

    gt@yoda:~/GeniusTrader/Scripts$ setup_beancounter -m -s
    Now using MySQL
    Creating beancounter database

    Creating beancounter database tables
    Schema created, exiting

    Now finally add a symbol to track:

    gt@yoda:~/GeniusTrader/Scripts$ beancounter --dbsystem MySQL --dbname beancounter addstock QQQQ

    gt@yoda:~/GeniusTrader/Scripts$ beancounter --dbsystem MySQL --dbname beancounter backpopulate --prevdate '1 year ago' --date 'yesterday' QQQQ
    Config file /home/gt/.beancounterrc not found, ignored.
    Adding QQQQ from 20070315 to 20080314
    gt@yoda:~/GeniusTrader/Scripts$ gt@yoda:~/GeniusTrader/Scripts$ beancounter --dbsystem MySQL --dbname beancounter addstock QQQQ


    1.3 Automatically Updating Quotes Each Day
    =============================

    Finally setup a cronjob to automatially update each day:

    Create a file eg (crontab.txt) with this in it:

    53 16 * * 1-5 gt beancounter --dbsystem MySQL --dbname beancounter update --forceupdate today

    and then

    crontab crontab.txt

    To check that it worked:

    crontab -l

    Now at 4:53 each weekday the database is updated.

    This is where I stop for now. I need to figure out how to get GeniusTrader to use the BeanCounter database.
     
  4. rosy2

    rosy2

    whats the datasource feeding the mysql database?
     
  5. m_kramar

    m_kramar

    It definitely makes sense to create your own trading platform (or to find open-source one) if you want to make custom changes to the way it works. At the moment I'm trying to do the same thing. But it seems Perl is not the most suitable technology for this purpose. Is there any other code avaliable out there?
     
  6. marbi

    marbi

    Ctrader,

    are you still trying to use GeniusTrader?
     
  7. I have GeniusTrader installed and am still trying to wade through it. I am a PERL programmer, but it has a LARGE learning curve (not the PERL, GeniusTrader itself). Anyone having success with it?