diff --git a/src/app/hashtag/[tag]/page.tsx b/src/app/hashtag/[tag]/page.tsx
index 25433a3..11d946f 100644
--- a/src/app/hashtag/[tag]/page.tsx
+++ b/src/app/hashtag/[tag]/page.tsx
@@ -35,7 +35,8 @@ export default async function HashtagPage({ params, searchParams }: Props) {
where: { tag },
include: {
priceHistory: {
- orderBy: { recordedAt: 'asc' },
+ orderBy: { recordedAt: 'desc' },
+ take: 192, // 192 updates = 2 days of 15-min intervals
},
_count: {
select: { positions: true },
@@ -153,7 +154,7 @@ export default async function HashtagPage({ params, searchParams }: Props) {
Price History
({ ...p, recordedAt: p.recordedAt.toISOString() }))}
+ data={hashtag.priceHistory.slice().reverse().map((p) => ({ ...p, recordedAt: p.recordedAt.toISOString() }))}
height={280}
/>
diff --git a/src/app/positions/page.tsx b/src/app/positions/page.tsx
index 5b5a8cf..9cc63fc 100644
--- a/src/app/positions/page.tsx
+++ b/src/app/positions/page.tsx
@@ -88,7 +88,7 @@ export default async function PositionsPage({
displayTag: true,
currentPrice: true,
priceHistory: {
- orderBy: { recordedAt: 'asc' },
+ orderBy: { recordedAt: 'desc' },
take: 20,
select: { price: true },
},
@@ -148,7 +148,7 @@ export default async function PositionsPage({
const costBasis = pos.avgBuyPrice * pos.shares
const currentValue = pos.hashtag.currentPrice * pos.shares
const pnlPct = costBasis > 0 ? (pnl / costBasis) * 100 : 0
- const sparkPrices = pos.hashtag.priceHistory.map((h) => h.price)
+ const sparkPrices = pos.hashtag.priceHistory.slice().reverse().map((h) => h.price)
return { ...pos, pnl, costBasis, currentValue, pnlPct, sparkPrices }
})