Skip to content

Instantly share code, notes, and snippets.

@zmitton
Last active August 7, 2018 19:51
Show Gist options
  • Save zmitton/53cf2731a2c781d74d9654530618fb1c to your computer and use it in GitHub Desktop.
Save zmitton/53cf2731a2c781d74d9654530618fb1c to your computer and use it in GitHub Desktop.
Prediction Market Order-books

AUGUR

Will the Astros win the world series?

In a standard bet like this (with 2 outcomes (Y and N)), the participants each put in amounts totaling 1ETH, and a "yes share" and "no share" are created for the betting participants. When the outcome has been established the winning share becomes redeemable for 1ETH.

But how do the parties agree on what % of the ETH each should pay if the bet is not 50/50 odds? Order books can be created with Y Bids and N Bids (only bids because no one has any to sell). Whenever the highest bids from each order book add to >= 1, a "match" is made and the contract mints shares to accommodate them. Its kindof cool, and slightly different from standard order books.

A market with 2 outcomes (Y and N) would have 4 order books

Y bid Y ask
.70 .75*
.69 .76
.65
.63
-----------------

===================

N bid N ask
.24 .25*
.23 .31
.22 .32
------ --------
  • When a new order would fulfill the condition: yBid + nBid becomes >= 1, a share is created (thus lowering yBid + nBid back to < 1)
  • When a new order would fulfill the condition: yAsk + nAsk <= 1, a share is destroyed (thus increasing yAsk + nAsk back to > 1 ; note in order to create a yAsk or nAsk one must have a share to sell. This is the one which gets destroyed)
  • Therefore the inequalities always hold true: yBid + nBid > 1 and yAsk + nAsk > 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment