Repository navigation
perf(ws): inplace orderbook updates; config knobs; pluggable JSON; small polish - #232
Conversation
…all polish - OrderbookManager: split state mutation from materialization. Recv loop now uses _apply_*_inplace variants — stops building+discarding ~2N OrderbookLevel allocations per frame on deep books. - KalshiConfig: new ws_ping_interval, ws_close_timeout, ws_json_loads, ws_json_dumps fields. - ConnectionManager.connect/reconnect deduped via _open_socket helper; uses Full Jitter formula matching REST. - OrderbookDeltaPayload.side typed as Literal['yes','no'] — invalid sides now rejected at parse. - MessageQueue.put_sentinel is a no-op when already closed. Closes #199, Closes #208, Closes #209 Refs #221 (P2 items 1/2/5 — W2-C finishes items 3/4: populate_by_name + AwareDatetime) Refs #224
Code Review — PR #232Well-structured PR with a clear scope per issue. The audit trail (issue refs in code comments) is especially useful. Below are findings grouped by severity. Findings1. Dead branch in
|
Wave 2-A of audit umbrella. Three issues + 3 P2 polish items.
Changes
_apply_*_inplaceorderbook variants — stops building+discarding ~2N OrderbookLevel allocations per frame on deep books.KalshiConfig.ws_ping_interval/ws_close_timeoutknobs;ConnectionManageruses them via a new_open_sockethelper.KalshiConfig.ws_json_loads/ws_json_dumpspluggable JSON hooks; orjson opt-in for hot path.OrderbookDeltaPayload.sideasLiteral['yes','no'].put_sentinelidempotent on already-closed queue.Closes #199, Closes #208, Closes #209
Refs #221 (W2-C lands items 3/4)
Refs #224