Skip to content

Commit

Permalink
Merge pull request #2319 from Dragun-Sultan/master
Browse files Browse the repository at this point in the history
Add ooia aggregator
  • Loading branch information
dtmkeng authored Jan 16, 2025
2 parents ee0f2bf + 4ffa444 commit 3af7422
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions aggregators/ooia/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { FetchOptions, FetchV2, SimpleAdapter } from "../../adapters/types";
import { CHAIN } from "../../helpers/chains";
import fetchURL from "../../utils/fetchURL";

const BaseURL = "https://apiprod662ba0315.ooia.art";
const endpoint = "api/v1/collections/defillama/analytics/volumes";
const currency = "USDT";

interface IAPIResponse {
dailyVolume: string;
totalVolume: string;
}
const fromMicro = (value: string) => {
return (parseFloat(value) / 1e6).toString();
};

const fetch: FetchV2 = async ({ startOfDay }: FetchOptions) => {
const { dailyVolume, totalVolume }: IAPIResponse = await fetchURL(
`${BaseURL}/${endpoint}?timestamp=${startOfDay}&currency=${currency}`
);
return {
dailyVolume: fromMicro(dailyVolume),
totalVolume: fromMicro(totalVolume),
};
};

const adapters: SimpleAdapter = {
version: 2,
adapter: {
[CHAIN.TON]: {
start: "2024-11-01",
fetch,
},
},
};
export default adapters;

0 comments on commit 3af7422

Please sign in to comment.