Skip to content

Commit

Permalink
update jojo
Browse files Browse the repository at this point in the history
  • Loading branch information
JoscelynFarr committed Apr 30, 2024
1 parent b424233 commit 6829400
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions dexs/jojo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,29 @@ import fetchURL from "../../utils/fetchURL"
import { SimpleAdapter, Fetch } from "../../adapters/types";
import { CHAIN } from "../../helpers/chains";
import { getUniqStartOfTodayTimestamp } from "../../helpers/getUniSubgraphVolume";
const historicalVolumeEndpointZk = (symbol: string, chain: string) => `https://api.` + chain +`-mainnet.jojo.exchange/v1/platform/tradeVolume?marketId=${symbol}`
const historicalVolumeEndpointZk = (symbol: string, chain: string) => `https://api.` + chain + `-mainnet.jojo.exchange/v1/platform/tradeVolume?marketId=${symbol}`
const coins = {
'ethusdc': 'coingecko:ethereum',
'btcusdc': 'coingecko:bitcoin',
'solusdc': 'coingecko:solana'
'solusdc': 'coingecko:solana',
'wifusdc': 'coingecko:wif',
'enausdc': 'coingecko:ena',
'ckbusdc': 'coingecko:ckb',
'bomeusdc': 'coingecko:bome',
'wusdc': 'coingecko:w',
'ethfiusdc': 'coingecko:ethfi',
'ondousdc': 'coingecko:ondo',
'dogeusdc': 'coingecko:doge',
'memeusdc': 'coingecko:meme',
'ordiusdc': 'coingecko:ordi',
'wldusdc': 'coingecko:wld',
'agixusdc': 'coingecko:agix',
'tiausdc': 'coingecko:tia',
'rndrusdc': 'coingecko:rndr',
'altusdc': 'coingecko:alt',
'xaiusdc': 'coingecko:xai',
'linkusdc': 'coingecko:link'

}

interface IVolumeall {
Expand All @@ -20,8 +38,8 @@ const getVolume = async (timestamp: number, chain: string) => {

const historical = (await Promise.all(Object.keys(coins).map((coins: string) => fetchURL(historicalVolumeEndpointZk(coins, chain)))));

const historicalVolume = historical.map((item => item.dailyVolume))
const historicalUSD = historicalVolume.map((a: any, index: number) => a.map((e: any) => { return { timestamp: e.t / 1000, volume: e.v, id: Object.values(coins)[index]} })).flat()
const historicalVolume = historical.map((item => item.dailyVolume))
const historicalUSD = historicalVolume.map((a: any, index: number) => a.map((e: any) => { return { timestamp: e.t / 1000, volume: e.v, id: Object.values(coins)[index] } })).flat()
const historicalUSD2 = historicalUSD.map((e: IVolumeall) => {
return {
...e,
Expand Down

0 comments on commit 6829400

Please sign in to comment.