Exchange
kalshi
Severity
MEDIUM
What Our Normalizer Expects
core/src/exchanges/kalshi/normalizer.ts unconditionally parses all *_dollars price fields as dollar-denominated floats (e.g. parseFloat(raw.last_price_dollars)). The normalizer never reads the response_price_units field.
// normalizer.ts ~line 51
price: parseFloat(raw.last_price_dollars ?? raw.yes_ask_dollars ?? ...),
What The Live API Returns
The live /markets and /markets/{ticker} endpoints include a response_price_units field not present in the local type definitions:
markets[].response_price_units: str ← NEW, not read by normalizer
markets[].last_price_dollars: str ← read, assumed to be dollars
markets[].yes_ask_dollars: str ← read, assumed to be dollars
markets[].yes_bid_dollars: str ← read, assumed to be dollars
Endpoint tested: GET https://api.elections.kalshi.com/trade-api/v2/markets?limit=1
Impact
MEDIUM: response_price_units signals the denomination of the accompanying price fields. If Kalshi ever serves a response where this field is not "dollars" (e.g. for certain market types or future API changes), the normalizer will parse cent-scale values as dollar-scale values, silently producing prices 100x off. No current crash, but a latent parsing correctness risk.
Suggested Fix
Read response_price_units and apply a conditional divisor:
const isInCents = raw.response_price_units === 'cent';
const scale = isInCents ? 100 : 1;
price: parseFloat(raw.last_price_dollars ?? '0') / scale,
Also add response_price_units?: string to the KalshiRawMarket type.
Found by automated response shape drift audit
Exchange
kalshi
Severity
MEDIUM
What Our Normalizer Expects
core/src/exchanges/kalshi/normalizer.tsunconditionally parses all*_dollarsprice fields as dollar-denominated floats (e.g.parseFloat(raw.last_price_dollars)). The normalizer never reads theresponse_price_unitsfield.What The Live API Returns
The live
/marketsand/markets/{ticker}endpoints include aresponse_price_unitsfield not present in the local type definitions:Endpoint tested:
GET https://api.elections.kalshi.com/trade-api/v2/markets?limit=1Impact
MEDIUM:
response_price_unitssignals the denomination of the accompanying price fields. If Kalshi ever serves a response where this field is not"dollars"(e.g. for certain market types or future API changes), the normalizer will parse cent-scale values as dollar-scale values, silently producing prices 100x off. No current crash, but a latent parsing correctness risk.Suggested Fix
Read
response_price_unitsand apply a conditional divisor:Also add
response_price_units?: stringto theKalshiRawMarkettype.Found by automated response shape drift audit