Skip to content

humz2k/kalshi-python-unofficial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kalshi-python-unofficial

A lightweight Python wrapper for the Kalshi trading API. Fairly untested at the moment.

Installing

Install with pip: python3 -m pip install kalshi-python-unofficial

Usage

Setting API Credentials

import kalshi.auth
kalshi.auth.set_key("PUBLIC_KEY","path/to/private_key.pem")

REST Endpoints

Full coverage as of Jan 18th 2025 except for collections and advanced endpoints.

from kalshi.rest import portfolio, exchange
print(portfolio.GetBalance())
print(exchange.GetExchangeStatus())

Websocket Client

import kalshi.websocket
class MyClient(kalshi.websocket.Client):
    async def on_open(self):
        await self.subscribe(["orderbook_delta"], ["KXBTCD-25JAN1821-T104249.99"])

    async def on_message(self, message):
        print("Received message:", message)

ws_client = MyClient()
asyncio.run(ws_client.connect())

About

Unofficial lightweight Python wrapper for the Kalshi trading API.

Topics

Resources

License

Stars

Watchers

Forks

Languages