From e34ee44bc0e285df9a730b2b63ffba1635cd8e61 Mon Sep 17 00:00:00 2001 From: alan Date: Mon, 3 Nov 2025 18:16:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?add=20tvl=E3=80=81volume=E3=80=81fee=20thre?= =?UTF-8?q?e=20meters=20for=20dipcoin=20spot=20and=20dipcoin=20perps.=20an?= =?UTF-8?q?d=20combine=20dipcoin=20spot=20and=20dipcoin=20perps=20into=20o?= =?UTF-8?q?ne=20dipcoin=20group.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dexs/dipcoin-perps/index.ts | 39 ++++++++++++++++++++++++++++++++ dexs/dipcoin-spot/index.ts | 23 +++++++++++++++++++ fees/dipcoin-perps.ts | 44 +++++++++++++++++++++++++++++++++++++ fees/dipcoin-spot.ts | 29 ++++++++++++++++++++++++ 4 files changed, 135 insertions(+) create mode 100644 dexs/dipcoin-perps/index.ts create mode 100644 dexs/dipcoin-spot/index.ts create mode 100644 fees/dipcoin-perps.ts create mode 100644 fees/dipcoin-spot.ts 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-spot/index.ts b/dexs/dipcoin-spot/index.ts new file mode 100644 index 0000000000..cc810200fd --- /dev/null +++ b/dexs/dipcoin-spot/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-spot.ts b/fees/dipcoin-spot.ts new file mode 100644 index 0000000000..57cc953ac8 --- /dev/null +++ b/fees/dipcoin-spot.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; From c46bba24515f4df7e723d49de8703011214589af Mon Sep 17 00:00:00 2001 From: alan Date: Wed, 5 Nov 2025 05:23:31 +0800 Subject: [PATCH 2/2] =?UTF-8?q?add=20tvl=E3=80=81volume=E3=80=81fee=20thre?= =?UTF-8?q?e=20meters=20for=20dipcoin=20spot=20and=20dipcoin=20perps.=20an?= =?UTF-8?q?d=20combine=20dipcoin=20spot=20and=20dipcoin=20perps=20into=20o?= =?UTF-8?q?ne=20dipcoin=20group.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dexs/{dipcoin-spot => dipcoin}/index.ts | 0 fees/{dipcoin-spot.ts => dipcoin.ts} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename dexs/{dipcoin-spot => dipcoin}/index.ts (100%) rename fees/{dipcoin-spot.ts => dipcoin.ts} (100%) diff --git a/dexs/dipcoin-spot/index.ts b/dexs/dipcoin/index.ts similarity index 100% rename from dexs/dipcoin-spot/index.ts rename to dexs/dipcoin/index.ts diff --git a/fees/dipcoin-spot.ts b/fees/dipcoin.ts similarity index 100% rename from fees/dipcoin-spot.ts rename to fees/dipcoin.ts