Examples#
from stakepd import kalshi_data as kd
client = kd.KalshiClient.from_env() # portfolio data needs an API key
Open positions with their side:
pos = client.get_positions(count_filter="position")
pos["side"] = pos.position.gt(0).map({True: "YES", False: "NO"})
print(pos[["ticker", "side", "position", "market_exposure", "realized_pnl"]])