-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add parimutuel docs #87
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c56b753
Add parimutuel docs
maltekliemann 5d543c0
Format markdown
maltekliemann 82a21be
Apply suggestions from code review
maltekliemann 27f994a
Fix formatting
maltekliemann 55b7262
Make external fee payments a little bit clearer
maltekliemann 79de718
Add note about stable odds in parimutuel
maltekliemann 77314c1
Fix broken LaTeX
maltekliemann 84eaf21
Fix formatting
maltekliemann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
--- | ||
id: parimutuel | ||
title: Parimutuel | ||
--- | ||
|
||
## Overview | ||
|
||
The term _parimutuel_ refers to a particular market making and payout mechanism | ||
used on Zeitgeist for extra casual markets. | ||
|
||
These are "losers pay winners" market makers: Any informant can bet any amount | ||
at any time. Their bet amount goes into the _pot_ and they receive tokens which | ||
represent their share of the pot. After the market is resolved, the entire pot | ||
is distributed amongst those who wagered on the outcome that materialized, | ||
proportional to what their share of the pot is. | ||
|
||
Although parimutuels work with scalar markets, Zeitgeist currently only supports | ||
parimutuel for categorical markets. | ||
|
||
## Example | ||
|
||
Let's imagine a simple prediction market based on a horse race. There are five | ||
horses running in this race: A, B, C, D and E. People are placing bets on which | ||
horse they believe will win. | ||
|
||
Suppose that at this point, the total amount of money wagered on these horses is | ||
as follows: | ||
|
||
- A: $200 | ||
- B: $300 | ||
- C: $100 | ||
- D: $250 | ||
- E: $150 | ||
|
||
Altogether, the total pool of money that's been wagered is $1,000. | ||
|
||
If you bet on Horse A, and Horse A wins, for each dollar you bet, you'd get the | ||
total bets on all horses ($1,000) divided by the total amount bet on Horse A | ||
($200). So for every dollar you bet, you would get $5 back - this includes the | ||
return of your original dollar plus $4 in winnings. If you bet $100, then you'd | ||
receive a total of $500 from the pot. The market predicts the probability of A | ||
winning the race as 20% (or 1:4). | ||
|
||
Similarly, if you bet on Horse B, and Horse B wins, for each dollar you bet, | ||
you'd get the total bets on all horses ($1,000) divided by the amount bet on | ||
Horse B ($300). So for every dollar you bet, you would get roughly $3.33 back - | ||
this includes the return of your original dollar plus about $2.33 in winnings. | ||
The market predicts the probability of B winning the race as 30%. | ||
|
||
And so on for the rest of the horses... | ||
|
||
### Advantages and Disadvantages | ||
|
||
Unlike automatic market makers (AMM) or continuous double-auction (CDA), the | ||
parimutuel market maker does not require any liquidity, and shares the property | ||
of AMM that it can fill any order at any time. It is essentially a "bring your | ||
own liquidity" market maker. | ||
|
||
However, it does suffer several disadvantages compared to the other mechanisms | ||
on Zeitgeist: | ||
|
||
- The odds are not fixed when tokens are bought. For example, if an informant | ||
fills an ask at a price of 0.33 on an order book, then they know that they'll | ||
get a 300% payoff if they're right. That's not the case at a parimutuel. If | ||
more people buy your outcome, your payoff gets worse. This makes it impossible | ||
to properly reward traders that have moved the price in the right direction | ||
and have done so early and incentivizes informants to withhold information | ||
until close to the end of the market. | ||
|
||
But a particularly vexing symptom of this problem is that, if a market becomes | ||
trivialized (some outcome $X$ has materialized before the end of the market) | ||
and at least two agents have bet on the winning outcome, then it's a winning | ||
strategy to keep pumping more money into the market to dilute the other | ||
agent's stake. | ||
|
||
- No selling of contracts. Once you've bought a contract, you have to hold it. | ||
You can't just take back your bet. This means that parimutuels are really only | ||
suited for markets which resolve very quickly. | ||
Chralt98 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
As such, parimutuel markets are perfectly suited for short-lived markets where | ||
the market's outcome is published at a predefined time or where odds are | ||
considered comparatively stable. | ||
|
||
## Parimutuel Markets on Zeitgeist | ||
|
||
### Betting | ||
|
||
Every parimutuel market uses a special account as the pot. If an informant | ||
places a bet, they send `x` units of collateral to the pot and receive `x` units | ||
of the corresponding type of _parimutuel shares_. Informants must observe a | ||
minimum bet size defined in the parimutuel pallet when placing their bets. | ||
|
||
<!-- TODO External fees to be defined in the general section on Zeitgeist markets in a later PR. --> | ||
|
||
External fees are paid when users buy parimutuel shares in the usual fashion: If | ||
Alice buys parimutuel shares for a certain amount of collateral, then the | ||
external fees are deducted from this amount before the rest of the transaction | ||
is executed. The amount Alice is left with after fees are deducted must satisfy | ||
the minimum bet size requirement. | ||
|
||
### Claiming Rewards | ||
|
||
Suppose an informant holds $x$ units of the parimutuel share for the outcome | ||
$A$. If the market resolves to some outcome not equal to $A$, then the | ||
informants shares are completely worthless; if the market resolves to $A$, then | ||
the informant receives $xr$ units of collateral from the pot, where $r$ is the | ||
ratio between the amount wagered on $A$ and the total amount wagered on any | ||
outcome. A detailed outline of the math is presented further below. | ||
|
||
If the unlikely event occurs that the winning token has a total issuance of zero | ||
but the pot is not empty, each informant can redeem _any_ parimutuel share for | ||
its original price, one unit of collateral. This avoids confusion on markets | ||
with very low participation ("I bet $100 on A, no one else was interested, B won | ||
and now my money is gone?! Why?"). | ||
|
||
## Details: Expected Payoff in Categorical Markets | ||
|
||
If you believe an outcome has a probability p of occurring, then the fair return | ||
on a winning bet should be $1/p$. This is because, over many repetitions, you'd | ||
expect to win once every $1/p$ times. For example, if you believe that | ||
$p = 0.25$, then fair odds would be 4:1. This means for every dollar you bet, | ||
you'd expect a return of $4 on a win. | ||
|
||
We consider a denote the amount wagered on each outcome $i$ by $w_i$. In the | ||
parimutuel system, the return for each dollar bet on $i$ is | ||
$r_i = \sum_k w_k | ||
/w_i$. For this return to be considered "fair" based on your | ||
belief about the outcome's probability, it should match the inverse of your | ||
believed probability. In other words, if you think there's a 25% chance of an | ||
outcome, you'd expect the system to give you 4:1 odds (or a return of $4 for | ||
every $1 bet) for it to be a fair bet. | ||
|
||
If the system offers odds that are better than your believed probability, then | ||
you'd consider the bet to have positive expected value (you expect to make a | ||
profit in the long run). If the odds are worse, then the bet has negative | ||
expected value (you expect to lose money in the long run). | ||
|
||
In essence, for a bet to be "fair", the expected value should be zero: you | ||
neither expect to make nor lose money in the long run. This happens when the | ||
system's offered odds match your personal beliefs about the probability of the | ||
outcome. | ||
|
||
Long story short, given a pot balance $w$, the return $r_i(w)$ of a fair bet on | ||
$i$ would match the inverse of the probability $p_i(w)$ of $i$. Thus, the | ||
prediction/spot price of $i$ is $p_i(w) = r_i(w)^{-1}$. | ||
|
||
## Bibliography & Further Reading | ||
|
||
- Abraham Othman, Tuomas Sandholm, David M. Pennock, Daniel M. Reeves, | ||
[A practical liquidity-sensitive automated market maker](https://www.researchgate.net/publication/221445031_A_practical_liquidity-sensitive_automated_market_maker), | ||
ACM Transactions on Economics and Computation 1(3), pp. 377-386 (2010) | ||
- D. M. Pennock, "A dynamic pari-mutuel market for hedging, wagering, and | ||
information aggregation," in Proceedings of the 5th ACM Conference, 2004. DOI: | ||
10.1145/988772.988799 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK there will be no support for scalar markets, if we don't find a proper solution. You could try to explain the reason why we avoided scalar markets. But this requires probably too much knowledge for the documentation user. Maybe we should do marketing only for categorical markets using parimutuel, because scalar markets are harder to understand anyways.. So, I would probably reframe or add this "Because of the nature of how scalar markets work on the Zeitgeist protocol, the market participant would be rewarded or slashed based on the last state of the pot before the pot funds are redistributed. Essentially the SHORT and LONG percentage at the end of the market (closing time) is compared to the correct SHORT and LONG percentage determined by the correct scalar outcome value. This misaligns the incentives of the market participants, since a rational trader would always look for the LONG and SHORT percentage at the end of the market period to check if there is still a profit to make. Each trade shifts the LONG / SHORT ratio and therefore it's unclear if a trade is going to be profitable or not, assuming it's not the last trade."
This is too complicated, feel free to make it more simple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to explain why we don't implement certain features. I also disagree with some of what you write. I don't think there's any problem with scalar markets in conjunction with parimutuels that you don't also have with categorical markets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
Please think the reward process through with scalar markets. I thought we came to the same conclusion in our process and for that reason we decided to remove scalar markets for Parimutuels. Didn't we?
For categorical markets, if you buy the winning outcome, you can not lose any base asset. For scalar markets you can lose base asset, because there is no clear winner of LONG or SHORT, because the pot is divided by the actual scalar value between range start and range end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a clear winning strategy for scalar markets if your prediction is correct: If you think that the long correctness is c, and thus the short correctness is (1-c), then buy xc units of LONG and x(1-c) units of SHORT. The payoff is x(cr_l + (1 - c)r_s). You can know show that this greater or equal to x and equality holds if and only if everybody else is also buying at the same ratio.
The approach to do this is to define y = a_s/a_l and then calculate
cr_l + (1-c)r_s = c^2 * (1 + y) + (1 - c)^2 * (1 + 1/y).
You can now define f(c, y) = c^2 * (1 + y) + (1 - c)^2 * (1 + 1/y) and take first and second partial derivatives to see that in the strip (0, 1) \times (0, \infty), we have local minima at c = 1/(y + 1), and f(1/(y + 1), y) = 1, which proves the assertion (takes a bit of calculation to get through this).
TL;DR: Betting on parimutuel scalar markets just works a bit different than with AMM or CDA. You don't bet based on market state because... well, there is no market state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The doctor himself spoke.