Skip to content

Commit 117cb9b

Browse files
authored
Merge pull request #318 from clober-dex/fix/houly-pool-snapshots
chore: bump version to 1.0.0-beta.38 in package.json and package-lock…
2 parents 435ef94 + f832b75 commit 117cb9b

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@clober/v2-sdk",
3-
"version": "1.0.0-beta.37",
3+
"version": "1.0.0-beta.38",
44
"description": "🛠 An SDK for building applications on top of Clober V2",
55
"files": [
66
"dist"

src/entities/pool/apis/snapshot.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ export const fetchPoolSnapshotFromSubgraph = async (
176176
performanceHistories[0].performanceIndex = 1
177177
performanceHistories[0].relativePriceIndex = 1
178178
}
179+
const now = Math.floor(Date.now() / 1000)
180+
const before24h = now - 24 * 60 * 60
179181
return {
180182
chainId,
181183
key: poolKey,
@@ -201,6 +203,7 @@ export const fetchPoolSnapshotFromSubgraph = async (
201203
currencyB,
202204
lpCurrency,
203205
volumeUSD24h: poolHourDatas
206+
.filter((data) => data.date >= before24h)
204207
.reduce((acc, data) => acc + Number(data.volumeUSD), 0)
205208
.toString(),
206209
lpPriceUSD: pool.lpPriceUSD,

0 commit comments

Comments
 (0)