Skip to content

Add futures beta support #884

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Add futures beta support #884

wants to merge 10 commits into from

Conversation

justinpolygon
Copy link
Contributor

@justinpolygon justinpolygon commented Jun 9, 2025

Adds futures REST and Websocket beta support.

REST support was straightforward but websocket support needed a small refactor around how events are processed. Added new parsing logic using MARKET_EVENT_MAP to address event type collisions between markets like stocks and futures. Previously, event types such as "A", "AM", "T", and "Q" were unique across markets. With the addition of futures, these types are now reused, creating ambiguity, and mapping to incorrect model structures. For example, an event with "ev": "T" could be an EquityTrade (stocks) or a FuturesTrade (futures), depending on the market.

The solution uses MARKET_EVENT_MAP, which maps each market to its specific event types and model classes. By leveraging the market context from the WebSocketClient, the parser can now accurately identify and process these events. This change ensures reliable data parsing as we expand to support more markets, while remaining backward-compatible for existing stock market clients.

@justinpolygon justinpolygon marked this pull request as ready for review June 9, 2025 17:08
Copy link

@penelopus penelopus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks generally good; have a handful of comments/Qs

  • usage of order
  • an out-of-sync path
  • removal of a ws address

@justinpolygon
Copy link
Contributor Author

Thanks for catching all the @penelopus!

@justinpolygon justinpolygon requested a review from penelopus June 9, 2025 19:38
Copy link

@penelopus penelopus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐍 looks good! (one non-blocking comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants