Skip to content

Conversation

cprussin
Copy link
Collaborator

@cprussin cprussin commented Oct 9, 2025

Summary

When feeds are not currently trading, we would previously still show the price point published to pythnet. However this is misleading in IH since it looks like the feed is still live and updating. With this PR, we now only show ticking prices when feeds are trading -- when they aren't we instead fall back to previousPrice / previousTimestamp.

We also enter whitespace data into the chart for points where the feed is not trading -- to be honest there are probably more intuitive ways to account for this in the chart (e.g. maybe we should just skip these points and default the chart to show a window including the last published point or something), but this is a reasonable stopgap that correctly displays what we saw in pythnet, while removing confusion around stale data looking like it's still being published. cc @fhqvst , this is something to think of in future iterations of the chart.

Rationale

Resolves some confusing behavior of IH

How has this been tested?

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

@cprussin cprussin requested a review from a team as a code owner October 9, 2025 01:34
Copy link

vercel bot commented Oct 9, 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 9, 2025 2:28am
insights Ready Ready Preview Comment Oct 9, 2025 2:28am
5 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
api-reference Skipped Skipped Oct 9, 2025 2:28am
developer-hub Skipped Skipped Oct 9, 2025 2:28am
entropy-explorer Skipped Skipped Oct 9, 2025 2:28am
proposals Skipped Skipped Oct 9, 2025 2:28am
staking Skipped Skipped Oct 9, 2025 2:28am

@cprussin cprussin force-pushed the cprussin/dont-tick-offline-feeds branch from 714ada5 to f4ac640 Compare October 9, 2025 02:25
@vercel vercel bot temporarily deployed to Preview – entropy-explorer October 9, 2025 02:25 Inactive
@vercel vercel bot temporarily deployed to Preview – api-reference October 9, 2025 02:25 Inactive
@vercel vercel bot temporarily deployed to Preview – developer-hub October 9, 2025 02:25 Inactive
@vercel vercel bot temporarily deployed to Preview – proposals October 9, 2025 02:25 Inactive
@vercel vercel bot temporarily deployed to Preview – staking October 9, 2025 02:25 Inactive
Copy link
Collaborator

@ali-behjati ali-behjati left a comment

Choose a reason for hiding this comment

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

overall LGTM but right now you need to manually check every place to make sure it's used correctly. it is better to move the transformation of the price into what you want to the adapter layer (which is the context right?).

@cprussin
Copy link
Collaborator Author

cprussin commented Oct 9, 2025

overall LGTM but right now you need to manually check every place to make sure it's used correctly. it is better to move the transformation of the price into what you want to the adapter layer (which is the context right?).

I originally planned to do this in the context but it felt incorrect to me because the context is intended to expose directly the state on chain. It seems more correct that the transformation should be applied where the data is displayed since it's reasonable that we'd want some places to display the data as-is and some to have this transformation -- the LivePrices components are the mechanism by which prices, confidence, and last updated gets displayed on-screen and nearly all places that show this info should do so by using them -- the only real exception is the chart, which doesn't feel important to me since it will be updated to use hermes anyways soon.

@ali-behjati
Copy link
Collaborator

ali-behjati commented Oct 9, 2025

@cprussin i get where you are coming from but still what you have is very error prone. My rule is always how as a reader i understand the code and change it. Am i sure reading this code that all places are handled well? No. If i later change it i can miss one too.

I don't get why onchain state should be as is, i see context as an adapter to the code representation and needs. And then i'd define types that represent what i need in the app. If the main raw data can sometimes be used, then make new types of what is used that make this distinction clear within the context. This makes the reasoning obvious too (as it'll have low coupling, just one place that you look to understand the assumptions/..., and another place concerned with display,..)

Copy link
Contributor

@fhqvst fhqvst left a comment

Choose a reason for hiding this comment

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

Looks good! I'll leave the approval for @ali-behjati

Comment on lines +506 to +509
unique.set(a.time, a);
}
for (const b of bs) {
unique.set(b.time as number, b);
unique.set(b.time, b);
Copy link
Contributor

Choose a reason for hiding this comment

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

Wonder if we need to add some check here so that if the timestamp for a LineData and a WhitespaceData are equal, the LineData wins.

I.e., if we're using 1 day as resolution, and the status goes down and up within that same day, we'll be guaranteed to see the price instead of whitespace.

Perhaps this could/should be done in the Clickhouse query even? Not sure...

Copy link
Collaborator

@ali-behjati ali-behjati left a comment

Choose a reason for hiding this comment

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

It looks good to me. My comments are opinionated, we can take it offline.

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.

3 participants