Sunday, December 20, 2009

List of Open source trading software

For everybody who is interested in topic. List of links below should help to make initial evaluation of available open-source java trading software & related products and also provides some other interesting links. Note, that projects below are not ordered in any particular order.

Groups, forums, communities

Google Group, JavaTraders

Elite trader, the #1 community for active traders of Stocks, Futures, Options, and Currencies.

Trading software

Open source platform for strategy-driven trading, providing you with all the tools you need for strategy automation, integrated market data, multi-destination FIX routing, broker neutrality and more.
Looks like is the leader in that list - it's well supported, has lots of capabilities and is active project.
Latest version available at 23.12.2009: 1.5.0 (released 05.2009)

EclipseTrader is an application focused to the building of an online stock trading system, featuring shares pricing watch, intraday and history charts with technical analysis indicators, level II/market depth view, news watching, and integrated trading. The standard Eclipse RCP plug-ins architecture allows third-party vendors to extend the functionality of the program to include custom indicators, views or access to subscription-based data feeds and order entry.
Latest version available at 23.12.2009: 0.30.0 (released 07.2009)

JSystemTrader is a fully automated trading system (ATS) that can trade various types of market securities during the trading day without user monitoring. All aspects of trading, such as obtaining prices, analyzing price patterns, making trading decisions, placing orders, monitoring order executions, and controlling the risk are automated according to the user preferences. The central idea behind JSystemTrader is to completely remove the emotions from trading, so that the trading system can systematically and consistently follow a predefined set of rules.
Latest version available at 23.12.2009:
6.24 (released 09.2008)

AQ is a framework or an API for automated trading, opportunity detection, financial engineering, research in finance, connecting to brokers, etc. - basically everything around trading, written in Java, using Spring. All is published under a usage friendly open source license.
Latest version available at 23.12.2009: ??? Failed to find any possibility to download it or get latest version number, all links to that information are broken.

AIOTrade (former Humai Trader) is a free, open source (under the terms of BSD license) stock technical analysis platform with a pluggable architecture that is ideal for extensions such as indicators and charts. It's built on pure java.
Latest version available at 23.12.2009:
1.0.3a (released 02.2007)

JStock makes it easy to track your stock investment. It provides well organized stock market information, to help you decide your best investment strategy.
No automated trading support.
Latest version available at 29.12.2009: 1.0.5g (released 12.2009)

Merchant of Venice
Venice is a stock market trading programme that supports portfolio management, charting, technical analysis, paper trading and experimental methods like genetic programming. Venice runs in a graphical user interface with online help and has full documentation.
Latest version available at 23.12.2009:
0.7b (released 04.2006)

Market Analysis System
The Market Analysis System (MAS) is an open-source software application that provides tools for analysis of financial markets using technical analysis. MAS provides facilities for stock charting and futures charting, including price, volume, and a wide range of technical analysis indicators. MAS also allows automated processing of market data — applying technical analysis indicators with user-selected criteria to market data to automatically generate trading signals — and can be used as the main component of a sophisticated trading system.

Latest version available at 23.12.2009:
1.6.6 (released 07.2004)

Open Java Trading System
The Open Java Trading System (OJTS) is meant to be a common infrastructure to develop stock trading systems. The project's aim is to provide a self contained pure Java (platform independent) common infrastructure for developers of trading systems.
Latest version available at 23.12.2009: 0.13 (released 06.2005)

Oropuro trading system
The software perform the technical analysis of stock or commodity for various markets, manage portfolio definitions and orders. It has the base characteristics of most populars technical analysis software.
The most of information about that project is in Italian language, so it's really hard to dive in it :(
Latest version available at 23.12.2009: 0.2.4 (released 11.2007)

TrueTrade is a framework for developing, testing and running automatic trading systems. It is intended to provide support for a wide range of orders, financial instruments and time scales. It provides tooling for backtesting the strategy against historical data, and a separate tool for running the strategies in live mode.
Latest version available at 23.12.2009: 0.5 (released 05.2007)

Robotrader is a simulation platform for automated stock exchange trading. It delivers statistics to analyse performance on historic data and allows comparison between trading strategies.
Latest version available at 23.12.2009: 0.2.7 (released 02.2006)

SFL Java Trading System Enviroment
At current moment project is inactive. Author suggests to use ActiveQuant instead.

Related software

TA-Lib: Technical Analysis Library
TA-Lib is widely used by trading software developers requiring to perform technical analysis of financial market data.
* Includes 200 indicators such as ADX, MACD, RSI, Stochastic, Bollinger Bands etc...
* Candlestick pattern recognition
* Open-source API for C/C++, Java, Perl, Python and 100% Managed .NET
Latest version available at 23.12.2009: 0.4 (released 09.2007)

Tail - A java technical analysis lib
Technical Analysis studies forecasting future price trends with the objective of managea best moment to buy and sell shares. The Tail's target is to develop a Java Open-Source library that abstracts the basic components of Technical Analysis, supplying tools for creation, manipulation and evaluation of strategies to buy and sell.
Latest version available at 15.01.2010:
1.0 (released 12.2007)

JessX Project's main goal is to create a program allowing for the simulation of a financial market with realistic features (such as an order book and realistic orders). Researchers and teachers in Finance may find it helpful in their works.
Latest version available at 23.12.2009: 1.5 (released 05.2008)

100% Java Open Source FIX (Financial Information eXchange protocol) Engine
Latest version available at 23.12.2009: 1.4 (released 02.2009)

Auge is an easy-to-use and very simple financial portfolio management application. Auge will help you monitor and analyze your stock and mutual fund positions, providing powerful insight into your entire investment portfolio.

Latest version available at 23.12.2009:
0.2 (released 04.2007)

Advanced spreadsheet.
Latest version available at 23.12.2009:
1.3.8 (released 10.2009)

Data Visualizer
Data Visualizer displays text file stock market type data ("Date,Open,High,Low,Close,Volume,Adjusted Close Price") as Stock Charts, featuring a variation of Japanese "Candlesticks" chart elements.
Latest version available at 23.12.2009: 0.0.1 (released 03.2006)

Forex Optimizer
Absolutely new revolutionary trade platform, is intended both for beginners, and for the tempered traders of Forex. Beginners can study market Forex, using a simulator, not risking the capitals and not being connected to the Internet. For more skilled traders Forex Optimizer allows to create and optimize trade strategy, not having knowledge in programming to operate (to make trading operations) the real account of the broker. The platform can offer professionals greater functionality for application of the strategy and methods of trade in market Forex.
Latest version available at 08.12.2010: 2.7 (released ??)

Wednesday, October 21, 2009

Hibernate + Spring in Standalone application

Just a quick reminder howto use Hibernate + Spring in standalone application.
First comes hibernate session factory. I prefer to use separate file for hibernate, Instead of configuring it Spring's applicationContext.xml:

<bean name="hibernateSessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="configLocation" value="hibernate.cfg.xml"/>
<!-- Those package will be scanned for classes with persistence annotations -->
<property name="packagesToScan" value="net.test.domain"/>
<!-- Annotated package. Contains package-level configuration. -->
<property name="annotatedPackages" value="net.test.domain"/>

Transaction manager:

<bean id="hibernateTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="hibernate.session.factory"/>
<tx:annotation-driven transaction-manager="hibernateTransactionManager"/>

Next is hibernate session. Hibernate guys suggest to use HibernateDaoSupport class as base for your DAOs, but to be completely honest, I'm not really comfortable with it, because it adds really weird dependency on Spring in DAO classes. Instead, it looks more natural to use dependency injection, which is really Spring's approach. To archive that all you need to do is mark session definition as being scoped proxy, set scope to 'prototype' and define SessionFactoryUtils#getSession as factory method. In result, each call to "any_method" in hibernate session bean instance is converted to SessionFactoryUtils.getSession().any_method():

<bean name="hibernateSession" class="org.springframework.orm.hibernate3.SessionFactoryUtils" factory-method="getSession"
<constructor-arg index="0" ref="hibernateSessionFactory"/>
<constructor-arg index="1" value="false"/>

And all together:

<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="" xmlns:aop=""

<bean name="hibernateSessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="configLocation" value="hibernate.cfg.xml"/>
<!-- Those package will be scanned for classes with persistence annotations ->
<property name="packagesToScan" value="net.test.domain"/>
<!-- Annotated package. Contains package-level configuration. -->
<property name="annotatedPackages" value="net.test.domain"/>

<bean id="hibernateTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="hibernateSessionFactory"/>
<tx:annotation-driven transaction-manager="hibernateTransactionManager"/>
<bean name="hibernateSession" class="org.springframework.orm.hibernate3.SessionFactoryUtils" factory-method="getSession"
<constructor-arg index="0" ref="hibernateSessionFactory"/>
<constructor-arg index="1" value="false"/>

<bean name="someDao" scope="singleton" class="net.test.TestDAO">
<property name="session" ref="hibernateSession"/>

In DAO class there is no need to worry about session management, "tx:annotation-driven" will do all work for you. The only thing, which developer has to think about is appropriate usage of transaction annotations.

Thursday, August 20, 2009

How to make IntelliJ Idea usable on linux

Which Idea on Linux there are two big problems - memory (which I failed to resolve :)) and overall performance. When I've just installed it, it wasn't usable on may box with four Xeon CPUs and four gigs of memory, and that fact surprised me a lot. After some time spent looking on Internet found several tips, which resolved most of my problems. First one is following java setting, which switches off storing images in pixelmaps:


Another thing is one of Linux file system settings, which disables update of accessed timestamp. I'm working with quite big projects, which have several thousand files and updating timestamp of each file access is unnecessary overhead. That feature is something which doesn't have lots of use and can be witched off, specially when you are running Linux as desktop. Just add following to your filesystem mount settings in fstab:


After that Idea became reasonably fast, but I must admit, on Win XP or Vista it still runs faster and uses less memory.

I'm running Fedora 10 with NVidia graphic drivers.

Udpate 2010.12: I've just installed Idea 10. It looks just awesome and it's much faster! Works brilliantly. Thanks to IntelliJ!

Sunday, February 22, 2009

Memory mapped files in Java? Easy!?

Heh. Not so easy :) In NIO there is ability to work with memory mapped files, which is provided via java.nio.MappedByteBuffer. I was really happy with idea using memory mapped files, which means icreasing of performace of working with with big files. But... well, it is not so good, as could be. Generally speaking, it works, but has some serious pitfalls, which are well-known and described (and discussed) here: (fixed in 1.6)

In two words, you can't unmap file from memory, which is causing all other issues. It is released only when GC collects that buffer. Such limitation doesn't allow you to use that feature in any application which need to release file or work with mappings really intensive (create lots of new ones).

Sunday, February 1, 2009

Java Exceptions usage

I'm working on project which definitely requires Exception re-architecture and I had a quick discussion about that topic with my colleagues. That discussion was the trigger which activated some parts of my brain and materialized into that post. Some ideas can be arguable, so comments are much appreciated.

It looks like, there is big misunderstanding on how to use checked and unchecked exceptions and what exactly is the difference between them. Assume that misunderstanding was born from the fact that developers ignore fact that Java's error processing is based on Exceptions. That fact means that each piece of code can throw exception anytime, whether declared it explicitly or not. Which means, that you do not need to to declare exception explicitly to make developer think, that exception can be thrown - he has to assume it anyway.

So rule is quite simple - unchecked exceptions are for system errors, checked exceptions are for business ones. Business errors are errors, which can happen as a result of EXPECTED business conditions, like UserNotFoundException. Business code has to make a decision based on caught exception and usually it will affect of execution flow. If such exception is thrown, it means, that system behaves as it is expected to behave.
On opposite unchecked exception is something, which is NOT expected, so in the most of the cases, developer should not throw such exceptions by himself. There are just a few possible cases when developer can throw then - converting of checked system exceptions (like, which is checked for some uknown reason) or throwing exceptions on "assertion" checks, e.g. throwing java.lang.IllegalArgumentException for invalid argument value, etc. Such exceptions are are consequence of system and technical failures, which are not part of business flow.

There is opinion which says that it's a bad practice to log exception on every catch. Well, that's clean and gives some economy of disk space, but has one big disadvantage - it doesn't give you guarantee, that exception will be logged at all. So, better approach is logging exception each time it is caught. Yes, it will add some trash (not much, of case of good architecture) in logs, but usually applications do not have many catch statements (again, in case when they are designed properly :) see next paragraph). Some more stack traces shouldn't confuse anyone. It gives bigger confidence, that exceptions will be logged, at least by your code, even if client code will swallow it. For production systems such confidence is much more important than clean logs.

To make logs and logic cleaner, if you are not interested in exception - do not to catch it at all. Business Exceptions are, usually, are part of business logic and should be processed appropriately, code usually is interested in them. But there is no point in catching Runtime (unexpected) exceptions, which should be caught just by the top-most, application layer and just only to log it and display "Sorry" page to user.
But is doesn't mean, that you shouldn't worry about writing exception-safe code and do not use try-finally construction, which are amust even if it looks that code will not ever throw exception.
Sometimes there are such cases like IOException, which, unluckily, is not checked. Most propably, you may not want to add it into "throws" list. I think that the best you can do is to wrap it with custom non-checked exception and re-throw.