Author Topic: discrete LMSR html5 demo  (Read 5542 times)

martinBrown

  • Newbie
  • *
  • Posts: 42
    • View Profile
discrete LMSR html5 demo
« on: August 27, 2014, 11:05:44 pm »
A crude front-end: code and demo. Just discrete PM trading/betting, no forms for voting to resolve event outcomes, yet.

Slap it on top of your preferred TruthCoin back-end stack ;D  And polish the UI/CSS theme while you're at it.

Suggestions, critiques, corrections?

psztorc

  • Administrator
  • Sr. Member
  • *****
  • Posts: 464
    • View Profile
Re: discrete LMSR html5 demo
« Reply #1 on: August 28, 2014, 01:31:01 am »
The best so far!  :)

And, what's more, it seems to work! From stress testing it, I seem to be able to buy 5 shares, and then sell 6, which is of course illegal.

The theme is cracking me up. What century are we in?
Nullius In Verba

koeppelmann

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: discrete LMSR html5 demo
« Reply #2 on: August 29, 2014, 01:41:10 am »
Thanks - I think this is helpful to have the option to play around with some values.

I noticed a bug: when I bought some shares (2000 on every event) the "change prob. to" is not working - see screenshot attached.
EDIT: hm, guess the attachment did not work. However - it should be easy to reproduce.


And I noticed one more thing: As a event author it will be VERY HARD to get your initial investment back.

Lets have a look at this example: the initial capital required is $415.88.
No lets make assumption how trading could look like. First lets assume that the "real prob." is indeed 25% for each team. However - people might have different opinions about the teams - but I think a realistic assumption would be, that people don't want to move the price more than 3%.

In this example this would be: buying 46 shares or spending $12.23. If the fee would be 1% (that is what we take at fairlay on average) the profit would be $0,12. To cover the initial investment of $415.88 3465 trades are needed.

Note that fees for event creation or fees for the votecoin holders are not even in this calculation. Of course the event creator only pays the full amount of the initial funding if one price converges to 1 and that event actually happens. But this should happen all the time the way truthcoin is designed.


Note that even if four parties are willing to predict large amounts at a price up to 0.28 on there team they can only do so by placing around small orders. And every one has an incentive to place a order as small as possible to not pay a higher price then necessary.

I think it would be necessary to place classical buy/sell orders in the truthcoin blockchain that either get active as soon as the market maker price goes below them or that could be matched by other orders directly.
« Last Edit: August 29, 2014, 01:43:36 am by koeppelmann »

psztorc

  • Administrator
  • Sr. Member
  • *****
  • Posts: 464
    • View Profile
Re: discrete LMSR html5 demo
« Reply #3 on: August 29, 2014, 02:18:52 am »
And I noticed one more thing: As a event author it will be VERY HARD to get your initial investment back.

Lets have a look at this example: the initial capital required is $415.88.
No lets make assumption how trading could look like. First lets assume that the "real prob." is indeed 25% for each team. However - people might have different opinions about the teams - but I think a realistic assumption would be, that people don't want to move the price more than 3%.

Yes, this implied a b of 415.88/ln(4) = 300 which would be an extraordinarily "generous" amount of liquidity in general. Moreso given that this is a sports bet which probably doesn't need any extra liquidity...one would think a b of 3 would suffice, requiring about 4 bucks. In practice I suspect that some Authors will rely on marketing and entertainment, and even set b's that are even lower (.03, requiring about 4 cents).
Nullius In Verba

koeppelmann

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: discrete LMSR html5 demo
« Reply #4 on: August 29, 2014, 03:46:34 am »
Well - a smaller k does not change too much since the trades gets smaller as well.

If I take your excel file (minimal example/ Hillary) and set b to 3 the capital required k is 2,07. Again - a trade that alters the % by 3% costs 10% of k. Assuming a 1% fee - that is still 1000 trades required just to reach k.

psztorc

  • Administrator
  • Sr. Member
  • *****
  • Posts: 464
    • View Profile
Re: discrete LMSR html5 demo
« Reply #5 on: August 29, 2014, 04:12:36 am »
I don't understand what you are saying. Trades may be a function of liquidity (b, the seed capital), but surely you'd expect them to be mostly functions of, say, user interest. Markets will either be popular or not, probably based on topic more than anything else. In contrast, lower b means lower seed capital, it is a 1:1 function.

Moreover, the real prob might start at 25% even, but one the game(s) start new information (and new interpretations of that information) would induce all kinds of trades, don't you agree?
Nullius In Verba

