TrueTrade, Java/IB trading & backtesting

Discussion in 'Automated Trading' started by tyro_t, May 3, 2007.

  1. Yes. just check out the new code and no compilation error at all.

    Just another 2 minors thing:
    a. js.jar, itext-1.4.3.jar and jfreechart-1.0.2.jar should be put into
    \com.ats.resources\lib folder(in the wiki page, it was com.ats.model\lib)
    b. ibatis-2.3.0.677.jar is missing from com.ats.model\lib. I had to download it seperately.

    Everything looks good and now it is time to dig into the code.




     
    #11     May 5, 2007
  2. tyro_t

    tyro_t

    Thanks, I've updated the wiki and am uploading the missing ibatis JAR file now.
     
    #12     May 5, 2007
  3. biggdog

    biggdog

    One thing...
    On the install guide, you don't have
    com.ats.resources listed in your list of
    projects to pull from Google Subversion repository but it looks like it is required.
     
    #13     May 5, 2007
  4. tyro_t

    tyro_t

    True dat. K, the InstallGuide is fixed.

    Thanks for catching these things for me. I had to change a lot of the code structure to fit Google's organization requirements and to try to separate strategies for custom development and most of the docs were written against an older layout.
     
    #14     May 5, 2007
  5. Yes, the original intent was just autotrading. The backtesting and optimization components were meant to be outside. However, I realized it makes a lot of sense to put all three pieces together, since they all run against the same strategy code and the corresponding core classes. With the grand total of 80 classes and about 12,000 lines of code, JSystemTrader is still very light, though.
     
    #15     May 5, 2007
  6. more bugs in the downloaded zips file need to be fixed before getting truetrade running in the eclipse.

    a. in createtable.sql:
    the following lines need to be fixed something like:
    insert into instrument (id, symbol, sec_type, exchange, currency) values
    (1, 'AAPL', 'STK', 'SMART', 'USD',1, 1),
    (2, 'GOOG', 'STK', 'SMART', 'USD', 1, 1);


    this is because
    PlatformDAO.getAllInstruments() will throw an exception when
    trying set tick_size. The default value for tick_size in the db table is null. i guess that sqlmap framework tried to parse it as double.

    another way fix is to make these two filelds not null when creating the table.

    b. insert into strat_def (id, data_timespan_id, simu_timespan_id, classname) values
    (1, 10, 10, 'com.ats.strategy.RandomStrategy');

    if the value is 'com.jsystem.strategy.RandomStrategy' in strat_def
    table, classnotfound exception will be thrown.


    c. in com.ats.platform.Bar.java

    public void setBeginTime(Date beginTime) need to be
    refactor-renamed to something different like public void setBeginTimeX(Date beginTime).
    because the reflection system is going to complain that
    the original method signature violate the java bean convention.
     
    #16     May 5, 2007
  7. thrunner

    thrunner

    Newbie question: How do you run the create_tables.sql properly using the script file:

    I tried from Windows run CMD:
    C:\Documents and Settings\Administrator>C:\PROGRA~1\MySQL\MYSQLS~1.0\bin\mysql.exe -uroot -padmin < C:/create_tables.sql
    ERROR 1046 (3D000) at line 10: No database selected

    (assuming -u user=root and -p passw=admin; create_tables.sql was copied to C:\)

    line 10 of the sql seems to be : drop table instrument;

    http://forums.mysql.com/read.php?35,149025,149025#msg-149025

    Thanks for the effort Tyro and all participants.
     
    #17     May 5, 2007
  8. first, you need to run
    create database ats;
    use ats;
    grant SELECT,INSERT,UPDATE,DELETE on * to 'guest'@'localhost' identified by 'guest';

    hopefully it helps.



     
    #18     May 5, 2007
  9. thrunner

    thrunner

    Thanks for the reply LakeTrader,

    After making some minor changes to create_tables.sql :
    1. delete the entire database called ats if one existed instead of each tables within each time. Comment out "drop database ats" if your install has none.
    /*
    For MySQL:
    */
    drop database ats;
    create database ats;
    use ats;
    grant SELECT,INSERT,UPDATE,DELETE on * to 'guest'@'localhost' identified by 'guest';

    2. comment out all the "drop table" eg:
    /*drop table instrument;*/
    otherwise you will get unknown table error

    Handy MySQL commands for newbies like me: http://www.pantz.org/database/mysql/mysqlcommands.shtml

    I haven't gotten to the point where you are getting your errors, but I am sure your post above will prove helpful.
     
    #19     May 5, 2007
  10. tyro_t

    tyro_t

    Yeah, I used those to bootstrap myself and forgot they were still there.

    Do you think this is useful? I'm happiest deleting all insert statements entirely, however it will make it a bit empty. At the very least the insert statements should properly reflect the current table structure, and the strategy should be real (com.ats, not com.jsystemtrader! :) )


    That's technically just a warning and it runs fine without, but you're right, it can be confusing. I checked in a new copy of Bar and the YahooHistDataBuilder which was the only thing which used that method.
     
    #20     May 5, 2007