Repository navigation
feat(ws): typed subscribe_ebattle_scores (#575) — 22.11.0 - #577
Merged
Merged
Conversation
AsyncAPI gained the public ebattle_scores WebSocket channel (15 → 16; batch_communications remains gone). OpenAPI changes are description-only plus a documented 429 on RFQ create.
Add models, dispatch, subscribe helper, and update_subscription support (singular sid + match_ids) for Kalshi's new ebattle_scores WebSocket channel. Bump to 22.11.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #575
Reconciles today's nightly spec-drift failure: AsyncAPI grew from 15 to 16 channels.
batch_communicationsis still gone; the new channel isebattle_scores(live eSoccer/eFootball and eBasketball scores). Yesterday's #575 items (POST /margin/fcm/positions/transfers,ApiKey.key_type) already shipped in v22.10.0 via #576 and are not revisited here.This is a minor release (22.11.0). Additive only; nothing was renamed or removed.
What changed
KalshiWebSocket.subscribe_ebattle_scores(*, match_ids=None, maxsize=1000).A fresh subscription is empty until matches are requested. Passing
match_ids(e.g.["all"]or Kalshi milestone IDs) sendsupdate_subscriptionwithaction=subscribe_matchesimmediately after the subscribe ack, while the recv loop is still paused.EbattleScoresMessage/EbattleScoresPayloadandEbattleScoresMatchlistMessage/EbattleScoresMatchlistPayload.msg.datais left as a JSON-encoded string (same as CF Benchmarksdata).ebattle_scoresandebattle_scores_matchlist.SubscriptionManager.update_subscriptionacceptsmatch_idsand, forsubscribe_matches/unsubscribe_matches/matchlist, sends the spec's required scalarparams.sid(notparams.sids). Existing market and CF Benchmarks actions still sendsids.batch_communicationsto stay absent.open_rfq_limit_exceeded/ 400rfq_market_not_open;balance_breakdownand subaccount-balance wording). Recorded in the changelog; no REST model changes.Blast radius
GitNexus is unavailable; this is a hand-written impact note.
Direct
kalshi/ws/models/ebattle.py(new)kalshi/ws/models/__init__.py— exportskalshi/ws/dispatch.py—MESSAGE_MODELSkalshi/ws/channels.py—_CHANNEL_PARAMS["ebattle_scores"](empty;match_idsis not a subscribe-command param) andupdate_subscriptionwire format for match actionskalshi/ws/client.py—subscribe_ebattle_scoreskalshi/_contract_map.py—WS_CONTRACT_MAPentriestests/test_contracts.py—test_batch_communications_channel_removedtest_models.py,test_client.py,test_channels.py,test_dispatch.pydocs/websockets.md,README.md,docs/index.md,CLAUDE.md,CHANGELOG.mdpyproject.toml,kalshi/__init__.py→ 22.11.0specs/asyncapi.yaml,specs/openapi.yaml(synced;_generated/unchanged)Likely callers / behavior
subscribe_*helpers and genericsubscribe(channel, ...)are untouched.update_subscriptionforadd_markets/delete_markets/get_snapshot/subscribe_indices/unsubscribe_indices/indexliststill sendsparams.sids. Only the three new eBattle actions take the singularsidpath.CONTROL_TYPESstill treatsokas a control frame, sosubscribedMatchesResponse(typeok) is consumed as the update ack, not yielded on the iterator.pyth_value,root, andcontrol_framesremain escape-hatch-only.Risks
sidsfor eBattle and rejectedsid, seedingmatch_idswould fail. The AsyncAPI schema requiressidand does not listsidsfor this command, so the singular form matches the contract.ebattle_scoresis temporary and may later require individual approval; unapproved subscriptions then end. Documented on the method and indocs/websockets.md.