Cross-Venue Liquidity
The same prediction can trade on Polymarket, Kalshi, and other platforms at different prices. Horizon’s liquidity aggregation module merges orderbooks from multiple venues into a unified view, routes orders to the best venue, and enables cross-venue market making. All aggregation math is in Rust.Overview
Book Aggregation
hz.aggregate_books() merges bid/ask levels from multiple venues.Smart Routing
hz.smart_route() picks the best venue for a given order.Best Venue
hz.best_venue() returns the venue with the best price for a side.Cross-Venue MM
hz.cross_venue_mm() market-makes using the aggregated book.Core Functions
hz.aggregate_books
Merge bid/ask levels from multiple venues into a unified orderbook.
Returns an
AggregatedBook with fields: bids, asks, best_bid, best_ask, mid_price, total_bid_size, total_ask_size.
hz.smart_route
Route an order to the venue(s) offering best execution.hz.best_venue
Return the venue with the best price for a given side.hz.merged_mid_price
Compute the size-weighted mid price across venues.Pipeline Functions
hz.aggregate_book
Aggregate orderbooks from multiple venue feeds each cycle.
Returns each cycle: