Skip to content

Conversation

fhqvst
Copy link
Contributor

@fhqvst fhqvst commented Oct 15, 2025

Summary

With this PR we now consume historical price data from the Benchmarks API instead of using our own hand-rolled Clickhouse query.

One downside is that we don't have confidence intervals in the Benchmarks API...

Rationale

Our clients' users have complained that they're seeing inconsistent data in insights hub vs. the data on our clients' pages. With this change we now make sure that the data our clients are consuming is the same one we're using on insights hub, meaning there shouldn't be any inconsistencies.

How has this been tested?

  • Current tests cover my changes
  • Added new tests
  • Manually tested the code

Copy link

linear bot commented Oct 15, 2025

Copy link

vercel bot commented Oct 15, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
component-library Ready Ready Preview Comment Oct 15, 2025 3:17pm
insights Ready Ready Preview Comment Oct 15, 2025 3:17pm
5 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
api-reference Skipped Skipped Oct 15, 2025 3:17pm
developer-hub Skipped Skipped Oct 15, 2025 3:17pm
entropy-explorer Skipped Skipped Oct 15, 2025 3:17pm
proposals Skipped Skipped Oct 15, 2025 3:17pm
staking Skipped Skipped Oct 15, 2025 3:17pm

@fhqvst fhqvst force-pushed the fhqvst/ui-276-use-benchmarks-api-for-historical-data branch from a008adb to a697c35 Compare October 15, 2025 15:12
@vercel vercel bot temporarily deployed to Preview – developer-hub October 15, 2025 15:12 Inactive
@vercel vercel bot temporarily deployed to Preview – api-reference October 15, 2025 15:12 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-explorer October 15, 2025 15:12 Inactive
@vercel vercel bot temporarily deployed to Preview – proposals October 15, 2025 15:12 Inactive
@vercel vercel bot temporarily deployed to Preview – staking October 15, 2025 15:12 Inactive
@fhqvst fhqvst marked this pull request as ready for review October 17, 2025 09:46
@fhqvst fhqvst requested a review from a team as a code owner October 17, 2025 09:46
Copy link
Collaborator

@cprussin cprussin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change is overall good! But I think there's a few more things before we ship it:

  1. I think the /historical-prices endpoint is now dead code, can you check and clean it up if so?
  2. @ali-behjati can you tell us how hard it would be to add CI to the benchmarks endpoint? Is it feasible? I really hate losing CI from the historical charts, plus it does seem reasonable that we might want to have CI in the benchmarks apis.

Comment on lines +188 to +193
const data = benchmarkData.t.map((timestamp, i) => ({
time: timestamp as UTCTimestamp,
price: benchmarkData.c[i], // Use close price
confidence: 0, // No confidence data from benchmarks API
status: PriceStatus.Trading,
}));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd do this using a zod transform

// Transform OHLC data to our format using close prices
const data = benchmarkData.t.map((timestamp, i) => ({
time: timestamp as UTCTimestamp,
price: benchmarkData.c[i], // Use close price
Copy link
Collaborator

@cprussin cprussin Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love this -- I think we will need to put more thought in here. If we aren't showing OHLC candles, I think the chart will be misleading. Plus, we should have full resolution (individual points) when zoomed all the way in, so OHLC doesn't really make sense at that resolution. Let's grab some time to chat through this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants