Skip to content

Commit

Permalink
enable dexter-exchange (#2041)
Browse files Browse the repository at this point in the history
* enable dexter-exchange

* refactor

---------

Co-authored-by: g1nt0ki <[email protected]>
  • Loading branch information
dtmkeng and g1nt0ki authored Oct 28, 2024
1 parent 6ce9eff commit cf8cdc5
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions dexs/dexter-tezos/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { FetchOptions, SimpleAdapter } from "../../adapters/types";
import { CHAIN } from "../../helpers/chains";
import { httpGet } from "../../utils/fetchURL";

let _data: any

async function getData() {
if (!_data)
_data = httpGet("https://github.com/StableTechnologies/usdtz-stats/blob/main/temp/dollarizedRevenue_3.json")

return _data
}

const fetchVolume = async (_: any, _t: any, options: FetchOptions) => {

const date = new Date(options.startOfDay * 1000).toLocaleDateString()
console.log(date)
const data = (await getData())[date]
if (!data) throw new Error("No data found for date " + date)
return {
dailyVolume: data.volume,
timestamp: options.startOfDay,
}
}


const adapter: SimpleAdapter = {
adapter: {
[CHAIN.TEZOS]: {
fetch: fetchVolume,
start: 0
}
}
}

export default adapter;

0 comments on commit cf8cdc5

Please sign in to comment.