All URIs are relative to https://api.elections.kalshi.com/trade-api/v2
MethodHTTP requestDescription
get_marketGET /markets/Get Market
get_market_candlesticksGET /series//markets//candlesticksGet Market Candlesticks
get_market_orderbookGET /markets//orderbookGet Market Orderbook
get_marketsGET /marketsGet Markets
get_tradesGET /markets/tradesGet Trades

get_market

GetMarketResponse get_market(ticker)
Get Market Get a single market by its ticker. A market represents a specific binary outcome within an event that users can trade on (e.g., “Will candidate X win?”). Markets have yes/no positions, current prices, volume, and settlement rules.

Example

import kalshi_python
from kalshi_python.models.get_market_response import GetMarketResponse
from kalshi_python.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
    host = "https://api.elections.kalshi.com/trade-api/v2"
)

# Read private key from file
with open('path/to/private_key.pem', 'r') as f:
    private_key = f.read()

# Configure API key authentication
configuration.api_key_id = "your-api-key-id"
configuration.private_key_pem = private_key

# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)

ticker = 'ticker_example' # str | Market ticker

try:
    # Get Market
    api_response = client.get_market(ticker)
    print("The response of MarketsApi->get_market:\n")
    pprint(api_response)
except Exception as e:
    print("Exception when calling MarketsApi->get_market: %s\n" % e)

Parameters

NameTypeDescriptionNotes
tickerstrMarket ticker

Return type

GetMarketResponse

HTTP response details

Status codeDescription
200Market retrieved successfully
401Unauthorized - authentication required
404Resource not found
500Internal server error
[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_market_candlesticks

GetMarketCandlesticksResponse get_market_candlesticks(ticker, market_ticker, start_ts=start_ts, end_ts=end_ts, period_interval=period_interval)
Get Market Candlesticks Get candlestick data for a market within a series

Example

import kalshi_python
from kalshi_python.models.get_market_candlesticks_response import GetMarketCandlesticksResponse
from kalshi_python.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
    host = "https://api.elections.kalshi.com/trade-api/v2"
)

# Read private key from file
with open('path/to/private_key.pem', 'r') as f:
    private_key = f.read()

# Configure API key authentication
configuration.api_key_id = "your-api-key-id"
configuration.private_key_pem = private_key

# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)

ticker = 'ticker_example' # str | The series ticker

market_ticker = 'market_ticker_example' # str | The market ticker

start_ts = 56 # int | Start timestamp for the range (optional)

end_ts = 56 # int | End timestamp for the range (optional)

period_interval = 'period_interval_example' # str | Period interval for candlesticks (e.g., 1m, 5m, 1h, 1d) (optional)

try:
    # Get Market Candlesticks
    api_response = client.get_market_candlesticks(ticker, market_ticker, start_ts=start_ts, end_ts=end_ts, period_interval=period_interval)
    print("The response of MarketsApi->get_market_candlesticks:\n")
    pprint(api_response)
except Exception as e:
    print("Exception when calling MarketsApi->get_market_candlesticks: %s\n" % e)

Parameters

NameTypeDescriptionNotes
tickerstrThe series ticker
market_tickerstrThe market ticker
start_tsintStart timestamp for the range[optional]
end_tsintEnd timestamp for the range[optional]
period_intervalstrPeriod interval for candlesticks (e.g., 1m, 5m, 1h, 1d)[optional]

Return type

GetMarketCandlesticksResponse

HTTP response details

Status codeDescription
200Candlesticks retrieved successfully
400Bad request - invalid input
401Unauthorized - authentication required
404Resource not found
500Internal server error
[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_market_orderbook

GetMarketOrderbookResponse get_market_orderbook(ticker, depth=depth)
Get Market Orderbook Get the orderbook for a market

Example

import kalshi_python
from kalshi_python.models.get_market_orderbook_response import GetMarketOrderbookResponse
from kalshi_python.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
    host = "https://api.elections.kalshi.com/trade-api/v2"
)

# Read private key from file
with open('path/to/private_key.pem', 'r') as f:
    private_key = f.read()

# Configure API key authentication
configuration.api_key_id = "your-api-key-id"
configuration.private_key_pem = private_key

# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)

ticker = 'ticker_example' # str | Market ticker

depth = 10 # int | Depth of the orderbook to retrieve (optional) (default to 10)

try:
    # Get Market Orderbook
    api_response = client.get_market_orderbook(ticker, depth=depth)
    print("The response of MarketsApi->get_market_orderbook:\n")
    pprint(api_response)
except Exception as e:
    print("Exception when calling MarketsApi->get_market_orderbook: %s\n" % e)

Parameters

NameTypeDescriptionNotes
tickerstrMarket ticker
depthintDepth of the orderbook to retrieve[optional] [default to 10]

Return type

GetMarketOrderbookResponse

HTTP response details

