Skip to content

Commit

Permalink
Merge pull request #1838 from re-doubt/feature/stormtrade_volume_api
Browse files Browse the repository at this point in the history
Switch StormTrade volume adapter to the project API endpoint
  • Loading branch information
dtmkeng authored Aug 29, 2024
2 parents 2417abd + 7c0caa7 commit 75f9a0a
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions dexs/stormtrade/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { time } from 'console';
import { CHAIN } from '../../helpers/chains'
import fetchURL from '../../utils/fetchURL'
import { postURL } from '../../utils/fetchURL'

const GRAPHQL_ENDPOINT = 'https://api5.storm.tg/graphql';

export default {
adapter: {
Expand All @@ -10,15 +12,23 @@ export default {
meta: {
methodology: {
DailyVolume: 'Leverage trading volume',
DataSource: 'Data collected by the re:doubt team, available at https://beta.redoubt.online/tracker'
DataSource: 'Data prepared by the project team by indexing blockchain data'
},
},
fetch: async () => {
const response = await fetchURL('https://api.redoubt.online/dapps/v1/export/defi/storm')
fetch: async (timestamp: number) => {
const response = (await postURL(GRAPHQL_ENDPOINT, {
query: `
query VolumeDaily {
marketInfo {
exchangedTradeVolume
}
}
`
}));

return {
dailyVolume: response.volume.toString(),
timestamp: response.timestamp
dailyVolume: response.data.marketInfo.exchangedTradeVolume / 1e9,
timestamp: new Date().getTime() / 1000
}
},
},
Expand Down

0 comments on commit 75f9a0a

Please sign in to comment.