d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
206 lines
5.8 KiB
TypeScript
206 lines
5.8 KiB
TypeScript
import type { KalshiSeries } from '@/tools/kalshi/types'
|
|
import { buildKalshiUrl, handleKalshiError } from '@/tools/kalshi/types'
|
|
import type { ToolConfig } from '@/tools/types'
|
|
|
|
export interface KalshiGetSeriesByTickerParams {
|
|
seriesTicker: string
|
|
}
|
|
|
|
export interface KalshiGetSeriesByTickerResponse {
|
|
success: boolean
|
|
output: {
|
|
series: KalshiSeries
|
|
}
|
|
}
|
|
|
|
export const kalshiGetSeriesByTickerTool: ToolConfig<
|
|
KalshiGetSeriesByTickerParams,
|
|
KalshiGetSeriesByTickerResponse
|
|
> = {
|
|
id: 'kalshi_get_series_by_ticker',
|
|
name: 'Get Series by Ticker from Kalshi',
|
|
description: 'Retrieve details of a specific market series by ticker',
|
|
version: '1.0.0',
|
|
|
|
params: {
|
|
seriesTicker: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'Series ticker identifier (e.g., "KXBTC", "INX", "FED-RATE")',
|
|
},
|
|
},
|
|
|
|
request: {
|
|
url: (params) => {
|
|
return buildKalshiUrl(`/series/${params.seriesTicker.trim()}`)
|
|
},
|
|
method: 'GET',
|
|
headers: () => ({
|
|
'Content-Type': 'application/json',
|
|
}),
|
|
},
|
|
|
|
transformResponse: async (response: Response) => {
|
|
const data = await response.json()
|
|
|
|
if (!response.ok) {
|
|
handleKalshiError(data, response.status, 'get_series_by_ticker')
|
|
}
|
|
|
|
const series = data.series || data
|
|
|
|
return {
|
|
success: true,
|
|
output: {
|
|
series,
|
|
},
|
|
}
|
|
},
|
|
|
|
outputs: {
|
|
series: {
|
|
type: 'object',
|
|
description: 'Series object with details',
|
|
},
|
|
},
|
|
}
|
|
|
|
/**
|
|
* V2 Params for Get Series by Ticker
|
|
*/
|
|
export interface KalshiGetSeriesByTickerV2Params {
|
|
seriesTicker: string
|
|
includeVolume?: string
|
|
}
|
|
|
|
/**
|
|
* V2 Response matching Kalshi API exactly
|
|
*/
|
|
export interface KalshiGetSeriesByTickerV2Response {
|
|
success: boolean
|
|
output: {
|
|
series: {
|
|
ticker: string
|
|
title: string
|
|
frequency: string
|
|
category: string
|
|
tags: string[] | null
|
|
settlement_sources: Array<{
|
|
name: string
|
|
url: string
|
|
}> | null
|
|
contract_url: string | null
|
|
contract_terms_url: string | null
|
|
fee_type: string | null
|
|
fee_multiplier: number | null
|
|
additional_prohibitions: string[] | null
|
|
product_metadata: Record<string, unknown> | null
|
|
volume: number | null
|
|
volume_fp: number | null
|
|
}
|
|
}
|
|
}
|
|
|
|
export const kalshiGetSeriesByTickerV2Tool: ToolConfig<
|
|
KalshiGetSeriesByTickerV2Params,
|
|
KalshiGetSeriesByTickerV2Response
|
|
> = {
|
|
id: 'kalshi_get_series_by_ticker_v2',
|
|
name: 'Get Series by Ticker from Kalshi V2',
|
|
description: 'Retrieve details of a specific market series by ticker (V2 - exact API response)',
|
|
version: '2.0.0',
|
|
|
|
params: {
|
|
seriesTicker: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'Series ticker identifier (e.g., "KXBTC", "INX", "FED-RATE")',
|
|
},
|
|
includeVolume: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Include volume data in response (true/false)',
|
|
},
|
|
},
|
|
|
|
request: {
|
|
url: (params) => {
|
|
const queryParams = new URLSearchParams()
|
|
if (params.includeVolume) queryParams.append('include_volume', params.includeVolume)
|
|
|
|
const query = queryParams.toString()
|
|
const url = buildKalshiUrl(`/series/${params.seriesTicker.trim()}`)
|
|
return query ? `${url}?${query}` : url
|
|
},
|
|
method: 'GET',
|
|
headers: () => ({
|
|
'Content-Type': 'application/json',
|
|
}),
|
|
},
|
|
|
|
transformResponse: async (response: Response) => {
|
|
const data = await response.json()
|
|
|
|
if (!response.ok) {
|
|
handleKalshiError(data, response.status, 'get_series_by_ticker_v2')
|
|
}
|
|
|
|
const series = data.series || data
|
|
|
|
const settlementSources = series.settlement_sources
|
|
? (series.settlement_sources as Array<Record<string, unknown>>).map((s) => ({
|
|
name: (s.name as string) ?? null,
|
|
url: (s.url as string) ?? null,
|
|
}))
|
|
: null
|
|
|
|
return {
|
|
success: true,
|
|
output: {
|
|
series: {
|
|
ticker: series.ticker ?? null,
|
|
title: series.title ?? null,
|
|
frequency: series.frequency ?? null,
|
|
category: series.category ?? null,
|
|
tags: series.tags ?? null,
|
|
settlement_sources: settlementSources,
|
|
contract_url: series.contract_url ?? null,
|
|
contract_terms_url: series.contract_terms_url ?? null,
|
|
fee_type: series.fee_type ?? null,
|
|
fee_multiplier: series.fee_multiplier ?? null,
|
|
additional_prohibitions: series.additional_prohibitions ?? null,
|
|
product_metadata: series.product_metadata ?? null,
|
|
volume: series.volume ?? null,
|
|
volume_fp: series.volume_fp ?? null,
|
|
},
|
|
},
|
|
}
|
|
},
|
|
|
|
outputs: {
|
|
series: {
|
|
type: 'object',
|
|
description: 'Series object with full details matching Kalshi API response',
|
|
properties: {
|
|
ticker: { type: 'string', description: 'Series ticker' },
|
|
title: { type: 'string', description: 'Series title' },
|
|
frequency: { type: 'string', description: 'Event frequency' },
|
|
category: { type: 'string', description: 'Series category' },
|
|
tags: { type: 'array', description: 'Series tags' },
|
|
settlement_sources: { type: 'array', description: 'Settlement sources' },
|
|
contract_url: { type: 'string', description: 'Contract URL' },
|
|
contract_terms_url: { type: 'string', description: 'Contract terms URL' },
|
|
fee_type: { type: 'string', description: 'Fee type' },
|
|
fee_multiplier: { type: 'number', description: 'Fee multiplier' },
|
|
additional_prohibitions: { type: 'array', description: 'Additional prohibitions' },
|
|
product_metadata: { type: 'object', description: 'Product metadata' },
|
|
volume: { type: 'number', description: 'Series volume' },
|
|
volume_fp: { type: 'number', description: 'Volume (fixed-point)' },
|
|
},
|
|
},
|
|
},
|
|
}
|