kalshi
Kalshi is a regulated prediction market exchange. Use this skill to interact with the Kalshi API for market data, trading, portfolio management, WebSocket streaming, and historical data retrieval.
What this skill does
# Kalshi API
[Kalshi](https://kalshi.com) is a CFTC-regulated prediction market exchange where users trade on the outcomes of real-world events.
Check this skill and the [official documentation](https://docs.kalshi.com) _FREQUENTLY_. The canonical machine-readable index of all docs lives at:
> **<https://docs.kalshi.com/llms.txt>**
Always consult `llms.txt` to discover every available page before building. It is the single source of truth for endpoint references, SDK docs, WebSocket channels, FIX protocol details, and getting-started guides.
---
## Key Concepts (Glossary)
| Term | Definition |
|---|---|
| **Market** | A single binary outcome contract (Yes / No) with prices in cents (1–99¢). |
| **Event** | A collection of related markets representing a real-world occurrence (e.g., an election, a weather reading). |
| **Series** | A template for recurring events that share the same structure and rules (e.g., "Daily Highest Temp in NYC"). |
| **Orderbook** | Bids only — in binary markets a YES bid at X¢ is equivalent to a NO ask at (100−X)¢. |
| **Fill** | A matched trade on one of your orders. |
| **Settlement** | The final resolution of a market (Yes or No) after determination. |
| **Multivariate Event** | A combo event created dynamically from a multivariate event collection. |
Full glossary: <https://docs.kalshi.com/getting_started/terms.md>
---
## Base URLs
| Environment | REST API | WebSocket |
|---|---|---|
| **Production** | `https://api.elections.kalshi.com/trade-api/v2` | `wss://api.elections.kalshi.com/trade-api/ws/v2` |
| **Demo** | `https://demo-api.kalshi.co/trade-api/v2` | `wss://demo-api.kalshi.co/trade-api/ws/v2` |
> **Note:** Despite the `elections` subdomain, the production URL serves ALL Kalshi markets — economics, weather, tech, entertainment, etc.
Demo environment info: <https://docs.kalshi.com/getting_started/demo_env.md>
---
## Documentation & References
All detailed examples, request/response schemas, and walkthroughs live in the official docs. Always consult these before building:
| Resource | URL |
|---|---|
| **Full documentation index (llms.txt)** | <https://docs.kalshi.com/llms.txt> |
| Introduction | <https://docs.kalshi.com/welcome/index.md> |
| Making your first request | <https://docs.kalshi.com/getting_started/making_your_first_request.md> |
| Quick Start: Market Data | <https://docs.kalshi.com/getting_started/quick_start_market_data.md> |
| Quick Start: Authenticated Requests | <https://docs.kalshi.com/getting_started/quick_start_authenticated_requests.md> |
| Quick Start: Create Your First Order | <https://docs.kalshi.com/getting_started/quick_start_create_order.md> |
| Quick Start: WebSockets | <https://docs.kalshi.com/getting_started/quick_start_websockets.md> |
| API Keys guide | <https://docs.kalshi.com/getting_started/api_keys.md> |
| Rate Limits & Tiers | <https://docs.kalshi.com/getting_started/rate_limits.md> |
| Pagination | <https://docs.kalshi.com/getting_started/pagination.md> |
| Orderbook Responses | <https://docs.kalshi.com/getting_started/orderbook_responses.md> |
| Historical Data | <https://docs.kalshi.com/getting_started/historical_data.md> |
| Subpenny Pricing | <https://docs.kalshi.com/getting_started/subpenny_pricing.md> |
| Fixed-Point Contracts | <https://docs.kalshi.com/getting_started/fixed_point_contracts.md> |
| OpenAPI Spec (YAML) | <https://docs.kalshi.com/openapi.yaml> |
| API Changelog | <https://docs.kalshi.com/changelog/index.md> |
| Kalshi Platform | <https://kalshi.com> |
| Demo Platform | <https://demo.kalshi.co> |
---
## Authentication
Kalshi uses **RSA-PSS signed requests** (not Bearer tokens). Every authenticated request requires three headers:
| Header | Value |
|---|---|
| `KALSHI-ACCESS-KEY` | Your API Key ID |
| `KALSHI-ACCESS-TIMESTAMP` | Current Unix timestamp in **milliseconds** |
| `KALSHI-ACCESS-SIGNATURE` | Base64-encoded RSA-PSS signature of `{timestamp}{METHOD}{path}` |
**Important:** When signing, use the path **without** query parameters. For example, sign `/trade-api/v2/portfolio/orders` even if the request URL is `/trade-api/v2/portfolio/orders?limit=5`.
### Generating API Keys
1. Log in → Account Settings → API Keys section.
2. Click "Create New API Key" to generate an RSA key pair.
3. **Store the private key immediately** — it cannot be retrieved again.
Full guide: <https://docs.kalshi.com/getting_started/api_keys.md>
### Python Signing Example
```python
import base64, datetime, requests
from cryptography.hazmat.primitives import serialization, hashes
from cryptography.hazmat.primitives.asymmetric import padding
def load_private_key(file_path):
with open(file_path, "rb") as f:
return serialization.load_pem_private_key(f.read(), password=None)
def sign_pss(private_key, text: str) -> str:
sig = private_key.sign(
text.encode("utf-8"),
padding.PSS(mgf=padding.MGF1(hashes.SHA256()), salt_length=padding.PSS.DIGEST_LENGTH),
hashes.SHA256(),
)
return base64.b64encode(sig).decode("utf-8")
def kalshi_headers(key_id, private_key, method, path):
ts = str(int(datetime.datetime.now().timestamp() * 1000))
path_no_qs = path.split("?")[0]
sig = sign_pss(private_key, ts + method + path_no_qs)
return {
"KALSHI-ACCESS-KEY": key_id,
"KALSHI-ACCESS-SIGNATURE": sig,
"KALSHI-ACCESS-TIMESTAMP": ts,
}
```
### JavaScript Signing Example
```javascript
const crypto = require("crypto");
const fs = require("fs");
function signPss(privateKeyPem, text) {
const sign = crypto.createSign("RSA-SHA256");
sign.update(text);
sign.end();
return sign.sign({
key: privateKeyPem,
padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
saltLength: crypto.constants.RSA_PSS_SALTLEN_DIGEST,
}).toString("base64");
}
function kalshiHeaders(keyId, privateKeyPem, method, path) {
const ts = Date.now().toString();
const pathNoQs = path.split("?")[0];
const sig = signPss(privateKeyPem, ts + method + pathNoQs);
return {
"KALSHI-ACCESS-KEY": keyId,
"KALSHI-ACCESS-SIGNATURE": sig,
"KALSHI-ACCESS-TIMESTAMP": ts,
};
}
```
---
## SDKs
Kalshi provides official SDKs. Prefer these for production integrations:
| SDK | Install | Docs |
|---|---|---|
| Python (sync) | `pip install kalshi_python_sync` | <https://docs.kalshi.com/sdks/python/quickstart.md> |
| Python (async) | `pip install kalshi_python_async` | <https://docs.kalshi.com/sdks/python/quickstart.md> |
| TypeScript | `npm install kalshi-typescript` | <https://docs.kalshi.com/sdks/typescript/quickstart.md> |
> The old `kalshi-python` package is **deprecated**. Migrate to `kalshi_python_sync` or `kalshi_python_async`.
SDK overview: <https://docs.kalshi.com/sdks/overview.md>
For production applications, consider generating your own client from the [OpenAPI spec](https://docs.kalshi.com/openapi.yaml).
---
## Rate Limits
| Tier | Read | Write |
|---|---|---|
| Basic | 20/s | 10/s |
| Advanced | 30/s | 30/s |
| Premier | 100/s | 100/s |
| Prime | 400/s | 400/s |
Write-limited endpoints: `CreateOrder`, `CancelOrder`, `AmendOrder`, `DecreaseOrder`, `BatchCreateOrders`, `BatchCancelOrders`. In batch APIs each item counts as 1 transaction (except `BatchCancelOrders` where each cancel = 0.2 transactions).
Full details: <https://docs.kalshi.com/getting_started/rate_limits.md>
---
## Pagination
The API uses **cursor-based pagination**. Responses include a `cursor` field; pass it as `?cursor={value}` on the next request. An empty/null cursor means no more pages. Default page size is 100 (max typically 1000).
Full guide: <https://docs.kalshi.com/getting_started/pagination.md>
---
## REST API Endpoints Overview
Below is a summary organized by domain. For full request/response schemas, see the linked docs or browse <https://docs.kalshi.com/llms.txt>.
### Markets
| Endpoint | Method | Auth | Description |
|---|---|---|---|
| `/markets` | GET | No | List markets with filters (status, series, timestampRelated in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.