Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Optim Finance daily volume #2055

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions dexs/optim-finance/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import BigNumber from "bignumber.js";
import { FetchOptions, BreakdownAdapter, FetchV2 } from "../../adapters/types";
import { CHAIN } from "../../helpers/chains";

const fetchVolume: FetchV2 = async (options: FetchOptions) => {
const volumeResponse = await fetch(`https://spo-server.optim.finance/oada/stake-auction-volume?timeframe=1d&time=${options.endTimestamp}`).then(response => response.json())

if (volumeResponse.tag !== 'OK') return {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we prefer an error when something goes wrong, PR is good otherwise


return {
dailyVolume: new BigNumber(volumeResponse?.contents['1D']).div(1e6).toString(),
}
}

const adapter: BreakdownAdapter = {
version: 2,
breakdown: {
derivatives: {
[CHAIN.CARDANO]: {
fetch: fetchVolume,
start: 1717200000,
}
},
},
};


export default adapter;
Loading