diff --git a/common/util/promise.ts b/common/util/promise.ts new file mode 100644 index 00000000..33db339c --- /dev/null +++ b/common/util/promise.ts @@ -0,0 +1,18 @@ +export const batchedWaitAll = async ( + createPromises: (() => Promise)[], + batchSize = 10 +) => { + const numBatches = Math.ceil(createPromises.length / batchSize) + const result: T[] = [] + for (let batchIndex = 0; batchIndex < numBatches; batchIndex++) { + const from = batchIndex * batchSize + const to = from + batchSize + + const promises = createPromises.slice(from, to).map((f) => f()) + + const batch = await Promise.all(promises) + result.push(...batch) + } + + return result +} diff --git a/functions/src/update-contract-metrics.ts b/functions/src/update-contract-metrics.ts index 3646e7ad..d203ee99 100644 --- a/functions/src/update-contract-metrics.ts +++ b/functions/src/update-contract-metrics.ts @@ -5,6 +5,7 @@ import * as _ from 'lodash' import { getValues } from './utils' import { Contract } from '../../common/contract' import { Bet } from '../../common/bet' +import { batchedWaitAll } from '../../common/util/promise' const firestore = admin.firestore() @@ -17,8 +18,8 @@ export const updateContractMetrics = functions.pubsub firestore.collection('contracts') ) - await Promise.all( - contracts.map(async (contract) => { + await batchedWaitAll( + contracts.map((contract) => async () => { const volume24Hours = await computeVolumeFrom(contract, oneDay) const volume7Days = await computeVolumeFrom(contract, oneDay * 7) diff --git a/functions/src/update-user-metrics.ts b/functions/src/update-user-metrics.ts index 7de7fddd..50069423 100644 --- a/functions/src/update-user-metrics.ts +++ b/functions/src/update-user-metrics.ts @@ -7,6 +7,7 @@ import { Contract } from '../../common/contract' import { Bet } from '../../common/bet' import { User } from '../../common/user' import { calculateDpmPayout } from '../../common/calculate-dpm' +import { batchedWaitAll } from '../../common/util/promise' const firestore = admin.firestore() @@ -22,8 +23,8 @@ export const updateUserMetrics = functions.pubsub contracts.map((contract) => [contract.id, contract]) ) - await Promise.all( - users.map(async (user) => { + await batchedWaitAll( + users.map((user) => async () => { const [investmentValue, creatorVolume] = await Promise.all([ computeInvestmentValue(user, contractsDict), computeTotalPool(user, contractsDict), diff --git a/web/pages/about.tsx b/web/pages/about.tsx index 85e3eaee..3f0fcead 100644 --- a/web/pages/about.tsx +++ b/web/pages/about.tsx @@ -118,6 +118,13 @@ function Contents() {

+

+ More questions? Check out{' '} + + this community-driven FAQ + + ! +

Can prediction markets work without real money?

@@ -148,6 +155,40 @@ function Contents() { .

+ +

Why is this important?

+

+ Prediction markets aggregate and reveal crucial information that would + not otherwise be known. They are a bottom-up mechanism that can + influence everything from politics, economics, and business, to + scientific research and education. +

+

+ Prediction markets can predict{' '} + + which research papers will replicate + + ; which drug is the most effective; which policy would generate the most + tax revenue; which charity will be underfunded; or which startup idea is + the most promising. By surfacing and quantifying our collective + knowledge, we as a society become wiser. +

+ +

How does betting work?

+ +

How are markets resolved?

The creator of the prediction market decides the outcome and earns{' '} @@ -166,29 +207,9 @@ function Contents() { or even personal. (E.g. "Will I enjoy participating in the Metaverse in 2023?")

-

Why is this important?

-

- Prediction markets aggregate and reveal crucial information that would - not otherwise be known. They are a bottom-up mechanism that can - influence everything from politics, economics, and business, to - scientific research and education. -

-

- Prediction markets can predict{' '} - - which research papers will replicate - - ; which drug is the most effective; which policy would generate the most - tax revenue; which charity will be underfunded; or, which startup idea - is the most promising. -

-

- By surfacing and quantifying our collective knowledge, we as a society - become wiser. -

-

+ {/*

How is this different from Metaculus or Hypermind? -

+ */} {/*

We believe that in order to get the best results, you have to have skin in the game. We require that people use real money to buy the currency @@ -199,28 +220,13 @@ function Contents() { carefully and can't rig the outcome by creating multiple accounts. The result is more accurate predictions.

*/} -

+ {/*

Manifold Markets is focused on accessibility and allowing anyone to quickly create and judge a prediction market. When we all have the power to create and share prediction markets in seconds and apply our own judgment on the outcome, it leads to a qualitative shift in the number, variety, and usefulness of prediction markets. -

- -

How does betting work?

- +

*/}

What kind of betting system do you use?

@@ -249,6 +255,20 @@ function Contents() { to find out more!

+

Can I create private markets?

+

+ Soon! We're running a pilot version of Manifold for Teams - private + Manifold instances where you can discuss internal topics and predict on + outcomes for your organization. +

+

+ If this sounds like something you’d want,{' '} + + join the waitlist here + + ! +

+

Who are we?

Manifold Markets is currently a team of three: