kalshi
kalshi prediction-market exchange — CCXT unified API: methods, parameters and endpoints.
kalshi
Kind: global class
Extends: Exchange
- fetchMarkets
- fetchTicker
- fetchStatus
- fetchOpenInterest
- fetchTickers
- fetchOrderBook
- fetchOHLCV
- fetchTrades
- fetchMyTrades
- fetchBalance
- fetchPositions
- fetchSettlements
- fetchOpenOrders
- fetchOrders
- fetchClosedOrders
- fetchOrder
- createOrder
- editOrder
- cancelOrder
- cancelAllOrders
- fetchEvents
- fetchEvent
fetchMarkets
fetches kalshi markets; with a query it resolves the query via the events endpoint and returns the matched events' markets, otherwise it pages the markets listing
Kind: instance method of kalshi
Returns: Array<object> - an array of objects representing market data
See: https://trading-api.readme.io/reference/getmarkets
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra parameters specific to the exchange API endpoint |
| params.query | string | No | a single search query; resolved against the events endpoint (event title/ticker), then the matched events' markets are returned |
| params.queries | Array<string> | No | multiple search queries (alternative to query); markets from any matching event are returned |
| params.limit | int | No | for an unscoped listing (no query), the max number of markets to collect (defaults to options.maxFetchMarketsLimit, 1000) |
kalshi.fetchMarkets (params?)fetchTicker
fetches the current market price and bid/ask for a single kalshi outcome
Kind: instance method of kalshi
Returns: object - a ticker structure
See: https://docs.kalshi.com/api-reference/market/get-market
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | Yes | the unified outcome like TRUMP_BRING_BACK_MANUFACTURING:YES or outcomeId like KXGDPSHAREMANU-29 |
| params | object | No | extra parameters specific to the exchange API endpoint |
kalshi.fetchTicker (outcome, params?)fetchStatus
fetches the kalshi exchange status
Kind: instance method of kalshi
Returns: object - a status structure
See: https://docs.kalshi.com/api-reference/exchange/get-exchange-status
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra parameters specific to the exchange API endpoint |
kalshi.fetchStatus (params?)fetchOpenInterest
fetches the open interest of a prediction market outcome
Kind: instance method of kalshi
Returns: object - an open interest structure
See: https://docs.kalshi.com/api-reference/market/get-market
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | Yes | unified outcome or outcome id |
| params | object | No | extra parameters specific to the exchange API endpoint |
kalshi.fetchOpenInterest (outcome, params?)fetchTickers
fetches tickers for multiple outcomes at once, batching their market tickers through the markets endpoint (100 per request)
Kind: instance method of kalshi
Returns: object - a dictionary of ticker structures indexed by outcome
See: https://docs.kalshi.com/api-reference/market/get-markets
| Param | Type | Required | Description |
|---|---|---|---|
| outcomes | Array<string> | Yes | unified outcomes — required: kalshi has tens of thousands of markets and no endpoint returning all tickers at once, so an unscoped call is not supported |
| params | object | No | extra parameters specific to the exchange API endpoint |
kalshi.fetchTickers (outcomes, params?)fetchOrderBook
fetches the order book for a single kalshi outcome
Kind: instance method of kalshi
Returns: object - an order book structure
See: https://docs.kalshi.com/api-reference/market/get-market-orderbook
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | Yes | unified outcome or outcome id |
| limit | int | No | the maximum number of bids/asks to return (not enforced by kalshis API, reserved for future client-side trimming) |
| params | object | No | extra parameters specific to the exchange API endpoint |
kalshi.fetchOrderBook (outcome, limit?, params?)fetchOHLCV
fetches OHLCV candlesticks for a single kalshi outcome from the candlesticks endpoint
Kind: instance method of kalshi
Returns: Array<Array<int>> - a list of candles ordered as timestamp, open, high, low, close, volume
See: https://docs.kalshi.com/api-reference/market/get-market-candlesticks
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | Yes | unified outcome |
| timeframe | string | Yes | the length of time each candle represents |
| since | int | No | timestamp in ms of the earliest candle to fetch |
| limit | int | No | the maximum number of candles to fetch |
| params | object | No | extra parameters specific to the exchange API endpoint |
kalshi.fetchOHLCV (outcome, timeframe, since?, limit?, params?)fetchTrades
fetches public trade history for a single kalshi market ticker
Kind: instance method of kalshi
Returns: Array<object> - a list of trade structures
See: https://docs.kalshi.com/api-reference/market/get-trades
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | Yes | unified outcome |
| since | int | No | timestamp in ms of the earliest trade to fetch |
| limit | int | No | the maximum number of trades to fetch |
| params | object | No | extra parameters specific to the exchange API endpoint |
kalshi.fetchTrades (outcome, since?, limit?, params?)fetchMyTrades
fetch the fills (executed trades) of the authenticated kalshi user
Kind: instance method of kalshi
Returns: Array<object> - a list of trade structures
See: https://trading-api.readme.io/reference/getfills
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | No | filter to a single unified outcome |
| since | int | No | the earliest fill timestamp (ms) to fetch |
| limit | int | No | the maximum number of fills to fetch |
| params | object | No | extra parameters specific to the exchange API endpoint |
kalshi.fetchMyTrades (outcome?, since?, limit?, params?)fetchBalance
fetches the authenticated user's USD portfolio balance from kalshi
Kind: instance method of kalshi
Returns: object - a balance structure
See: https://trading-api.readme.io/reference/getbalance
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra parameters specific to the exchange API endpoint |
kalshi.fetchBalance (params?)fetchPositions
fetches open market positions for the authenticated kalshi user
Kind: instance method of kalshi
Returns: Array<object> - a list of position structures
See: https://trading-api.readme.io/reference/getportfoliopositions
| Param | Type | Required | Description |
|---|---|---|---|
| outcomes | Array<string> | No | filter by outcome ids or outcomes |
| params | object | No | extra parameters specific to the exchange API endpoint |
kalshi.fetchPositions (outcomes?, params?)fetchSettlements
fetches the user's settled (resolved) positions, with the collateral paid out and realized pnl
Kind: instance method of kalshi
Returns: Array<object> - a list of prediction settlement structures
See: https://trading-api.readme.io/reference/getportfoliosettlements
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | No | filter to a single unified outcome |
| since | int | No | timestamp in ms of the earliest settlement to fetch |
| limit | int | No | the maximum number of settlements to fetch |
| params | object | No | extra parameters specific to the exchange API endpoint |
kalshi.fetchSettlements (outcome?, since?, limit?, params?)fetchOpenOrders
fetches resting (open) orders for the authenticated kalshi user, optionally filtered by ticker
Kind: instance method of kalshi
Returns: Array<object> - a list of order structures
See: https://trading-api.readme.io/reference/getorders
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | No | filter by unified outcome |
| since | int | No | timestamp in ms of the earliest order to fetch |
| limit | int | No | the maximum number of orders to fetch |
| params | object | No | extra parameters specific to the exchange API endpoint |
kalshi.fetchOpenOrders (outcome?, since?, limit?, params?)fetchOrders
fetches all orders (resting, executed and canceled) for the authenticated kalshi user
Kind: instance method of kalshi
Returns: Array<object> - a list of order structures
See: https://trading-api.readme.io/reference/getorders
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | No | filter by unified outcome |
| since | int | No | timestamp in ms of the earliest order to fetch |
| limit | int | No | the maximum number of orders to fetch |
| params | object | No | extra parameters specific to the exchange API endpoint |
kalshi.fetchOrders (outcome?, since?, limit?, params?)fetchClosedOrders
fetches the closed (executed or canceled) orders for the authenticated kalshi user
Kind: instance method of kalshi
Returns: Array<object> - a list of order structures
See: https://trading-api.readme.io/reference/getorders
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | No | filter by unified outcome |
| since | int | No | timestamp in ms of the earliest order to fetch |
| limit | int | No | the maximum number of orders to fetch |
| params | object | No | extra parameters specific to the exchange API endpoint |
kalshi.fetchClosedOrders (outcome?, since?, limit?, params?)fetchOrder
fetches a single order by id from the kalshi portfolio endpoint
Kind: instance method of kalshi
Returns: object - an order structure
See: https://trading-api.readme.io/reference/getorder
| Param | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | order id |
| outcome | string | No | unified outcome |
| params | object | No | extra parameters specific to the exchange API endpoint |
kalshi.fetchOrder (id, outcome?, params?)createOrder
places a limit or market order on kalshi for the given outcome token
Kind: instance method of kalshi
Returns: object - an order structure
See: https://trading-api.readme.io/reference/createorder
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | Yes | unified outcome |
| type | string | Yes | 'limit' or 'market' |
| side | string | Yes | 'buy' or 'sell' |
| amount | float | Yes | number of contracts |
| price | float | No | limit price in dollars (0–1 range) |
| params | object | No | extra parameters specific to the exchange API endpoint |
kalshi.createOrder (outcome, type, side, amount, price?, params?)editOrder
edits a resting order by cancelling it and placing a new one with the updated terms
Kind: instance method of kalshi
Returns: object - an order structure
See: https://trading-api.readme.io/reference/createorder
| Param | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | the id of the order to edit |
| outcome | string | Yes | unified outcome |
| type | string | Yes | 'limit' (kalshi has only limit orders) |
| side | string | Yes | 'buy' or 'sell' |
| amount | float | No | the new number of contracts |
| price | float | No | the new price (0..1) |
| params | object | No | extra parameters specific to the exchange API endpoint |
kalshi.editOrder (id, outcome, type, side, amount?, price?, params?)cancelOrder
cancels a single open order by id on kalshi
Kind: instance method of kalshi
Returns: object - an order structure
See: https://trading-api.readme.io/reference/cancelorder
| Param | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | order id |
| outcome | string | No | unified outcome |
| params | object | No | extra parameters specific to the exchange API endpoint |
kalshi.cancelOrder (id, outcome?, params?)cancelAllOrders
cancels all open orders on kalshi, optionally scoped to one outcome ticker
Kind: instance method of kalshi
Returns: Array<object> - a list of order structures
See: https://trading-api.readme.io/reference/cancelorders
| Param | Type | Required | Description |
|---|---|---|---|
| outcome | string | No | unified outcome to scope the cancellation to |
| params | object | No | extra parameters specific to the exchange API endpoint |
kalshi.cancelAllOrders (outcome?, params?)fetchEvents
fetches kalshi events scoped by a search query, tag, category or series ticker — always live from the API, never from the local cache (it POPULATES the cache for later event()/outcome lookups). the scope decides the endpoint: a free-text query hits kalshi's ranked search endpoint and the top limit matches are fetched canonically; tags/category resolve to series via the /series listing then fetch their events; series_ticker is used verbatim. limit bounds how many events are actually fetched (broad scopes stop early), and any other param is forwarded straight to the /events endpoint.
Kind: instance method of kalshi
Returns: Array<object> - an array of event structures
See: https://docs.kalshi.com/api-reference/events/get-events
| Param | Type | Required | Description |
|---|---|---|---|
| params | object | No | extra parameters specific to the exchange API endpoint (unrecognised keys are forwarded to GET /events) |
| params.query | string | No | free-text search resolved server-side via kalshi's series search endpoint |
| params.queries | Array<string> | No | multiple free-text searches (alternative to query, unioned) |
| params.series_ticker | string | No | one or more comma-separated kalshi series tickers (e.g. 'KXBTC') — used verbatim, no search |
| params.tags | Array<string> | No | kalshi series tags (e.g. ['BTC']) — resolved to series via the /series listing |
| params.category | string | No | a kalshi series category (e.g. 'Crypto') — resolved to series via the /series listing |
| params.status | string | No | 'active' |
| params.limit | int | No | max number of events to return |
kalshi.fetchEvents (params?)fetchEvent
fetches a single prediction-market event by its event ticker
Kind: instance method of kalshi
Returns: object - a prediction event structure
See: https://trading-api.readme.io/reference/getevent
| Param | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | the event ticker |
| params | object | No | extra parameters specific to the exchange API endpoint |
kalshi.fetchEvent (id, params?)