feat(Metaculus): wire Metaculus exchange into package, server, docs, and compliance#71
Merged
realfishsam merged 9 commits intopmxt-dev:mainfrom Apr 4, 2026
Conversation
…n auth - Export MetaculusExchange from core index and pmxt default map; add apiToken to ExchangeCredentials for Authorization: Token header. - Register metaculus on HTTP sidecar; honor apiToken for per-request instances. - Complete Metaculus has map; document token requirement; fix event category when Metaculus returns string or object categories. - Regenerate COMPLIANCE.md and Python _exchanges (Metaculus + api_token on Exchange client); compliance initExchange reads METACULUS_API_TOKEN. - README: add Metaculus to supported exchanges. - Probable: cast wallet for createClobClient when duplicate viem installs break WalletClient assignability (tsc). Made-with: Cursor
Contributor
|
Huge! Will review ASAP. |
…t data Add forecast submission (createOrder) and withdrawal (cancelOrder) for binary and multiple-choice questions. Improve error handling with 403 auth disambiguation, add community prediction extraction with fallbacks, and support group-of-questions expansion into individual markets.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
The Metaculus implementation already lived under
core/src/exchanges/metaculus/. This PR finishes the integration by exporting it from the public API, registering it on the HTTP sidecar, aligning types and credentials, refreshing compliance and Python wrappers, documenting it in the README, and fixing a Probable/viemtyping issue that blockedtsc.What changed
Metaculus exposure and auth
MetaculusExchange/Metaculusfromcore/src/index.tsand addMetaculusto the defaultpmxtobject.ExchangeCredentials: optionalapiTokenfor Metaculus (Authorization: Token …).MetaculusExchange: completehasmap forExchangeHas; short note that the API expects a token (403 when unauthenticated).HTTP sidecar
core/src/server/app.ts:metaculusin singletons andcreateExchange; per-request instances whencredentials.apiTokenis present (alongside existing privateKey/apiKey logic).Compliance
core/test/compliance/shared.ts:initExchangepassesMETACULUS_API_TOKENforMetaculusExchange.core/scripts/generate-compliance.js: Metaculus column +METACULUS_API_TOKENin the documented env block;core/COMPLIANCE.mdregenerated.Data / SDK
fetchEvents:categorysupports string or{ name }entries.Exchange: optionalapi_token→apiTokenin request credentials; generator updated;_exchanges.py/__init__.pyregenerated.Docs
readme.md: Metaculus in Supported Exchanges.Build fix (non-Metaculus)
probable/auth.ts: duplicatevieminstalls makeWalletClienttypes incompatible; pass wallet intocreateClobClientwithas anyplus a comment (runtime unchanged).Manual verification
With
METACULUS_API_TOKENset (e.g. in repo-root.env) anddotenvloading that file,fetchMarketssucceeds against the live API. Example run fromcoreafternpm run build:Interpretation: five markets returned; first market title as shown; 2 outcomes on that market (binary-style).
Note: Plain
node -edoes not load.env. UseDOTENV_CONFIG_PATH=../.env node -r dotenv/config -e "..."fromcore, export the variable in the shell, or rely on compliance tests / sidecar with env configured.How to test (for reviewers)
METACULUS_API_TOKEN(root.envor environment).cd core && npm run buildnew Metaculus({ apiToken: process.env.METACULUS_API_TOKEN })and callsfetchMarkets({ limit: 5 }), with env loaded as above.npx jest … --testNamePattern=MetaculusExchangeonfetchMarkets/fetchEventswith the same token.Notes
fetchMarkets({ query: "…" }), consistent with the unified market API (no separatesearchMarketson the base class).has(no trading / OHLCV / order book, etc.).