hrbx.me
Harrison Weingard's Portfolio & Personal Website
site_design
TWS Trader 6ddf79ed0af60af5a48aacef2882d775e80948e6 Harrison Weingard<h4rr@uw.edu> Jan. 6, 2012, 11:34 p.m.

TWS Trader

This project was inspired by my father who wanted to try algorithm trading from his home computer. I modeled this system after another called Apama. The core of this system is an event pump with dynamic listeners and event classes. Its a multi-pass message system which allows synchronization of events in a parallelized environment with minimal performance overhead.

The core loop of the system

As long as there are events in queue -- we dequeue an event and enqueue its completion event. This way, when the event is processed by iterating through all the listeners the internal events get enqueued in front of the parents completion event. This way we can synchronize events without any real overhead.

The trades being simulated in the markets

The above trades generated also generated the following logs from the system shown below.

The output of a simple algorithm trading

The size of this project is pretty small, but is also has a strong foundation of core classes and interfaces which make it extendible. As reference to the core loop, we have GUTS (main loops and system logic), Event (base class for all events), and EventListener (base class for everything that produces Events.)

The size of the project is fairly large

tws_trader.md text/plain