Skip to content

Commit

Permalink
Merge pull request #1775 from timanrebel/master
Browse files Browse the repository at this point in the history
Add astrolescent volume
  • Loading branch information
dtmkeng committed Aug 15, 2024
2 parents c891295 + 62fb49e commit a76acac
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions dexs/astrolescent/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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;
}
const fetchVolume = async (timestamp: number): Promise<FetchResultVolume> => {
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,
customBackfill: customBackfill(CHAIN.RADIXDLT, () => fetchVolume),
runAtCurrTime: false
}
}
}
export default adapters;

0 comments on commit a76acac

Please sign in to comment.