Skip to content

ammario/kalshi

Repository files navigation

kalshi

Go Reference Go workflow status codecov

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

Basic Usage

See the _test.go files for more examples.

func main() {
  client := New(kalshi.APIProdURL)
  ctx := context.Background()
  err := client.Login(
    ctx,
    "jill@live.com", "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)
  }
}

Endpoint Support

Markets

kalshi supports all Market endpoints.

Endpoint Support Status
GetSeries βœ…
GetEvent βœ…
GetMarkets βœ…
GetTrades βœ…
GetMarket βœ…
GetMarketHistory βœ…
GetMarketOrderbook βœ…
GetSeries βœ…

Exchange

kalshi supports all Exchange endpoints.

Endpoint Support Status
GetExchangeSchedule βœ…
GetExchangeStatus βœ…

Auth

kalshi supports all Auth endpoints.

Endpoint Support Status
Login βœ…
Logout βœ…

Portfolio

kalshi has mixed support for Portfolio endpoints.

Endpoint Support Status
GetBalance βœ…
GetFills βœ…
GetOrders βœ…
CreateOrder βœ…
GetOrder βœ…
CancelOrder βœ…
BatchCreateOrders ❌
BatchCancelOrders ❌
DecreaseOrder βœ…
GetPositions βœ…
GetPortolioSettlements βœ…

Market Data Feed

Market Data Feed is supported, although it hasn't been thoroughly tested. You may open a feed through (*Client).OpenFeed().

About

Go client for the Kalshi API

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages