fix(kalshi): sync Trade schema with v2 API drift (#1187)#1282
fix(kalshi): sync Trade schema with v2 API drift (#1187)#1282AbhilashG12 wants to merge 2 commits into
Conversation
PR Review: FAILWhat This DoesUpdates the vendored Kalshi OpenAPI Blast RadiusKalshi trade schema/specification only. The runtime Kalshi fetcher/normalizer and generated Consumer VerificationBefore (base branch): side: raw.taker_side === 'yes' ? 'buy' : 'sell'A v2-style payload without After (PR branch): node - <<'NODE'
const { KalshiNormalizer } = require('./core/dist/exchanges/kalshi/normalizer.js');
const n = new KalshiNormalizer();
console.log(JSON.stringify(n.normalizeTrade({
trade_id:'t1', created_time:'2026-06-22T00:00:00Z',
yes_price_dollars:'0.42', count_fp:'1.00',
taker_outcome_side:'yes', taker_book_side:'bid', is_block_trade:false
}, 0)));
NODEObserved response: {"id":"t1","timestamp":1782086400000,"price":0.42,"amount":1,"side":"sell"}So the PR documents the schema drift but does not make the runtime consumer path handle it. Test Results
Findings
PMXT Pipeline Check
Semver Impactpatch -- intended venue API drift compatibility fix. RiskCurrent SDK consumers can still receive incorrect unified trade |
…rade/fill directions
|
Thanks for clarifying the runtime path! I found the hand-written KalshiRawTrade and KalshiRawFill interfaces in fetcher.ts. I have updated both to make the deprecated fields optional and added the new v2 directional fields (taker_outcome_side, outcome_side, etc.). I then updated normalizer.ts to safely fall back to the new v2 fields if the legacy fields are undefined. The normalizer will now output the correct buy/sell sides regardless of whether it receives a v1 or v2 payload. This should close both #1187 and #1188. |
PR Review: PASS (NOT VERIFIED)What This DoesUpdates the cached Kalshi Trade schema for v2 API drift: Blast RadiusKalshi raw fetcher typing, Kalshi trade normalization, and cached Kalshi OpenAPI spec. This affects Consumer VerificationBefore (base branch): After (PR branch): Test Results
FindingsNo blocking findings. PMXT Pipeline Check
Semver Impactpatch -- response-drift compatibility fix for Kalshi trade payloads. RiskConsumer-path verification is incomplete: without live/fixture |
|
The PR is ready to get merged , as i have tested run test suite locally and confirmed everythings working : Runtime Verification:Python: from pmxt import Kalshi
client = Kalshi(api_key='test', private_key='test')✅ Import works Typescript import { Kalshi } from 'pmxtjs';
const client = new Kalshi({ apiKey: 'test', privateKey: 'test' });✅ Import works |
Closes #1187
What This Does:
Updates the cached OpenAPI spec for Kalshi to resolve the v2 API drift on the
Tradeschema.Changes:
taker_sidefrom therequiredarray.taker_sideasdeprecated: trueper the May 14, 2026 removal deadline.taker_outcome_side(yes|no).taker_book_side(bid|ask).is_block_trade(boolean).Compiled locally via
npm run build --workspace=core; YAML syntax and resulting type generation are clean.