feat(rain): add fetchOrderBooks batch order-book fetch#1693
Merged
realfishsam merged 1 commit intoJul 18, 2026
Conversation
RainExchange exposed a working single-outcome fetchOrderBook but never overrode the batch fetchOrderBooks, so calling it threw "Method fetchOrderBooks not implemented." and has.fetchOrderBooks reported false. Add a fetchOrderBooks(outcomeIds) override that loops the already-working single-outcome fetchOrderBook and returns a Record keyed by outcome id. Declare it as an emulated capability in capabilityOverrides to stay consistent with fetchOrderBook: 'emulated' (there is no native batch endpoint), so has.fetchOrderBooks now reports 'emulated'. Fixes pmxt-dev#1666
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.
What
RainExchangehad a working single-outcomefetchOrderBook, but the batchfetchOrderBooksfell through to the base class stub and threwMethod fetchOrderBooks not implemented..exchange.has.fetchOrderBooksalsoreported
false.This adds a
fetchOrderBooks(outcomeIds)override that loops the already-workingfetchOrderBookand returns aRecord<string, OrderBook>keyed by outcome id.Why
Rain has no native batch order-book endpoint, so the batch variant is emulated
by fanning out to the single-outcome fetch — the same way
fetchOrderBookitself is already declared
'emulated'. To keep the capability map honest,fetchOrderBooksis declared'emulated'incapabilityOverrides(rather thanletting it auto-derive to
true), so it stays consistent with the single fetch.Tests
Added
core/test/unit/rain-fetch-order-books.core.test.ts:fetchOrderBooks([...])calls the single-outcomefetchOrderBookonce per id(verified via a stub) and returns a record matching those N individual calls.
exchange.has.fetchOrderBooksnow reports'emulated'instead offalse.Fixes #1666