From 4c1a19f6997b6000ca4192e58c6a2fd9f8772bb9 Mon Sep 17 00:00:00 2001 From: Samuel Tinnerholm Date: Fri, 5 Jun 2026 14:38:34 +0000 Subject: [PATCH 1/2] fix: add fetch timeouts to Limitless and test server --- core/src/exchanges/limitless/fetcher.ts | 3 ++- core/src/server/test-server.js | 22 +++++++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/core/src/exchanges/limitless/fetcher.ts b/core/src/exchanges/limitless/fetcher.ts index aca7f6bf..01819d9a 100644 --- a/core/src/exchanges/limitless/fetcher.ts +++ b/core/src/exchanges/limitless/fetcher.ts @@ -102,6 +102,7 @@ export class LimitlessFetcher implements IExchangeFetcher { const { HttpClient, MarketFetcher } = await import('@limitless-exchange/sdk'); - const httpClient = new HttpClient({ baseURL: this.apiUrl }); + const httpClient = new HttpClient({ baseURL: this.apiUrl, timeout: 30000 }); const marketFetcher = new MarketFetcher(httpClient); const market = await marketFetcher.getMarket(slug); diff --git a/core/src/server/test-server.js b/core/src/server/test-server.js index 4b8a6454..e1975ba6 100644 --- a/core/src/server/test-server.js +++ b/core/src/server/test-server.js @@ -6,24 +6,32 @@ */ const BASE_URL = 'http://localhost:3847'; +const REQUEST_TIMEOUT_MS = 30_000; + +async function fetchWithTimeout(url, options = {}) { + return fetch(url, { + ...options, + signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS), + }); +} async function testHealthCheck() { console.log('\nTesting health check...'); - const response = await fetch(`${BASE_URL}/health`); + const response = await fetchWithTimeout(`${BASE_URL}/health`); const data = await response.json(); console.log('Health check:', data); } async function testVersion() { console.log('\nTesting version endpoint...'); - const response = await fetch(`${BASE_URL}/version`); + const response = await fetchWithTimeout(`${BASE_URL}/version`); const data = await response.json(); console.log('Version:', data); } async function testFetchMarkets() { console.log('\nTesting fetchMarkets (Polymarket)...'); - const response = await fetch(`${BASE_URL}/api/polymarket/fetchMarkets`, { + const response = await fetchWithTimeout(`${BASE_URL}/api/polymarket/fetchMarkets`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ @@ -42,7 +50,7 @@ async function testFetchMarkets() { async function testSearchMarkets() { console.log('\nTesting searchMarkets (Kalshi)...'); - const response = await fetch(`${BASE_URL}/api/kalshi/searchMarkets`, { + const response = await fetchWithTimeout(`${BASE_URL}/api/kalshi/searchMarkets`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ @@ -63,7 +71,7 @@ async function testSearchMarkets() { async function testGetMarketsBySlug() { console.log('\nTesting getMarketsBySlug (Polymarket)...'); - const response = await fetch(`${BASE_URL}/api/polymarket/getMarketsBySlug`, { + const response = await fetchWithTimeout(`${BASE_URL}/api/polymarket/getMarketsBySlug`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ @@ -84,7 +92,7 @@ async function testFetchOHLCV() { console.log('\nTesting fetchOHLCV (Polymarket)...'); // First, get a market to extract an outcome ID - const marketsResponse = await fetch(`${BASE_URL}/api/polymarket/searchMarkets`, { + const marketsResponse = await fetchWithTimeout(`${BASE_URL}/api/polymarket/searchMarkets`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ @@ -101,7 +109,7 @@ async function testFetchOHLCV() { const outcomeId = marketsData.data[0].outcomes[0].id; console.log(` Using outcome ID: ${outcomeId.substring(0, 20)}...`); - const response = await fetch(`${BASE_URL}/api/polymarket/fetchOHLCV`, { + const response = await fetchWithTimeout(`${BASE_URL}/api/polymarket/fetchOHLCV`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ From babf7b26d2c8dcbdd83dfeb1bc627bf517eafed0 Mon Sep 17 00:00:00 2001 From: Samuel Tinnerholm Date: Mon, 8 Jun 2026 08:00:50 +0000 Subject: [PATCH 2/2] chore: regenerate API references --- core/api-doc-config.generated.json | 36 +++++++++++++++--------------- sdks/python/API_REFERENCE.md | 2 +- sdks/typescript/API_REFERENCE.md | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/core/api-doc-config.generated.json b/core/api-doc-config.generated.json index 3e176c67..571082b0 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-06-02T00:34:44.916Z. Do not edit manually.", + "_generated": "Auto-generated by extract-jsdoc.js on 2026-06-08T07:59:09.153Z. Do not edit manually.", "methods": { "has": { "summary": "HTTP verb for the endpoint (e.g. GET, POST). */", @@ -566,7 +566,7 @@ "type": "UnifiedEvent[]", "description": "Filtered array of events" }, - "source": "BaseExchange.ts:1317" + "source": "BaseExchange.ts:1318" }, "watchOrderBook": { "summary": "Watch order book updates in real-time via WebSocket.", @@ -595,7 +595,7 @@ "type": "OrderBook", "description": "Promise that resolves with the current orderbook state" }, - "source": "BaseExchange.ts:1413" + "source": "BaseExchange.ts:1414" }, "watchOrderBooks": { "summary": "Watch multiple order books simultaneously via WebSocket.", @@ -624,7 +624,7 @@ "type": "Record", "description": "Promise that resolves with order books keyed by ID" }, - "source": "BaseExchange.ts:1426" + "source": "BaseExchange.ts:1427" }, "unwatchOrderBook": { "summary": "Unsubscribe from a previously watched order book stream.", @@ -641,7 +641,7 @@ "type": "void", "description": "Result" }, - "source": "BaseExchange.ts:1454" + "source": "BaseExchange.ts:1455" }, "watchTrades": { "summary": "Watch trade executions in real-time via WebSocket.", @@ -676,7 +676,7 @@ "type": "Trade[]", "description": "Promise that resolves with recent trades" }, - "source": "BaseExchange.ts:1467" + "source": "BaseExchange.ts:1468" }, "watchAddress": { "summary": "Stream activity for a public wallet address", @@ -699,7 +699,7 @@ "type": "SubscribedAddressSnapshot", "description": "Promise that resolves with the latest SubscribedAddressSnapshot snapshot" }, - "source": "BaseExchange.ts:1481" + "source": "BaseExchange.ts:1482" }, "unwatchAddress": { "summary": "Stop watching a previously registered wallet address and release its resource updates.", @@ -716,7 +716,7 @@ "type": "void", "description": "Result" }, - "source": "BaseExchange.ts:1494" + "source": "BaseExchange.ts:1495" }, "close": { "summary": "Close all WebSocket connections and clean up resources.", @@ -726,7 +726,7 @@ "type": "void", "description": "Result" }, - "source": "BaseExchange.ts:1503" + "source": "BaseExchange.ts:1504" }, "fetchMarketMatches": { "summary": "Find the same or related market on other venues. Two modes:", @@ -743,7 +743,7 @@ "type": "MatchResult[]", "description": "Array of matched markets with relation and confidence" }, - "source": "BaseExchange.ts:1517" + "source": "BaseExchange.ts:1518" }, "fetchMatches": { "summary": "fetchMatches", @@ -760,7 +760,7 @@ "type": "MatchResult[]", "description": "Result" }, - "source": "BaseExchange.ts:1533" + "source": "BaseExchange.ts:1534" }, "fetchEventMatches": { "summary": "Find the same or related event on other venues. Two modes:", @@ -777,7 +777,7 @@ "type": "EventMatchResult[]", "description": "Array of matched events with market-level match details" }, - "source": "BaseExchange.ts:1541" + "source": "BaseExchange.ts:1542" }, "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.", @@ -794,7 +794,7 @@ "type": "PriceComparison[]", "description": "Array of price comparisons across venues" }, - "source": "BaseExchange.ts:1557" + "source": "BaseExchange.ts:1558" }, "fetchRelatedMarkets": { "summary": "Find related markets across venues. Discovers subset/superset market relationships", @@ -811,7 +811,7 @@ "type": "PriceComparison[]", "description": "Array of subset/superset matches with live prices" }, - "source": "BaseExchange.ts:1567" + "source": "BaseExchange.ts:1568" }, "fetchMatchedMarkets": { "summary": "fetchMatchedMarkets", @@ -828,7 +828,7 @@ "type": "MatchedMarketPair[]", "description": "Result" }, - "source": "BaseExchange.ts:1578" + "source": "BaseExchange.ts:1579" }, "fetchMatchedPrices": { "summary": "fetchMatchedPrices", @@ -845,7 +845,7 @@ "type": "MatchedPricePair[]", "description": "Array of matched market pairs with prices from each venue" }, - "source": "BaseExchange.ts:1586" + "source": "BaseExchange.ts:1587" }, "fetchHedges": { "summary": "fetchHedges", @@ -862,7 +862,7 @@ "type": "PriceComparison[]", "description": "Array of subset/superset matches with live prices" }, - "source": "BaseExchange.ts:1597" + "source": "BaseExchange.ts:1598" }, "fetchArbitrage": { "summary": "fetchArbitrage", @@ -879,7 +879,7 @@ "type": "ArbitrageOpportunity[]", "description": "Array of arbitrage opportunities sorted by spread" }, - "source": "BaseExchange.ts:1607" + "source": "BaseExchange.ts:1608" }, "watchPrices": { "summary": "Watch AMM price updates for a market address (Limitless only).", diff --git a/sdks/python/API_REFERENCE.md b/sdks/python/API_REFERENCE.md index dac681ce..b20f3aa2 100644 --- a/sdks/python/API_REFERENCE.md +++ b/sdks/python/API_REFERENCE.md @@ -1456,7 +1456,7 @@ title: str # The market title (e.g., "Will BTC close above $100k on Dec 31?"). description: str # Long-form market description or resolution criteria. slug: str # URL-friendly slug for the market. outcomes: List[MarketOutcome] # The possible outcomes for this market. -resolution_date: str # When the market is scheduled to resolve. +resolution_date: str # When the market is scheduled to resolve. Optional because some venues do not publish a cutoff for every market (e.g. Opinion categorical children) — emit `undefined` rather than coercing to epoch. volume24h: float # Trading volume over the past 24 hours (USD). volume: float # Total / Lifetime volume liquidity: float # Current market liquidity (USD). diff --git a/sdks/typescript/API_REFERENCE.md b/sdks/typescript/API_REFERENCE.md index f8504e0a..ec2f3280 100644 --- a/sdks/typescript/API_REFERENCE.md +++ b/sdks/typescript/API_REFERENCE.md @@ -1456,7 +1456,7 @@ title: string; // The market title (e.g., "Will BTC close above $100k on Dec 31? description: string; // Long-form market description or resolution criteria. slug: string; // URL-friendly slug for the market. outcomes: MarketOutcome[]; // The possible outcomes for this market. -resolutionDate: string; // When the market is scheduled to resolve. +resolutionDate: string; // When the market is scheduled to resolve. Optional because some venues do not publish a cutoff for every market (e.g. Opinion categorical children) — emit `undefined` rather than coercing to epoch. volume24h: number; // Trading volume over the past 24 hours (USD). volume: number; // Total / Lifetime volume liquidity: number; // Current market liquidity (USD).