diff --git a/core/api-doc-config.generated.json b/core/api-doc-config.generated.json index 40aaff04..39e836a9 100644 --- a/core/api-doc-config.generated.json +++ b/core/api-doc-config.generated.json @@ -1,5 +1,5 @@ { - "_generated": "Auto-generated by extract-jsdoc.js on 2026-07-10T06:40:05.097Z. Do not edit manually.", + "_generated": "Auto-generated by extract-jsdoc.js on 2026-07-12T07:28:50.334Z. Do not edit manually.", "methods": { "has": { "summary": "HTTP verb for the endpoint (e.g. GET, POST). */", @@ -9,7 +9,7 @@ "type": "ExchangeHas", "description": "Result" }, - "source": "BaseExchange.ts:42" + "source": "BaseExchange.ts:43" }, "implicitApi": { "summary": "Override in subclasses to force specific capability values.", @@ -19,7 +19,7 @@ "type": "ImplicitApiMethodInfo[]", "description": "Result" }, - "source": "BaseExchange.ts:459" + "source": "BaseExchange.ts:460" }, "loadMarkets": { "summary": "Load and cache all markets from the exchange into `this.markets` and `this.marketsBySlug`.", @@ -36,7 +36,7 @@ "type": "Record", "description": "Dictionary of markets indexed by marketId" }, - "source": "BaseExchange.ts:572" + "source": "BaseExchange.ts:573" }, "fetchMarkets": { "summary": "Fetch markets with optional filtering, search, or slug lookup.", @@ -83,7 +83,7 @@ "ordering — exchanges may reorder or add markets between requests. For stable iteration\nacross pages, use `loadMarkets()` and paginate over `Object.values(exchange.markets)`.", "Some exchanges (like Limitless) may only support status 'active' for search results." ], - "source": "BaseExchange.ts:609" + "source": "BaseExchange.ts:610" }, "fetchMarketsPaginated": { "summary": "Fetch markets with cursor-based pagination backed by a stable in-memory snapshot.", @@ -110,7 +110,7 @@ "type": "PaginatedMarketsResult", "description": "PaginatedMarketsResult with data, total, and optional nextCursor" }, - "source": "BaseExchange.ts:664" + "source": "BaseExchange.ts:665" }, "fetchEventsPaginated": { "summary": "Paginated variant of {@link fetchEvents}.", @@ -137,7 +137,7 @@ "type": "PaginatedEventsResult", "description": "PaginatedEventsResult with data, total, and optional nextCursor" }, - "source": "BaseExchange.ts:733" + "source": "BaseExchange.ts:734" }, "fetchEvents": { "summary": "Fetch events with optional keyword search.", @@ -175,7 +175,7 @@ "notes": [ "Some exchanges (like Limitless) may only support status 'active' for search results." ], - "source": "BaseExchange.ts:802" + "source": "BaseExchange.ts:803" }, "fetchSeries": { "summary": "Fetch the recurring series (fourth tier above Event -> Market -> Outcome)", @@ -192,7 +192,7 @@ "type": "UnifiedSeries[]", "description": "Array of unified series. Always an array, including the singular-lookup case." }, - "source": "BaseExchange.ts:841" + "source": "BaseExchange.ts:842" }, "fetchMarket": { "summary": "Fetch a single market by lookup parameters.", @@ -209,7 +209,7 @@ "type": "UnifiedMarket", "description": "A single unified market" }, - "source": "BaseExchange.ts:859" + "source": "BaseExchange.ts:860" }, "fetchEvent": { "summary": "Fetch a single event by lookup parameters.", @@ -226,7 +226,7 @@ "type": "UnifiedEvent", "description": "A single unified event" }, - "source": "BaseExchange.ts:959" + "source": "BaseExchange.ts:960" }, "fetchEventMetadata": { "summary": "Fetch venue-native metadata for a specific event when the exchange", @@ -243,7 +243,7 @@ "type": "Record", "description": "Result" }, - "source": "BaseExchange.ts:976" + "source": "BaseExchange.ts:977" }, "fetchOHLCV": { "summary": "Fetch historical OHLCV (candlestick) price data for a specific market outcome.", @@ -271,7 +271,7 @@ "Polymarket: outcomeId is the CLOB Token ID. Kalshi: outcomeId is the Market Ticker.", "Common resolutions: '1m' | '5m' | '15m' | '1h' | '6h' | '1d'. Arbitrary intervals (e.g. '30s', '120s', '3h') accepted by venues that support them." ], - "source": "BaseExchange.ts:987" + "source": "BaseExchange.ts:988" }, "fetchOrderBook": { "summary": "Fetch the order book (bids/asks) for a specific outcome.", @@ -300,7 +300,7 @@ "type": "OrderBook", "description": "Order book with bids and asks. Returns OrderBook[] when" }, - "source": "BaseExchange.ts:1002" + "source": "BaseExchange.ts:1003" }, "fetchOrderBooks": { "summary": "Batch variant of {@link fetchOrderBook}. Fetches order books for", @@ -317,7 +317,7 @@ "type": "Record", "description": "A map keyed by the input id (preserving the caller's exact" }, - "source": "BaseExchange.ts:1030" + "source": "BaseExchange.ts:1031" }, "fetchTrades": { "summary": "Fetch raw trade history for a specific outcome.", @@ -343,7 +343,7 @@ "notes": [ "Polymarket requires an API key for trade history. Use fetchOHLCV for public historical data." ], - "source": "BaseExchange.ts:1043" + "source": "BaseExchange.ts:1044" }, "createOrder": { "summary": "Place a new order on the exchange.", @@ -360,7 +360,7 @@ "type": "Order", "description": "The created order" }, - "source": "BaseExchange.ts:1060" + "source": "BaseExchange.ts:1061" }, "buildOrder": { "summary": "Build an order payload without submitting it to the exchange.", @@ -377,7 +377,7 @@ "type": "BuiltOrder", "description": "A BuiltOrder containing the exchange-native payload" }, - "source": "BaseExchange.ts:1074" + "source": "BaseExchange.ts:1075" }, "submitOrder": { "summary": "Submit a pre-built order returned by buildOrder().", @@ -394,7 +394,7 @@ "type": "Order", "description": "The submitted order" }, - "source": "BaseExchange.ts:1086" + "source": "BaseExchange.ts:1087" }, "cancelOrder": { "summary": "Cancel an existing open order.", @@ -411,7 +411,7 @@ "type": "Order", "description": "The cancelled order" }, - "source": "BaseExchange.ts:1096" + "source": "BaseExchange.ts:1097" }, "fetchOrder": { "summary": "Fetch a specific order by ID.", @@ -428,7 +428,7 @@ "type": "Order", "description": "The order details" }, - "source": "BaseExchange.ts:1106" + "source": "BaseExchange.ts:1107" }, "fetchOpenOrders": { "summary": "Fetch all open orders, optionally filtered by market.", @@ -445,7 +445,7 @@ "type": "Order[]", "description": "Array of open orders" }, - "source": "BaseExchange.ts:1116" + "source": "BaseExchange.ts:1117" }, "fetchMyTrades": { "summary": "Fetch authenticated user trade history.", @@ -488,7 +488,7 @@ "type": "UserTrade[]", "description": "Array of user trades" }, - "source": "BaseExchange.ts:1126" + "source": "BaseExchange.ts:1127" }, "fetchClosedOrders": { "summary": "Fetch authenticated closed orders.", @@ -527,7 +527,7 @@ "type": "Order[]", "description": "Array of closed orders" }, - "source": "BaseExchange.ts:1142" + "source": "BaseExchange.ts:1143" }, "fetchAllOrders": { "summary": "Fetch authenticated order history across open and closed orders.", @@ -566,7 +566,7 @@ "type": "Order[]", "description": "Array of orders" }, - "source": "BaseExchange.ts:1157" + "source": "BaseExchange.ts:1158" }, "fetchPositions": { "summary": "Fetch current user positions across all markets.", @@ -583,7 +583,7 @@ "type": "Position[]", "description": "Array of user positions" }, - "source": "BaseExchange.ts:1172" + "source": "BaseExchange.ts:1173" }, "fetchBalance": { "summary": "Fetch account balances.", @@ -600,7 +600,7 @@ "type": "Balance[]", "description": "Array of account balances" }, - "source": "BaseExchange.ts:1182" + "source": "BaseExchange.ts:1183" }, "getExecutionPrice": { "summary": "Calculate the volume-weighted average execution price for a given order size.", @@ -629,7 +629,7 @@ "type": "number", "description": "Average execution price, or 0 if insufficient liquidity" }, - "source": "BaseExchange.ts:1192" + "source": "BaseExchange.ts:1193" }, "getExecutionPriceDetailed": { "summary": "Calculate detailed execution price information including partial fill data.", @@ -658,7 +658,7 @@ "type": "ExecutionPriceResult", "description": "Detailed execution result with price, filled amount, and fill status" }, - "source": "BaseExchange.ts:1205" + "source": "BaseExchange.ts:1206" }, "filterMarkets": { "summary": "Filter a list of markets by criteria.", @@ -681,7 +681,7 @@ "type": "UnifiedMarket[]", "description": "Filtered array of markets" }, - "source": "BaseExchange.ts:1221" + "source": "BaseExchange.ts:1222" }, "filterEvents": { "summary": "Filter a list of events by criteria.", @@ -704,7 +704,7 @@ "type": "UnifiedEvent[]", "description": "Filtered array of events" }, - "source": "BaseExchange.ts:1381" + "source": "BaseExchange.ts:1382" }, "watchOrderBook": { "summary": "Watch order book updates in real-time via WebSocket.", @@ -733,7 +733,7 @@ "type": "OrderBook", "description": "Promise that resolves with the current orderbook state" }, - "source": "BaseExchange.ts:1477" + "source": "BaseExchange.ts:1478" }, "watchOrderBooks": { "summary": "Watch multiple order books simultaneously via WebSocket.", @@ -762,7 +762,7 @@ "type": "Record", "description": "Promise that resolves with order books keyed by ID" }, - "source": "BaseExchange.ts:1490" + "source": "BaseExchange.ts:1491" }, "unwatchOrderBook": { "summary": "Unsubscribe from a previously watched order book stream.", @@ -779,7 +779,7 @@ "type": "void", "description": "Result" }, - "source": "BaseExchange.ts:1518" + "source": "BaseExchange.ts:1519" }, "watchTrades": { "summary": "Watch trade executions in real-time via WebSocket.", @@ -814,7 +814,7 @@ "type": "Trade[]", "description": "Promise that resolves with recent trades" }, - "source": "BaseExchange.ts:1531" + "source": "BaseExchange.ts:1532" }, "watchAddress": { "summary": "Stream activity for a public wallet address", @@ -837,7 +837,7 @@ "type": "SubscribedAddressSnapshot", "description": "Promise that resolves with the latest SubscribedAddressSnapshot snapshot" }, - "source": "BaseExchange.ts:1545" + "source": "BaseExchange.ts:1546" }, "unwatchAddress": { "summary": "Stop watching a previously registered wallet address and release its resource updates.", @@ -854,7 +854,7 @@ "type": "void", "description": "Result" }, - "source": "BaseExchange.ts:1558" + "source": "BaseExchange.ts:1559" }, "close": { "summary": "Close all WebSocket connections and clean up resources.", @@ -864,7 +864,7 @@ "type": "void", "description": "Result" }, - "source": "BaseExchange.ts:1567" + "source": "BaseExchange.ts:1568" }, "fetchMarketMatches": { "summary": "Find the same or related market on other venues. Two modes:", @@ -881,7 +881,7 @@ "type": "MatchResult[]", "description": "Array of matched markets with relation and confidence" }, - "source": "BaseExchange.ts:1581" + "source": "BaseExchange.ts:1582" }, "fetchMatches": { "summary": "fetchMatches", @@ -898,7 +898,7 @@ "type": "MatchResult[]", "description": "Result" }, - "source": "BaseExchange.ts:1597" + "source": "BaseExchange.ts:1598" }, "fetchEventMatches": { "summary": "Find the same or related event on other venues. Two modes:", @@ -915,7 +915,7 @@ "type": "EventMatchResult[]", "description": "Array of matched events with market-level match details" }, - "source": "BaseExchange.ts:1605" + "source": "BaseExchange.ts:1606" }, "compareMarketPrices": { "summary": "Compare live prices for the same market across venues. Finds identity matches and returns side-by-side best bid/ask prices so you can spot price differences at a glance.", @@ -923,7 +923,7 @@ "params": [ { "name": "params", - "type": "FetchMatchesParams", + "type": "CompareMarketPricesParams", "optional": false, "description": "Match filter parameters (uses relation: 'identity' internally)" } @@ -932,7 +932,7 @@ "type": "PriceComparison[]", "description": "Array of price comparisons across venues" }, - "source": "BaseExchange.ts:1621" + "source": "BaseExchange.ts:1622" }, "fetchRelatedMarkets": { "summary": "Find related markets across venues. Discovers subset/superset market relationships", @@ -949,7 +949,7 @@ "type": "PriceComparison[]", "description": "Array of subset/superset matches with live prices" }, - "source": "BaseExchange.ts:1631" + "source": "BaseExchange.ts:1632" }, "fetchMatchedMarkets": { "summary": "fetchMatchedMarkets", @@ -966,7 +966,7 @@ "type": "MatchedMarketPair[]", "description": "Result" }, - "source": "BaseExchange.ts:1642" + "source": "BaseExchange.ts:1643" }, "fetchMatchedPrices": { "summary": "fetchMatchedPrices", @@ -983,7 +983,7 @@ "type": "MatchedPricePair[]", "description": "Array of matched market pairs with prices from each venue" }, - "source": "BaseExchange.ts:1650" + "source": "BaseExchange.ts:1651" }, "fetchHedges": { "summary": "fetchHedges", @@ -1000,7 +1000,7 @@ "type": "PriceComparison[]", "description": "Array of subset/superset matches with live prices" }, - "source": "BaseExchange.ts:1661" + "source": "BaseExchange.ts:1662" }, "fetchArbitrage": { "summary": "fetchArbitrage", @@ -1017,7 +1017,7 @@ "type": "ArbitrageOpportunity[]", "description": "Array of arbitrage opportunities sorted by spread" }, - "source": "BaseExchange.ts:1671" + "source": "BaseExchange.ts:1672" }, "watchPrices": { "summary": "Watch AMM price updates for a market address (Limitless only).", @@ -1159,7 +1159,7 @@ "type": "FirehoseEvent", "description": "Next event with source, symbol, and orderbook" }, - "source": "client.ts:2057" + "source": "client.ts:2070" }, "firehose": { "summary": "Stream all orderbook updates across venues.", @@ -1176,7 +1176,7 @@ "type": "FirehoseEvent", "description": "Next event with source, symbol, and orderbook" }, - "source": "client.ts:2098" + "source": "client.ts:2111" } }, "workflowExample": { diff --git a/core/scripts/generate-python-exchanges.js b/core/scripts/generate-python-exchanges.js index ee0739d9..8aa4e198 100644 --- a/core/scripts/generate-python-exchanges.js +++ b/core/scripts/generate-python-exchanges.js @@ -173,6 +173,10 @@ function generateClass(exchange) { constructorParams.push('base_url: Optional[str] = None'); constructorParams.push('auto_start_server: Optional[bool] = None'); constructorParams.push('pmxt_api_key: Optional[str] = None'); + constructorParams.push('wallet_address: Optional[str] = None'); + constructorParams.push('signer: Optional[object] = None'); + superArgs.push('wallet_address=wallet_address'); + superArgs.push('signer=signer'); superArgs.push('base_url=base_url'); superArgs.push('auto_start_server=auto_start_server'); superArgs.push('pmxt_api_key=pmxt_api_key'); diff --git a/core/src/BaseExchange.ts b/core/src/BaseExchange.ts index 469a32c9..035dd570 100644 --- a/core/src/BaseExchange.ts +++ b/core/src/BaseExchange.ts @@ -29,6 +29,7 @@ import type { MatchResult, EventMatchResult, PriceComparison, + CompareMarketPricesParams, ArbitrageOpportunity, MatchedMarketPair, MatchedPricePair, @@ -1624,7 +1625,7 @@ export abstract class PredictionMarketExchange { * @param params - Match filter parameters (uses relation: 'identity' internally) * @returns Array of price comparisons across venues */ - async compareMarketPrices(params: FetchMatchesParams): Promise { + async compareMarketPrices(params: CompareMarketPricesParams): Promise { throw new Error("Method compareMarketPrices not implemented."); } diff --git a/core/src/router/types.ts b/core/src/router/types.ts index d32a024a..9976d04b 100644 --- a/core/src/router/types.ts +++ b/core/src/router/types.ts @@ -71,6 +71,23 @@ export interface ArbitrageOpportunity { // Param types // --------------------------------------------------------------------------- + +/** + * Parameters for comparing market prices across venues. + */ +export interface CompareMarketPricesParams { + /** The source market ID to compare against. */ + marketId: string; + /** Optional list of target market IDs to compare with. If not provided, the router finds matches automatically. */ + targetMarketIds?: string[]; + /** Minimum price difference to return. */ + minDifference?: number; + /** Maximum number of results to return. */ + limit?: number; +} + + + export interface FetchMarketMatchesParams { /** Keyword search across matched market titles. */ query?: string; diff --git a/core/src/server/openapi.yaml b/core/src/server/openapi.yaml index 428cf7d9..d034c2e5 100644 --- a/core/src/server/openapi.yaml +++ b/core/src/server/openapi.yaml @@ -2069,7 +2069,7 @@ paths: type: array maxItems: 1 items: - $ref: '#/components/schemas/FetchMarketMatchesParams' + type: object minItems: 1 credentials: $ref: '#/components/schemas/ExchangeCredentials' diff --git a/docs/api-reference/openapi.json b/docs/api-reference/openapi.json index 72ee155e..ce3b134e 100644 --- a/docs/api-reference/openapi.json +++ b/docs/api-reference/openapi.json @@ -7043,7 +7043,7 @@ "type": "array", "maxItems": 1, "items": { - "$ref": "#/components/schemas/FetchMarketMatchesParams" + "type": "object" }, "minItems": 1 }, diff --git a/sdks/python/API_REFERENCE.md b/sdks/python/API_REFERENCE.md index 44a18595..3ec9dfb3 100644 --- a/sdks/python/API_REFERENCE.md +++ b/sdks/python/API_REFERENCE.md @@ -1172,12 +1172,12 @@ Compare live prices for the same market across venues. Finds identity matches an **Signature:** ```python -def compare_market_prices(params: FetchMatchesParams) -> List[PriceComparison]: +def compare_market_prices(params: CompareMarketPricesParams) -> List[PriceComparison]: ``` **Parameters:** -- `params` (FetchMatchesParams): Match filter parameters (uses relation: 'identity' internally) +- `params` (CompareMarketPricesParams): Match filter parameters (uses relation: 'identity' internally) **Returns:** List[[PriceComparison](#pricecomparison)] - Array of price comparisons across venues diff --git a/sdks/python/pmxt/_exchanges.py b/sdks/python/pmxt/_exchanges.py index 224672b5..e6e2d8fd 100644 --- a/sdks/python/pmxt/_exchanges.py +++ b/sdks/python/pmxt/_exchanges.py @@ -21,8 +21,6 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, - # NOTE: Generated wrapper; update the generator template in - # core/scripts/generate-python-exchanges.js in a follow-up. wallet_address: Optional[str] = None, signer: Optional[object] = None, ) -> None: @@ -39,8 +37,6 @@ def __init__( base_url: Base URL of the PMXT sidecar server auto_start_server: Automatically start server if not running (default: True) pmxt_api_key: Hosted PMXT API key (optional; enables hosted mode) - wallet_address: Ethereum address for hosted reads/writes (optional) - signer: Optional callable for signing typed_data (optional) """ super().__init__( exchange_name="polymarket", @@ -48,11 +44,11 @@ def __init__( private_key=private_key, proxy_address=proxy_address, signature_type=signature_type, + wallet_address=wallet_address, + signer=signer, base_url=base_url, auto_start_server=auto_start_server, pmxt_api_key=pmxt_api_key, - wallet_address=wallet_address, - signer=signer, ) self.api_secret = api_secret @@ -98,18 +94,16 @@ def __init__( base_url: Base URL of the PMXT sidecar server auto_start_server: Automatically start server if not running (default: True) pmxt_api_key: Hosted PMXT API key (optional; enables hosted mode) - wallet_address: Ethereum address for hosted reads/writes (optional) - signer: Optional callable for signing typed_data (optional) """ super().__init__( exchange_name="limitless", api_key=api_key, private_key=private_key, + wallet_address=wallet_address, + signer=signer, base_url=base_url, auto_start_server=auto_start_server, pmxt_api_key=pmxt_api_key, - wallet_address=wallet_address, - signer=signer, ) self.api_secret = api_secret @@ -134,6 +128,8 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, + wallet_address: Optional[str] = None, + signer: Optional[object] = None, ) -> None: """ Initialize Kalshi client. @@ -149,6 +145,8 @@ def __init__( exchange_name="kalshi", api_key=api_key, private_key=private_key, + wallet_address=wallet_address, + signer=signer, base_url=base_url, auto_start_server=auto_start_server, pmxt_api_key=pmxt_api_key, @@ -165,6 +163,8 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, + wallet_address: Optional[str] = None, + signer: Optional[object] = None, ) -> None: """ Initialize KalshiDemo client. @@ -180,6 +180,8 @@ def __init__( exchange_name="kalshi-demo", api_key=api_key, private_key=private_key, + wallet_address=wallet_address, + signer=signer, base_url=base_url, auto_start_server=auto_start_server, pmxt_api_key=pmxt_api_key, @@ -198,6 +200,8 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, + wallet_address: Optional[str] = None, + signer: Optional[object] = None, ) -> None: """ Initialize Probable client. @@ -215,6 +219,8 @@ def __init__( exchange_name="probable", api_key=api_key, private_key=private_key, + wallet_address=wallet_address, + signer=signer, base_url=base_url, auto_start_server=auto_start_server, pmxt_api_key=pmxt_api_key, @@ -241,6 +247,8 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, + wallet_address: Optional[str] = None, + signer: Optional[object] = None, ) -> None: """ Initialize Baozi client. @@ -254,6 +262,8 @@ def __init__( super().__init__( exchange_name="baozi", private_key=private_key, + wallet_address=wallet_address, + signer=signer, base_url=base_url, auto_start_server=auto_start_server, pmxt_api_key=pmxt_api_key, @@ -270,6 +280,8 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, + wallet_address: Optional[str] = None, + signer: Optional[object] = None, ) -> None: """ Initialize Myriad client. @@ -284,7 +296,9 @@ def __init__( super().__init__( exchange_name="myriad", api_key=api_key, + private_key=wallet_address, wallet_address=wallet_address, + signer=signer, base_url=base_url, auto_start_server=auto_start_server, pmxt_api_key=pmxt_api_key, @@ -302,8 +316,6 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, - # NOTE: Generated wrapper; update the generator template in - # core/scripts/generate-python-exchanges.js in a follow-up. wallet_address: Optional[str] = None, signer: Optional[object] = None, ) -> None: @@ -317,19 +329,17 @@ def __init__( base_url: Base URL of the PMXT sidecar server auto_start_server: Automatically start server if not running (default: True) pmxt_api_key: Hosted PMXT API key (optional; enables hosted mode) - wallet_address: Ethereum address for hosted reads/writes (optional) - signer: Optional callable for signing typed_data (optional) """ super().__init__( exchange_name="opinion", api_key=api_key, private_key=private_key, proxy_address=proxy_address, + wallet_address=wallet_address, + signer=signer, base_url=base_url, auto_start_server=auto_start_server, pmxt_api_key=pmxt_api_key, - wallet_address=wallet_address, - signer=signer, ) @@ -342,6 +352,8 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, + wallet_address: Optional[str] = None, + signer: Optional[object] = None, ) -> None: """ Initialize Metaculus client. @@ -355,6 +367,8 @@ def __init__( super().__init__( exchange_name="metaculus", api_token=api_token, + wallet_address=wallet_address, + signer=signer, base_url=base_url, auto_start_server=auto_start_server, pmxt_api_key=pmxt_api_key, @@ -371,6 +385,8 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, + wallet_address: Optional[str] = None, + signer: Optional[object] = None, ) -> None: """ Initialize Smarkets client. @@ -386,6 +402,8 @@ def __init__( exchange_name="smarkets", api_key=api_key, private_key=private_key, + wallet_address=wallet_address, + signer=signer, base_url=base_url, auto_start_server=auto_start_server, pmxt_api_key=pmxt_api_key, @@ -402,6 +420,8 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, + wallet_address: Optional[str] = None, + signer: Optional[object] = None, ) -> None: """ Initialize PolymarketUS client. @@ -417,6 +437,8 @@ def __init__( exchange_name="polymarket_us", api_key=api_key, private_key=private_key, + wallet_address=wallet_address, + signer=signer, base_url=base_url, auto_start_server=auto_start_server, pmxt_api_key=pmxt_api_key, @@ -433,6 +455,8 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, + wallet_address: Optional[str] = None, + signer: Optional[object] = None, ) -> None: """ Initialize Hyperliquid client. @@ -448,6 +472,8 @@ def __init__( exchange_name="hyperliquid", api_key=api_key, private_key=private_key, + wallet_address=wallet_address, + signer=signer, base_url=base_url, auto_start_server=auto_start_server, pmxt_api_key=pmxt_api_key, @@ -464,6 +490,8 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, + wallet_address: Optional[str] = None, + signer: Optional[object] = None, ) -> None: """ Initialize GeminiTitan client. @@ -478,6 +506,8 @@ def __init__( super().__init__( exchange_name="gemini-titan", api_key=api_key, + wallet_address=wallet_address, + signer=signer, base_url=base_url, auto_start_server=auto_start_server, pmxt_api_key=pmxt_api_key, @@ -500,6 +530,8 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, + wallet_address: Optional[str] = None, + signer: Optional[object] = None, ) -> None: """ Initialize SuiBets client. @@ -511,6 +543,8 @@ def __init__( """ super().__init__( exchange_name="suibets", + wallet_address=wallet_address, + signer=signer, base_url=base_url, auto_start_server=auto_start_server, pmxt_api_key=pmxt_api_key, @@ -522,20 +556,27 @@ class Rain(Exchange): def __init__( self, + private_key: Optional[str] = None, base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, + wallet_address: Optional[str] = None, + signer: Optional[object] = None, ) -> None: """ Initialize Rain client. Args: + private_key: Private key for authentication (optional) base_url: Base URL of the PMXT sidecar server auto_start_server: Automatically start server if not running (default: True) pmxt_api_key: Hosted PMXT API key (optional; enables hosted mode) """ super().__init__( exchange_name="rain", + private_key=private_key, + wallet_address=wallet_address, + signer=signer, base_url=base_url, auto_start_server=auto_start_server, pmxt_api_key=pmxt_api_key, @@ -552,6 +593,7 @@ def __init__( auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, wallet_address: Optional[str] = None, + signer: Optional[object] = None, ) -> None: """ Initialize Hunch client. @@ -561,15 +603,15 @@ def __init__( base_url: Base URL of the PMXT sidecar server auto_start_server: Automatically start server if not running (default: True) pmxt_api_key: Hosted PMXT API key (optional; enables hosted mode) - wallet_address: EVM wallet address used for hosted reads/writes """ super().__init__( exchange_name="hunch", private_key=private_key, + wallet_address=wallet_address, + signer=signer, base_url=base_url, auto_start_server=auto_start_server, pmxt_api_key=pmxt_api_key, - wallet_address=wallet_address, ) @@ -581,6 +623,8 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, + wallet_address: Optional[str] = None, + signer: Optional[object] = None, ) -> None: """ Initialize Mock client. @@ -592,6 +636,8 @@ def __init__( """ super().__init__( exchange_name="mock", + wallet_address=wallet_address, + signer=signer, base_url=base_url, auto_start_server=auto_start_server, pmxt_api_key=pmxt_api_key, @@ -606,6 +652,8 @@ def __init__( base_url: Optional[str] = None, auto_start_server: Optional[bool] = None, pmxt_api_key: Optional[str] = None, + wallet_address: Optional[str] = None, + signer: Optional[object] = None, ) -> None: """ Initialize Router client. @@ -617,6 +665,8 @@ def __init__( """ super().__init__( exchange_name="router", + wallet_address=wallet_address, + signer=signer, base_url=base_url, auto_start_server=auto_start_server, pmxt_api_key=pmxt_api_key, diff --git a/sdks/typescript/API_REFERENCE.md b/sdks/typescript/API_REFERENCE.md index 79ec1a85..63dd4365 100644 --- a/sdks/typescript/API_REFERENCE.md +++ b/sdks/typescript/API_REFERENCE.md @@ -1174,12 +1174,12 @@ Compare live prices for the same market across venues. Finds identity matches an **Signature:** ```typescript -async compareMarketPrices(params: FetchMatchesParams): Promise +async compareMarketPrices(params: CompareMarketPricesParams): Promise ``` **Parameters:** -- `params` (FetchMatchesParams): Match filter parameters (uses relation: 'identity' internally) +- `params` (CompareMarketPricesParams): Match filter parameters (uses relation: 'identity' internally) **Returns:** Promise<[PriceComparison](#pricecomparison)[]> - Array of price comparisons across venues diff --git a/sdks/typescript/pmxt/client.ts b/sdks/typescript/pmxt/client.ts index 41eadab9..28b63015 100644 --- a/sdks/typescript/pmxt/client.ts +++ b/sdks/typescript/pmxt/client.ts @@ -944,6 +944,19 @@ export abstract class Exchange { // BEGIN GENERATED METHODS +import { + // Router types + FetchMarketMatchesParams, + MatchResult, + FetchEventMatchesParams, + EventMatchResult, + CompareMarketPricesParams, + PriceComparison, + FetchMatchedPricesParams, + FetchArbitrageParams, + ArbitrageOpportunity, +} from './models.js'; + async loadMarkets(reload: boolean = false): Promise> { await this.initPromise; try { @@ -1622,7 +1635,7 @@ export abstract class Exchange { } } - async fetchMarketMatches(params?: any): Promise { + async fetchMarketMatches(params?: FetchMarketMatchesParams): Promise { await this.initPromise; try { const args: any[] = []; @@ -1647,7 +1660,7 @@ export abstract class Exchange { } } - async fetchMatches(params: any): Promise { + async fetchMatches(params: any): Promise { await this.initPromise; try { const args: any[] = []; @@ -1672,7 +1685,7 @@ export abstract class Exchange { } } - async fetchEventMatches(params?: any): Promise { + async fetchEventMatches(params?: FetchEventMatchesParams): Promise { await this.initPromise; try { const args: any[] = []; @@ -1697,7 +1710,7 @@ export abstract class Exchange { } } - async compareMarketPrices(params: any): Promise { + async compareMarketPrices(params: CompareMarketPricesParams): Promise { await this.initPromise; try { const args: any[] = []; @@ -1722,7 +1735,7 @@ export abstract class Exchange { } } - async fetchRelatedMarkets(params: any): Promise { + async fetchRelatedMarkets(params: any): Promise { await this.initPromise; try { const args: any[] = []; @@ -1772,7 +1785,7 @@ export abstract class Exchange { } } - async fetchMatchedPrices(params?: any): Promise { + async fetchMatchedPrices(params?: FetchMatchedPricesParams): Promise { await this.initPromise; try { const args: any[] = []; @@ -1797,7 +1810,7 @@ export abstract class Exchange { } } - async fetchHedges(params: any): Promise { + async fetchHedges(params: any): Promise { await this.initPromise; try { const args: any[] = []; @@ -1822,7 +1835,7 @@ export abstract class Exchange { } } - async fetchArbitrage(params?: any): Promise { + async fetchArbitrage(params?: FetchArbitrageParams): Promise { await this.initPromise; try { const args: any[] = []; diff --git a/sdks/typescript/scripts/generate-client-methods.js b/sdks/typescript/scripts/generate-client-methods.js index 7eed6d61..8f30445c 100644 --- a/sdks/typescript/scripts/generate-client-methods.js +++ b/sdks/typescript/scripts/generate-client-methods.js @@ -48,6 +48,19 @@ function extractExistingTsMethod(generatedRegion, methodName) { return match ? match[0].replace(/\n+$/, '') : null; } +const GENERATED_IMPORTS = `import { + // Router types + FetchMarketMatchesParams, + MatchResult, + FetchEventMatchesParams, + EventMatchResult, + CompareMarketPricesParams, + PriceComparison, + FetchMatchedPricesParams, + FetchArbitrageParams, + ArbitrageOpportunity, +} from './models.js';`; + // Methods kept hand-maintained in client.ts (special logic, streaming, local-only) const SKIP_GENERATE = new Set([ 'callApi', @@ -87,6 +100,11 @@ const TYPE_MAP = { PriceCandle: { converter: 'convertCandle' }, // Pagination wrapper — gets its own response handler PaginatedMarketsResult: { converter: null, pattern: 'paginatedMarkets' }, + + MatchResult: { converter: null, pattern: 'raw' }, + EventMatchResult: { converter: null, pattern: 'raw' }, + PriceComparison: { converter: null, pattern: 'raw' }, + ArbitrageOpportunity: { converter: null, pattern: 'raw' }, PaginatedEventsResult: { converter: null, pattern: 'paginatedEvents' }, }; @@ -101,6 +119,16 @@ const SDK_PARAM_TYPES = new Set([ 'MyTradesParams', 'OrderHistoryParams', 'CreateOrderParams', 'MarketFilterCriteria', 'EventFilterCriteria', 'SubscriptionOption', + + 'FetchMarketMatchesParams', + 'FetchEventMatchesParams', + 'CompareMarketPricesParams', + 'FetchMatchedPricesParams', + 'FetchArbitrageParams', + 'MatchResult', + 'EventMatchResult', + 'PriceComparison', + 'ArbitrageOpportunity', ]); // Parameter names that represent outcome IDs and should accept MarketOutcome. @@ -515,7 +543,8 @@ function main() { throw new Error(`Generation markers not found in ${CLIENT_PATH}.\nAdd:\n ${MARKER_BEGIN}\n ${MARKER_END}`); } - const before = client.slice(0, beginIdx + MARKER_BEGIN.length); + + const before = client.slice(0, beginIdx + MARKER_BEGIN.length) + '\n\n' + GENERATED_IMPORTS; const existingRegion = client.slice(beginIdx + MARKER_BEGIN.length, endIdx); const after = client.slice(endIdx);