↓ Skip to main content
All methods

stakepd.kalshi_data.KalshiAuth

Class
Signature
kd.KalshiAuth(api_key_id, private_key)

A requests authentication handler that adds Kalshi’s signature headers.

Use it to call Kalshi endpoints the wrapper doesn’t cover, with plain requests. The API base URLs are in kd.BASE_URLS ({"prod": ..., "demo": ...}).

Parameters

api_key_id:str
Your Kalshi API key ID.
private_key:private key
A loaded key, e.g. from load_private_key.

Returns

KalshiAuth
Pass it as auth= to any requests call.

See also

load_private_key
Load an RSA or Ed25519 PEM private key.
KalshiClient
The high-level client, which signs requests for you.

Examples
#

Example:

import requests
from stakepd import kalshi_data as kd

auth = kd.KalshiAuth("a1b2c3d4-...", kd.load_private_key(private_key_path="~/.kalshi/key.pem"))
r = requests.get(kd.BASE_URLS["prod"] + "/portfolio/balance", auth=auth)

This method is also covered, alongside the rest of the module, in the overview guide.