From fb5e115345ba5a70f16455ced014ad9afa1a5a21 Mon Sep 17 00:00:00 2001 From: 0xgnek <0xgnek@gmail.com> Date: Fri, 15 Mar 2024 10:53:22 +0000 Subject: [PATCH] fix query --- dexs/synfutures-v3/index.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dexs/synfutures-v3/index.ts b/dexs/synfutures-v3/index.ts index b723b1d4a2..7b85cbe806 100644 --- a/dexs/synfutures-v3/index.ts +++ b/dexs/synfutures-v3/index.ts @@ -2,6 +2,7 @@ import request from "graphql-request"; import { Chain } from "@defillama/sdk/build/general"; import { CHAIN } from "../../helpers/chains"; import { ChainBlocks, FetchOptions, SimpleAdapter } from "../../adapters/types"; +import { getTimestampAtStartOfDayUTC, getTimestampAtStartOfNextDayUTC } from "../../utils/date"; const info: { [key: string]: any } = { [CHAIN.BLAST]: { @@ -13,10 +14,11 @@ const fetch = (chain: Chain) => { return async ( timestamp: number, _: ChainBlocks, - { createBalances, startTimestamp, endTimestamp, startOfDay }: FetchOptions + { createBalances, startOfDay }: FetchOptions ) => { const dailyVolume = createBalances(); - + const to = getTimestampAtStartOfNextDayUTC(timestamp) + const from = getTimestampAtStartOfDayUTC(timestamp) const graphQL = `{ amms(where: {status_in: [TRADING, SETTLING]}) { instrument { @@ -24,7 +26,7 @@ const fetch = (chain: Chain) => { id } } - hourlyDataList(where: {timestamp_gte: ${startTimestamp}, timestamp_lt: ${endTimestamp}}, orderBy: timestamp, orderDirection: desc) { + hourlyDataList(where: {timestamp_gte: ${from}, timestamp_lte: ${to - 1}}, orderBy: timestamp, orderDirection: desc) { volume } }