From 9b0b42859c45346fed7cbb445417828ddbe52347 Mon Sep 17 00:00:00 2001 From: Timan Rebel Date: Thu, 15 Aug 2024 14:00:33 +0200 Subject: [PATCH 1/2] add astrolescent volume --- dexs/astrolescent/index.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 dexs/astrolescent/index.ts diff --git a/dexs/astrolescent/index.ts b/dexs/astrolescent/index.ts new file mode 100644 index 0000000000..c7fc2fa492 --- /dev/null +++ b/dexs/astrolescent/index.ts @@ -0,0 +1,27 @@ +import { FetchResultFees, FetchResultVolume, SimpleAdapter } from "../../adapters/types" +import { CHAIN } from "../../helpers/chains" +import fetchURL from "../../utils/fetchURL" + +interface AstrolescentStats { + volumeUSD: number; +} +const fetchVolume = async (timestamp: number): Promise => { + const response: AstrolescentStats = (await fetchURL(`https://api.astrolescent.com/stats/history?timestamp=${timestamp}`)); + const dailyVolume = Number(response?.volumeUSD); + + return { + dailyVolume, + timestamp + } +} + +const adapters: SimpleAdapter = { + adapter: { + [CHAIN.RADIXDLT]: { + fetch: fetchVolume, + start: 1698624000, + runAtCurrTime: false + } + } +} +export default adapters; From 62fb49e51f9ed6bf64787ba71cdd572e8c149fba Mon Sep 17 00:00:00 2001 From: Timan Rebel Date: Thu, 15 Aug 2024 14:05:07 +0200 Subject: [PATCH 2/2] add custom backfill to Astrolescent --- dexs/astrolescent/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dexs/astrolescent/index.ts b/dexs/astrolescent/index.ts index c7fc2fa492..58c930f176 100644 --- a/dexs/astrolescent/index.ts +++ b/dexs/astrolescent/index.ts @@ -1,6 +1,7 @@ import { FetchResultFees, FetchResultVolume, SimpleAdapter } from "../../adapters/types" import { CHAIN } from "../../helpers/chains" import fetchURL from "../../utils/fetchURL" +import customBackfill from "../../helpers/customBackfill"; interface AstrolescentStats { volumeUSD: number; @@ -20,6 +21,7 @@ const adapters: SimpleAdapter = { [CHAIN.RADIXDLT]: { fetch: fetchVolume, start: 1698624000, + customBackfill: customBackfill(CHAIN.RADIXDLT, () => fetchVolume), runAtCurrTime: false } }