diff --git a/dexs/dipcoin-perps/index.ts b/dexs/dipcoin-perps/index.ts new file mode 100644 index 0000000000..c3d65c7af5 --- /dev/null +++ b/dexs/dipcoin-perps/index.ts @@ -0,0 +1,39 @@ +import { SimpleAdapter } from "../../adapters/types"; +import { CHAIN } from "../../helpers/chains"; +import { httpGet } from "../../utils/fetchURL"; +import BigNumber from "bignumber.js"; + +const fetch = async () => { + const symbols = ( + await httpGet("https://gray-api.dipcoin.io/api/perp-market-api/list") + )?.data?.map((i: any) => i.symbol); + const volumes = await Promise.all( + symbols.map(async (symbol) => { + const ticker = await httpGet( + `https://gray-api.dipcoin.io/api/perp-market-api/ticker?symbol=${symbol}` + ); + const volumeValue = ticker?.data?.volume24h || 0; + + return BigNumber(volumeValue); + }) + ); + const sum = volumes + .reduce((acc, volume) => acc.plus(volume), BigNumber(0)) + .div(1e18) + .toNumber(); + + return { + dailyVolume: sum, + }; +}; + +const adapter: SimpleAdapter = { + adapter: { + [CHAIN.SUI]: { + fetch: fetch, + runAtCurrTime: true, + }, + }, +}; + +export default adapter; diff --git a/dexs/dipcoin/index.ts b/dexs/dipcoin/index.ts new file mode 100644 index 0000000000..cc810200fd --- /dev/null +++ b/dexs/dipcoin/index.ts @@ -0,0 +1,23 @@ +import { SimpleAdapter } from "../../adapters/types"; +import { CHAIN } from "../../helpers/chains"; +import { httpGet } from "../../utils/fetchURL"; + +const fetch = async () => { + const totalVolume = (await httpGet(`https://api.dipcoin.io/api/index/stats/line`))?.data?.[0]?.volume + + return { + dailyVolume: totalVolume, + }; +}; + + +const adapter: SimpleAdapter = { + adapter:{ + [CHAIN.SUI]:{ + fetch: fetch, + runAtCurrTime: true + } + } +}; + +export default adapter; diff --git a/fees/dipcoin-perps.ts b/fees/dipcoin-perps.ts new file mode 100644 index 0000000000..4ad751a48f --- /dev/null +++ b/fees/dipcoin-perps.ts @@ -0,0 +1,44 @@ +import { httpGet } from "../utils/fetchURL"; +import { FetchResultFees, SimpleAdapter } from "../adapters/types"; +import { CHAIN } from "../helpers/chains"; +import BigNumber from "bignumber.js"; + +const fetch = async (_: number): Promise => { + const symbols = ( + await httpGet("https://gray-api.dipcoin.io/api/perp-market-api/list") + )?.data?.map((i: any) => i.symbol); + const volumes = await Promise.all( + symbols.map(async (symbol: string) => { + const ticker = await httpGet( + `https://gray-api.dipcoin.io/api/perp-market-api/ticker?symbol=${symbol}` + ); + const volumeValue = ticker?.data?.volume24h || 0; + + return BigNumber(volumeValue); + }) + ); + + const fees = volumes + .reduce((acc, volume) => acc.plus(volume), BigNumber(0)) + .div(1e18) + .multipliedBy(0.0004) + .toNumber(); + + return { + dailyFees: fees, + dailyRevenue: fees, + }; +}; + +const adapter: SimpleAdapter = { + version: 1, + adapter: { + [CHAIN.SUI]: { + fetch, + start: "2025-10-15", + runAtCurrTime: true, + }, + }, +}; + +export default adapter; diff --git a/fees/dipcoin.ts b/fees/dipcoin.ts new file mode 100644 index 0000000000..57cc953ac8 --- /dev/null +++ b/fees/dipcoin.ts @@ -0,0 +1,29 @@ +import fetchURL from "../utils/fetchURL"; +import { FetchResultFees, SimpleAdapter } from "../adapters/types"; +import { CHAIN } from "../helpers/chains"; + +const fetch = async (_: number): Promise => { + const pools = (await fetchURL("https://api.dipcoin.io/api/pools"))?.data; + + let spotFees = 0; + for (const pool of pools) { + spotFees += Number(pool.fee24h); + } + + return { + dailyFees: spotFees, + }; +}; + +const adapter: SimpleAdapter = { + version: 1, + adapter: { + [CHAIN.SUI]: { + fetch, + start: "2025-05-20", + runAtCurrTime: true, + }, + }, +}; + +export default adapter;