Status codeDescription
200Orderbook retrieved successfully
401Unauthorized - authentication required
404Resource not found
500Internal server error
[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_markets

GetMarketsResponse get_markets(limit=limit, cursor=cursor, event_ticker=event_ticker, series_ticker=series_ticker, max_close_ts=max_close_ts, min_close_ts=min_close_ts, status=status, tickers=tickers)
Get Markets List and discover markets on Kalshi. A market represents a specific binary outcome within an event that users can trade on (e.g., “Will candidate X win?”). Markets have yes/no positions, current prices, volume, and settlement rules. This endpoint returns a paginated response. Use the ‘limit’ parameter to control page size (1-1000, defaults to 100). The response includes a ‘cursor’ field - pass this value in the ‘cursor’ parameter of your next request to get the next page. An empty cursor indicates no more pages are available.

Example

import kalshi_python
from kalshi_python.models.get_markets_response import GetMarketsResponse
from kalshi_python.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
    host = "https://api.elections.kalshi.com/trade-api/v2"
)

# Read private key from file
with open('path/to/private_key.pem', 'r') as f:
    private_key = f.read()

# Configure API key authentication
configuration.api_key_id = "your-api-key-id"
configuration.private_key_pem = private_key

# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)

limit = 100 # int | Number of results per page. Defaults to 100. Maximum value is 1000. (optional) (default to 100)

cursor = 'cursor_example' # str | Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page. (optional)

event_ticker = 'event_ticker_example' # str | Filter by event ticker (optional)

series_ticker = 'series_ticker_example' # str | Filter by series ticker (optional)

max_close_ts = 56 # int | Filter items that close before this Unix timestamp (optional)

min_close_ts = 56 # int | Filter items that close after this Unix timestamp (optional)

status = 'status_example' # str | Filter by market status. Comma-separated list. Possible values are 'initialized', 'open', 'closed', 'settled', 'determined'. Note that the API accepts 'open' for filtering but returns 'active' in the response. Leave empty to return markets with any status. (optional)

tickers = 'tickers_example' # str | Filter by specific market tickers. Comma-separated list of market tickers to retrieve. (optional)

try:
    # Get Markets
    api_response = client.get_markets(limit=limit, cursor=cursor, event_ticker=event_ticker, series_ticker=series_ticker, max_close_ts=max_close_ts, min_close_ts=min_close_ts, status=status, tickers=tickers)
    print("The response of MarketsApi->get_markets:\n")
    pprint(api_response)
except Exception as e:
    print("Exception when calling MarketsApi->get_markets: %s\n" % e)

Parameters

NameTypeDescriptionNotes
limitintNumber of results per page. Defaults to 100. Maximum value is 1000.[optional] [default to 100]
cursorstrPagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page.[optional]
event_tickerstrFilter by event ticker[optional]
series_tickerstrFilter by series ticker[optional]
max_close_tsintFilter items that close before this Unix timestamp[optional]
min_close_tsintFilter items that close after this Unix timestamp[optional]
statusstrFilter by market status. Comma-separated list. Possible values are ‘initialized’, ‘open’, ‘closed’, ‘settled’, ‘determined’. Note that the API accepts ‘open’ for filtering but returns ‘active’ in the response. Leave empty to return markets with any status.[optional]
tickersstrFilter by specific market tickers. Comma-separated list of market tickers to retrieve.[optional]

Return type

GetMarketsResponse

HTTP response details

Status codeDescription
200Markets retrieved successfully
400Bad request - invalid input
401Unauthorized - authentication required
500Internal server error
[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_trades

GetTradesResponse get_trades(limit=limit, cursor=cursor, ticker=ticker, min_ts=min_ts, max_ts=max_ts)
Get Trades Get all trades for all markets. A trade represents a completed transaction between two users on a specific market. Each trade includes the market ticker, price, quantity, and timestamp information. This endpoint returns a paginated response. Use the ‘limit’ parameter to control page size (1-1000, defaults to 100). The response includes a ‘cursor’ field - pass this value in the ‘cursor’ parameter of your next request to get the next page. An empty cursor indicates no more pages are available.

Example

import kalshi_python
from kalshi_python.models.get_trades_response import GetTradesResponse
from kalshi_python.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.elections.kalshi.com/trade-api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = kalshi_python.Configuration(
    host = "https://api.elections.kalshi.com/trade-api/v2"
)


# Initialize the Kalshi client
client = kalshi_python.KalshiClient(configuration)

limit = 100 # int | Number of results per page. Defaults to 100. Maximum value is 1000. (optional) (default to 100)

cursor = 'cursor_example' # str | Pagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page. (optional)

ticker = 'ticker_example' # str | Filter by market ticker (optional)

min_ts = 56 # int | Filter items after this Unix timestamp (optional)

max_ts = 56 # int | Filter items before this Unix timestamp (optional)

try:
    # Get Trades
    api_response = client.get_trades(limit=limit, cursor=cursor, ticker=ticker, min_ts=min_ts, max_ts=max_ts)
    print("The response of MarketsApi->get_trades:\n")
    pprint(api_response)
except Exception as e:
    print("Exception when calling MarketsApi->get_trades: %s\n" % e)

Parameters

NameTypeDescriptionNotes
limitintNumber of results per page. Defaults to 100. Maximum value is 1000.[optional] [default to 100]
cursorstrPagination cursor. Use the cursor value returned from the previous response to get the next page of results. Leave empty for the first page.[optional]
tickerstrFilter by market ticker[optional]
min_tsintFilter items after this Unix timestamp[optional]
max_tsintFilter items before this Unix timestamp[optional]

Return type

GetTradesResponse

HTTP response details

Status codeDescription
200Trades retrieved successfully
400Bad request - invalid input
500Internal server error
[Back to top] [Back to API list] [Back to Model list] [Back to README]