Skip to content

Commit ff7dc98

Browse files
committed
use hourly candles for evedex and standx to make it synced with normalized volume
1 parent 53ac194 commit ff7dc98

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

dexs/evedex/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ async function fetch(_a: any, _b: any, options: FetchOptions) {
1818
await PromisePool.withConcurrency(1)
1919
.for(markets)
2020
.process(async (market) => {
21-
const ohlcvData = await fetchURLAutoHandleRateLimit(`${OHLCV_ENDPOINT}/${market}/list?after=${after}&before=${before}&group=1d`);
21+
const ohlcvData = await fetchURLAutoHandleRateLimit(`${OHLCV_ENDPOINT}/${market}/list?after=${after}&before=${before}&group=1h`);
2222
const todaysData = ohlcvData.filter(data => data[0] >= options.startOfDay * 1000 && data[0] < options.endTimestamp * 1000);
23-
dailyVolume.addUSDValue((todaysData[0]?.[5] ?? 0) / 2); //They count both maker and taker volume in candles
23+
dailyVolume.addUSDValue(todaysData.reduce((acc: number, data: any) => acc + data[5] / 2, 0)); //They count both maker and taker volume in candles
2424
await sleep(1000);
2525
});
2626

dexs/standx/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ const fetch = async (_a: any, _b: any, options: FetchOptions): Promise<FetchResu
2828

2929
await PromisePool.withConcurrency(1).for(symbols).process(async (symbol) => {
3030
const marketInfo: MarketInfo = await fetchURLAutoHandleRateLimit(
31-
`${apiEndpoint}/kline/history?symbol=${symbol}&from=${options.startOfDay}&to=${options.endTimestamp}&resolution=1D`,
31+
`${apiEndpoint}/kline/history?symbol=${symbol}&from=${options.startOfDay}&to=${options.endTimestamp}&resolution=60&countback=50`,
3232
);
33-
const todaysDataPosition = marketInfo.t.findIndex(t => t >= options.startOfDay && t < options.endTimestamp);
34-
const volUsd = marketInfo?.v[todaysDataPosition] ? marketInfo?.v[todaysDataPosition] * marketInfo?.c[todaysDataPosition] : 0;
33+
const todaysDataPositions = marketInfo.t
34+
.map((t: number, i: number) => (t >= options.startOfDay && t < options.endTimestamp ? i : -1))
35+
.filter((i: number) => i >= 0);
36+
const volUsd = todaysDataPositions.reduce((acc: number, i: number) => acc + marketInfo?.v[i] * marketInfo?.c[i], 0);
3537
dailyVolume.addUSDValue(volUsd);
3638
await sleep(1000);
3739
});

factory/normalizedVolume.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ const protocols = {
266266
protocolName: 'evedex',
267267
chains: [CHAIN.EVENTUM],
268268
start: '2026-03-30',
269-
version: 2,
269+
version: 1,
270270
minContracts: 15
271271
}),
272272
} as const;

0 commit comments

Comments
 (0)