interface Candle { id: number x: number y: number open: number close: number high: number low: number delay: number duration: number } // Generate static candlesticks once const generateCandles = (): Candle[] => { const newCandles: Candle[] = [] const numCandles = 15 for (let i = 0; i < numCandles; i++) { const open = Math.random() * 60 + 20 const movement = (Math.random() - 0.5) * 40 const close = open + movement const high = Math.max(open, close) + Math.random() * 20 const low = Math.min(open, close) - Math.random() * 20 newCandles.push({ id: i, x: Math.random() * 100, y: Math.random() * 100, open, close, high, low, delay: Math.random() * 5, duration: 8 + Math.random() * 4, }) } return newCandles } const CANDLES = generateCandles() const TradingBackground = () => { return (
{CANDLES.map((candle) => { const isBullish = candle.close > candle.open const color = isBullish ? 'url(#bullishGradient)' : 'url(#bearishGradient)' const strokeColor = isBullish ? 'rgba(16, 185, 129, 0.6)' : 'rgba(239, 68, 68, 0.6)' const bodyTop = Math.min(candle.open, candle.close) const bodyHeight = Math.abs(candle.close - candle.open) const bodyWidth = 1.5 return ( {/* High-Low line (wick) */} {/* Candle body */} ) })} {/* Animated trend lines - now spanning full width */} {/* Floating gradient orbs */}
) } export default TradingBackground