Skip to content

feat: add GADUIN read-only venue (markets, OHLCV) - #2637

Open
chebyrash wants to merge 2 commits into
pmxt-dev:mainfrom
chebyrash:feat/gaduin-venue
Open

chebyrash wants to merge 2 commits into
pmxt-dev:mainfrom
chebyrash:feat/gaduin-venue

Conversation

@chebyrash

@chebyrash chebyrash commented Nov 12, 2026 •

Copy link
Copy Markdown

Adds GADUIN (gaduin.com) as a read-only venue.

What GADUIN is

A prediction market on transport outcomes: flight delays, train punctuality, ship arrivals, and weekly ship counts through maritime chokepoints. Each market is priced by an automated market maker (kind: LMSR) and publishes its outcomes with a current price per outcome. There is no order book. Markets are binary (yes/no) or multi-outcome (for example on_time / delayed / cancelled).

Operator: Gaduin Inc. (Panama). GADUIN is not licensed by any regulator and is not available to US persons.

What the adapter supports

Everything reads GADUIN's public read API (https://gaduin.com/api/v1, OpenAPI at https://gaduin.com/.well-known/openapi.json):

  • fetchMarkets: lists up to 100 markets per call (GADUIN refuses larger pages for API-key reads). status maps as follows: active (the default) → OPEN, closed/inactive → CLOSED + SETTLED, all → no filter. category is FLIGHT, TRAIN or SHIP and goes through the base client-side filter. query matches the question text of the fetched page, because the API has no server-side search.
  • fetchMarket: looks up by marketId (UUID), slug or outcomeId through GET /markets/{id}. A 404 becomes MarketNotFound.
  • fetchOHLCV: GET /markets/{id}/price-history returns the outcome prices after each trade (up to 180 points). The adapter buckets those points into candles for any <n>m|h|d resolution and honours start/end/limit. volume is left unset.
  • Outcomes are passed through exactly as published. The outcome id is <marketId>:<outcome idx>, the label is GADUIN's own, and the price comes from prices[idx]. yes/no accessors are set only when the two outcomes are literally yes and no. Multi-outcome markets get no YES/NO mapping, and labels are never rewritten.
  • status is active for OPEN; otherwise it is the lowercased venue status (closed, settled, cancelled, disputed). sourceMetadata carries kind, tradable, tradingClosesAt and settledOutcomeIdx.

What the adapter does not support

  • No order book, trades, events or series. GADUIN has no event tier, and its activity feed reports cost paid, not price and size.
  • No trading, balances or positions. The API is read-only by design, and trading happens only on the GADUIN website.
  • The API publishes no 24h volume and no liquidity figure, so volume24h and liquidity are 0. Prices are null on CANCELLED/DISPUTED markets, so outcomes there report 0.

Authentication

Every REST read, market data included, needs a read-only GADUIN API key (pk_live_…, minted at https://gaduin.com/account/ai; see https://gaduin.com/auth.md). Pass { apiKey } (env GADUIN_API_KEY). GaduinAuth exchanges the key for a short-lived JWT at POST /auth/token and caches it until a minute before expires_in. Without a key, every read throws AuthenticationError with a pointer to where keys are minted. This follows the Metaculus pattern, where a token is also required for reads. No credential is embedded anywhere.

Files

  • core/specs/gaduin/gaduin.yaml: GADUIN's published OpenAPI document. The only change is that operationIds are added. The published spec has none, and /markets and /markets/{id} would both auto-name to getMarkets. api.ts is generated from it via npm run fetch:openapi, and fetch-openapi-specs.js has the new entry.
  • core/src/exchanges/gaduin/: api.ts, auth.ts, errors.ts, utils.ts, fetchMarkets.ts, fetchOHLCV.ts, index.ts.
  • Registration follows ADDING_AN_EXCHANGE.md and the Hunch PR: core/src/index.ts, server/app.ts, server/exchange-factory.ts, generate-openapi.js (instance + enum) → openapi.yaml, generate-compliance.js → COMPLIANCE.md (plus GADUIN_API_KEY in the env section), generate-python-exchanges.js → _exchanges.py / __init__.py, TS SDK client.ts / index.ts, Mintlify venue label → venues.mdx, llms docs (including "12 → 13 more venues"), and the README venue strip.
  • Tests: core/test/exchanges/gaduin.test.ts runs 7 tests against fixtures built from the documented response shapes, with an axios adapter mock and no live calls. They cover the key → token exchange (once, JSON body, Bearer header), list params and status mapping, the page cap, the category filter, faithful binary and multi-outcome mapping, the cancelled-market null-price case, lookup by id/slug with 404 → MarketNotFound, OHLCV bucketing (unordered input, limit), and validation errors. The venue lists in the existing docs tests also include GADUIN now.

Verification (local)

  • npm run build --workspace=pmxt-core: pass.
  • npx jest -c jest.config.js in core: 52 suites passed, 1 skipped (829 passed, 3 skipped).
  • node core/scripts/check-exchange-drift.js: no drift, 18 exchanges present in every layer.
  • The compliance, python-exchanges, TS/Python client-methods and generate:openapi generators all regenerate to the committed files.
  • Live checks against gaduin.com, without a valid key: a keyless read throws AuthenticationError, and an invalid key gets 401 invalid api key from the token endpoint. The same two checks through the sidecar route POST /api/gaduin/fetchMarkets return the unified 401 error envelope. A successful live read needs a GADUIN account key, which this PR does not include.

Notes for maintainers

  • docs/api-reference/openapi.json: only the GADUIN hunks are committed. On current main, regenerating this file already produces a large unrelated diff (and a 2.54.0 → 2.17.1 version line), so the docs-sync check may report that pre-existing drift.
  • npm run generate:sdk:all was not run: the openapi-generator step needs Java, which this machine does not have. As in the Hunch PR, the generated SDK clients take no exchange enum, so nothing there should change.

Update, 23 Nov

  • GADUIN no longer serves GET /healthz publicly, so GetHealthz is gone from the vendored spec and the generated api.ts. Nothing in the adapter called it.
  • The vendored spec is refreshed from https://gaduin.com/.well-known/openapi.json (operation ids kept as the adapter uses them): /markets limit maximum is 100, /markets/{id}/activity limit is bounded at 500, and the activity and price-history responses document truncated / starts_at.
  • api.ts is byte-identical below its header to what npm run fetch:openapi writes; test/exchanges/gaduin.test.ts passes (7 tests).
  • The class doc comment now says this venue covers the markets API only. GADUIN's transport data (flight status, boards, ship traffic) is a separate REST API: https://gaduin.com/docs/api

Disclosure: I work on GADUIN. This was prepared with an AI coding agent on the maintainer's behalf.

@mintlify

mintlify Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 44d9cd2.

Approve preview

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant