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)
kd.KalshiAuth(api_key_id, private_key)A requests authentication handler that adds Kalshi’s signature headers.
requests. The API base URLs are in kd.BASE_URLS ({"prod": ..., "demo": ...}).api_key_id:strprivate_key:private keyload_private_key.auth= to any requests call.load_private_keyKalshiClientExample:
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.