Author Topic: Simple Binary Prediction Market Discussion  (Read 24764 times)

0 Members and 1 Guest are viewing this topic.

Offline arhag

  • Hero Member
  • *****
  • Posts: 1214
    • View Profile
    • My posts on Steem
  • BitShares: arhag
  • GitHub: arhag
Why dont we offer paul a delegate to be our pm consultant?

Like he would take it. Haven't you read this? He dislikes us for some reason. Plus he is a Proof-of-Waste believer. Sigh.

Anyway, the information for this stuff is out there. These papers are all great:
http://mason.gmu.edu/~rhanson/mktscore.pdf
http://mason.gmu.edu/~rhanson/combobet.pdf
http://www.eecs.harvard.edu/cs286r/courses/fall12/papers/OPRS10.pdf

If you want to study the Truthcoin design you can get it from their whitepaper (http://www.truthcoin.info/papers/truthcoin-whitepaper.pdf). Plus, the source code is open and available (https://github.com/psztorc/Truthcoin).

We don't need Paul. Though it would be terrific if he were to change his views about BitShares, DPOS, and BitAssets and decide he wanted to make prediction markets a reality for BitShares. In that case I would be happy to support him, but it isn't going to happen.
« Last Edit: February 08, 2015, 03:50:07 am by arhag »

Offline jsidhu

  • Hero Member
  • *****
  • Posts: 1335
    • View Profile
Why dont we offer paul a delegate to be our pm consultant?
Hired by blockchain | Developer
delegate: dev.sidhujag

Offline arhag

  • Hero Member
  • *****
  • Posts: 1214
    • View Profile
    • My posts on Steem
  • BitShares: arhag
  • GitHub: arhag
However, this may help. Please do look at a this modified market maker that truthcoin and augur are going to use called Practical Liquidity Sensitive Market Maker.  From what I've gathered since I started reading it today, there is a fee charged (say 3%), which is then applied to the liquidity pool.  This alpha helps to limit the swings in the markets.  The impact of loss is reduced and a bookie won't think hard about what the appropriate seed capital should be when authoring the contract.

http://forum.truthcoin.info/index.php/topic,130.msg886.html#msg886

http://www.eecs.harvard.edu/cs286r/courses/fall12/papers/OPRS10.pdf

+5% Yes, now we're talking. We need the market maker to be liquidity sensitive and profitable. Let the PM creator set a trading fee that goes to enhancing liquidity (which sets alpha) and a trading fee that goes to a profit pool; the combined trading fee is the percentage fee on all trades made in the PM that traders need to pay (hopefully not too large). Let them also set the slate of judges that are allowed to determine the outcome and a fixed fee they are willing to pay them if they do provide the consensus outcome. Before the PM opens up for trading, people can invest money into the PM in return for equity at a 1:1 rate (which they can trade back at any time before the PM opens up for trading) so that the money can be used to provide the fees to pay the minimum number of judges needed to reach consensus on the outcome and the rest can go towards the market maker to provide initial liquidity. Judges in the specified judge slate for that PM can submit a message to the blockchain claiming that they will judge the outcome of that PM (they can take back this claim anytime before the PM opens up for trading). Once a specified minimum number of judges agree to judge the outcome of this PM (and the money raised is larger than the amount needed to pay them), the prediction market opens up for trading. At the end once the consensus outcome is known, the collected pool of money is used to first pay the winners, then pay the judges who voted for the consensus results (up to the per-judge fee that was specified in the definition of the PM), and then any money left over is divided proportionally to the equity holders.
« Last Edit: February 08, 2015, 02:54:36 am by arhag »

Offline Bitcoinfan

  • Sr. Member
  • ****
  • Posts: 240
    • View Profile

(start of lsmr in current develop: https://github.com/BitShares/bitshares/blob/6d42fcab803983ec16f9ec094a71fa2078febad3/libraries/blockchain/include/bts/blockchain/lsmr_record.hpp

we can also copy the working lsmr impelmentation from TC's repo)

Right on.  Glad you have an eye on this.  We may see a test version in march to play around with that can be applied to Bitshares.   

I thought some more and I'm thinking we'll have to worry a bit about additional interesting things that happen if, instead of having a bunch of agents doing one-shot deals with the market maker, we have a bunch of standing orders that will execute whenever the price (tries to) move past a given value.

Suppose there's a buy order for A at $0.40.  The market maker's current price for A is $0.41 and current price for B is $0.45.  Someone places a buy order for a large quantity of B at $0.50.  Buying B will push up the price of B and push down the price of A, but once the price of A hits $0.40, the order for A starts to execute, putting a downward pressure on B which will fight the upward pressure from the buy order.

In other words, the buy order for A creates a floor at $0.40 below which the value of A cannot fall until the order is totally filled.  Once the price hits this floor, it becomes harder for the guy buying B to raise the price (less price movement per quantity bought).

We can classify the assets as reactive, active or inactive based on the price of the top-of-book order relative to the market maker's price.  Inactive order isn't matched by the market maker (buying more cheaply than the market maker's offering).  Active order is matched by the market maker with nonzero quantity (i.e. buying strictly greater than the market maker's current price).  Reactive order is exactly matched by market maker's price, it "executes at zero quantity" which means in practice it doesn't execute.  But when an active order executes, every reactive order will execute and oppose the price forces exerted by the active order on themselves and the active order (but will push in the same direction as the active order on inactive prices!)

I'm trying to figure out how we end up implementing this without needing numerical integration.  It might be possible; I'll have to think about it some more.  OTOH maybe numerical integration is fine, especially if we smooth out the discontinuities a little (e.g. instead of having the boundaries be vertical cliffs, make them instead very steep slopes 0.1% wide with smooth curve-in and curve-out, which are less "confusing" to the integrator).

Since I'm not as close to the implementation as you are I won't share the same appreciation that you just mentioned.  I tend to think this is natural function of price discovery, in this case information discovery. The random walk could be noise (which is greatest the shorter the time interval your looking at), or it could be that this rightfully prices the degrees of belief within the market. 

However, this may help. Please do look at a this modified market maker that truthcoin and augur are going to use called Practical Liquidity Sensitive Market Maker.  From what I've gathered since I started reading it today, there is a fee charged (say 3%), which is then applied to the liquidity pool.  This alpha helps to limit the swings in the markets.  The impact of loss is reduced and a bookie won't think hard about what the appropriate seed capital should be when authoring the contract.

http://forum.truthcoin.info/index.php/topic,130.msg886.html#msg886

http://www.eecs.harvard.edu/cs286r/courses/fall12/papers/OPRS10.pdf

http://www.bayesianinvestor.com/blog/index.php/2010/06/21/an-improved-automated-market-maker/


btw since your pivoting to prediction mrkets don't be afraid to start jumping into the truthcoin forums and start picking everyone's brains there. Paul is always helpful when answering questions. 
« Last Edit: February 07, 2015, 10:27:29 pm by Bitcoinfan »

Offline theoretical

I thought some more and I'm thinking we'll have to worry a bit about additional interesting things that happen if, instead of having a bunch of agents doing one-shot deals with the market maker, we have a bunch of standing orders that will execute whenever the price (tries to) move past a given value.

Suppose there's a buy order for A at $0.40.  The market maker's current price for A is $0.41 and current price for B is $0.45.  Someone places a buy order for a large quantity of B at $0.50.  Buying B will push up the price of B and push down the price of A, but once the price of A hits $0.40, the order for A starts to execute, putting a downward pressure on B which will fight the upward pressure from the buy order.

In other words, the buy order for A creates a floor at $0.40 below which the value of A cannot fall until the order is totally filled.  Once the price hits this floor, it becomes harder for the guy buying B to raise the price (less price movement per quantity bought).

We can classify the assets as reactive, active or inactive based on the price of the top-of-book order relative to the market maker's price.  Inactive order isn't matched by the market maker (buying more cheaply than the market maker's offering).  Active order is matched by the market maker with nonzero quantity (i.e. buying strictly greater than the market maker's current price).  Reactive order is exactly matched by market maker's price, it "executes at zero quantity" which means in practice it doesn't execute.  But when an active order executes, every reactive order will execute and oppose the price forces exerted by the active order on themselves and the active order (but will push in the same direction as the active order on inactive prices!)

I'm trying to figure out how we end up implementing this without needing numerical integration.  It might be possible; I'll have to think about it some more.  OTOH maybe numerical integration is fine, especially if we smooth out the discontinuities a little (e.g. instead of having the boundaries be vertical cliffs, make them instead very steep slopes 0.1% wide with smooth curve-in and curve-out, which are less "confusing" to the integrator).
BTS- theoretical / PTS- PZxpdC8RqWsdU3pVJeobZY7JFKVPfNpy5z / BTC- 1NfGejohzoVGffAD1CnCRgo9vApjCU2viY / the delegate formerly known as drltc / Nothing said on these forums is intended to be legally binding / All opinions are my own unless otherwise noted / Take action due to my posts at your own risk

Offline theoretical

I don't know if understand your preorder idea. If the orders are placed but don't execute how will the market maker adjust the price?

The market maker won't adjust the price until it opens its doors.

If it doesn't adjust the price doesn't that mean all preorder buyers will be forced to buy at a price of 0.33 BitUSD/{A,B,C} for all three assets?

Yes, but only the first $1 (actually, the math effectively uses infinitesimal fractions, so it's more like 1 satoshi) will execute at that price.  If people only buy A and B at that price, then A and B will start to rise and C will start to fall.  Then eventually either A or B will be pushed to a price that exceeds what people are willing to pay (or buy orders for them will run out of money).  Likewise C may fall cheap enough that buy orders for C become active (there may be takers for C willing to pay $0.05 or $0.03 or $0.001).

But what if the market's prior expectation of the probabilities for the three outcomes is not uniform?

What I mean by the market maker being "dumb" is that his prior expectation for the probabilities is always uniform.  Then he updates those prices based on the total of what he's bought and sold and how much money he has left to help pay out winners (if someone buys a million tickets when the market maker only has $1000, the tickets might cost $0.9997 each and most of the payout will be the buyer getting his own money back, but the market maker does "help" by adding $1,000,000 - $999,700 = $300 to the pool).

That means people only buy the assets corresponding to outcomes with better than uniform probabilities at a nice discount price (granted at the cost that 5% of their orders will instead be forced into a speculative asset which gets its value from the outcome being contrary to the market's expectation of the outcome immediately prior to the outcome being known to the blockchain).

Yes, this is true -- but the discount quickly vanishes after only a small fraction of the orders are filled, because the market maker's funds dwindle.

That brings up another question. Won't the market always adjust to make the true outcome most favorable faster than a super majority of the judges can put the outcome into the blockchain?

Yes.  If everyone saw on TV that Ron Paul won, but it'll be a few days before the official result comes in and the judges input it into the blockchain, then everybody'll be buying C at $0.99 and trying to unload A or B at $0.001.  The $0.01 discount on C would be basically because some people with C might want the convenience of cashing out now instead of in a few days, and they want it so bad they're offering to give 1% of their payout to somebody else if that's what it takes to make it happen.  The A and B assets would probably be completely illiquid -- whoever ended up with them is stuck with the assets and their $0 payout, because the supply of fools willing to buy assets known to be worthless is usually quite limited, and all the people willing to sell to them at any price will quickly part them from their money.

In other words, while we're watching who various states went for on TV, people will be trying to buy the winner before he's all the way in the $0.90 range and sell the loser before he's totally worthless.  They'll be trading to contrarians, people trying to sell an overvalued lead horse and trying to pick up shares in the underdog on the cheap.  In the course of those madly gyrating market conditions, somebody will end up with all those A and B shares and be unable to unload them, their orders will go unfilled and they'll end up with worthless assets.  Traders who prefer a calmer style could simply pick their horse at more stable prices earlier in the week, then simply hold the shares until it's all over.

So isn't the market maker pretty much always going to lose?

Yes.  Which is why in the paper he suggests it be funded by someone who derives value from having the prediction, because they can expect a loss from funding the market maker.

I say the market maker should be funded by equity investors, and everyone who places a pre-order becomes an equity investor in the amount of 5% of their order.  Everyone who places a pre-order gets a piece of the action when the market maker has their dumb initial position with A, B, C all at $0.34.  The +EV of that piece cancels out the -EV of investing in someone who only makes money when a free market doesn't work.  It has to cancel because there's nowhere else for the money to go!
« Last Edit: February 07, 2015, 04:01:01 pm by theoretical »
BTS- theoretical / PTS- PZxpdC8RqWsdU3pVJeobZY7JFKVPfNpy5z / BTC- 1NfGejohzoVGffAD1CnCRgo9vApjCU2viY / the delegate formerly known as drltc / Nothing said on these forums is intended to be legally binding / All opinions are my own unless otherwise noted / Take action due to my posts at your own risk

Offline arhag

  • Hero Member
  • *****
  • Posts: 1214
    • View Profile
    • My posts on Steem
  • BitShares: arhag
  • GitHub: arhag
I spent some time looking into it.  Bookie stands to lose in some cases, but how much does he stand to gain?

If asset X wins, the bookie's leftover funds are the difference between his cash reserves and the float of asset X.  So the biggest win for the bookie is if the least popular option ends up winning.  In other words, the bookie's betting against the market; the bookie will make a profit when the market is wrong!

In the paper he talks about the bookie being altruistically funded by someone who derives value from knowing the prediction.  E.g. a newspaper wanting a poll result to sell papers, a business wanting a prediction to help place investments, etc.

I think a better way is to have the bookie funded by orders themselves.  I.e. have a preorder period, let the market open happen some time after the asset's been defined.  In the preorder period, orders can be placed but don't execute (in fact they can't execute because the bookie is initially the only seller of all the assets, so the market has to be closed until he's funded).  Then at some defined point in time, the market opens -- 5% is taken from every order and used to fund the bookie operations.  I think the 5% should not be a fee, the users should get an equity position in the bookie, which will make bank if the decision has a float much lower than the bookie's cash reserves.  So all funds used to buy A, B, and C, except for normal transaction fees (and maybe some functionality-specific fees), will be returned to holders of A, B and C.

I don't know if understand your preorder idea. If the orders are placed but don't execute how will the market maker adjust the price? If it doesn't adjust the price doesn't that mean all preorder buyers will be forced to buy at a price of 0.33 BitUSD/{A,B,C} for all three assets? But what if the market's prior expectation of the probabilities for the three outcomes is not uniform? That means people only buy the assets corresponding to outcomes with better than uniform probabilities at a nice discount price (granted at the cost that 5% of their orders will instead be forced into a speculative asset which gets its value from the outcome being contrary to the market's expectation of the outcome immediately prior to the outcome being known to the blockchain). That brings up another question. Won't the market always adjust to make the true outcome most favorable faster than a super majority of the judges can put the outcome into the blockchain? The only way I can see to prevent that is if the prediction market was frozen before the outcome was known, but then we can't use that for things where we don't know exactly when the outcome will be known. So isn't the market maker pretty much always going to lose?

Personally, I think the market maker needs to recover its costs through charging a small spread on everyone's orders. Someone or a group of people could put up the initial funds to provide liquidity to the market maker in the hope that there will be enough volume so that they can make a profit from the spread. In fact, I envision that the prediction market creator would define the initial pool of capital, C BitUSD, meant for the LMSR market maker that is needed for the prediction market to open, define the fixed percentage spread, and also define an expiration date for when the prediction market is considered to be a dud. Anyone could browse through these inactive prediction markets and decide if they see one they want to invest in. If the prediction market has not opened up yet, someone can deposit X BitUSD and get back X/C fraction of the total shares in that prediction market's market maker equity. If C BitUSD is not raised by the expiration date then all funds are returned back to those shareholders. Otherwise if the amount is reached, the prediction market opens up. The market maker takes the spread and puts it in their profit pool. At the end when the outcome has been decided, the prediction market pays out the winners and any remaining funds are split proportionally to the shareholders.

Furthermore, the prediction market could be defined to increase the amount of shares by a certain amount to give to each of the judges who voted for an outcome that turned out to be the consensus outcome decided by the super majority of selected judges. This pays the judges for their work of actually determining the outcomes and voting for it on the blockchain, without having to worry about whether the prediction market creator or some other third party will pay them (instead the blockchain enforces it).
« Last Edit: February 07, 2015, 05:03:34 am by arhag »

Offline theoretical

Also, I know that now that we understand it, some of us (me at least) are feeling all fired up to implement this.  But I want to do some refactoring of the market engine this weekend, and we might want to hold off because what I'm doing will make writing the bookie easier (at least the market part).
BTS- theoretical / PTS- PZxpdC8RqWsdU3pVJeobZY7JFKVPfNpy5z / BTC- 1NfGejohzoVGffAD1CnCRgo9vApjCU2viY / the delegate formerly known as drltc / Nothing said on these forums is intended to be legally binding / All opinions are my own unless otherwise noted / Take action due to my posts at your own risk

Offline theoretical

I spent some time looking into it.  Bookie stands to lose in some cases, but how much does he stand to gain?

If asset X wins, the bookie's leftover funds are the difference between his cash reserves and the float of asset X.  So the biggest win for the bookie is if the least popular option ends up winning.  In other words, the bookie's betting against the market; the bookie will make a profit when the market is wrong!

In the paper he talks about the bookie being altruistically funded by someone who derives value from knowing the prediction.  E.g. a newspaper wanting a poll result to sell papers, a business wanting a prediction to help place investments, etc.

I think a better way is to have the bookie funded by orders themselves.  I.e. have a preorder period, let the market open happen some time after the asset's been defined.  In the preorder period, orders can be placed but don't execute (in fact they can't execute because the bookie is initially the only seller of all the assets, so the market has to be closed until he's funded).  Then at some defined point in time, the market opens -- 5% is taken from every order and used to fund the bookie operations.  I think the 5% should not be a fee, the users should get an equity position in the bookie, which will make bank if the decision has a float much lower than the bookie's cash reserves.  So all funds used to buy A, B, and C, except for normal transaction fees (and maybe some functionality-specific fees), will be returned to holders of A, B and C.
BTS- theoretical / PTS- PZxpdC8RqWsdU3pVJeobZY7JFKVPfNpy5z / BTC- 1NfGejohzoVGffAD1CnCRgo9vApjCU2viY / the delegate formerly known as drltc / Nothing said on these forums is intended to be legally binding / All opinions are my own unless otherwise noted / Take action due to my posts at your own risk

Offline bytemaster

I spent some time looking into it.  Bookie stands to lose in some cases, but how much does he stand to gain?
For the latest updates checkout my blog: http://bytemaster.bitshares.org
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

Offline theoretical

Spreadsheet is way clearer than the paper.  Basically the DAC runs a bookie who always goes by more or less the current odds, except early on when there's not much action, he prices everything equally.  So if the bookie initially has $100 and you can bet on A = Democratic President, B = Republican President, C = Somebody else, he'll sell you a ticket that pays $1 if A for $0.34, $1 if B for $0.34, and $1 if C for $0.34.

Of course we know things about elections that the bookie doesn't, namely that his price for C is way out of line with the odds.

But the bookie knows he's dumb, so he's set it up so you can only buy $1 at a time, and then you have to let him incorporate the information "somebody bought a ticket on A for $1" into his price setting algorithm before anyone can buy another ticket.  So if you get a ticket for A, then the price of A might rise to $0.36, while B and C drop -- if you want a second ticket on A, you'll have to pay more.  So eventually the big run of people buying A+B to make a Dutch book on the bookie will end up pushing the odds of C where it belongs (and an impoverished bookie).

If someone tries to buy a million tickets on A (or A+B or any combination) when there's not much other action, he'll end up paying $0.99 each (or more!) and end up merely getting his own money back.

With the math in the paper, the tickets are infinitesimally small, but that's the idea.
BTS- theoretical / PTS- PZxpdC8RqWsdU3pVJeobZY7JFKVPfNpy5z / BTC- 1NfGejohzoVGffAD1CnCRgo9vApjCU2viY / the delegate formerly known as drltc / Nothing said on these forums is intended to be legally binding / All opinions are my own unless otherwise noted / Take action due to my posts at your own risk

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
UI != core
you could do it in a completely different app, too ..
It would just use an asset?
There is no need to interpret every single transaction in the blockchain .. also with light-weight clients you can start interpreting only what you are interesting in.
So basically the blockchain/tech allows you to only use Decentralized exchange, only bitUSD, VOTE, or only DNS, or maybe only the PM. No need to also check the whole thing because that is what the delegates are good for.

Offline jsidhu

  • Hero Member
  • *****
  • Posts: 1335
    • View Profile
Hard part will be deciding how to integrate pms with the core of bitshares.. Not just another tab next to market
UI != core
you could do it in a completely different app, too ..
It would just use an asset?
Hired by blockchain | Developer
delegate: dev.sidhujag

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Hard part will be deciding how to integrate pms with the core of bitshares.. Not just another tab next to market
UI != core
you could do it in a completely different app, too ..