Summary
Users interested in the long-term exchange rate between two assets currently have no way to see how the rate has changed over time within this app. This issue adds a historical rate chart to the results section that queries Horizon's trade aggregations endpoint and renders a line chart for the selected asset pair, giving users price context before acting on a route.
Task
- Create
src/lib/trade-aggregations.ts with a fetchRateHistory(network, selling, buying, resolution) function that queries Horizon's /trade_aggregations endpoint and returns an array of { timestamp: number, close: string } objects.
- Add a
src/components/rate-chart.tsx component that accepts the aggregation data and renders a line chart. Use a lightweight charting library such as recharts or chart.js to avoid a large bundle impact.
- Render
RateChart in the results section in src/app/page.tsx when paths.length > 0, between the comparison strip and the table.
- Fetch 30 days of daily aggregations using the source and destination assets from the last search.
- Handle the case where no trade history exists for the pair (show a "No historical data available" placeholder).
Acceptance Criteria
Files in Scope
src/lib/trade-aggregations.ts (new file)
src/components/rate-chart.tsx (new file)
src/app/page.tsx
src/types/path.ts
Summary
Users interested in the long-term exchange rate between two assets currently have no way to see how the rate has changed over time within this app. This issue adds a historical rate chart to the results section that queries Horizon's trade aggregations endpoint and renders a line chart for the selected asset pair, giving users price context before acting on a route.
Task
src/lib/trade-aggregations.tswith afetchRateHistory(network, selling, buying, resolution)function that queries Horizon's/trade_aggregationsendpoint and returns an array of{ timestamp: number, close: string }objects.src/components/rate-chart.tsxcomponent that accepts the aggregation data and renders a line chart. Use a lightweight charting library such asrechartsorchart.jsto avoid a large bundle impact.RateChartin the results section insrc/app/page.tsxwhenpaths.length > 0, between the comparison strip and the table.Acceptance Criteria
Files in Scope
src/lib/trade-aggregations.ts(new file)src/components/rate-chart.tsx(new file)src/app/page.tsxsrc/types/path.ts