Skip to content

Commit

Permalink
fix the historical data
Browse files Browse the repository at this point in the history
  • Loading branch information
mnsrulz committed Sep 23, 2024
1 parent 39bf919 commit 4228e3d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/app/api/symbols/[symbol]/historical/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ const getPriceAtDate = async (symbol: string, dt: string) => {
if (!isUSMarketOpenedForToday()) {
const resp = await yf.historical(symbol, {
interval: '1d',
period1: dayjs().add(-1, 'day').toDate(),
period1: dayjs().add(-7, 'day').toDate(),
period2: new Date()
});
return resp.at(0)?.close?.toFixed(2);
return resp.pop()?.close?.toFixed(2);
}
}

Expand Down

0 comments on commit 4228e3d

Please sign in to comment.