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 class OrderBookCache {
    private bookCache;
    constructor();
    /**
     * Replace full book (after a `book` event)
     * @param event new orderbook event
     */
    replaceBook(event: BookEvent): void;
    /**
     * Update a cached book from a `price_change` event.
     *
     * @param event PriceChangeEvent
     * @returns true if the book was updated.
     * @throws if the book is not found.
     */
    upsertPriceChange(event: PriceChangeEvent): void;
    /**
     * Side effect: updates the book's spread
     *
     * @returns `true` if best-bid/best-ask spread exceeds `cents`.
     * @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;
    /**
     * Removes a specific market from the orderbook if assetId is provided
     * otherwise clears all orderbook
     * @param assetId tokenId of a market
     */
    clear(assetId?: string): void;
    /**
     * Get a book entry by asset id.
     *
     * @returns book entry if found, otherwise null
     */
    getBookEntry(assetId: string): BookEntry | null;
}
