-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Utilize on chain data for token price pool graph #2356
Conversation
PR deployed in Google Cloud |
PR deployed in Google Cloud |
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.
there still seems to be a discrepancy between the token prices displayed - I'm seeing three different token prices on the page (above the chart, in the chart tooltip for today, underneath the chart in the blue box).I think it would help to replace the last day of the subquery data in the chart with chain data from today?
Hmmm that's weird. I will double check. It seems we want to move away from the subquery for this one. Thank you for checking!! @sophialittlejohn |
feb8bc7
to
695abdd
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.
I would suggest a slightly different approach:
const todayPrice = pool?.tranches[pool.tranches.length - 1].tokenPrice?.toDecimal().toNumber() || null
const todayNav = pool.nav.total.toDecimal().toNumber()
const isSingleTranche = pool?.tranches.length === 1
const data: ChartData[] = React.useMemo(
() =>
truncatedPoolStates?.map((day) => {
const nav = day.poolState.netAssetValue.toDecimal().toNumber()
const price = (isSingleTranche && Object.values(day.tranches)[0].price?.toFloat()) || null
// Replace the data as it's being created for the chart so that data stays consistent with the UI
if (day.timestamp && new Date(day.timestamp).toDateString() === new Date().toDateString()) {
return { day: new Date(day.timestamp), nav: todayNav, price: todayPrice }
}
return { day: new Date(day.timestamp), nav, price }
}) || [],
[isSingleTranche, truncatedPoolStates]
)
695abdd
to
295db3a
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.
🥳
Description
#2312
#2310
Approvals