fix: timeframe handling and progress tracking improvements
- Fix timeframe parameter handling in enhanced-screenshot API route - Support both 'timeframe' (singular) and 'timeframes' (array) parameters - Add proper sessionId propagation for real-time progress tracking - Enhance MACD analysis prompt with detailed crossover definitions - Add progress tracker service with Server-Sent Events support - Fix Next.js build errors in chart components (module variable conflicts) - Change dev environment port from 9000:3000 to 9001:3000 - Improve AI analysis layout detection logic - Add comprehensive progress tracking through all service layers
This commit is contained in:
@@ -16,9 +16,10 @@ interface Position {
|
||||
interface TradingChartProps {
|
||||
symbol?: string
|
||||
positions?: Position[]
|
||||
onPriceUpdate?: (price: number) => void
|
||||
}
|
||||
|
||||
export default function TradingChart({ symbol = 'SOL/USDC', positions = [] }: TradingChartProps) {
|
||||
export default function TradingChart({ symbol = 'SOL/USDC', positions = [], onPriceUpdate }: TradingChartProps) {
|
||||
const chartContainerRef = useRef<HTMLDivElement>(null)
|
||||
const chart = useRef<any>(null)
|
||||
const candlestickSeries = useRef<any>(null)
|
||||
@@ -33,7 +34,7 @@ export default function TradingChart({ symbol = 'SOL/USDC', positions = [] }: Tr
|
||||
try {
|
||||
// Dynamic import to avoid SSR issues
|
||||
const LightweightCharts = await import('lightweight-charts')
|
||||
const { createChart, ColorType, CrosshairMode, LineStyle, CandlestickSeries } = LightweightCharts
|
||||
const { createChart, ColorType, CrosshairMode, LineStyle } = LightweightCharts
|
||||
|
||||
chart.current = createChart(chartContainerRef.current!, {
|
||||
layout: {
|
||||
@@ -58,7 +59,7 @@ export default function TradingChart({ symbol = 'SOL/USDC', positions = [] }: Tr
|
||||
})
|
||||
|
||||
// Create candlestick series
|
||||
candlestickSeries.current = chart.current.addSeries(CandlestickSeries, {
|
||||
candlestickSeries.current = chart.current.addCandlestickSeries({
|
||||
upColor: '#26a69a',
|
||||
downColor: '#ef5350',
|
||||
borderDownColor: '#ef5350',
|
||||
@@ -76,6 +77,12 @@ export default function TradingChart({ symbol = 'SOL/USDC', positions = [] }: Tr
|
||||
console.log('Setting chart data...')
|
||||
candlestickSeries.current.setData(data)
|
||||
console.log('Chart data set successfully')
|
||||
|
||||
// Call onPriceUpdate with the latest price if provided
|
||||
if (onPriceUpdate && data.length > 0) {
|
||||
const latestPrice = data[data.length - 1].close
|
||||
onPriceUpdate(latestPrice)
|
||||
}
|
||||
|
||||
// Add position overlays
|
||||
console.log('Adding position overlays...')
|
||||
|
||||
Reference in New Issue
Block a user