This mostly came about from reading about the FIX (Financial Information eXchange) protocol, thinking "Ooh, that looks quite interesting to parse", downloading the 4.0 specs - a mere 60 pages and 27 message types - and thinking "why not". Then I realised implementing a FIX engine on its own would be about as much use as owning the world's only fax machine and, since I'm not going to have a real exchange to connect to any time soon, I'd have to write one myself...
So... why not? I've seen order books of various stripes and they're simple enough - a list of buy orders, a list of sell orders and, if the best buy/sell orders happen to cross over, some code to execute the trades.
I figure I'm going to do this in five parts:
- * Network Server - the network/session parts of the server
- * Network Client - the network/session parts of the client
- * FIX Engine - encoding/decoding messages and validation as the presentation layer
- * Exchange - application running the order book(s), executing trades and issuing ticks
- * Trader - application to actually issue orders, probably randomly as it'll rapidly become AI Complete if I start building in trading strategies
Maybe also a sixth part to monitor the exchange and produce pretty graphs of the virtual stock prices.
So, yeah, I've managed to waste a day's holiday doing... nothing other than writing this blog post. Time to get my code on!
---
Russ
