Skip to content

Commit

Permalink
fix polymarket
Browse files Browse the repository at this point in the history
  • Loading branch information
dtmkeng committed Oct 17, 2024
1 parent 075ba86 commit c7c855f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 0 additions & 1 deletion dexs/polymarket/data.json

This file was deleted.

13 changes: 8 additions & 5 deletions dexs/polymarket/index.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@

import { FetchOptions, SimpleAdapter } from "../../adapters/types";
import { CHAIN } from "../../helpers/chains";
import { queryDune } from "../../helpers/dune";

const fetchFees = async (options: FetchOptions) => {
const data = require('./data.json');
const dateStr = new Date(options.startOfDay * 1000).toISOString().split('T')[0];
const fetchFees = async (timestamp: number, _t: any, options: FetchOptions) => {
const data: any[] = await queryDune("4172945")
const dateStr = new Date(timestamp * 1000).toISOString().split('T')[0];
const daily = data.find(e => e.day.split(' ')[0] === dateStr);
const dailyVolume = options.createBalances();
dailyVolume.addUSDValue(daily.total_volume_usd);
return {
timestamp: timestamp,
dailyVolume: dailyVolume
}
}

const adapters: SimpleAdapter = {
version: 2,
version: 1,
adapter: {
[CHAIN.POLYGON]: {
fetch: fetchFees,
start: 1601424000,
}
}
},
isExpensiveAdapter: true,
}

export default adapters

0 comments on commit c7c855f

Please sign in to comment.