TSS is software that which traders can use to define arbitrarily complex trading strategies in Java and evaluate them using historical end-of-day data. Strategies also have access to emerging behavior using Google Trends data and to Technical Indicators using TA-lib. TSS also provides the ability to return the best strategy from a family of strategies using data mining algorithms provided by Weka.
TSS is in a very early state of development, and it’s probably not appropriate for casual tinkering - you need to be a fairly sophisticated Java user to use it at this stage.
TSS is provided in source form; you can compile it with the build.sh script provided.
TSS is implemented in Java and has been tested on both Windows and Linux. The TSS download runs on Linux; minor modifications, described below, are needed to run on Windows. TSS needs Java 1.5 (both compiler and run-time environment are needed) and sqlite3.
Download TSS-1.0.tar.g from here, and uncompress and untar it:
shell> gunzip tss-1.0.tar.gz
shell> tar xvf tss-1.0.tar
This creates the tss-1.0 directory. Use cd to enter this directory and run the following:
shell> java -cp . WebServer 8888
TSS comes with historical data stored in the file stocks.db for the symbols over the duration 8/1/2010 to 9-1-2010.
To create the database from scratch, execute the create.sh script
This creates the file stocks.db, a sqlite database of end-of-day information downloaded from Yahoo finance.
If you have already created stocks.db, and simply want to update it, run the update.sh script. by default, the database is populated from data starting from 8/1/2010; you can change this by setting DefaultStartDate in SymbolsDatabase.java (don’t forget to recompile). You may see some exceptions caused by missing symbols - that’s an artefact of companies merging, going bankrupt, etc., and should not afffect you.
Now point your browser to localhost:8888/tss.html and you should get the following display, with minor differences as the project is updated.
You can now enter a strategy in the code box. A simple strategy is provided with TSS; click right above the Code Entry Editor to display it.
Hit the “Run code on server” button, and be prepared to wait for about 30 seconds - TSS is running your strategy on a large number of ETFs and equities. (A spinning logo indicates it’s waiting for the strategy to complete.) Now you can enter equity symbols in the Results text box and hit Get Symbol; the webpage will update with a chart of the following form:
Enter the name of a symbol in the text box below the results heading to get a chart capturing the effect of your strategy. Specifically. the chart shows the days that the strategy bought and sold that equity, and the portfolio value as time progressed, as shown below.
The page will also display recent Google News articles that contain that symbol.
Using TSS as a library
For very complex strategies, running in batch mode, or an easier development experience, you can write your run method directly in a file, and execute it from the command line. More generally, you can use the TSS classes in any way you please - see ComputeDailyVariance.java for an example.
TSS has other capabilities, such as using Google Trends data (historical frequency of search terms) in strategies, and machine learning to automatically extract best strategies. These cannot be accessed through the Web UI; see more deail in Salim’s MS Report.
How can I add new equities?
Edit the Symbols.java file. In particular, if you want to add more ETFs, disable the commented out sections.
How can I get TSS to run on Windows?
You will need to edit the CompileAndRun.java file - look for TODOs in comments - these describe exactly what changes you need to make.
An error message for the form
/home/adnan/TradingSoftwareSystem/UserProgram_Utilities.java:4: package com.tictactec.ta.lib does not exist
means that your paths (to java/javac executables or libraries) are not right.
How do I compile TSS?
Use the build.sh script, either directly or modified according to your Java implementation.
What features are planned for the next release?
The feature are most interested in is a system by which a real-time feed can be used to create alerts to buying and selling opportunities. The feeds could come from Yahoo or Google Finance, or a more sophisticated source such as Interactive Brokers.
How does TSS work?
Salim’s MS report describes the implementation in detail. Briefly, the code you enter in the TSS text box is sent to a custom webserver, which adds an epilog and prologue to the code to define a method called run. This is written to a file called UserProgram.java and is compiled Consequently the SystemRun classes’s main method is called on the entire list of equities; SystemRun generates files in the htdocs which define the charts that are displayed, as well as the list of equity symbols.
Is TSS as efficient as it could be?
Certainly not - we use a low-end SQL server, don’t cache much, don’t compute on demand, etc. Our goal was to get a system that worked reasonably quickly (which TSS does); we felt the complexity required to get high performance wasn’t worth it.
Can I access TSS as a service?
We intend to make TSS available as a web service, i.e., you can point your browser to the TSS homepage, write your stragey, and hit run - all the work will be done at the TSS server.
Technically, Java is almost completely platform independent; one place where the write-once run-anywhere paradigm breaks is in Runtime class. Unfortunately, there is no way to compile Java code within a JVM, so we have to resort to the Runtime class which lets us invoke the compiler. The Runtime exec method is brittle - it depends on file names, and environment variables, both of which are platform dependent (these are the places where you need to make changes in the code).