File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -4,17 +4,25 @@ import {getUniqStartOfTodayTimestamp} from "../../helpers/getUniSubgraphVolume";
44import fetchURL from "../../utils/fetchURL"
55import { FetchOptions } from "../../adapters/types" ;
66
7+ const tickers_endpoint = 'https://serverprod.vest.exchange/v2/ticker/24hr'
8+
9+ const blacklisted_tickers = [ 'VC-PERP' ] // wash trading
10+
711const fetch = async ( timestamp : number , _ : any , options : FetchOptions ) : Promise < FetchResultVolume > => {
8- const from_date = getUniqStartOfTodayTimestamp ( new Date ( options . startOfDay * 1000 ) ) ;
9- const to_date = from_date + 86400 ;
10- const data = ( await fetchURL ( `https://serverprod.vest.exchange/v2/exchangeInfo/volume?from_date=${ from_date * 1000 } &to_date=${ to_date * 1000 } ` ) ) ;
12+ // const from_date = getUniqStartOfTodayTimestamp(new Date(options.startOfDay * 1000));
13+ // const to_date = from_date + 86400;
14+ // const data = (await fetchURL(`https://serverprod.vest.exchange/v2/exchangeInfo/volume?from_date=${from_date * 1000}&to_date=${to_date * 1000}`));
15+
16+ const data = ( await fetchURL ( tickers_endpoint ) ) . tickers ;
17+ const dailyVolume = data . filter ( ( ticker : any ) => ! blacklisted_tickers . includes ( ticker . symbol ) ) . reduce ( ( acc : number , ticker : any ) => acc + Number ( ticker . quoteVolume || 0 ) , 0 ) ;
18+
1119 return {
12- dailyVolume : data . total ,
13- timestamp : timestamp ,
20+ dailyVolume : dailyVolume ,
1421 } ;
1522} ;
1623
1724const adapter : SimpleAdapter = {
25+ version : 2 ,
1826 adapter : {
1927 [ CHAIN . BASE ] : {
2028 fetch,
You can’t perform that action at this time.
0 commit comments