koeppelmann

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: discrete LMSR html5 demo
« Reply #6 on: August 29, 2014, 02:39:47 pm »
I think trade size is a function f1(b or k) and trade number is a function f2(interest in the event (i) + #of new information (since every new information should cause a trade))

All I am saying now is that for a reasonable assumption of f1 the result of f2(i+#) must be > 1000 to cover k from the fees independent of b.

This is because larger trades of two parties against each other can only be done this LOTS of small alternating trades. Maybe this can he hidden behind a user interface - but maybe the trading rules of truthcoin should change to allow large trades.

psztorc

  • Administrator
  • Sr. Member
  • *****
  • Posts: 464
    • View Profile
Re: discrete LMSR html5 demo
« Reply #7 on: August 29, 2014, 06:41:16 pm »
This is because larger trades of two parties against each other can only be done this LOTS of small alternating trades. Maybe this can he hidden behind a user interface - but maybe the trading rules of truthcoin should change to allow large trades.

If people don't sell, the oustanding shares increase and the market can take larger movements without a higher b, just like regular markets (the NYSE, with a "b of zero" [no AMM], people still place large trades on the DJIA every trading day, because other people are also doing so).
« Last Edit: August 29, 2014, 09:51:38 pm by psztorc »
Nullius In Verba

martinBrown

  • Newbie
  • *
  • Posts: 42
    • View Profile
Re: discrete LMSR html5 demo
« Reply #8 on: August 31, 2014, 03:51:30 pm »
From stress testing it, I seem to be able to buy 5 shares, and then sell 6, which is of course illegal.

fixed. Also added "risk to win" and decimal odds.

The theme is cracking me up. What century are we in?

The century before bootstrap (twitter's css theme).


I noticed a bug: when I bought some shares (2000 on every event) the "change prob. to" is not working - see screenshot attached.
EDIT: hm, guess the attachment did not work. However - it should be easy to reproduce.

2000 is a huge amount, I mostly experiment with sizes around 10-100. Anyway, that field isn't yet robust, you'll see a lot of NaN's and Infinity's if you change that field directly. It needs the ability to "sell short" an outcome (ie. buy an equal amount on every other outcome) before it can be robust. Until then, entering a probability that's lower than the current one will cause those errors (not sure if its the same bug you saw. I've used imgur to post screenshots here).


And I noticed one more thing: As a event author it will be VERY HARD to get your initial investment back.

The basic LMSR market maker isn't designed to be profitable - its designed to be subsidized. One thing that might alleviate this, even for basic LMSR, is to use an initial "b" vector with the probabilities at Vegas odds. Not sure how much this would help (and it would depend on the outcome anyway), but its on the TODOs (in the repo readme). Right now the b vector is uniform probabilities (ie, starts at 0.25 on all 4 outcomes).

Another of the TODOS is volume-parameterized (aka liquidity-sensitive) LMSR - where the "b" parameter increases as trade volume increases. These designs replace the "b" parameter with an "alpha" parameter, which acts as a percentage fee and creates a profit-making market-maker. Note that traditional sportsbooks maintain a "vig" of around 4%-5%.

I think it would be necessary to place classical buy/sell orders in the truthcoin blockchain that either get active as soon as the market maker price goes below them or that could be matched by other orders directly.

I like the idea of a hybrid classical order book + LMSR, described here. This would let users make offers, which adds liquidity (opposed to only permitting users to take offers, which in basic LMSR do not add liquidity).

Zocalo

  • Newbie
  • *
  • Posts: 2
  • libertarian, zocalo.sourceforge.net, sci-fi
    • View Profile
Re: discrete LMSR html5 demo
« Reply #9 on: January 26, 2015, 06:56:36 am »
The LMSR design requires a subsidy, and the calculations it uses to decide on prices always result in the AMM having enough funds to be able to trade. As the price gets arbitrarily close to 0 or 1, the market maker's funds get arbitrarily close to zero. If the market then swings the other way, the AMM collects money as the price moves back to the middle, so it can then subsidize trades again.

I'd like to see a design for a scoring rule that managed to increase B as the market gets thicker. The math for this is not obvious. It's not even clear what behavior would be desirable. It's possible to argue that since bookies collect a vig, it would be acceptable to charge more than the minimum on every trade, but every percentage the market takes makes it less likely for people to vote, and skews the market's output probability estimates ever so slightly.

I wouldn't mind talking about this more. (I'm the author of the explanation linked to above.)

psztorc

  • Administrator
  • Sr. Member
  • *****
  • Posts: 464
    • View Profile
Re: discrete LMSR html5 demo
« Reply #10 on: January 26, 2015, 03:35:17 pm »
The MSR-certified martinBrown has convinced me to switch to this: http://www.eecs.harvard.edu/cs286r/courses/fall12/papers/OPRS10.pdf

I have a newer Excel file which includes this example, but haven't released it to the public. Nonetheless I am excited about taking away the requirement that Market-Authors choose a good b...now any initial-liquidity-errors that Market-Authors make have a drastically lower impact.
Nullius In Verba