diff --git a/core/api-doc-config.generated.json b/core/api-doc-config.generated.json index 7c9c434b..b6f025b5 100644 --- a/core/api-doc-config.generated.json +++ b/core/api-doc-config.generated.json @@ -1011,4 +1011,4 @@ "python": "import pmxt\nimport os\n\nexchange = pmxt.Polymarket(\n private_key=os.getenv('POLYMARKET_PRIVATE_KEY')\n)\n\n# 1. Check balance\nbalances = exchange.fetch_balance()\nif balances:\n balance = balances[0]\n print(f'Available: ${balance.available}')\n\n# 2. Search for a market\nmarkets = exchange.fetch_markets(query='Trump')\nmarket = markets[0]\noutcome = market.yes\n\nprint(f'{market.title}')\nprint(f'Price: {outcome.price * 100:.1f}%')\n\n# 3. Place a limit order\norder = exchange.create_order(\n market_id=market.market_id,\n outcome_id=outcome.outcome_id,\n side='buy',\n type='limit',\n amount=10,\n price=0.50\n)\n\nprint(f'Order placed: {order.id}')\n\n# 4. Check order status\nupdated_order = exchange.fetch_order(order.id)\nprint(f'Status: {updated_order.status}')\nprint(f'Filled: {updated_order.filled}/{updated_order.amount}')\n\n# 5. Cancel if needed\nif updated_order.status == 'open':\n exchange.cancel_order(order.id)\n print('Order cancelled')\n\n# 6. Check positions\npositions = exchange.fetch_positions()\nfor pos in positions:\n pnl_sign = '+' if pos.unrealized_pnl > 0 else ''\n print(f'{pos.outcome_label}: {pnl_sign}${pos.unrealized_pnl:.2f}')", "typescript": "import pmxt from 'pmxtjs';\n\nconst exchange = new pmxt.Polymarket({\n privateKey: process.env.POLYMARKET_PRIVATE_KEY\n});\n\n// 1. Check balance\nconst [balance] = await exchange.fetchBalance();\nconsole.log(`Available: $${balance.available}`);\n\n// 2. Search for a market\nconst markets = await exchange.fetchMarkets({ query: 'Trump' });\nconst market = markets[0];\nconst outcome = market.yes;\n\nconsole.log(market.title);\nconsole.log(`Price: ${(outcome.price * 100).toFixed(1)}%`);\n\n// 3. Place a limit order\nconst order = await exchange.createOrder({\n marketId: market.marketId,\n outcomeId: outcome.outcomeId,\n side: 'buy',\n type: 'limit',\n amount: 10,\n price: 0.50\n});\n\nconsole.log(`Order placed: ${order.id}`);\n\n// 4. Check order status\nconst updatedOrder = await exchange.fetchOrder(order.id);\nconsole.log(`Status: ${updatedOrder.status}`);\nconsole.log(`Filled: ${updatedOrder.filled}/${updatedOrder.amount}`);\n\n// 5. Cancel if needed\nif (updatedOrder.status === 'open') {\n await exchange.cancelOrder(order.id);\n console.log('Order cancelled');\n}\n\n// 6. Check positions\nconst positions = await exchange.fetchPositions();\npositions.forEach(pos => {\n console.log(`${pos.outcomeLabel}: ${pos.unrealizedPnL > 0 ? '+' : ''}$${pos.unrealizedPnL.toFixed(2)}`);\n});" } -} \ No newline at end of file +} diff --git a/core/specs/kalshi/Kalshi.yaml b/core/specs/kalshi/Kalshi.yaml index 36086514..2fc91f66 100644 --- a/core/specs/kalshi/Kalshi.yaml +++ b/core/specs/kalshi/Kalshi.yaml @@ -5,7 +5,7 @@ info: description: Manually defined OpenAPI spec for endpoints being migrated to spec-first approach servers: - - url: https://{env}.elections.kalshi.com/trade-api/v2 + - url: https://{env}.external-api.kalshi.com/trade-api/v2 description: Kalshi Trade API variables: env: diff --git a/core/specs/metaculus/Metaculus.yaml b/core/specs/metaculus/Metaculus.yaml index a1ce9d67..a0eb3738 100644 --- a/core/specs/metaculus/Metaculus.yaml +++ b/core/specs/metaculus/Metaculus.yaml @@ -431,11 +431,12 @@ components: must be 1.0, otherwise no more than 0.999 - meaning at least 0.1% of the probability mass must be assigned above the upper bound.

- At least 1% of the probability mass must be assigned uniformly within - bounds, which means that the CDF must be strictly increasing by at - least 0.01/200 = 0.0005 per step. No two adjacent values of the CDF - can differ by more than 0.59, which is the largest number obtainable + At least 1% of the probability mass must be assigned uniformly within + bounds, which means that the CDF must be strictly increasing by at + least 0.01/200 = 0.0005 per step. No two adjacent values of the CDF + can differ by more than 0.20, which is the largest number obtainable via the sliders. + type: array items: type: number diff --git a/core/specs/myriad/myriad.yaml b/core/specs/myriad/myriad.yaml index 8c44574a..8228d9b7 100644 --- a/core/specs/myriad/myriad.yaml +++ b/core/specs/myriad/myriad.yaml @@ -437,7 +437,12 @@ paths: in: query schema: type: string - enum: [open, closed, resolved] + enum: [open, closed, resolved, voided] + - name: trading_model + in: query + description: Filter markets by trading model (e.g. CLOB, AMM) + schema: + type: string - name: token_address in: query schema: @@ -1046,6 +1051,11 @@ paths: in: query schema: type: string + - name: trading_model + in: query + description: Filter portfolio results by trading model (e.g. CLOB, AMM) + schema: + type: string - name: token_address in: query schema: diff --git a/core/specs/opinion/opinion-openapi.yaml b/core/specs/opinion/opinion-openapi.yaml index b8c51fef..55e2f69b 100644 --- a/core/specs/opinion/opinion-openapi.yaml +++ b/core/specs/opinion/opinion-openapi.yaml @@ -822,6 +822,34 @@ paths: "400": $ref: "#/components/responses/BadRequestError" + /market/slug/{slug}: + get: + tags: [Market] + summary: Get market detail by slug + description: Get detailed information about a specific market using its slug + operationId: getMarketDetailBySlug + parameters: + - name: slug + in: path + required: true + description: Market slug + schema: + type: string + responses: + "200": + description: Successful response + content: + application/json: + schema: + allOf: + - $ref: "#/components/schemas/APIBaseResponse" + - type: object + properties: + result: + $ref: "#/components/schemas/MarketDetailResponse" + "400": + $ref: "#/components/responses/BadRequestError" + /market/categorical/{marketId}: get: tags: [Market] diff --git a/core/specs/polymarket/PolymarketClobAPI.yaml b/core/specs/polymarket/PolymarketClobAPI.yaml index 0a2f619e..311a3b36 100644 --- a/core/specs/polymarket/PolymarketClobAPI.yaml +++ b/core/specs/polymarket/PolymarketClobAPI.yaml @@ -133,6 +133,8 @@ components: type: string tick_size: type: string + last_trade_price: + type: string neg_risk: type: boolean @@ -331,14 +333,24 @@ components: properties: success: type: boolean - errorMsg: + orderID: + type: string + status: type: string - orderId: + makingAmount: type: string - orderHashes: + takingAmount: + type: string + transactionsHashes: + type: array + items: + type: string + tradeIDs: type: array items: type: string + errorMsg: + type: string CancelResponse: type: object @@ -838,6 +850,23 @@ paths: schema: $ref: '#/components/schemas/CancelResponse' + /v1/heartbeats: + post: + summary: Refresh authenticated session heartbeat + tags: [Orders] + description: Keep an authenticated Polymarket session or websocket subscription alive. + security: + - L2Auth: [] + parameters: + - $ref: '#/components/parameters/L2Headers' + responses: + '200': + description: Heartbeat acknowledged + content: + application/json: + schema: + type: object + /data/order/{id}: get: summary: Get Order @@ -881,15 +910,29 @@ paths: in: query schema: type: string + - name: next_cursor + in: query + description: Cursor for keyset pagination + schema: + type: string responses: '200': description: List of active orders content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/OpenOrder' + type: object + properties: + limit: + type: integer + next_cursor: + type: string + count: + type: integer + data: + type: array + items: + $ref: '#/components/schemas/OpenOrder' /data/trades: get: diff --git a/core/specs/probable/probable.yaml b/core/specs/probable/probable.yaml index 558bc16c..58ecda71 100644 --- a/core/specs/probable/probable.yaml +++ b/core/specs/probable/probable.yaml @@ -205,7 +205,7 @@ components: type: object properties: id: - type: integer + type: string slug: type: string title: @@ -223,7 +223,7 @@ components: type: object properties: id: - type: integer + type: string question: type: string market_slug: @@ -428,14 +428,9 @@ paths: content: application/json: schema: - type: object - properties: - events: - type: array - items: - $ref: '#/components/schemas/Event' - pagination: - type: object + type: array + items: + $ref: '#/components/schemas/Event' /public/api/v1/events/{id}: get: @@ -510,6 +505,17 @@ paths: responses: '200': description: List of markets + content: + application/json: + schema: + type: object + properties: + markets: + type: array + items: + $ref: '#/components/schemas/Market' + pagination: + type: object /public/api/v1/markets/{id}: get: diff --git a/core/src/exchanges/kalshi/api.ts b/core/src/exchanges/kalshi/api.ts index 4687bd60..4b45a1bc 100644 --- a/core/src/exchanges/kalshi/api.ts +++ b/core/src/exchanges/kalshi/api.ts @@ -1,6 +1,6 @@ /** - * Auto-generated from /Users/samueltinnerholm/Documents/GitHub/pmxt/.claude/worktrees/agent-a6e1b73d/core/specs/kalshi/Kalshi.yaml - * Generated at: 2026-05-24T14:48:08.117Z + * Auto-generated from /opt/data/repos/pmxt/.worktrees/hermes-42dac47d/core/specs/kalshi/Kalshi.yaml + * Generated at: 2026-06-05T12:40:10.068Z * Do not edit manually -- run "npm run fetch:openapi" to regenerate. */ export const kalshiApiSpec = { @@ -11,7 +11,7 @@ export const kalshiApiSpec = { }, "servers": [ { - "url": "https://{env}.elections.kalshi.com/trade-api/v2", + "url": "https://{env}.external-api.kalshi.com/trade-api/v2", "variables": { "env": { "default": "api", diff --git a/core/src/exchanges/kalshi/config.ts b/core/src/exchanges/kalshi/config.ts index 4c122bd8..7bde66b1 100644 --- a/core/src/exchanges/kalshi/config.ts +++ b/core/src/exchanges/kalshi/config.ts @@ -11,19 +11,19 @@ * Do NOT put runtime config into api.ts — it will be overwritten. * * Environment mapping (aligns with the `{env}` server variable in Kalshi.yaml): - * env = "api" → production: https://api.elections.kalshi.com - * env = "demo-api" → demo/paper: https://demo-api.elections.kalshi.com + * env = "api" → production: https://api.external-api.kalshi.com + * env = "demo-api" → demo/paper: https://demo-api.external-api.kalshi.com */ // ── Base URL constants ──────────────────────────────────────────────────────── -export const KALSHI_PROD_API_URL = process.env.KALSHI_BASE_URL || "https://api.elections.kalshi.com"; -export const KALSHI_DEMO_API_URL = process.env.KALSHI_DEMO_BASE_URL || "https://demo-api.kalshi.co"; +export const KALSHI_PROD_API_URL = process.env.KALSHI_BASE_URL || "https://api.external-api.kalshi.com"; +export const KALSHI_DEMO_API_URL = process.env.KALSHI_DEMO_BASE_URL || "https://demo-api.external-api.kalshi.com"; export const KALSHI_PROD_WS_URL = - "wss://api.elections.kalshi.com/trade-api/ws/v2"; + "wss://api.external-api.kalshi.com/trade-api/ws/v2"; export const KALSHI_DEMO_WS_URL = - "wss://demo-api.kalshi.co/trade-api/ws/v2"; + "wss://demo-api.external-api.kalshi.com/trade-api/ws/v2"; // ── Path constants ──────────────────────────────────────────────────────────── @@ -52,12 +52,12 @@ export interface KalshiApiConfig { /** * Return a typed config object for the requested environment. * - * @param demoMode - Pass `true` to target demo-api.elections.kalshi.com. + * @param demoMode - Pass `true` to target demo-api.external-api.kalshi.com. * * @example * ```typescript * const config = getKalshiConfig(true); - * // config.apiUrl === "https://demo-api.elections.kalshi.com" + * // config.apiUrl === "https://demo-api.external-api.kalshi.com" * ``` */ export function getKalshiConfig(demoMode = false, baseUrlOverride?: string): KalshiApiConfig { diff --git a/core/src/exchanges/metaculus/utils.ts b/core/src/exchanges/metaculus/utils.ts index 9cc8eab1..5360f613 100644 --- a/core/src/exchanges/metaculus/utils.ts +++ b/core/src/exchanges/metaculus/utils.ts @@ -142,7 +142,6 @@ function buildOutcomes(question: any, postId: string, medianProb: number): Marke aggregations: latest, resolution: question?.resolution ?? null, scaling: question?.scaling ?? null, - possibilities: question?.possibilities ?? null, }; // Multiple choice: one outcome per option, each independently forecastable diff --git a/core/src/exchanges/myriad/api.ts b/core/src/exchanges/myriad/api.ts index 7a99ed03..d1d81687 100644 --- a/core/src/exchanges/myriad/api.ts +++ b/core/src/exchanges/myriad/api.ts @@ -1,6 +1,6 @@ /** - * Auto-generated from /Users/ndmeiri/Developer/pmxt/core/specs/myriad/myriad.yaml - * Generated at: 2026-04-21T22:01:26.565Z + * Auto-generated from /opt/data/repos/pmxt/.worktrees/hermes-42dac47d/core/specs/myriad/myriad.yaml + * Generated at: 2026-06-05T12:40:10.188Z * Do not edit manually -- run "npm run fetch:openapi" to regenerate. */ export const myriadApiSpec = { @@ -163,10 +163,18 @@ export const myriadApiSpec = { "enum": [ "open", "closed", - "resolved" + "resolved", + "voided" ] } }, + { + "name": "trading_model", + "in": "query", + "schema": { + "type": "string" + } + }, { "name": "token_address", "in": "query", @@ -652,6 +660,13 @@ export const myriadApiSpec = { "type": "string" } }, + { + "name": "trading_model", + "in": "query", + "schema": { + "type": "string" + } + }, { "name": "token_address", "in": "query", diff --git a/core/src/exchanges/myriad/utils.ts b/core/src/exchanges/myriad/utils.ts index ff4a2456..965b3b9e 100644 --- a/core/src/exchanges/myriad/utils.ts +++ b/core/src/exchanges/myriad/utils.ts @@ -47,6 +47,8 @@ export function mapMarketState(state: string): 'active' | 'inactive' | 'closed' return 'inactive'; case 'resolved': return 'closed'; + case 'voided': + return 'closed'; default: return 'active'; } diff --git a/core/src/exchanges/opinion/api.ts b/core/src/exchanges/opinion/api.ts index 0b7b341b..c7b14a3e 100644 --- a/core/src/exchanges/opinion/api.ts +++ b/core/src/exchanges/opinion/api.ts @@ -1,6 +1,6 @@ /** - * Auto-generated from /Users/ndmeiri/Developer/pmxt/core/specs/opinion/opinion-openapi.yaml - * Generated at: 2026-04-21T22:01:26.567Z + * Auto-generated from /opt/data/repos/pmxt/.worktrees/hermes-42dac47d/core/specs/opinion/opinion-openapi.yaml + * Generated at: 2026-06-05T12:40:10.198Z * Do not edit manually -- run "npm run fetch:openapi" to regenerate. */ export const opinionApiSpec = { @@ -147,6 +147,25 @@ export const opinionApiSpec = { ] } }, + "/market/slug/{slug}": { + "get": { + "tags": [ + "Market" + ], + "summary": "Get market detail by slug", + "operationId": "getMarketDetailBySlug", + "parameters": [ + { + "name": "slug", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ] + } + }, "/market/categorical/{marketId}": { "get": { "tags": [ diff --git a/core/src/exchanges/polymarket/api-clob.ts b/core/src/exchanges/polymarket/api-clob.ts index 2ca68348..69d3427b 100644 --- a/core/src/exchanges/polymarket/api-clob.ts +++ b/core/src/exchanges/polymarket/api-clob.ts @@ -1,6 +1,6 @@ /** - * Auto-generated from /Users/samueltinnerholm/Documents/GitHub/pmxt/core/specs/polymarket/PolymarketClobAPI.yaml - * Generated at: 2026-05-22T18:49:00.795Z + * Auto-generated from /opt/data/repos/pmxt/.worktrees/hermes-42dac47d/core/specs/polymarket/PolymarketClobAPI.yaml + * Generated at: 2026-06-05T12:40:10.090Z * Do not edit manually -- run "npm run fetch:openapi" to regenerate. */ export const polymarketClobSpec = { @@ -346,6 +346,24 @@ export const polymarketClobSpec = { ] } }, + "/v1/heartbeats": { + "post": { + "summary": "Refresh authenticated session heartbeat", + "tags": [ + "Orders" + ], + "security": [ + { + "L2Auth": [] + } + ], + "parameters": [ + { + "$ref": "#/components/parameters/L2Headers" + } + ] + } + }, "/data/order/{id}": { "get": { "summary": "Get Order", @@ -407,6 +425,13 @@ export const polymarketClobSpec = { "schema": { "type": "string" } + }, + { + "name": "next_cursor", + "in": "query", + "schema": { + "type": "string" + } } ] } diff --git a/core/src/exchanges/probable/api.ts b/core/src/exchanges/probable/api.ts index aac43d6b..e97a7a45 100644 --- a/core/src/exchanges/probable/api.ts +++ b/core/src/exchanges/probable/api.ts @@ -1,6 +1,6 @@ /** - * Auto-generated from /Users/ndmeiri/Developer/pmxt/core/specs/probable/probable.yaml - * Generated at: 2026-04-21T22:01:26.564Z + * Auto-generated from /opt/data/repos/pmxt/.worktrees/hermes-42dac47d/core/specs/probable/probable.yaml + * Generated at: 2026-06-05T12:40:10.177Z * Do not edit manually -- run "npm run fetch:openapi" to regenerate. */ export const probableApiSpec = { diff --git a/sdks/python/API_REFERENCE.md b/sdks/python/API_REFERENCE.md index b20f3aa2..1d0e55cf 100644 --- a/sdks/python/API_REFERENCE.md +++ b/sdks/python/API_REFERENCE.md @@ -2219,6 +2219,7 @@ result = exchange.call_api('operationName', {'param': 'value'}) | `deleteOrders` | `DELETE` | `/orders` | Cancel Multiple Orders | Required | | `deleteCancelAll` | `DELETE` | `/cancel-all` | Cancel All Orders | Required | | `deleteCancelMarketOrders` | `DELETE` | `/cancel-market-orders` | Cancel Market Orders | Required | +| `postV1Heartbeats` | `POST` | `/v1/heartbeats` | Refresh authenticated session heartbeat | Required | | `getDataOrder` | `GET` | `/data/order/{id}` | Get Order | Required | | `getDataOrders` | `GET` | `/data/orders` | Get Active Orders | Required | | `getDataTrades` | `GET` | `/data/trades` | Get Trades | Required | @@ -2751,6 +2752,16 @@ Cancel Market Orders *(Auth required)* **Parameters:** - `` (, string) +--- +##### `postV1Heartbeats` + +**POST** `/v1/heartbeats` + +Refresh authenticated session heartbeat *(Auth required)* + +**Parameters:** +- `` (, string) + --- ##### `getDataOrder` @@ -2774,6 +2785,7 @@ Get Active Orders *(Auth required)* - `id` (query, string) - `market` (query, string) - `asset_id` (query, string) +- `next_cursor` (query, string) — Cursor for keyset pagination --- ##### `getDataTrades` @@ -4829,7 +4841,8 @@ List Markets *(Auth required)* - `sort` (query, string) — enum: `volume,volume_24h,liquidity,expires_at,published_at,featured` - `order` (query, string) — enum: `asc,desc` - `network_id` (query, string) — Comma-separated list of network ids -- `state` (query, string) — enum: `open,closed,resolved` +- `state` (query, string) — enum: `open,closed,resolved,voided` +- `trading_model` (query, string) — Filter markets by trading model (e.g. CLOB, AMM) - `token_address` (query, string) - `topics` (query, string) — Comma-separated list of topics - `keyword` (query, string) — Full-text search across title, description, and outcome titles @@ -4984,6 +4997,7 @@ Get User Markets Portfolio *(Auth required)* - `min_shares` (query, number) - `network_id` (query, integer) - `state` (query, string) +- `trading_model` (query, string) — Filter portfolio results by trading model (e.g. CLOB, AMM) - `token_address` (query, string) - `topics` (query, string) - `keyword` (query, string) diff --git a/sdks/typescript/API_REFERENCE.md b/sdks/typescript/API_REFERENCE.md index ec2f3280..b7b82934 100644 --- a/sdks/typescript/API_REFERENCE.md +++ b/sdks/typescript/API_REFERENCE.md @@ -2220,6 +2220,7 @@ const result = await exchange.callApi('operationName', { param: 'value' }); | `deleteOrders` | `DELETE` | `/orders` | Cancel Multiple Orders | Required | | `deleteCancelAll` | `DELETE` | `/cancel-all` | Cancel All Orders | Required | | `deleteCancelMarketOrders` | `DELETE` | `/cancel-market-orders` | Cancel Market Orders | Required | +| `postV1Heartbeats` | `POST` | `/v1/heartbeats` | Refresh authenticated session heartbeat | Required | | `getDataOrder` | `GET` | `/data/order/{id}` | Get Order | Required | | `getDataOrders` | `GET` | `/data/orders` | Get Active Orders | Required | | `getDataTrades` | `GET` | `/data/trades` | Get Trades | Required | @@ -2752,6 +2753,16 @@ Cancel Market Orders *(Auth required)* **Parameters:** - `` (, string) +--- +##### `postV1Heartbeats` + +**POST** `/v1/heartbeats` + +Refresh authenticated session heartbeat *(Auth required)* + +**Parameters:** +- `` (, string) + --- ##### `getDataOrder` @@ -2775,6 +2786,7 @@ Get Active Orders *(Auth required)* - `id` (query, string) - `market` (query, string) - `asset_id` (query, string) +- `next_cursor` (query, string) — Cursor for keyset pagination --- ##### `getDataTrades` @@ -4830,7 +4842,8 @@ List Markets *(Auth required)* - `sort` (query, string) — enum: `volume,volume_24h,liquidity,expires_at,published_at,featured` - `order` (query, string) — enum: `asc,desc` - `network_id` (query, string) — Comma-separated list of network ids -- `state` (query, string) — enum: `open,closed,resolved` +- `state` (query, string) — enum: `open,closed,resolved,voided` +- `trading_model` (query, string) — Filter markets by trading model (e.g. CLOB, AMM) - `token_address` (query, string) - `topics` (query, string) — Comma-separated list of topics - `keyword` (query, string) — Full-text search across title, description, and outcome titles @@ -4985,6 +4998,7 @@ Get User Markets Portfolio *(Auth required)* - `min_shares` (query, number) - `network_id` (query, integer) - `state` (query, string) +- `trading_model` (query, string) — Filter portfolio results by trading model (e.g. CLOB, AMM) - `token_address` (query, string) - `topics` (query, string) - `keyword` (query, string)