What the controller needs from the chart (the Chart implements this).

interface TradingHost {
    addPrimitive(p: IPrimitive): void;
    emit(event: string, payload: unknown): void;
    removePrimitive(p: IPrimitive): void;
    subscribeClick(cb: (externalId: string) => void): void;
    subscribeDrag(
        onDrag: (externalId: string, price: number) => void,
        onDragEnd?: (externalId: string, price: number) => void,
    ): void;
    tickSchedule(): null | TickSchedule;
}

Methods

  • Optional: route trading events onto the chart's unified chart.on(...) bus.

    Parameters

    • event: string
    • payload: unknown

    Returns void

  • Parameters

    • onDrag: (externalId: string, price: number) => void
    • OptionalonDragEnd: (externalId: string, price: number) => void

    Returns void

  • Optional: the instrument's tick schedule when the layer is built. The layer is built on first use, often after the instrument was applied, and applying one does not build it early: building it subscribes to drags, which makes every ns-resize price line on the chart draggable.

    Returns null | TickSchedule