-
-
Notifications
You must be signed in to change notification settings - Fork 106
Description
I’d like to propose a small structural improvement to make exchange integrations more explicitly modular and plug-and-play.
By venue, I mean every prediction market supported like Polymarket, Kalshi, etc.
Idea
For each venue, it would be great to clearly separate:
-
Fetch layer
Responsible for calling the venue API (viacallApi), handling pagination/rate limits, and returning venue-native/raw data. -
Normalization layer
Responsible for mapping venue-native shapes into pmxt unified types (UnifiedMarket, etc.). -
SDK class (composition layer)
Finally, the SDK class wires fetchers + normalizers together and exposes the unified methods defined inBaseExchange.
The sidecar model and SDKs remain unchanged.
Why
Right now, fetching and normalization logic are often mixed inside exchange implementations or utilities. Making the boundary explicit would:
- Make venues easier to reason about
- Improve testability (mock fetchers separately from normalizers)
- Allow advanced users to reuse only part of the stack
- e.g. reuse pmxt’s Polymarket fetch layer but plug in a custom normalizer
- or reuse pmxt’s normalization but fetch from a custom data source
- Make adding new venues more straightforward
And, of course, we could have shared utilities if multiple venus share the same logic, but again, this should be explicit.
I won't have time for now to make a PR on this but I could help in the future. Anyone can take it until then.