Skip to content

Commit 8e29b87

Browse files
committed
track evedex 24h vol & oi
1 parent aea80fc commit 8e29b87

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

open-interest/evedex.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
const endpoint = 'https://exchange-api.evedex.com/api/external/cmc/v1/contracts'
2+
import type { FetchOptions, SimpleAdapter } from "../adapters/types";
3+
import { CHAIN } from "../helpers/chains";
4+
import fetchURL from "../utils/fetchURL";
5+
6+
const fetch = async (_options: FetchOptions) => {
7+
const response = await fetchURL(endpoint);
8+
9+
let openInterestAtEnd = 0
10+
let dailyVolume = 0
11+
for (const i of response) {
12+
openInterestAtEnd += i.open_interest_usd
13+
if (i.quote_currency === 'USD' && i.product_type === 'Perpetual') {
14+
dailyVolume += i.quote_volume
15+
}
16+
}
17+
18+
return { openInterestAtEnd, dailyVolume };
19+
};
20+
21+
const adapter: SimpleAdapter = {
22+
version: 2,
23+
adapter: {
24+
[CHAIN.EVENTUM]: {
25+
fetch,
26+
runAtCurrTime: true,
27+
},
28+
},
29+
};
30+
31+
export default adapter;

0 commit comments

Comments
 (0)