Skip to content

Response drift: kalshi — market.liquidity field renamed to liquidity_dollars, liquidity always 0 #554

@realfishsam

Description

@realfishsam

Exchange

kalshi

Severity

LOW

What Our Normalizer Expects

normalizer.ts:88 accesses market.liquidity with a || 0 fallback:

liquidity: Number(market.liquidity || 0),

What The Live API Returns

The GET https://api.elections.kalshi.com/trade-api/v2/markets?limit=1 response does not include a liquidity field. The live response contains:

markets[].liquidity_dollars: str   ← present (dollar-denominated string)

market.liquidity is absent — the field was renamed to liquidity_dollars.

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

Impact

LOW: The || 0 fallback fires on every market normalization. UnifiedMarket.liquidity is always 0 for all Kalshi markets. Any feature that displays or filters by liquidity (market ordering, liquidity-gated UI) will show Kalshi as having zero liquidity.

Suggested Fix

Update the normalizer to read the current field name, with a parse step since the value is a dollar string:

liquidity: parseFloat(market.liquidity_dollars || market.liquidity || '0') || 0,

This handles both the new field name and retains backwards compatibility if the old field ever reappears.


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