Manifold Markets: A market for every question
Go to file
James Grugett 76f27d1a93
Numeric range markets!! (#146)
* Numeric contract type

* Create market numeric type

* Add numeric graph (coded without testing)

* Outline of numeric bet panel

* Update bet panel logic

* create numeric contracts

* remove batching for antes for numeric markets

* Remove focus

* numeric market range [1, 100]

* Zoom graph

* Hide bet panels

* getNumericBets

* Add numeric resolution panel

* Use getNumericBets in bet panel calc

* Switch bucket count to 100

* Parallelize ante creation

* placeBet for numeric markets

* halve std of numeric bets

* Update resolveMarket with numeric type

* Set min and max for contract

* lower std for numeric bets

* calculateNumericDpmShares: use sorted order

* Use min and max to map the input

* Fix probability calc

* normpdf variance mislabeled

* range input

* merge

* change numeric graph color

* fix getNewContract params

* bet panel labels

* validation

* number input

* fix bucketing

* bucket input, numeric resolution panel

* outcome label

* merge

* numeric bet panel on mobile

* Make text underneath filled green answer bar selectable

* Default to 'all' feed category when loading page.

* fix numeric resolution panel

* fix numeric bet panel calculations

* display numeric resolution

* don't render NumericBetPanel for non numeric markets

* numeric bets: store shares, bet amounts across buckets in each bet object

* restore your bets for numeric markets

* numeric pnl calculations

* remove hasUserHitManaLimit

* contrain contract type

* handle undefined allOutcomeShares

* numeric ante bet amount

* use correct amount for numeric dpm payouts

* change numeric graph/outcome color

* numeric constants

* hack to show correct numeric payout in calculateDpmPayoutAfterCorrectBet

* remove comment

* fix ante display in bet list

* halve bucket count

* cast to NumericContract

* fix merge imports

* OUTCOME_TYPES

* typo

* lower bucket count to 200

* store raw numeric value with bet

* store raw numeric resolution value

* number input max length

* create page: min, max to undefined if not numeric market

* numeric resolution formatting

* expected value for numeric markets

* expected value for numeric markets

* rearrange lines for readability

* move normalpdf to util/math

* show bets tab

* check if outcomeMode is undefined

* remove extraneous auto-merge cruft

* hide comment status for numeric markets

* import

Co-authored-by: mantikoros <sgrugett@gmail.com>
2022-05-19 12:42:03 -05:00
.github Link to beeminder & discourse 2022-04-29 13:45:10 -04:00
.vscode Switch vscode imports to "shortest" 2022-05-10 09:43:04 -04:00
common Numeric range markets!! (#146) 2022-05-19 12:42:03 -05:00
functions Numeric range markets!! (#146) 2022-05-19 12:42:03 -05:00
og-image Threaded free response comments & general comments sections (#121) 2022-05-03 14:38:40 -06:00
web Numeric range markets!! (#146) 2022-05-19 12:42:03 -05:00
.firebaserc Allow admins to see private-users info 2022-01-24 00:48:10 -06:00
.gitignore Single threaded comments (#175) 2022-05-11 15:11:46 -06:00
.prettierrc move prettier config to top level 2022-01-10 17:44:42 -06:00
firebase.json Reapply Manifold for Teams config changes (#54) 2022-02-26 23:29:33 -08:00
firestore.indexes.json Merge Manifold for Teams infra into main codebase (#61) 2022-03-08 18:43:30 -08:00
firestore.rules Allow users to generate an API key in their profile (#182) 2022-05-15 20:41:07 -07:00
LICENSE.md Choose MIT license 2022-04-02 12:01:23 -07:00
package.json Yarn workspaces (#42) 2022-02-01 15:25:51 -06:00
README.md Update README link to Discord 2022-05-02 10:14:40 -04:00
yarn.lock Implement onRequest versions of createContract, placeBet functions (#227) 2022-05-16 21:43:40 -07:00

Manifold Markets

This monorepo has basically everything involved in running and operating Manifold.

Getting started

  1. Make sure you have Yarn 1.x
  2. $ cd web
  3. $ yarn
  4. $ yarn dev:dev
  5. Your site will be available on http://localhost:3000

See web/README.md for more details on hacking on the web client.

General architecture

Manifold's public API and web app are hosted by Vercel. In general, the web app runs as much as possible on the client; we follow a JAMStack architecture. All data is stored in Firebase's database, Cloud Firestore. This is directly accessed by the client for most data access operations.

Operations with complicated contracts (e.g. buying shares) are provided in a separate HTTP API using Firebase's Cloud Functions. Those are deployed separately from the Vercel website; see functions/README.md for more details.

Directory overview

  • web/: UI and business logic for the client. Where most of the site lives. The public API endpoints are also in here.

  • functions/: Firebase cloud functions, for secure work (e.g. balances, Stripe payments, emails). Also contains in functions/src/scripts/ some Typescript scripts that do ad hoc CLI interaction with Firebase.

  • common/: Typescript library code shared between web/ & functions/. If you want to look at how the market math works, most of that's in here (it gets called from the placeBet and sellBet endpoints in functions/.) Also contains in common/envs configuration for the different environments (i.e. prod, dev, Manifold for Teams instances.)

  • og-image/: The OpenGraph image generator; creates the preview images shown on Twitter/social media.

Also: Our docs are currently in a separate repo. TODO: move them into this monorepo.

Contributing

Since we are just now open-sourcing things, we will see how things go. Feel free to open issues, submit PRs, and chat about the process on Discord. We would prefer small PRs that we can effectively evaluate and review -- maybe check in with us first if you are thinking to work on a big change.

By contributing to this codebase, you are agreeing to the terms of the Manifold CLA.

If you need additional access to any infrastructure in order to work on something (e.g. Vercel, Firebase) let us know about that on Discord as well.