How to Build a Stock Exchange