import { BookEvent, PriceChangeEvent, PriceLevel } from '../types/PolymarketWebSocket';
export interface BookEntry {
    bids: PriceLevel[];
    asks: PriceLevel[];
    price: string | null;
    midpoint: string | null;
    spread: string | null;
}
export declare function sortDescendingInPlace(bookSide: PriceLevel[]): void;
export declare class OrderBookCache {
    private bookCache;
    constructor();
    /**
     * Replace full book (after a `book` event)
     */
    replaceBook(event: BookEvent): void;
    /**
     * Update a cached book from a `price_change` event.
     *
     * Returns true if the book was updated.
     * Throws if the book is not found.
     */
    upsertPriceChange(event: PriceChangeEvent): void;
    /**
     * Return `true` if best-bid/best-ask spread exceeds `cents`.
     *
     * Side effect: updates the book's spread
     *
     * Throws if either side of the book is empty.
     */
    spreadOver(assetId: string, cents?: number): boolean;
    /**
     * Calculate the midpoint of the book, rounded to 3dp, no trailing zeros
     *
     * Side effect: updates the book's midpoint
     *
     * Throws if
     * - the book is not found or missing either bid or ask
     * - the midpoint is NaN.
    */
    midpoint(assetId: string): string;
    clear(assetId?: string): void;
    /**
     * Get a book entry by asset id.
     *
     * Return null if the book is not found.
     */
    getBookEntry(assetId: string): BookEntry | null;
}
