/webcurvesim

Stock Market Simulator with FIX gateway support

Primary LanguageJavaGNU Lesser General Public License v2.1LGPL-2.1

webcurvesim

Stock Market Simulator with FIX gateway support

A generic equity/derivative stock exchange simulator

If you work in financial industry especially in Equity/Derivative trading area, often you wish to have a stock exchange simulator for your application testing. There are a few reasons for this:

  • The test exchange gateways provided by exchange may not be always available. e.g. some are not available after working hours or in weekend.
  • The test exchange gateways provided by exchange are shared by other brokers and your testing may be interfered by other people.
  • An exchange simulator provides you the freedom of total controlling when and how to use it since you own the simulator.
  • You could perform load testing on your application against the simulator where its usually prohibited on the test exchange since it might overload the system and affect testers from other brokers.
  • It's extreme useful for algorithmic trading testing due to
    1. "you own the market" such that you could generate any scenario for your testing
    2. you can replay the market data for your back testing and even play different strategies or same strategy with different parameters against replay market to fine tune strategy performance.

Features:

WebCurve simulator provides the following features for you with an open source license(its basically free, please read the license for details):

  • A set of core functions to simulate the exchange behavior.
  • A FIX gateway supported by QuickFIX/J for your FIX application testing
  • Market making simulation to provide a simulated market
  • Market replay function to support replay live market data
Known limitation
  • No stock, price, price step, lot size validation. This would require a huge database implementation.
  • Only support FIX 4.2. I am happy to implement other versions in a later stage if  there are enough interest out there.
  • Webecurvesim.jar provides generic interface to java 6/5/1/1.4.2. The sample programs main()s are written and compiled with java 5 so you need to get java 5/6 runtime to play. If your application is at 1.4.x, you are still able to the webcurvesim.jar lib but just need to write your interface program in 1.4.x way.

There are 4 sample programs come with this bundle which demonstrate how WebCurve simulator work. Feel free to contact me at dennis_d_chen@yahoo.com if you have any questions or want to see any features to add.

Samples Programs

Please unzip webcurvesim.zip to a directory. You can find 4 windows batch files test1.bat, test2.bat, exchange.bat and trade.bat. Unix users should find it simple to convert them into shell scripts.

Test1

This demonstrates how to use the core Exchange class and  OrderBook class in a basic way.

Test2

This demonstrates  how to get order and trade updates a call back way.

Exchange

This demonstrates the exchange simulator in a GUI application with the following features
  • Order transaction in interative way
  • Market activity simulation
  • Market replay
  • Serves as a FIX gateway server(see next)

Trade

This demonstrates how a simple OMS system interacts with exchange simulator through FIX 4.2 protocol. This requres the above sample program running as server.
Usage
  • Create client orders(parent order) with "Enter Order" button.
  • Select one or many client orders then send child orders with "Split Order" button.
  • Amend client order or child order with "Amend Order" button. Only allow amend down quantity and amend price.
  • Cancel client order or child order with "Cancel Order" button.
Known issues
  • No quantity check between parent orders and child orders. It is possible to overfill order.
  • Some time you may hit some GUI refresh problems when expanding the order tree.

Dependent Packages

  • QuickFIX/J
  • Appache MINA required by  QuickFIX
  • SF4J

Original author is Dennis Chen, you can contact him here at dennis_d_chen@yahoo.com.