Hacker News new | ask | show | jobs
by logfromblammo 4457 days ago
You aggregate all trade offers in a given time interval. You line them up in order of their price. Buyers are ordered highest to lowest. Sellers are ordered lowest to highest. Continue matching units until the buy price is lower than the sell price. Back up one. The average of the buy and sell prices for that unit is the clearing price. All the units to the left get traded. Everything to the right expires or rolls over to the next auction.

In case of ties, there is no tiebreaker, so any orders that can't be filled at exactly filled at the clearing price are filled as much as possible in as close to equal proportions as possible. For a variety of reasons, there will probably be a slight bias towards filling larger orders by a greater amount.

There is no FIFO. There is only participating in the auction and not. Did you get your orders in before the deadline, or not? The only way to guarantee complete fulfillment of your order is by having a better price than the marginal trader.

Having an order partially filled sucks, but it is your signal that you guessed the clearing price exactly right, and your prize is that you pay no fees whatsoever for your partially filled trade. You beat the system. You didn't beat the other traders, but you beat the system.

The more trade offers there are, the better the whole thing works. But people don't want to wait around forever, either. That's why I think clearing once an hour is a good compromise.

2 comments

In another comment I mentioned the most elegant way to mitigate fifo priority gaming is to allow extremely high levels of fractional tick price. Something like 1/1000 of a penny would probably be enough.

I still think if you want to eliminate electronic market makers that is simpler and has less unintended consequences.

As I mentioned in another comment without serious protections against it your exchange is going to bias very strongly towards many many single quantity orders (they can't be filled partially after all) and stacked orders around your last trade price.

You also are going to lose lots of large volume orders because most large order investors are less sensitive about price than they are about fill certainty.

That said the more I think about it, the more I think algo shops would love your exchange because price discovery would be so hard. When price discovery is hard there are more opportunities for the "smart" money.