diff --git a/frontend/src/components/InstrumentChart.tsx b/frontend/src/components/InstrumentChart.tsx index f5db3b1..41340ad 100644 --- a/frontend/src/components/InstrumentChart.tsx +++ b/frontend/src/components/InstrumentChart.tsx @@ -25,10 +25,11 @@ interface ChartEvent { } interface Props { - priceData: PriceCandle[] - indicators: Record - events?: ChartEvent[] - height?: number + priceData: PriceCandle[] + indicators: Record + events?: ChartEvent[] + height?: number + chartType?: 'candles' | 'line' onDateHover?: (date: string | null) => void } @@ -57,7 +58,7 @@ const CAT_LABELS: Record = { technical: 'Tech.', } -export default function InstrumentChart({ priceData, indicators, events = [], height = 420, onDateHover }: Props) { +export default function InstrumentChart({ priceData, indicators, events = [], height = 420, chartType = 'candles', onDateHover }: Props) { const containerRef = useRef(null) const cleanupRef = useRef<(() => void) | null>(null) const onHoverRef = useRef(onDateHover) @@ -119,16 +120,30 @@ export default function InstrumentChart({ priceData, indicators, events = [], he }))) } - // Candlesticks - const candleSeries = chart.addCandlestickSeries({ - upColor: '#10b981', - downColor: '#ef4444', - borderUpColor: '#10b981', - borderDownColor: '#ef4444', - wickUpColor: '#6ee7b7', - wickDownColor: '#fca5a5', - }) - candleSeries.setData(priceData) + // Prix principal — chandeliers ou courbe lisse + if (chartType === 'line') { + const areaSeries = chart.addAreaSeries({ + lineColor: '#3b82f6', + topColor: 'rgba(59,130,246,0.18)', + bottomColor: 'rgba(59,130,246,0.01)', + lineWidth: 2, + priceLineVisible: true, + lastValueVisible: true, + crosshairMarkerVisible: true, + crosshairMarkerRadius: 4, + }) + areaSeries.setData(priceData.map(d => ({ time: d.time as any, value: d.close }))) + } else { + const candleSeries = chart.addCandlestickSeries({ + upColor: '#10b981', + downColor: '#ef4444', + borderUpColor: '#10b981', + borderDownColor: '#ef4444', + wickUpColor: '#6ee7b7', + wickDownColor: '#fca5a5', + }) + candleSeries.setData(priceData) + } // MA lines for (const [key, color] of Object.entries(MA_COLORS)) { @@ -278,7 +293,7 @@ export default function InstrumentChart({ priceData, indicators, events = [], he cleanupRef.current?.() cleanupRef.current = null } - }, [priceData, indicators, events, height]) + }, [priceData, indicators, events, height, chartType]) return (
diff --git a/frontend/src/pages/InstrumentDashboard.tsx b/frontend/src/pages/InstrumentDashboard.tsx index bf4355c..49c9e13 100644 --- a/frontend/src/pages/InstrumentDashboard.tsx +++ b/frontend/src/pages/InstrumentDashboard.tsx @@ -1066,14 +1066,20 @@ function ExplanationScore({ // ── Main page ───────────────────────────────────────────────────────────────── const PERIODS = [ - { key: '3mo', label: '3M' }, { key: '6mo', label: '6M' }, - { key: '1y', label: '1Y' }, { key: '2y', label: '2Y' }, { key: '5y', label: '5Y' }, + { key: '5d', label: '5D' }, + { key: '1mo', label: '1M' }, + { key: '3mo', label: '3M' }, + { key: '6mo', label: '6M' }, + { key: '1y', label: '1Y' }, + { key: '2y', label: '2Y' }, + { key: '5y', label: '5Y' }, ] export default function InstrumentDashboard() { const { id = 'SPY' } = useParams<{ id: string }>() const navigate = useNavigate() const [period, setPeriod] = useState('1y') + const [chartStyle, setChartStyle] = useState<'candles' | 'line'>('candles') const [instruments, setInstruments] = useState([]) const [snapshot, setSnapshot] = useState(null) const [narrative, setNarrative] = useState('') @@ -1265,6 +1271,20 @@ export default function InstrumentDashboard() { )}
+ {/* Chart style toggle */} +
+ + +
+ {/* Period selector */}
{PERIODS.map(p => (
+ {/* ── Quick category filter ── */} +
+ {([ + { key: '', label: 'Tout', dot: 'bg-slate-500' }, + { key: 'event_calendar', label: '★ Cal.', dot: 'bg-amber-500' }, + { key: 'geopolitical', label: '★ Géo.', dot: 'bg-red-500' }, + { key: 'fundamental', label: '★ Fund.', dot: 'bg-emerald-500' }, + { key: 'report', label: '★ Rep.', dot: 'bg-blue-500' }, + { key: 'sentiment', label: '★ Sent.', dot: 'bg-violet-500' }, + { key: 'technical', label: '★ Tech.', dot: 'bg-cyan-500' }, + ] as const).map(({ key, label, dot }) => ( + + ))} +
+ {/* ── Sort + more filters toggle ── */}
Tri: @@ -1183,7 +1212,7 @@ export default function MarketEvents() { ? 'bg-slate-700 border-slate-600 text-slate-300' : 'border-slate-800 text-slate-600 hover:border-slate-600')}> - Filtres {(level || minScore > 0 || evaluated || instTicker) ? '●' : ''} + Filtres {(category || level || minScore > 0 || evaluated || instTicker) ? '●' : ''}