Skip to content

Instantly share code, notes, and snippets.

View Swoorup's full-sized avatar
🎲
Focusing

Swoorup Joshi Swoorup

🎲
Focusing
View GitHub Profile

https://web.archive.org/web/20110219163448/http://howtohft.wordpress.com/2011/02/15/how-to-build-a-fast-limit-order-book/

The response to my first few posts has been much larger than I’d imagined and I’d like to thank everyone for the encouragement.

If you’re interested in building a trading system I recommend first reading my previous post on general ideas to keep in mind.

My first really technical post will be on how to build a limit order book, probably the single most important component of a trading system. Because the data structure chosen to represent the limit order book will be the primary source of market information for trading models, it is important to make it both absolutely correct and extremely fast.

To give some idea of the data volumes, the Nasdaq TotalView ITCH feed, which is every event in every instrument traded on the Nasdaq, can have data rates of 20+ gigabytes/day with spikes of 3 megabytes/second or more. The individual messages average about 20 bytes each so this means handling

@Swoorup
Swoorup / sapaths.py
Last active August 29, 2015 14:27 — forked from l1am9111/sapaths.py
Python GTA: SA Path Reader
from struct import unpack
from cStringIO import StringIO
class SAPath():
def __init__(self, node):
self.path = StringIO(open(node, "rb").read())
self.header = {}
self.pathnodes = []
self.navinodes = []
self.links = []