-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2301 from pyth-network/cprussin/insights-hub-pric…
…e-chart feat(insights): initial version of price chart
- Loading branch information
Showing
25 changed files
with
680 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { NextRequest } from "next/server"; | ||
|
||
import { getHistoricalPrices } from "../../services/clickhouse"; | ||
|
||
export async function GET(req: NextRequest) { | ||
const symbol = req.nextUrl.searchParams.get("symbol"); | ||
const until = req.nextUrl.searchParams.get("until"); | ||
if (symbol && until) { | ||
const res = await getHistoricalPrices(decodeURIComponent(symbol), until); | ||
return Response.json(res); | ||
} else { | ||
return new Response("Must provide `symbol` and `until`", { status: 400 }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { Chart as default } from "../../../components/PriceFeed/chart"; | ||
export { ChartPage as default } from "../../../components/PriceFeed/chart-page"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Card } from "@pythnetwork/component-library/Card"; | ||
import { notFound } from "next/navigation"; | ||
|
||
import { Chart } from "./chart"; | ||
import styles from "./chart-page.module.scss"; | ||
import { Cluster, getData } from "../../services/pyth"; | ||
|
||
type Props = { | ||
params: Promise<{ | ||
slug: string; | ||
}>; | ||
}; | ||
|
||
export const ChartPage = async ({ params }: Props) => { | ||
const [{ slug }, data] = await Promise.all([ | ||
params, | ||
getData(Cluster.Pythnet), | ||
]); | ||
const symbol = decodeURIComponent(slug); | ||
const feed = data.find((item) => item.symbol === symbol); | ||
|
||
return feed ? ( | ||
<Card title="Chart" className={styles.chartCard}> | ||
<div className={styles.chart}> | ||
<Chart symbol={symbol} feedId={feed.product.price_account} /> | ||
</div> | ||
</Card> | ||
) : ( | ||
notFound() | ||
); | ||
}; |
Oops, something went wrong.