Package kalshi provides a Go implementation of the Kalshi API.
go get github.com/ammario/kalshi
Supports:
- Streaming market data feed
- All core API endpoints
- Rate-limits
- Cursor-based pagination
See the _test.go files for more examples.
func main() {
client := New(kalshi.APIProdURL)
ctx := context.Background()
err := client.Login(
ctx,
"[email protected]", "hunter12",
)
if err != nil {
panic(err)
}
defer client.Logout(ctx)
// Get all S&P 500 markets.
markets, err := client.Markets(ctx, kalshi.MarketsRequest{
SeriesTicker: "INX"
})
if err != nil {
panic(err)
}
for _, market := range markets {
fmt.Println("found market", market)
}
}kalshi supports all Market endpoints.
| Endpoint | Support Status |
|---|---|
| GetSeries | ✅ |
| GetEvent | ✅ |
| GetMarkets | ✅ |
| GetTrades | ✅ |
| GetMarket | ✅ |
| GetMarketHistory | ✅ |
| GetMarketOrderbook | ✅ |
| GetSeries | ✅ |
kalshi supports all Exchange endpoints.
| Endpoint | Support Status |
|---|---|
| GetExchangeSchedule | ✅ |
| GetExchangeStatus | ✅ |
kalshi supports all Auth endpoints.
| Endpoint | Support Status |
|---|---|
| Login | ✅ |
| Logout | ✅ |
kalshi has mixed support for Portfolio endpoints.
| Endpoint | Support Status |
|---|---|
| GetBalance | ✅ |
| GetFills | ✅ |
| GetOrders | ✅ |
| CreateOrder | ✅ |
| GetOrder | ✅ |
| CancelOrder | ✅ |
| BatchCreateOrders | ❌ |
| BatchCancelOrders | ❌ |
| DecreaseOrder | ✅ |
| GetPositions | ✅ |
| GetPortolioSettlements | ✅ |
Market Data Feed is supported, although it hasn't been thoroughly tested. You may open a feed through (*Client).OpenFeed().