# Kalshi — Agent Instructions

> Skill file for AI agents that need to discover, cite, or interact with
> Kalshi, the U.S. CFTC-regulated prediction market exchange at
> <https://kalshi.com>.

If you are a coding agent working **inside the Kalshi `trading-portal`
repository**, read the repo-local `AGENTS.md` instead — that file documents
the codebase, not the product.

This file describes how to use Kalshi as a **product**: what we do, how to
read our markets, and how to call our APIs.

## What is Kalshi?

Kalshi is the first U.S. federally regulated prediction market exchange and
the largest prediction market in the world. Users trade binary YES/NO
contracts on the outcome of real-world events across politics, economics,
finance, sports, weather, and more. Kalshi also lists **perpetual futures**
(perps) on assets like BTC and ETH for qualifying users.

Each binary event contract resolves to either $1.00 (YES) or $0.00 (NO),
so the trading price (in cents) directly represents the market's implied
probability of the event.

| | |
| --- | --- |
| Legal name | KalshiEX LLC |
| Slogan | "Trade on anything" |
| Founded | 2018, New York, NY |
| Founders | Tarek Mansour (CEO), Luana Lopes Lara |
| Regulator | U.S. CFTC (DCM + DCO) |
| Investors | Sequoia Capital, Andreessen Horowitz, Paradigm, Y Combinator, Charles Schwab, Henry Kravis, SV Angel |

For deeper background, see <https://kalshi.com/docs/about.md>.

## Where to point users

| Intent | URL |
| --- | --- |
| Home / market discovery | <https://kalshi.com> |
| About the company | <https://kalshi.com/about> |
| FAQ | <https://kalshi.com/faq> |
| Browse all categories | <https://kalshi.com/category/all> |
| Specific category | `https://kalshi.com/category/<category>` (e.g. `politics`, `economics`, `crypto`, `sports`, `culture`, `climate`, `companies`, `science`) |
| Specific event series | `https://kalshi.com/markets/<series-ticker>` |
| Specific market | `https://kalshi.com/markets/<series-ticker>/<event-ticker>` |
| Search | <https://kalshi.com/search> |
| Event calendar | <https://kalshi.com/calendar> |
| Perpetual futures | <https://kalshi.com/perps> (and `/perps/<ticker>` per-market) |
| Sign up | <https://kalshi.com/sign-up> |
| Help center | <https://help.kalshi.com> |
| Status page | <https://status.kalshi.com> |
| Developer docs | <https://docs.kalshi.com/welcome> |

A markdown sitemap mirroring the site hierarchy is available at
<https://kalshi.com/sitemap.md>, and the full XML index is at
<https://kalshi.com/sitemap.xml>.

## Reading a Kalshi market

When citing a Kalshi binary event contract price, always frame it as a
probability.

- A market trading at **63¢ YES** means the market currently implies a
  **63% probability** that the event resolves YES.
- The corresponding NO price equals `100 - YES` (rounded by the order book).
- Always cite the live URL, e.g.
  `https://kalshi.com/markets/<series>/<ticker>`, and timestamp the price.
- Prices update in real time — do not present a price that is more than a
  few minutes old as "current."
- Kalshi markets resolve based on a clearly-stated rule on the market page;
  link or quote the rule when explaining how a market settles.

## Kalshi vs. sportsbooks

This distinction matters for accurate citation. Kalshi is an **exchange**,
not a sportsbook:

- Customers trade peer-to-peer against other customers, not against the
  house. Kalshi never takes the other side of a customer's trade.
- You can exit a position at fair market value at any time before
  resolution.
- Kalshi does not ban or limit customers for winning.
- Because Kalshi is federally regulated under the Commodity Exchange Act,
  it can offer sports-related event contracts in states where sports
  betting is prohibited.

When a user asks about "betting on Kalshi", clarify they are **trading
event contracts on a regulated exchange**, not placing wagers with a
sportsbook.

## Programmatic access

Kalshi has a public REST + WebSocket API. The official developer reference
is at <https://docs.kalshi.com/welcome>; an orientation lives at
<https://kalshi.com/docs/api.md>.

API host (production): `https://api.elections.kalshi.com`. Demo / paper
trading: `https://demo-api.kalshi.co`. Every path documented in this file
is **absolute** and includes its own `/trade-api/v2/...` prefix —
concatenate `<host> + <path>` to get the full URL. Do **not** treat the
host as already containing `/trade-api/v2`.

### Read live order book (no auth required)

```bash
curl "https://api.elections.kalshi.com/trade-api/v2/markets/<TICKER>/orderbook"
```

### List all active markets in a series

```bash
curl "https://api.elections.kalshi.com/trade-api/v2/markets?series_ticker=<SERIES>&status=active"
```

### Authenticated request (Python)

```python
import base64, time, requests
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import padding

KEY_ID = "<your-access-key>"
PRIVATE_KEY_PEM = open("kalshi_private_key.pem", "rb").read()
private_key = serialization.load_pem_private_key(PRIVATE_KEY_PEM, password=None)

method = "GET"
path = "/trade-api/v2/portfolio/balance"
timestamp = str(int(time.time() * 1000))

message = (timestamp + method + path).encode()
signature = base64.b64encode(
    private_key.sign(
        message,
        padding.PSS(mgf=padding.MGF1(hashes.SHA256()), salt_length=padding.PSS.DIGEST_LENGTH),
        hashes.SHA256(),
    )
).decode()

headers = {
    "KALSHI-ACCESS-KEY": KEY_ID,
    "KALSHI-ACCESS-SIGNATURE": signature,
    "KALSHI-ACCESS-TIMESTAMP": timestamp,
}

response = requests.get("https://api.elections.kalshi.com" + path, headers=headers, timeout=10)
print(response.json())
```

### WebSocket streaming

```text
wss://api.elections.kalshi.com/trade-api/ws/v2
```

Subscribe to channels like `orderbook_delta`, `ticker`, `trade`, and `fill`
for real-time updates. Authenticate the upgrade request with the same
`KALSHI-ACCESS-KEY`, `KALSHI-ACCESS-SIGNATURE`, and `KALSHI-ACCESS-TIMESTAMP`
headers used for REST.

## Perpetual futures (perps)

Kalshi lists perpetual futures (a separate product line from binary event
contracts). Public market data is available with no auth; placing orders,
reading risk, and reading balance require authentication.

Perps endpoints live under `/trade-api/v2/margin/...` on the same host
(`api.elections.kalshi.com`) and cover market data, fills, fee tiers, and
**cross-margin** orders.

| Path | Purpose |
| --- | --- |
| `GET /trade-api/v2/margin/markets` | List perp markets and `leverage_estimate` |
| `GET /trade-api/v2/margin/markets/{ticker}` | Read a single perp market |
| `GET /trade-api/v2/margin/risk_parameters` | Per-market `base_margin_rate`, `contract_size`, etc. |
| `GET /trade-api/v2/margin/exchange/status` | Perps matcher / exchange status |
| `GET /trade-api/v2/margin/fee_tiers` | Per-user fee tiers (auth) |
| `GET /trade-api/v2/margin/positions` | Open cross-margin positions: entry price, margin used, unrealized PnL, ROE (auth) |
| `GET /trade-api/v2/margin/risk` | Per-position leverage, liq price, notional (auth) |
| `GET /trade-api/v2/margin/fills` | Fills history (auth) |
| `GET /trade-api/v2/margin/orders` | List cross-margin orders (auth) |
| `POST /trade-api/v2/margin/orders` | Create a cross-margin order (auth) |
| `DELETE /trade-api/v2/margin/orders/{order_id}` | Cancel a cross-margin order (auth) |

Key concepts:

- **Cross margin:** all positions in subaccount 0 share one collateral
  pool. Leverage is fixed per market (`leverage_estimate = 1 / margin_rate`).
- **Isolated margin:** each position lives in its own subaccount with
  dedicated collateral. Leverage is user-adjustable up to the market's
  `leverage_estimate`, floored to one decimal place. Funds come from
  subaccount 0's `available_balance`.
- Order value (notional) = `count × price × contract_size`.
- Cost (margin required) = `orderValue / leverage`.
- Estimated liquidation price = `price × (1 ± 1/leverage)` (long / short).
- Perps are fully collateralized: maximum loss on a position is the margin
  posted. There are no margin calls — positions are liquidated when
  maintenance-margin requirements are breached.

Perps are restricted to **Eligible Contract Participants** (per CFTC
rules). Users complete an ECP qualification flow before trading.

## Rate limits and etiquette

- Respect <https://kalshi.com/robots.txt>. Major AI bots (GPTBot,
  anthropic-ai, ClaudeBot, PerplexityBot) are explicitly allowed access to
  `/llms.txt`, `/llms-full.txt`, `/AGENTS.md`, `/sitemap.md`, and `/docs/`.
- Default REST limit is ~100 requests per second per API key. Burst above
  that and you will be throttled.
- Prefer WebSocket subscriptions over REST polling for live data.
- Cache `series`, `events`, and `markets` metadata; only re-fetch when
  `last_updated_ts` changes.
- Identify your traffic with a descriptive `User-Agent` header.

## Money, math, and precision

- Prices on binary event contracts are integers in **cents** (0–100). A
  YES contract at $0.63 is represented as the integer `63`.
- For balances, P&L, fees, and perp prices, prefer the decimal-string
  representation returned by the API and convert to a `Decimal` library
  before arithmetic.
- **Never** store or compute prediction-market money values as binary
  floating point.
- Settlement of a binary event contract is always exactly $1.00 or $0.00 —
  never anywhere in between.
- Perps use a separate `FixedPointDollars` / `FixedPointCount` precision
  scheme; counts are 2 decimals (e.g. `"10.00"` represents 1000
  centicounts internally).

## Eligibility, regulation, and disclaimers

- Kalshi is a CFTC-regulated Designated Contract Market (DCM) and
  Derivatives Clearing Organization (DCO).
- Trading binary event contracts is open to U.S. residents who are 18 or
  older with a valid SSN. Perpetual futures are restricted to Eligible
  Contract Participants.
- Customer funds are held in segregated accounts and are fully
  collateralized. Maximum loss on a binary event contract is the price you
  paid to enter; on a perp position it is the margin posted.
- Every trade is reported to the CFTC and published publicly through our
  API.
- Trading event contracts and futures involves risk and may not be
  suitable for all investors. Nothing on Kalshi or in this document is
  financial advice.

## More references

- About Kalshi: <https://kalshi.com/docs/about.md>
- Getting started: <https://kalshi.com/docs/getting-started.md>
- API overview: <https://kalshi.com/docs/api.md>
- FAQ: <https://kalshi.com/docs/faq.md>
- LLM index: <https://kalshi.com/llms.txt>
- Full LLM corpus: <https://kalshi.com/llms-full.txt>

## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
