Skip to content

Spec drift: kalshi — balance_dollars typed as number/double in spec; live API returns FixedPointDollars string #900

@realfishsam

Description

@realfishsam

Exchange

kalshi

Drift Type

changed_response

Severity

MEDIUM — the balance_dollars field is a centi-cent precision fixed-point string in the live API but typed as a floating-point number in the spec; any JSON parser expecting a number will fail to parse a string value

Their Docs

Per the Kalshi changelog (May 28, 2026), balance_dollars on the GET /portfolio/balance response is specified as a FixedPointDollars type — a centi-cent precision string (e.g., "1234.5678") for direct-member accounts. The live OpenAPI spec uses $ref: FixedPointDollars for this field.

Source: https://docs.kalshi.com/welcome (changelog, May 28, 2026)

Our Cached Spec

core/specs/kalshi/Kalshi.yamlGetBalance response schema has balance_dollars: { type: number, format: double }. This type mismatch means typed code generated from the spec will attempt to use it as a number when the actual response delivers a string.

File: core/specs/kalshi/Kalshi.yaml (GetBalance response, balance_dollars field)

callApi() References at Risk

  • callApi('GetBalance') at fetcher.ts:381 — balance response affected

Hardcoded URL Bypasses

None

Impact

The normalizer at normalizer.ts:317 reads raw.balance (the cents-based integer field, not balance_dollars) via / 100. However, if any code uses the balance_dollars field via the typed spec interface, it will encounter a string where a number is expected.

Fix: Update balance_dollars type in Kalshi.yaml to type: string (or add $ref: '#/components/schemas/FixedPointDollars') to match the live spec.


Found by automated spec drift audit

Metadata

Metadata

Assignees

No one assigned

    Labels

    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