Expand description
Paper Exchange: Simulates order execution using real quotes.
Wraps a real exchange for quote data but simulates fills locally. Orders fill when the quote price crosses the order price. Uses FillSimulator for shared fill matching logic. Uses MarginLedger for accurate perp margin accounting.
Structs§
- ArcExchange
- Newtype wrapper around
Arc<dyn Exchange>to implement Exchange trait. This allows PaperExchange to wrap anyArc<dyn Exchange>while satisfying orphan rules. - NoOp
Exchange - Minimal exchange that does nothing - used internally by PaperExchange::new_standalone() All quotes come from queue_quotes/inject_quote, not from this exchange.
- Paper
Exchange - Paper Exchange - wraps a real exchange for quotes, simulates fills locally.
Functions§
- create_
standalone_ paper_ exchange - Create a standalone paper exchange for backtesting without any inner exchange.
Uses
queue_quotes()orinject_quote()for price data. - create_
standalone_ paper_ exchange_ with_ id - Create a standalone paper exchange with a custom exchange ID and environment. Use exchange_id = “hyperliquid” and environment = Mainnet for backtest mode compatibility.
Type Aliases§
- Standalone
Paper Exchange - Type alias for standalone PaperExchange (no inner exchange dependency)