The minimal broker write interface the OrderEngine drives: place / modify / cancel. OpenAlgoTradeFeed implements this. Distinct from the base-tier TradeFeed (a higher-level place + subscribe shape in openalgo-charts): implement OrderFeed for the engine's write path.

Implements

Constructors

Methods

  • Fetch the order book, keeping the rows that could not be read.

    getOrders returns the first half of this. A host that renders the book needs the second half too: "2 rows from the broker could not be read" is a thing the trader must see, and a quietly shorter list is not.

    Returns Promise<OrderBookSnapshot>

  • Read the analyzer mode the SERVER is in.

    Analyzer mode is a server-side global in OpenAlgo: get_analyze_mode() decides where every order goes, and it is flipped at POST /api/v1/analyzer/toggle. It is not a per-order flag, there is no mode field on the placeorder payload, and one added there would be read by nothing. So this client never asserts a mode. It asks for the server's, and place refuses when the answer disagrees with the caller's belief.

    Answers younger than maxAgeMs are reused, so a host that polls the books (whose sandbox responses carry the mode already) never pays for this call.

    Parameters

    • maxAgeMs: number = ...

    Returns Promise<TradeMode>

  • Parameters

    • orderId: string
    • patch: { price?: number; qty?: number; triggerPrice?: number }

    Returns Promise<void>

  • Release a claim after the host has established what really happened, for instance by finding no such order in a freshly fetched book.

    Deliberately manual. Nothing in this library can safely decide on its own that an ambiguous order did not reach the exchange.

    Parameters

    • token: string

    Returns void

  • Whether a client order id is known to have reached the broker.

    'ambiguous' is the one worth handling: the request left and the outcome is unknown, so the order may be live. A host should say so and offer the order book, not a retry button.

    Parameters

    • token: string

    Returns "unknown" | "inflight" | "sent" | "ambiguous"