A stock exchange is a complex beast, but much of it can be reduced to a single data structure: the Order Book. A Bitcoin exchange uses the same data structure when trading currency pairs of USD, BTC, or ETH. This article will show you how to: Design an order book that can handle limit orders and market orders Install automated sanity checks that run on every write to the order book, preventing hac