File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 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 ;
You can’t perform that action at this time.
0 commit comments