-
Notifications
You must be signed in to change notification settings - Fork 300
feat: Use benchmarks API for historical data #3138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
5 Skipped Deployments
|
a008adb
to
a697c35
Compare
There was a problem hiding this 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:
- I think the
/historical-prices
endpoint is now dead code, can you check and clean it up if so? - @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.
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, | ||
})); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
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?