UNPKG

@thuantan2060/technicalindicators

Version:
42 lines (41 loc) 1.65 kB
import StockData from '../StockData'; /** * Basic configuration interface for CandlestickFinder base class. * Only contains the scale parameter used by approximateEqual function. */ export interface ICandlestickConfig { /** Scale parameter for approximateEqual function precision (default: 0.001) */ scale?: number; } /** * Default configuration for CandlestickFinder base class. */ export declare const DEFAULT_CANDLESTICK_CONFIG: ICandlestickConfig; export default class CandlestickFinder { requiredCount: number; name: string; /** * Scale parameter for price comparison precision in approximateEqual function. * This should ONLY be used in the approximateEqual method, not in other pattern calculations. */ scale: number; constructor(config?: ICandlestickConfig); /** * Compares two numbers for approximate equality using scale-dependent threshold. * This is the ONLY place where this.scale should be used in pattern detection. * * @param a First number to compare * @param b Second number to compare * @returns true if the numbers are approximately equal, false otherwise */ approximateEqual(a: number, b: number): boolean; /** * Helper method to validate OHLC data integrity */ protected validateOHLC(open: number, high: number, low: number, close: number): boolean; logic(data: StockData): boolean; getAllPatternIndex(data: StockData): number[]; hasPattern(data: StockData): any; protected _getLastDataForCandleStick(data: StockData): StockData; protected _generateDataForCandleStick(data: StockData): any[]; }