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

Properties

rejectNextPlace: null | string = null

Test hook: set to a reason to make the next place() throw it once, as a plain error. That is an answer lost on its way back, not a refusal: the engine settles the order as ambiguous and keeps its token, since it may have reached the broker. For a broker's refusal, construct with accounts and call failNext('place', 'reject', reason).

Accessors

Methods

  • Drop the connection. Every call fails without applying: one made while it is down as never sent (isPreflightFailure), one already out with a plain error. Account streams report the loss.

    Returns void

  • Simulate a fill for an order (test hook).

    Parameters

    • orderId: string

    Returns void

  • Parameters

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

    Returns Promise<void>

  • Stop delivering order-stream updates, as a dropped stream would (test hook).

    Parameters

    • muted: boolean

    Returns void

  • Parameters

    • cb: (symbol: string, ltp: number) => void

    Returns void

  • The price market orders fill at and positions are valued at. Pushes fresh figures to holders.

    Parameters

    • symbol: string
    • price: number

    Returns void

  • Push readings as they change. onError reports a dead stream; the returned function stops it.

    Parameters

    • accountId: string
    • onSnapshot: (s: AccountSnapshot) => void
    • OptionalonError: (e: unknown) => void

    Returns () => void

  • Build a deterministic N-level synthetic book around ltp (demo/test helper).

    Parameters

    • ltp: number
    • levels: number
    • tickSize: number = 0.05

    Returns MarketDepth