Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 55 additions & 38 deletions core/api-doc-config.generated.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"_generated": "Auto-generated by extract-jsdoc.js on 2026-06-23T14:45:30.753Z. Do not edit manually.",
"_generated": "Auto-generated by extract-jsdoc.js on 2026-07-10T06:40:05.097Z. Do not edit manually.",
"methods": {
"has": {
"summary": "HTTP verb for the endpoint (e.g. GET, POST). */",
Expand Down Expand Up @@ -228,6 +228,23 @@
},
"source": "BaseExchange.ts:959"
},
"fetchEventMetadata": {
"summary": "Fetch venue-native metadata for a specific event when the exchange",
"description": "exposes a dedicated metadata endpoint.\n\nKalshi implements this for `GET /events/{event_ticker}/metadata`.",
"params": [
{
"name": "eventTicker",
"type": "string",
"optional": false,
"description": "eventTicker"
}
],
"returns": {
"type": "Record<string, unknown>",
"description": "Result"
},
"source": "BaseExchange.ts:976"
},
"fetchOHLCV": {
"summary": "Fetch historical OHLCV (candlestick) price data for a specific market outcome.",
"description": "Fetch historical OHLCV (candlestick) price data for a specific market outcome.",
Expand All @@ -254,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:976"
"source": "BaseExchange.ts:987"
},
"fetchOrderBook": {
"summary": "Fetch the order book (bids/asks) for a specific outcome.",
Expand Down Expand Up @@ -283,7 +300,7 @@
"type": "OrderBook",
"description": "Order book with bids and asks. Returns OrderBook[] when"
},
"source": "BaseExchange.ts:991"
"source": "BaseExchange.ts:1002"
},
"fetchOrderBooks": {
"summary": "Batch variant of {@link fetchOrderBook}. Fetches order books for",
Expand All @@ -300,7 +317,7 @@
"type": "Record<string, OrderBook>",
"description": "A map keyed by the input id (preserving the caller's exact"
},
"source": "BaseExchange.ts:1019"
"source": "BaseExchange.ts:1030"
},
"fetchTrades": {
"summary": "Fetch raw trade history for a specific outcome.",
Expand All @@ -326,7 +343,7 @@
"notes": [
"Polymarket requires an API key for trade history. Use fetchOHLCV for public historical data."
],
"source": "BaseExchange.ts:1032"
"source": "BaseExchange.ts:1043"
},
"createOrder": {
"summary": "Place a new order on the exchange.",
Expand All @@ -343,7 +360,7 @@
"type": "Order",
"description": "The created order"
},
"source": "BaseExchange.ts:1049"
"source": "BaseExchange.ts:1060"
},
"buildOrder": {
"summary": "Build an order payload without submitting it to the exchange.",
Expand All @@ -360,7 +377,7 @@
"type": "BuiltOrder",
"description": "A BuiltOrder containing the exchange-native payload"
},
"source": "BaseExchange.ts:1063"
"source": "BaseExchange.ts:1074"
},
"submitOrder": {
"summary": "Submit a pre-built order returned by buildOrder().",
Expand All @@ -377,7 +394,7 @@
"type": "Order",
"description": "The submitted order"
},
"source": "BaseExchange.ts:1075"
"source": "BaseExchange.ts:1086"
},
"cancelOrder": {
"summary": "Cancel an existing open order.",
Expand All @@ -394,7 +411,7 @@
"type": "Order",
"description": "The cancelled order"
},
"source": "BaseExchange.ts:1085"
"source": "BaseExchange.ts:1096"
},
"fetchOrder": {
"summary": "Fetch a specific order by ID.",
Expand All @@ -411,7 +428,7 @@
"type": "Order",
"description": "The order details"
},
"source": "BaseExchange.ts:1095"
"source": "BaseExchange.ts:1106"
},
"fetchOpenOrders": {
"summary": "Fetch all open orders, optionally filtered by market.",
Expand All @@ -428,7 +445,7 @@
"type": "Order[]",
"description": "Array of open orders"
},
"source": "BaseExchange.ts:1105"
"source": "BaseExchange.ts:1116"
},
"fetchMyTrades": {
"summary": "Fetch authenticated user trade history.",
Expand Down Expand Up @@ -471,7 +488,7 @@
"type": "UserTrade[]",
"description": "Array of user trades"
},
"source": "BaseExchange.ts:1115"
"source": "BaseExchange.ts:1126"
},
"fetchClosedOrders": {
"summary": "Fetch authenticated closed orders.",
Expand Down Expand Up @@ -510,7 +527,7 @@
"type": "Order[]",
"description": "Array of closed orders"
},
"source": "BaseExchange.ts:1131"
"source": "BaseExchange.ts:1142"
},
"fetchAllOrders": {
"summary": "Fetch authenticated order history across open and closed orders.",
Expand Down Expand Up @@ -549,7 +566,7 @@
"type": "Order[]",
"description": "Array of orders"
},
"source": "BaseExchange.ts:1146"
"source": "BaseExchange.ts:1157"
},
"fetchPositions": {
"summary": "Fetch current user positions across all markets.",
Expand All @@ -566,7 +583,7 @@
"type": "Position[]",
"description": "Array of user positions"
},
"source": "BaseExchange.ts:1161"
"source": "BaseExchange.ts:1172"
},
"fetchBalance": {
"summary": "Fetch account balances.",
Expand All @@ -583,7 +600,7 @@
"type": "Balance[]",
"description": "Array of account balances"
},
"source": "BaseExchange.ts:1171"
"source": "BaseExchange.ts:1182"
},
"getExecutionPrice": {
"summary": "Calculate the volume-weighted average execution price for a given order size.",
Expand Down Expand Up @@ -612,7 +629,7 @@
"type": "number",
"description": "Average execution price, or 0 if insufficient liquidity"
},
"source": "BaseExchange.ts:1181"
"source": "BaseExchange.ts:1192"
},
"getExecutionPriceDetailed": {
"summary": "Calculate detailed execution price information including partial fill data.",
Expand Down Expand Up @@ -641,7 +658,7 @@
"type": "ExecutionPriceResult",
"description": "Detailed execution result with price, filled amount, and fill status"
},
"source": "BaseExchange.ts:1194"
"source": "BaseExchange.ts:1205"
},
"filterMarkets": {
"summary": "Filter a list of markets by criteria.",
Expand All @@ -664,7 +681,7 @@
"type": "UnifiedMarket[]",
"description": "Filtered array of markets"
},
"source": "BaseExchange.ts:1210"
"source": "BaseExchange.ts:1221"
},
"filterEvents": {
"summary": "Filter a list of events by criteria.",
Expand All @@ -687,7 +704,7 @@
"type": "UnifiedEvent[]",
"description": "Filtered array of events"
},
"source": "BaseExchange.ts:1370"
"source": "BaseExchange.ts:1381"
},
"watchOrderBook": {
"summary": "Watch order book updates in real-time via WebSocket.",
Expand Down Expand Up @@ -716,7 +733,7 @@
"type": "OrderBook",
"description": "Promise that resolves with the current orderbook state"
},
"source": "BaseExchange.ts:1466"
"source": "BaseExchange.ts:1477"
},
"watchOrderBooks": {
"summary": "Watch multiple order books simultaneously via WebSocket.",
Expand Down Expand Up @@ -745,7 +762,7 @@
"type": "Record<string, OrderBook>",
"description": "Promise that resolves with order books keyed by ID"
},
"source": "BaseExchange.ts:1479"
"source": "BaseExchange.ts:1490"
},
"unwatchOrderBook": {
"summary": "Unsubscribe from a previously watched order book stream.",
Expand All @@ -762,7 +779,7 @@
"type": "void",
"description": "Result"
},
"source": "BaseExchange.ts:1507"
"source": "BaseExchange.ts:1518"
},
"watchTrades": {
"summary": "Watch trade executions in real-time via WebSocket.",
Expand Down Expand Up @@ -797,7 +814,7 @@
"type": "Trade[]",
"description": "Promise that resolves with recent trades"
},
"source": "BaseExchange.ts:1520"
"source": "BaseExchange.ts:1531"
},
"watchAddress": {
"summary": "Stream activity for a public wallet address",
Expand All @@ -820,7 +837,7 @@
"type": "SubscribedAddressSnapshot",
"description": "Promise that resolves with the latest SubscribedAddressSnapshot snapshot"
},
"source": "BaseExchange.ts:1534"
"source": "BaseExchange.ts:1545"
},
"unwatchAddress": {
"summary": "Stop watching a previously registered wallet address and release its resource updates.",
Expand All @@ -837,7 +854,7 @@
"type": "void",
"description": "Result"
},
"source": "BaseExchange.ts:1547"
"source": "BaseExchange.ts:1558"
},
"close": {
"summary": "Close all WebSocket connections and clean up resources.",
Expand All @@ -847,7 +864,7 @@
"type": "void",
"description": "Result"
},
"source": "BaseExchange.ts:1556"
"source": "BaseExchange.ts:1567"
},
"fetchMarketMatches": {
"summary": "Find the same or related market on other venues. Two modes:",
Expand All @@ -864,7 +881,7 @@
"type": "MatchResult[]",
"description": "Array of matched markets with relation and confidence"
},
"source": "BaseExchange.ts:1570"
"source": "BaseExchange.ts:1581"
},
"fetchMatches": {
"summary": "fetchMatches",
Expand All @@ -881,7 +898,7 @@
"type": "MatchResult[]",
"description": "Result"
},
"source": "BaseExchange.ts:1586"
"source": "BaseExchange.ts:1597"
},
"fetchEventMatches": {
"summary": "Find the same or related event on other venues. Two modes:",
Expand All @@ -898,7 +915,7 @@
"type": "EventMatchResult[]",
"description": "Array of matched events with market-level match details"
},
"source": "BaseExchange.ts:1594"
"source": "BaseExchange.ts:1605"
},
"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.",
Expand All @@ -915,7 +932,7 @@
"type": "PriceComparison[]",
"description": "Array of price comparisons across venues"
},
"source": "BaseExchange.ts:1610"
"source": "BaseExchange.ts:1621"
},
"fetchRelatedMarkets": {
"summary": "Find related markets across venues. Discovers subset/superset market relationships",
Expand All @@ -932,7 +949,7 @@
"type": "PriceComparison[]",
"description": "Array of subset/superset matches with live prices"
},
"source": "BaseExchange.ts:1620"
"source": "BaseExchange.ts:1631"
},
"fetchMatchedMarkets": {
"summary": "fetchMatchedMarkets",
Expand All @@ -949,7 +966,7 @@
"type": "MatchedMarketPair[]",
"description": "Result"
},
"source": "BaseExchange.ts:1631"
"source": "BaseExchange.ts:1642"
},
"fetchMatchedPrices": {
"summary": "fetchMatchedPrices",
Expand All @@ -966,7 +983,7 @@
"type": "MatchedPricePair[]",
"description": "Array of matched market pairs with prices from each venue"
},
"source": "BaseExchange.ts:1639"
"source": "BaseExchange.ts:1650"
},
"fetchHedges": {
"summary": "fetchHedges",
Expand All @@ -983,7 +1000,7 @@
"type": "PriceComparison[]",
"description": "Array of subset/superset matches with live prices"
},
"source": "BaseExchange.ts:1650"
"source": "BaseExchange.ts:1661"
},
"fetchArbitrage": {
"summary": "fetchArbitrage",
Expand All @@ -1000,7 +1017,7 @@
"type": "ArbitrageOpportunity[]",
"description": "Array of arbitrage opportunities sorted by spread"
},
"source": "BaseExchange.ts:1660"
"source": "BaseExchange.ts:1671"
},
"watchPrices": {
"summary": "Watch AMM price updates for a market address (Limitless only).",
Expand Down Expand Up @@ -1142,7 +1159,7 @@
"type": "FirehoseEvent",
"description": "Next event with source, symbol, and orderbook"
},
"source": "client.ts:1973"
"source": "client.ts:2057"
},
"firehose": {
"summary": "Stream all orderbook updates across venues.",
Expand All @@ -1159,7 +1176,7 @@
"type": "FirehoseEvent",
"description": "Next event with source, symbol, and orderbook"
},
"source": "client.ts:2014"
"source": "client.ts:2098"
}
},
"workflowExample": {
Expand Down
11 changes: 11 additions & 0 deletions core/src/BaseExchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,17 @@ export abstract class PredictionMarketExchange {
return events[0];
}

/**
* Fetch venue-native metadata for a specific event when the exchange
* exposes a dedicated metadata endpoint.
*
* Kalshi implements this for `GET /events/{event_ticker}/metadata`.
*/
async fetchEventMetadata(eventTicker: string): Promise<Record<string, unknown>> {
void eventTicker;
throw new Error("Method fetchEventMetadata not implemented.");
}

/**
* Fetch historical OHLCV (candlestick) price data for a specific market outcome.
*
Expand Down
10 changes: 10 additions & 0 deletions core/src/exchanges/kalshi/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,16 @@ export class KalshiFetcher implements IExchangeFetcher<KalshiRawEvent, KalshiRaw
}
}

async fetchRawEventMetadata(eventTicker: string): Promise<Record<string, unknown>> {
try {
return this.ctx.callApi('GetEventMetadata', {
event_ticker: eventTicker.toUpperCase(),
});
} catch (e: any) {
throw kalshiErrorMapper.mapError(e);
}
}

async fetchRawSeriesMap(): Promise<Map<string, KalshiSeriesInfo>> {
try {
const data = await this.ctx.callApi('GetSeriesList');
Expand Down
Loading
Loading