Skip to content

Response drift: kalshi — yes_ask_size_fp / yes_bid_size_fp depth fields not extracted #798

@realfishsam

Description

@realfishsam

Exchange

kalshi

Severity

MEDIUM

What Our Normalizer Expects

core/src/exchanges/kalshi/normalizer.ts reads yes_ask_dollars, yes_bid_dollars, last_price_dollars and the various _fp volume/liquidity fields. No extraction of bid/ask size fields is present in the normalizer.

What The Live API Returns

The live /markets and /markets/{ticker} endpoints now include depth-size fields alongside the price fields:

markets[].yes_ask_dollars: str      ← price, extracted
markets[].yes_bid_dollars: str      ← price, extracted
markets[].yes_ask_size_fp: str      ← NEW: ask-side depth size, NOT extracted
markets[].yes_bid_size_fp: str      ← NEW: bid-side depth size, NOT extracted

Endpoint tested: GET https://api.elections.kalshi.com/trade-api/v2/markets?limit=2

Impact

MEDIUM: yes_ask_size_fp and yes_bid_size_fp expose the top-of-book depth (how many contracts are available at the best bid/ask). Without these, PMXT can show the best price but not the available quantity at that price — degraded spread display and order sizing accuracy. No crash risk.

Suggested Fix

Add these fields to KalshiRawMarket and map them in the normalizer alongside the existing price fields:

// In KalshiRawMarket interface
yes_ask_size_fp?: string;
yes_bid_size_fp?: string;

// In normalizer
askSize: parseFloat(raw.yes_ask_size_fp ?? '0'),
bidSize: parseFloat(raw.yes_bid_size_fp ?? '0'),

Found by automated response shape drift audit

Metadata

Metadata

Assignees

No one assigned

    Labels

    response-driftLive API response shape differs from normalizer expectations

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions