Documentation
¶
Index ¶
- Constants
- Variables
- func Register(server *mcp.Server, handler Handler)
- type AmendOrderInput
- type ArmLiveTradingInput
- type CancelOrderInput
- type Error
- type GetCandlesInput
- type GetLastInput
- type GetMarketInput
- type GetOrderbookInput
- type GetPortfolioInput
- type GetTradesInput
- type GetWeatherIndexInput
- type Handler
- type KernelStatusInput
- type PlaceOrderInput
- type Response
- type SearchMarketsInput
- type Source
Constants ¶
const ( ServerName = "kalshi-kernel" ServerVersion = "0.1.2" ServerDescription = "Safety-focused Kalshi event-contract and perpetuals trading kernel." )
Variables ¶
var SourcesByTool = map[string][]Source{
"kernel_status": {},
"search_markets": {
{Spec: "trade", OperationID: "GetMarkets", Channel: ""},
{Spec: "perps", OperationID: "GetMarginMarkets", Channel: ""},
},
"get_market": {
{Spec: "trade", OperationID: "GetMarket", Channel: ""},
{Spec: "perps", OperationID: "GetMarginMarket", Channel: ""},
},
"get_orderbook": {
{Spec: "trade", OperationID: "GetMarketOrderbook", Channel: ""},
{Spec: "perps", OperationID: "GetMarginMarketOrderbook", Channel: ""},
{Spec: "market_data_ws", OperationID: "", Channel: "orderbook_delta"},
{Spec: "perps_ws", OperationID: "", Channel: "orderbook_delta"},
},
"get_candles": {
{Spec: "trade", OperationID: "GetMarketCandlesticks", Channel: ""},
{Spec: "perps", OperationID: "GetMarginMarketCandlesticks", Channel: ""},
},
"get_trades": {
{Spec: "trade", OperationID: "GetTrades", Channel: ""},
},
"get_last": {
{Spec: "trade", OperationID: "GetMarket", Channel: ""},
{Spec: "perps", OperationID: "GetMarginMarket", Channel: ""},
},
"get_weather_index": {
{Spec: "trade", OperationID: "GetWeatherIndex", Channel: ""},
},
"arm_live_trading": {
{Spec: "trade", OperationID: "CreateOrderV2", Channel: ""},
},
"get_portfolio": {
{Spec: "trade", OperationID: "GetBalance", Channel: ""},
{Spec: "trade", OperationID: "GetPositions", Channel: ""},
{Spec: "trade", OperationID: "GetOrders", Channel: ""},
{Spec: "trade", OperationID: "GetFills", Channel: ""},
{Spec: "perps", OperationID: "GetMarginBalance", Channel: ""},
{Spec: "perps", OperationID: "GetMarginPositions", Channel: ""},
{Spec: "perps", OperationID: "GetMarginOrders", Channel: ""},
{Spec: "perps", OperationID: "GetMarginFills", Channel: ""},
},
"place_order": {
{Spec: "trade", OperationID: "CreateOrderV2", Channel: ""},
{Spec: "perps", OperationID: "CreateMarginOrder", Channel: ""},
},
"amend_order": {
{Spec: "trade", OperationID: "AmendOrderV2", Channel: ""},
{Spec: "perps", OperationID: "AmendMarginOrder", Channel: ""},
},
"cancel_order": {
{Spec: "trade", OperationID: "CancelOrderV2", Channel: ""},
{Spec: "perps", OperationID: "CancelMarginOrder", Channel: ""},
},
}
Functions ¶
Types ¶
type AmendOrderInput ¶
type AmendOrderInput struct {
Product string `json:"product" jsonschema:"Product family containing the order. Allowed values: event, perp."`
OrderID string `json:"order_id" jsonschema:"Exchange or paper order identifier."`
Ticker string `json:"ticker" jsonschema:"Exact market ticker used for routing and validation."`
Side string `json:"side" jsonschema:"Existing single-book order side required by the upstream amend operation. Allowed values: bid, ask."`
Price string `json:"price" jsonschema:"Desired fixed-point dollar price; pass the existing value when changing only quantity."`
Count string `json:"count" jsonschema:"Desired total maximum fillable quantity; pass the existing value when changing only price."`
ClientOrderID *string `json:"client_order_id,omitempty" jsonschema:"Existing client order identifier."`
UpdatedClientOrderID *string `json:"updated_client_order_id,omitempty" jsonschema:"New idempotency identifier for the amended order."`
Subaccount *int `json:"subaccount,omitempty" jsonschema:"Kalshi subaccount number; defaults to the primary account. Minimum: 0. Maximum: 63."`
}
AmendOrderInput is generated from specs/mcp-tools.yaml.
type ArmLiveTradingInput ¶ added in v0.1.2
type ArmLiveTradingInput struct {
Acknowledgement string `` /* 129-byte string literal not displayed */
Arm bool `json:"arm" jsonschema:"True to arm, false to disarm."`
}
ArmLiveTradingInput is generated from specs/mcp-tools.yaml.
type CancelOrderInput ¶
type CancelOrderInput struct {
Product string `json:"product" jsonschema:"Product family containing the order. Allowed values: event, perp."`
OrderID string `json:"order_id" jsonschema:"Exchange or paper order identifier."`
Ticker string `json:"ticker" jsonschema:"Exact market ticker used for routing and validation."`
Subaccount *int `json:"subaccount,omitempty" jsonschema:"Kalshi subaccount number; defaults to the primary account. Minimum: 0. Maximum: 63."`
}
CancelOrderInput is generated from specs/mcp-tools.yaml.
type GetCandlesInput ¶ added in v0.1.2
type GetCandlesInput struct {
Product string `json:"product" jsonschema:"Product family containing the ticker. Allowed values: event, perp."`
Ticker string `json:"ticker" jsonschema:"Exact Kalshi market ticker."`
SeriesTicker *string `json:"series_ticker,omitempty" jsonschema:"Parent series ticker (required when product is event)."`
StartTs int64 `json:"start_ts" jsonschema:"Start unix timestamp; candles ending on or after this time are included. Minimum: 1."`
EndTs int64 `json:"end_ts" jsonschema:"End unix timestamp; candles ending on or before this time are included. Minimum: 1."`
PeriodInterval int `json:"period_interval" jsonschema:"Candle period in minutes. Valid values 1, 60, or 1440. Minimum: 1. Maximum: 1440."`
IncludeLatestBeforeStart *bool `` /* 127-byte string literal not displayed */
}
GetCandlesInput is generated from specs/mcp-tools.yaml.
type GetLastInput ¶ added in v0.1.2
type GetLastInput struct {
Product string `json:"product" jsonschema:"Product family containing the ticker. Allowed values: event, perp."`
Ticker string `json:"ticker" jsonschema:"Exact Kalshi market ticker."`
}
GetLastInput is generated from specs/mcp-tools.yaml.
type GetMarketInput ¶
type GetMarketInput struct {
Product string `json:"product" jsonschema:"Product family containing the ticker. Allowed values: event, perp."`
Ticker string `json:"ticker" jsonschema:"Exact Kalshi market ticker."`
}
GetMarketInput is generated from specs/mcp-tools.yaml.
type GetOrderbookInput ¶
type GetOrderbookInput struct {
Product string `json:"product" jsonschema:"Product family containing the ticker. Allowed values: event, perp."`
Ticker string `json:"ticker" jsonschema:"Exact Kalshi market ticker."`
Depth *int `json:"depth,omitempty" jsonschema:"Maximum price levels to return on each side. Minimum: 1. Maximum: 100."`
}
GetOrderbookInput is generated from specs/mcp-tools.yaml.
type GetPortfolioInput ¶
type GetPortfolioInput struct {
Product string `json:"product" jsonschema:"Product family to report. Allowed values: event, perp."`
Subaccount *int `json:"subaccount,omitempty" jsonschema:"Kalshi subaccount number; defaults to the primary account. Minimum: 0. Maximum: 63."`
}
GetPortfolioInput is generated from specs/mcp-tools.yaml.
type GetTradesInput ¶ added in v0.1.2
type GetTradesInput struct {
Ticker string `json:"ticker" jsonschema:"Exact Kalshi market ticker to read the tape for."`
MinTs *int64 `json:"min_ts,omitempty" jsonschema:"Only include trades at or after this unix timestamp."`
MaxTs *int64 `json:"max_ts,omitempty" jsonschema:"Only include trades at or before this unix timestamp."`
Limit *int `` /* 130-byte string literal not displayed */
Cursor *string `json:"cursor,omitempty" jsonschema:"Pagination cursor returned by a previous call."`
}
GetTradesInput is generated from specs/mcp-tools.yaml.
type GetWeatherIndexInput ¶ added in v0.1.2
type GetWeatherIndexInput struct {
City string `json:"city" jsonschema:"Index city ID (for example miami or lax)."`
From *int64 `` /* 133-byte string literal not displayed */
To *int64 `json:"to,omitempty" jsonschema:"Window end, unix milliseconds, inclusive. Defaults to now."`
LastSec *int64 `` /* 140-byte string literal not displayed */
Detailed *bool `json:"detailed,omitempty" jsonschema:"Include per-station audit readings with quality-control disposition on every point."`
}
GetWeatherIndexInput is generated from specs/mcp-tools.yaml.
type Handler ¶
type Handler interface {
KernelStatus(context.Context, *mcp.CallToolRequest, KernelStatusInput) (*mcp.CallToolResult, Response, error)
SearchMarkets(context.Context, *mcp.CallToolRequest, SearchMarketsInput) (*mcp.CallToolResult, Response, error)
GetMarket(context.Context, *mcp.CallToolRequest, GetMarketInput) (*mcp.CallToolResult, Response, error)
GetOrderbook(context.Context, *mcp.CallToolRequest, GetOrderbookInput) (*mcp.CallToolResult, Response, error)
GetCandles(context.Context, *mcp.CallToolRequest, GetCandlesInput) (*mcp.CallToolResult, Response, error)
GetTrades(context.Context, *mcp.CallToolRequest, GetTradesInput) (*mcp.CallToolResult, Response, error)
GetLast(context.Context, *mcp.CallToolRequest, GetLastInput) (*mcp.CallToolResult, Response, error)
GetWeatherIndex(context.Context, *mcp.CallToolRequest, GetWeatherIndexInput) (*mcp.CallToolResult, Response, error)
ArmLiveTrading(context.Context, *mcp.CallToolRequest, ArmLiveTradingInput) (*mcp.CallToolResult, Response, error)
GetPortfolio(context.Context, *mcp.CallToolRequest, GetPortfolioInput) (*mcp.CallToolResult, Response, error)
PlaceOrder(context.Context, *mcp.CallToolRequest, PlaceOrderInput) (*mcp.CallToolResult, Response, error)
AmendOrder(context.Context, *mcp.CallToolRequest, AmendOrderInput) (*mcp.CallToolResult, Response, error)
CancelOrder(context.Context, *mcp.CallToolRequest, CancelOrderInput) (*mcp.CallToolResult, Response, error)
}
type KernelStatusInput ¶
type KernelStatusInput struct {
}
KernelStatusInput is generated from specs/mcp-tools.yaml.
type PlaceOrderInput ¶
type PlaceOrderInput struct {
Product string `json:"product" jsonschema:"Product family containing the market. Allowed values: event, perp."`
Ticker string `json:"ticker" jsonschema:"Exact Kalshi market ticker."`
ClientOrderID *string `` /* 131-byte string literal not displayed */
Side string `json:"side" jsonschema:"Single-book order side. Allowed values: bid, ask."`
Count string `json:"count" jsonschema:"Fixed-point contract quantity encoded as a decimal string."`
Price string `json:"price" jsonschema:"Fixed-point dollar price encoded as a decimal string."`
TimeInForce string `` /* 135-byte string literal not displayed */
ExpirationTime *int64 `json:"expiration_time,omitempty" jsonschema:"Optional Unix time in seconds; only valid with good_till_canceled."`
PostOnly *bool `json:"post_only,omitempty" jsonschema:"Reject rather than immediately take liquidity."`
ReduceOnly *bool `json:"reduce_only,omitempty" jsonschema:"Prevent the order from increasing exposure."`
CancelOrderOnPause *bool `json:"cancel_order_on_pause,omitempty" jsonschema:"Cancel the resting order if exchange trading pauses."`
SelfTradePreventionType string `json:"self_trade_prevention_type" jsonschema:"Exchange self-trade prevention policy. Allowed values: taker_at_cross, maker."`
Subaccount *int `json:"subaccount,omitempty" jsonschema:"Kalshi subaccount number; defaults to the primary account. Minimum: 0. Maximum: 63."`
}
PlaceOrderInput is generated from specs/mcp-tools.yaml.
type SearchMarketsInput ¶
type SearchMarketsInput struct {
Product string `json:"product" jsonschema:"Product family to search. Allowed values: event, perp."`
Tickers []string `json:"tickers,omitempty" jsonschema:"Exact market tickers to include."`
EventTicker *string `json:"event_ticker,omitempty" jsonschema:"Restrict event contracts to one event."`
SeriesTicker *string `json:"series_ticker,omitempty" jsonschema:"Restrict event contracts to one series."`
Status *string `json:"status,omitempty" jsonschema:"Exchange market status filter."`
Limit *int `json:"limit,omitempty" jsonschema:"Maximum number of markets to return. Minimum: 1. Maximum: 1000."`
Cursor *string `json:"cursor,omitempty" jsonschema:"Pagination cursor returned by a previous call."`
}
SearchMarketsInput is generated from specs/mcp-tools.yaml.