TrueTrade, Java/IB trading & backtesting

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

  1. tyro_t

    tyro_t

    The ATS started out as modifications to JSystemTrader before I got fed up and started the rewrite. I tried to get rid of all JSystemTrader code - did I miss some?

    Much of the code in the IBWrapperAdapter and the IBHelper actually came from an earlier ATS that I started about six months ago, though I can see some lines that were JSystemTrader.

    I had that already under something like "synchronize two different data sources" but I can see that isn't very clear.

    I can see right away how it would be handy for some people who use, say, the TICK when trading the ES. I'll change the wording.


    BTW: when fixing the bug about JavaBeans specs, I introduced another bug which I just fixed. Blah. Trying to move too fast, here.
     
    #31     May 6, 2007
  2. thrunner

    thrunner

    Newbie here, couldn't get the downloaded prebuilt Truetrade client to run with the newly created ats database, getting exceptions (both InstrumentView and StrategyView); must be some newbie error:
    Code:
    [size=1]java.lang.NullPointerException
    	at com.ats.client.views.InstrumentView.buildTree(InstrumentView.java:136)
    	at com.ats.client.views.InstrumentView.createPartControl(InstrumentView.java:121)
    	at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:332)
    	at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:197)
    	at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:566)
    	at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:290)
    	at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:525)
    	at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:140)
    	at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:268)
    	at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
    	at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:394)
    	at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1144)
    	at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1097)
    	at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1311)
    	at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:601)
    	at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:532)
    	at org.eclipse.ui.internal.PartSashContainer.createControl(PartSashContainer.java:562)
    	at org.eclipse.ui.internal.PerspectiveHelper.activate(PerspectiveHelper.java:244)
    	at org.eclipse.ui.internal.Perspective.onActivate(Perspective.java:815)
    	at org.eclipse.ui.internal.WorkbenchPage.onActivate(WorkbenchPage.java:2429)
    	at org.eclipse.ui.internal.WorkbenchWindow$6.run(WorkbenchWindow.java:2616)
    	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
    	at org.eclipse.ui.internal.WorkbenchWindow.setActivePage(WorkbenchWindow.java:2597)
    	at org.eclipse.ui.internal.WorkbenchWindow.busyOpenPage(WorkbenchWindow.java:658)
    	at org.eclipse.ui.internal.Workbench.busyOpenWorkbenchWindow(Workbench.java:795)
    	at org.eclipse.ui.internal.Workbench.doOpenFirstTimeWindow(Workbench.java:1437)
    	at org.eclipse.ui.internal.Workbench.openFirstTimeWindow(Workbench.java:1388)
    	at org.eclipse.ui.internal.WorkbenchConfigurer.openFirstTimeWindow(WorkbenchConfigurer.java:190)
    	at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:708)
    	at org.eclipse.ui.internal.Workbench.init(Workbench.java:1085)
    	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1847)
    	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
    	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    	at com.ats.client.ATSApp.run(ATSApp.java:18)
    	at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
    	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
    	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
    	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
    	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
    	at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
    	at org.eclipse.core.launcher.Main.run(Main.java:977)
    	at org.eclipse.core.launcher.Main.main(Main.java:952)[/size]
    Separately I thought I would start installing Eclipse 3.2 and downloading the source with the new instruction (thanks Tyro), getting some more missing jar files; not a problem, I am sure they are easy to find and I just thought it is good to document for newbies:
    Code:
    [size=1]
    build:
    
    Severity and Description	Path	Resource	Location	Creation Time	Id
    Project com.ats.resources is missing required library: 'lib/commons-lang-2.2.jar'		com.ats.resources	Build path	1178496253343	26
    The file "lib/itext-1.4.3.jar" does not exist in the workspace	com.ats.resources	build.properties	line 8	1178496253547	40
    Project com.ats.resources is missing required library: 'lib/gnujaxp.jar'		com.ats.resources	Build path	1178496253343	27
    Project com.ats.resources is missing required library: 'lib/httpunit.jar'		com.ats.resources	Build path	1178496253343	28
    Project com.ats.resources is missing required library: 'lib/itext-1.4.3.jar'		com.ats.resources	Build path	1178496253343	29
    Project com.ats.resources is missing required library: 'lib/jcommon-1.0.5.jar'		com.ats.resources	Build path	1178496253343	30
    Project com.ats.resources is missing required library: 'lib/jfreechart-1.0.2.jar'		com.ats.resources	Build path	1178496253343	31
    Project com.ats.resources is missing required library: 'lib/js.jar'		com.ats.resources	Build path	1178496253343	32
    Project com.ats.resources is missing required library: 'lib/log4j-1.2.13.jar'		com.ats.resources	Build path	1178496253343	33
    Project com.ats.resources is missing required library: 'lib/mysql-connector-java-5.0.3-bin.jar'		com.ats.resources	Build path	1178496253343	34
    Project com.ats.resources is missing required library: 'lib/OTFeed.jar'		com.ats.resources	Build path	1178496253343	35
    Project com.ats.resources is missing required library: 'lib/servlet.jar'		com.ats.resources	Build path	1178496253343	36
    Project com.ats.resources is missing required library: 'lib/swt-datepicker.jar'		com.ats.resources	Build path	1178496253343	37
    Project com.ats.resources is missing required library: 'lib/Tidy.jar'		com.ats.resources	Build path	1178496253343	38
    The project cannot be built until build path errors are resolved		com.ats.resources	Unknown	1178496253422	39
    The file "lib/jfreechart-1.0.2.jar" does not exist in the workspace	com.ats.resources	build.properties	line 10	1178496253547	41
    The file "lib/js.jar" does not exist in the workspace	com.ats.resources	build.properties	line 11	1178496253547	42
    [/size]
    Installation hints for newbies like me:
    1. Install Eclipse to C:\Eclipse. Try to install by unzipping to the root directory, otherwise you may exceed 260 characters in the pathname.
    2. Subclipse install how to: http://subclipse.tigris.org/install.html you may get a Mylar dependency error, either uncheck it or dl the new version here: http://www.eclipse.org/mylar/dl.php
    3. GEF and Draw2D are together in the GEF download here: http://www.eclipse.org/downloads/do.../drops/R-3.2.2-200702081315/GEF-ALL-3.2.2.zip Eclipse plugins can be installed by just unzipping into the correct Eclipse installation folder and restarting Eclipse.
     
    #32     May 6, 2007
  3. thrunner

    thrunner

    Never mind about the missing jar files above. Newbie error; did not import all 4 package from SVN. After that, the remaining error was that the 4 jar files copied to the correct respective directory was still not seen by Eclipse even after restarting Eclipse or rebooting:
    Code:
    [size=1]Severity and Description	Path	Resource	Location	Creation Time	Id
    The project was not built since it depends on com.ats.model, which has build path errors		com.ats.client	Unknown	1178507919390	3919
    The project was not built since it depends on com.ats.model, which has build path errors		com.ats.client.runtime	Unknown	1178507919390	3918
    The project cannot be built until build path errors are resolved		com.ats.model	Unknown	1178507919390	3917
    The project cannot be built until build path errors are resolved		com.ats.resources	Unknown	1178507919359	3844
    Project com.ats.resources is missing required library: 'lib/js.jar'		com.ats.resources	Build path	1178507883875	3767
    Project com.ats.resources is missing required library: 'lib/jfreechart-1.0.2.jar'		com.ats.resources	Build path	1178507883875	3766
    Project com.ats.resources is missing required library: 'lib/itext-1.4.3.jar'		com.ats.resources	Build path	1178507883875	3765
    Project com.ats.model is missing required library: 'lib/ibatis-2.3.0.677.jar'		com.ats.model	Build path	1178507564047	3754[/size]
    The solution was to right click on the ..model or the ..resources package, do a build path, configure build path, click on the offending jar file and do an edit and point to the correct folder and file. Do that for the 4 copied jar files. There are some remaining errors, but the build will now run as an Eclipse app. Some of the remaining 187 errors:
    Code:
    [size=1]Severity and Description	Path	Resource	Location	Creation Time	Id
    AbstractXYDataset cannot be resolved to a type	com.ats.client/src/com/ats/client/tools	BarSeriesDataset.java	line 8	1178511491718	4608
    Discouraged access: The type InternalImages is not accessible due to restriction on required library C:\eclipse\plugins\org.eclipse.gef_3.2.2.v20070208.jar	com.ats.client/src/com/ats/client/views	StrategyView.java	line 7	1178511491375	4438
    The field AvailableDataView.MAX_DETAIL_ROWS is never read locally	com.ats.client/src/com/ats/client/views	AvailableDataView.java	line 45	1178511491687	4600
    The field BacktestOrderManager.logger is never read locally	com.ats.model/src/com/ats/engine	BacktestOrderManager.java	line 17	1178511489843	4357
    The field BacktestStrategyEngine.logger is never read locally	com.ats.model/src/com/ats/engine	BacktestStrategyEngine.java	line 8	1178511489828	4355
    The field Bar.dateFormat is never read locally	com.ats.model/src/com/ats/platform	Bar.java	line 23	1178511489625	4308
    The field BarFigure.logger is never read locally	com.ats.client/src/com/ats/client/charting/figures	BarFigure.java	line 19	1178511491875	4640
    The field BarFigure.PriceBarTooltip.tip is never read locally	com.ats.client/src/com/ats/client/charting/figures	BarFigure.java	line 104	1178511491875	4642
    The field ChartBar.bar is never read locally	com.ats.client/src/com/ats/client/charting/model	ChartBar.java	line 9	1178511491828	4628
    The field ChartExecution.execution is never read locally	com.ats.client/src/com/ats/client/charting/model	ChartExecution.java	line 9	1178511491828	4627
    The field CloseAboveStrategy.logger is never read locally	com.ats.model/src/com/ats/strategy	CloseAboveStrategy.java	line 23	1178511489359	4289
    The field CloseAboveStrategy.period is never read locally	com.ats.model/src/com/ats/strategy	CloseAboveStrategy.java	line 25	1178511489359	4290
    The field ContributionFigure.logger is never read locally	com.ats.client/src/com/ats/client/charting/figures	ContributionFigure.java	line 16	1178511491859	4633
    The field DataManager.logger is never read locally	com.ats.model/src/com/ats/engine	DataManager.java	line 18	1178511489828	4353
    The field ExecutionView.refreshAction is never read locally	com.ats.client/src/com/ats/client/views	ExecutionView.java	line 45	1178511491562	4529
    
    ....[/size]
     
    #33     May 7, 2007
  4. tyro_t

    tyro_t

    Most of those look like warnings rather than errors. While I take the point that, for a full release, we would like to eliminate compiler warnings, I'm not going to worry about them right now. I will worry about compiler errors or runtime bugs. Are you seeing any of those?
     
    #34     May 7, 2007
  5. biggdog

    biggdog

    okay, I managed to get everything to build...

    I had to right click and refresh each project that I had
    to add the additional JAR files for the IDE to recognize them.

    Changing the compiler version in the IDE was a big diff as well

    Also, I was getting a heap exception running this in linux
    so I changed your parameter to "-Xmx512m" and that seems
    to have fixed the heap exception.

    When I right click on com.ats.client and try Run->Run As->
    Eclipse Application it launches another version of eclipse
    and not your app. Any ideas on this one? Something not
    set on the Main tab?
     
    #35     May 7, 2007
  6. tyro_t

    tyro_t

    Ah right, forgot about that. K, I added it to the InstallGuide :)

    That is interesting. I've never seen that happen before. When you go "Run > Run..." to open the run configuration window, click on the "ATS Client Builder" configuration under "Eclipse Application". Where it says "Program to run", have you got the "Run a product" selected?
     
    #36     May 7, 2007
  7. biggdog

    biggdog

    screen shot helped to see where my settings were different...

    my only options in the "Run a product" drop down
    are:

    org.eclipse.platform.ide
    org.eclipse.sdk.ide

    Makes sense why it is launching a new version of the ide since it is the option that was currently selected.

    I'll try and research why there are only the two options in the
    drop down and not the com.ats.client.product like you had.
     
    #37     May 7, 2007
  8. biggdog

    biggdog

    screen shot helped to see where my settings were different...

    my only options in the "Run a product" drop down
    are:

    org.eclipse.platform.ide
    org.eclipse.sdk.ide

    Makes sense why it is launching a new version of the ide since it is the option that was currently selected.

    I'll try and research why there are only the two options in the
    drop down and not the com.ats.client.product like you had.
     
    #38     May 7, 2007
  9. tyro_t

    tyro_t

    I think that eclipse is using the *.product files (or maybe the plugin.xml files) to build this list.

    Can you verify which files are in the root of the com.ats.client project? You can compare yours against the subversion list at: http://truetrade.googlecode.com/svn/trunk/com.ats.client/

    Make sure you have client_builder.product and plugin.xml.

    To be sure, try a "Team>Update" on the project to get the latest code updates.
     
    #39     May 7, 2007
  10. Janhaus

    Janhaus

    Sure thing tyro. I was thinking maybe you should have your own group somewhere than using a thread from either elitetrader or ib discussion :) Anyway, I'll try looking at the MySQL stuff again, didn't pay too much attention to it so that's probably the problem.

    --
    tyro:

    JD

    Any chance you can ask follow-up questions on elitetrader? This forum interface is kind of driving me nuts. The reply is too far away to remember what people said, I can't figure out how to quote, the threads grow too long without paging, and I don't get e-mail notification. (And I come over unexpectedly whiny :) )

    Anyway...

    "managed to get your program to compile and run. However, both the instruments and strategy tab have errors, and thus just show an error message, something like 'Unable to create view: An unexpected exception was thrown.' for the instruments tab."

    That will happen if the database isn't set up correctly. Can you double-check that you have MySQL installed and configured correctly?

    If that checks, do the views contain a stack trace? What does it say? Is there an error in the log? What does it say?

    (Check the wiki for info on how to find the log file)
    ---
    me:

    I followed all the steps, and combined with the input from other users on the elitetrader forums, managed to get your program to compile and run. However, both the instruments and strategy tab have errors, and thus just show an error message, something like 'Unable to create view: An unexpected exception was thrown.' for the instruments tab.
     
    #40     May 7, 2007