Implements IExchange
Client implementation for exchange data access.
Features:
All methods use prototype functions for memory efficiency.
constructor(params: IExchangeParams);
params: IExchangeParams
getCandles(symbol: string, interval: CandleInterval, limit: number): Promise<ICandleData[]>;
Fetches historical candles backwards from execution context time.
getNextCandles(symbol: string, interval: CandleInterval, limit: number): Promise<ICandleData[]>;
Fetches future candles forwards from execution context time. Used in backtest mode to get candles for signal duration.
getAveragePrice(symbol: string): Promise<number>;
Calculates VWAP (Volume Weighted Average Price) from last N 1m candles. The number of candles is configurable via GLOBAL_CONFIG.CC_AVG_PRICE_CANDLES_COUNT.
Formula:
If volume is zero, returns simple average of close prices.
formatQuantity(symbol: string, quantity: number): Promise<string>;
Format quantity for exchange precision.
formatPrice(symbol: string, price: number): Promise<string>;
Format price for exchange precision.