FAQs

Installation On your web site I can read, suanshu.net-2.0.0.zip and algoquant-0.5.0.zip. Should we download both, or does AlgoQuant suffice and we get SuanShu with the algoquant-0.x.x.zip? You just need to download algoquant-0.5.0.zip. It comes with the latest version of SuanShu as well. SuanShu.net is our experimental C# library and is free to download and use. Which version of Java do you recommend? We in house test all our code using a few thousands unit tests daily with 4 versions of jvm from Sun/Oracle: 1.6.x 32 and 64 bits, 1.7.x 32 and 64 bit. Your choice of jvm version is a personal decision. Although some of our developers use the IBM clone with eclipse, it is not part of our routine testing procedure. My personal preference is the Oracle 1.6.x 64 bit. We need 64 bit to process a large amount of data. We prefer 1.6.x because it is a much more mature product with history esp. amid-st the infamous security patches and testing/release policy from Oracle lately. mvn compile does not work! Please do mvn clean install before compile. When building AlgoQuant with Maven, I got errors with the plugin Surefire. E.g., Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.14:test (default-test) on project algoquant-core: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.14:test failed This problem seems to happen mostly on a Mac. Please try to use Surefire version 2.14.1 or above. You may try to run the maven build with option “-e”. You may try to skip the unit testing by option “-skipTests”. (In NetBeans, there is such an option under “Maven”.) If none of the above works, our wild guess is that your VM...

Coding an AlgoQuant Strategy

There have been a number of questions on how to create a quantitative trading strategy using AlgoQuant. This is a brief introduction to the process, which will hopefully answer all questions you my have. Basic knowledge of the Java programming language is required, although you do not need to be an expert to follow this tutorial. Sources of Inspiration Of course you will need an idea of the type of strategy you want to develop. There are a number of popular (such as Moving Averages and Pairs Trading) and some more exotic strategies already included in AlgoQuant. You can use them as a template and build your own ideas on top of them for rapid prototyping. If you don’t want to use any of the built in strategies you can of course develop your own from scratch, in which case you may still find existing strategies useful as a code base or as examples if you are ever unsure about how something is done. Implementing a Strategy Once you have an idea for a strategy, coding it up is very straightforward. During a simulation in AlgoQuant a strategy object gets notified if an event (such as a price update) occurs, so that it can then carry out an action if desired. The strategy only has to deal with the type of event it has subscribed to and hence the amount of boilerplate code you have to write is minimal. We define a strategy by implementing the Strategy interface. To handle updates of a certain kind, all you need to do is to process that kind of updates in onEvent()...

Coding Tools

To set up the coding environment for a new AlgoQuant project, please follow the following steps. JDK SuanShu and AlgoQuant are Java based code. Before we can code using the libraries, we need to install the latest Java Development Kit (JDK). If you skip this step, you can download it together with NetBeans in the next step. NetBeans NetBeans is our preferred IDE for Java programming. You may download and install JDK and then NetBeans. Or you can download “NetBeans with JDK” directly.   NetBeans can be downloaded from this link. If you have no Java programming experience, choose the one labeled “Java SE”. Run the installer. TortoiseSVN Download TortoiseSVN. Run the installer. More information on svn can be found in this wiki. After installing TortoiseSVN, right click in Explorer in the empty space in the folder you want to put your project in. Click “SVN checkout” to check out project. The following example checks out AlgoQuant. You will use the URL given to you instead. In most cases, you do NOT need to check out AlgoQuant as it will be automatically downloaded by Maven when you build your project. Coding in NetBeans Launch NetBeans. Open your project. You can right click on a package/folder to create a new Java class to start coding. If you are asked to modify AlgoQuant code, copy and paste the code in your project and do the editing there. Do NOT modify source code in AlgoQuant directly. To build your project, right click on the project and hit “Clean and Build”. Alternatively, you can hit this button on the top bar. To run your project, you need to...

Setup

AlgoQuant uses ​Maven for project management. To download and install the required libraries, you need to do an initialization step. NetBeans In NetBeans, open the parent project algoquant and click Build: NetBeans will download all the required jar files to your local maven repository and run all the tests. Reference: ​http://wiki.netbeans.org/MavenBestPractices Eclipse In Eclipse, import the parent project (choose File > Import > Maven > Existing Maven Project, then select the root directory of algoquant). Then, Eclipse may install the required maven plugins and restart. After Eclipse restarts, you need to run Maven install for the parent project algoquant.     Eclipse will download all the required jar files to your local maven repository. If there are errors shown in source files in algoquant-core, they may be due to the ignorance of Eclipse about the generated source code. Add the generated source folder: References: ​http://www.sonatype.com/books/m2eclipse-book/reference/index.html https://www.eclipse.org/m2e/documentation/m2e-faq.html Command Line If you have already installed Maven in your workstation, you can directly use command line interface to do the setup by typing the command: > mvn install at the outermost project folder. Having done the proper setup, you can now start coding with the AlgoQuant API. Using AlgoQuant API via Maven dependency Alternatively, you may use AlgoQuant API in your own project without downloading the whole zipped package. In your project POM, fill in our repository information in the <repositories> section, then put a dependency in the <dependencies> section. Here is an example: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.mycompany</groupId> <artifactId>myproject</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties> <repositories> <repository> <id>nm-repo</id> <name>Numerical Method's Maven Repository</name> <url>http://repo.numericalmethod.com/maven/</url> <layout>default</layout> </repository> </repositories> <dependencies> <dependency>...

Maven

We do not include the javadoc files in the zipped package because Maven can automatically download it for you (when you need it) from our repository server. In NetBeans, you can also force it to download the javadoc by clicking the “Dependencies > suanshu-2.2.0 > Download Javadoc”: Or, right click “Dependencies” and choose “Download Javadoc” for downloading the javadoc of ALL dependencies: A little “J” means the javadoc is available offline. Then, by clicking “View Javadoc”, you can see the downloaded javadoc in your browser offline. Eclipse also has similar...