Skip to content

Commit

Permalink
fix timesstamp
Browse files Browse the repository at this point in the history
;
  • Loading branch information
dtmkeng committed Mar 18, 2024
1 parent 070336b commit 19a9956
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dexs/rabbitx/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fetchURL from "../../utils/fetchURL"
import { FetchResultVolume, SimpleAdapter } from "../../adapters/types";
import { CHAIN } from "../../helpers/chains";
import { getTimestampAtStartOfDay, getTimestampAtStartOfDayUTC, getTimestampAtStartOfNextDayUTC } from "../../utils/date";

const historicalVolumeEndpoint = "https://api.prod.rabbitx.io/markets"
const candles = (market: string, timestampFrom: number, timestampTo: number) => {
Expand All @@ -16,8 +17,8 @@ interface IVolumeall {
}

const fetchVolume = async (timestamp: number): Promise<FetchResultVolume> => {
const fromTimestamp = timestamp - 60 * 60 * 24
const toTimestamp = timestamp
const fromTimestamp = getTimestampAtStartOfDayUTC(timestamp);
const toTimestamp = getTimestampAtStartOfNextDayUTC(fromTimestamp) - 1;

// Get market data
const response = await fetchURL(historicalVolumeEndpoint);
Expand Down

0 comments on commit 19a9956

Please sign in to comment.