IExchangeSchema

Exchange schema registered via addExchange(). Defines candle data source and formatting logic.

exchangeName: string

Unique exchange identifier for registration

note: string

Optional developer note for documentation

getCandles: (symbol: string, interval: CandleInterval, since: Date, limit: number, backtest: boolean) => Promise<IPublicCandleData[]>

Fetch candles from data source (API or database).

formatQuantity: (symbol: string, quantity: number, backtest: boolean) => Promise<string>

Format quantity according to exchange precision rules.

Optional. If not provided, defaults to Bitcoin precision on Binance (8 decimal places).

formatPrice: (symbol: string, price: number, backtest: boolean) => Promise<string>

Format price according to exchange precision rules.

Optional. If not provided, defaults to Bitcoin precision on Binance (2 decimal places).

getOrderBook: (symbol: string, depth: number, from: Date, to: Date, backtest: boolean) => Promise<IOrderBookData>

Fetch order book for a trading pair.

Optional. If not provided, throws an error when called.

getAggregatedTrades: (symbol: string, from: Date, to: Date, backtest: boolean) => Promise<IAggregatedTradeData[]>

Fetch aggregated trades for a trading pair. Optional. If not provided, throws an error when called.

callbacks: Partial<IExchangeCallbacks>

Optional lifecycle event callbacks (onCandleData)