5 ms·
I was part of a project about a few years ago to do such a thing. The algorithms for writing a stock exchange are quite well known. I was just working on the in
by jmcmichael 18y ago
I was part of a project about a few years ago to do such a thing. The algorithms for writing a stock exchange are quite well known. I was just working on the interface, so I don't have a complete understanding of what was going on under the hood, but it was my understanding that we were using the same algorithm as the London Stock Exchange, which was developed using public funds and hence was made available to the public.
The most difficult thing to do in getting a stock exchange off the ground is not developing the software, but developing trust and liquidity. To do this, you need market makers - people who are obligated to provide buy and sell orders that keep the markets liquid. This is very very expensive.
We actually had an operating stock and commodities market, where you could trade the world's top currencies, gold, silver, platinum - for about 6 months, then 9/11 hit and it became very difficult to maintain the kinds of banking operations necessary to run an underground stock exchange.
- run4yourlives 18y agoHrm, liquidity is certainly a factor. What if you simplified things though? Take the focus off of trading and put it into the investment aspect? I suppose there would be something to be said about the obligation of the startup to actually be held to pay up though.
- jmcmichael 18y agoA stock market is set up to trade fungible bits of paper that have been contractually linked to companies (securities), commodities (futures), or derivatives like options. The algorithms for pricing and linking up buyers and sellers of these fungible bits of are fairly straightfoward. The types of contracts involved in initial investment in an idea or company aren't fungible, and tend to be highly customized affairs between the VC, the founders, and their lawyers.
- maxwell 18y agoIn other words, the algorithms (and interfaces (and laws?)) for scalable venture investment are immature, meaning it's still in the domain of trained professionals, like using software before GUIs.
- elai 18y agoIt's purely the laws that force that.
- kingkongrevenge 18y ago> The algorithms for pricing and linking up buyers and sellers of these fungible bits of are fairly straightfoward. Yes, but maintaining liquidity in a dynamic environment probably requires market makers, no? I don't think there's an algorithmic solution. You need the specialists.
- aston 18y agoMind linking to some of the underlying stock exchange algorithms?
- joshu 18y agoIt's not really an algorithm. It's called a limit order book. At least that's the way many electronic markets work.
- nostrademons 18y agoYeah, it's pretty trivial. Here's a quick implementation description in CS terms: 1.) Keep two heaps, a min-heap for sellers and a max-heap for buyers. The top of the seller heap is the "ask price". The top of the buyer is the "bid price". The difference between them is the "bid/ask spread". 2.a.) When a limit order comes in, put it in the appropriate heap. Then compare the tops of the heaps. If the prices overlap, send a fill message to the parties. Pay attention to quantities; you may have to send a partial fill to one party and a fill to another, and then repeat the process with the next order in the order book. 2.b.) When a market order comes in, immediately pop the top of the opposing heap and send out the appropriate fill or partial fill message. That's basically it. Depending on language, you're looking at anywhere from a page to a few hundred lines of code. An actual stock exchange is a bit more complicated, since it has to handle things like order cancellations, cancel-pending messages, transaction logs, and fault-tolerance, and has to operate on thousands of trades a second with minimal latency. But conceptually, it's simple. (And if Joshua corrects any of this, listen to him and not me. He was an actual quant; I just worked at a financial software startup.)
- joshu 18y agoI guess it's more of a "data structure" than an algorithm. Anyway, you need more than a heap, because price, time, size all matter. That's pretty close, though. Many exchanges are well documented, from internal workings to protocols. Check out XETRA, LSE, etc. NASDAQ too, but it's more complicated. The problem here is going to be achieving regulatory compliance and then liquidity. Both of these are harder.