CCXT

kalshi

kalshi prediction-market exchange — CCXT unified API: methods, parameters and endpoints.

kalshi

Kind: global class
Extends: Exchange

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

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint
params.querystringNoa single search query; resolved against the events endpoint (event title/ticker), then the matched events' markets are returned
params.queriesArray<string>Nomultiple search queries (alternative to query); markets from any matching event are returned
params.limitintNofor 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

ParamTypeRequiredDescription
outcomestringYesthe unified outcome like TRUMP_BRING_BACK_MANUFACTURING:YES or outcomeId like KXGDPSHAREMANU-29
paramsobjectNoextra 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

ParamTypeRequiredDescription
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomestringYesunified outcome or outcome id
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomesArray<string>Yesunified outcomes — required: kalshi has tens of thousands of markets and no endpoint returning all tickers at once, so an unscoped call is not supported
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomestringYesunified outcome or outcome id
limitintNothe maximum number of bids/asks to return (not enforced by kalshis API, reserved for future client-side trimming)
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomestringYesunified outcome
timeframestringYesthe length of time each candle represents
sinceintNotimestamp in ms of the earliest candle to fetch
limitintNothe maximum number of candles to fetch
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomestringYesunified outcome
sinceintNotimestamp in ms of the earliest trade to fetch
limitintNothe maximum number of trades to fetch
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomestringNofilter to a single unified outcome
sinceintNothe earliest fill timestamp (ms) to fetch
limitintNothe maximum number of fills to fetch
paramsobjectNoextra 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

ParamTypeRequiredDescription
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomesArray<string>Nofilter by outcome ids or outcomes
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomestringNofilter to a single unified outcome
sinceintNotimestamp in ms of the earliest settlement to fetch
limitintNothe maximum number of settlements to fetch
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomestringNofilter by unified outcome
sinceintNotimestamp in ms of the earliest order to fetch
limitintNothe maximum number of orders to fetch
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomestringNofilter by unified outcome
sinceintNotimestamp in ms of the earliest order to fetch
limitintNothe maximum number of orders to fetch
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomestringNofilter by unified outcome
sinceintNotimestamp in ms of the earliest order to fetch
limitintNothe maximum number of orders to fetch
paramsobjectNoextra 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

ParamTypeRequiredDescription
idstringYesorder id
outcomestringNounified outcome
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomestringYesunified outcome
typestringYes'limit' or 'market'
sidestringYes'buy' or 'sell'
amountfloatYesnumber of contracts
pricefloatNolimit price in dollars (0–1 range)
paramsobjectNoextra 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

ParamTypeRequiredDescription
idstringYesthe id of the order to edit
outcomestringYesunified outcome
typestringYes'limit' (kalshi has only limit orders)
sidestringYes'buy' or 'sell'
amountfloatNothe new number of contracts
pricefloatNothe new price (0..1)
paramsobjectNoextra 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

ParamTypeRequiredDescription
idstringYesorder id
outcomestringNounified outcome
paramsobjectNoextra 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

ParamTypeRequiredDescription
outcomestringNounified outcome to scope the cancellation to
paramsobjectNoextra 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

ParamTypeRequiredDescription
paramsobjectNoextra parameters specific to the exchange API endpoint (unrecognised keys are forwarded to GET /events)
params.querystringNofree-text search resolved server-side via kalshi's series search endpoint
params.queriesArray<string>Nomultiple free-text searches (alternative to query, unioned)
params.series_tickerstringNoone or more comma-separated kalshi series tickers (e.g. 'KXBTC') — used verbatim, no search
params.tagsArray<string>Nokalshi series tags (e.g. ['BTC']) — resolved to series via the /series listing
params.categorystringNoa kalshi series category (e.g. 'Crypto') — resolved to series via the /series listing
params.statusstringNo'active'
params.limitintNomax 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

ParamTypeRequiredDescription
idstringYesthe event ticker
paramsobjectNoextra parameters specific to the exchange API endpoint
kalshi.fetchEvent (id, params?)

On this page