Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions core/specs/kalshi/Kalshi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4711,7 +4711,6 @@ components:
- no_price
- yes_price_dollars
- no_price_dollars
- taker_side
properties:
trade_id:
type: string
Expand Down Expand Up @@ -4744,7 +4743,19 @@ components:
type: string
enum: ['yes', 'no']
x-enum-varnames: ['TradeTakerSideYes', 'TradeTakerSideNo']
description: Side for the taker of this trade
deprecated: true
description: Deprecated (removal deadline May 14, 2026). Use taker_outcome_side and taker_book_side instead.
taker_outcome_side:
type: string
enum: ['yes', 'no']
description: '"yes" or "no" — which side of the outcome the taker is on'
taker_book_side:
type: string
enum: ['bid', 'ask']
description: '"bid" or "ask" — taker''s side of the order book'
is_block_trade:
type: boolean
description: Whether this was a block trade
created_time:
type: string
format: date-time
Expand Down
18 changes: 15 additions & 3 deletions core/src/exchanges/kalshi/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ export interface KalshiRawOrderBook {
export interface KalshiRawOrderBooks {
orderbooks: KalshiRawOrderBook[];
}

export interface KalshiRawTrade {
trade_id: string;
created_time: string;
Expand All @@ -120,7 +119,13 @@ export interface KalshiRawTrade {
count?: number;
/** New API field: count as a string e.g. "424.00" */
count_fp?: string;
taker_side: string;

/** @deprecated removal deadline May 14, 2026 */
taker_side?: string;
/** New v2 directional fields */
taker_outcome_side?: string;
taker_book_side?: string;
is_block_trade?: boolean;

[key: string]: unknown;
}
Expand All @@ -134,9 +139,16 @@ export interface KalshiRawFill {
/** @deprecated Old API field */
count?: number;
count_fp?: string;
side: string;
order_id: string;

/** @deprecated removal deadline May 14, 2026 */
side?: string;
/** @deprecated removal deadline May 14, 2026 */
action?: string;
/** New v2 directional fields */
outcome_side?: string;
book_side?: string;

[key: string]: unknown;
}

Expand Down
5 changes: 3 additions & 2 deletions core/src/exchanges/kalshi/normalizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ export class KalshiNormalizer implements IExchangeNormalizer<KalshiRawEvent, Kal
timestamp: new Date(raw.created_time).getTime(),
price,
amount,
side: raw.taker_side === 'yes' ? 'buy' : 'sell',
// Support legacy taker_side, fallback to v2 taker_outcome_side
side: (raw.taker_side || raw.taker_outcome_side) === 'yes' ? 'buy' : 'sell',
};
}

Expand All @@ -300,7 +301,7 @@ export class KalshiNormalizer implements IExchangeNormalizer<KalshiRawEvent, Kal
timestamp: new Date(raw.created_time).getTime(),
price,
amount,
side: raw.side === 'yes' ? 'buy' as const : 'sell' as const,
side: (raw.side || raw.outcome_side) === 'yes' ? 'buy' as const : 'sell' as const,
orderId: raw.order_id,
};
}
Expand Down
Loading