Wednesday, 3 June 2009

Stock Exchange Simulator

Exchange Simulator

Google project link:

If you work for financial industry especially in Equity/Derivative trading area, often you may want 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 the 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 controling 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 the replay market to fine tune performance.


WebCurve simulator provides the following features for you with an open sourcelicense(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 a 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 stillable 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 works. Feel free to contact me at if you have any questions or want to see any features to add.

Samples Programs

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


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


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


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


This demonstrates how a simple OMS system interacts with exchange simulator through FIX 4.2 protocol. This sample program requires the above Exchange sample program running as server.


  • 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

Contact Me

Feel free to contact me if you have any comments/questions/suggestions.

Release History

r1.0.0 first release on 3 June 2009


  1. Can you provide any free or trial simulator download link

  2. java version "1.6.0_26"

    Is this program supposed to work out of the box ? I always get "Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory"

    and yet slf4j-api-1.5.6.jar is in the same current directory as webcurvesim.jar.


  3. I dont know much about stock market simulators, But I want to learn. My uncle is into that and he makes serious money. Whats the biggest challenge when learning how the stock market works?

  4. Thanks for sharing this article, its been a really fun interesting read. I've been thinking about getting a little more involved with my stock market simulator. I've really heard great things about it and want to see how it will go.