Skip to main content
Spectre implements a standard Limit Order Book (LOB).
  • Bids: Buy orders, sorted by Price DESC, then by Time ASC (Price-Time Priority).
  • Asks: Sell orders, sorted by Price ASC, then by Time ASC.
When an incoming order crosses the spread (e.g., a Buy order with price >= best Sell price), a trade occurs immediately.

Precision (Scaled Integers)

To avoid floating-point errors, Spectre uses Scaled Integers for all core arithmetic in the matching engine.
  • Price Scale: 100 (2 decimal places)
    • Example: A price of $10.50 is represented internally as 1050.
  • Quantity Scale: 100,000,000 (8 decimal places)
    • Example: A quantity of 1.5 BTC is represented internally as 150000000.
Note: The API handles this conversion automatically. You should send standard floats (e.g., 10.50, 1.5) in your JSON-RPC requests, and the API layer will convert them before passing them to the engine.