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

feat(dopex): holder and supply side revenue #1277

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 2 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
19 changes: 11 additions & 8 deletions options/dopex/clamm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ async function getChainStats({ graphUrl, timestamp }: IGetChainStatsParams) {
first: 1000
orderDirection: asc
orderBy: startTimestamp
where: { startTimestamp_gte: $fromTimestamp, startTimestamp_lte: $toTimestamp, volume_gt: 0 }
where: {
startTimestamp_gte: $fromTimestamp
startTimestamp_lte: $toTimestamp
volume_gt: 0
}
) {
volume
fees
Expand All @@ -58,14 +62,13 @@ async function getChainStats({ graphUrl, timestamp }: IGetChainStatsParams) {
return {
totalNotionalVolume:
acc.totalNotionalVolume + Number(market.totalVolume),
totalPremiumVolume:
acc.totalPremiumVolume + Number(market.totalPremium),
totalFees: acc.totalFees + Number(market.totalPremium),
totalRevenue: acc.totalRevenue + Number(market.totalFees),
};
},
{
totalNotionalVolume: 0,
totalPremiumVolume: 0,
totalFees: 0,
totalRevenue: 0,
}
);
Expand All @@ -74,23 +77,23 @@ async function getChainStats({ graphUrl, timestamp }: IGetChainStatsParams) {
(acc, market) => {
return {
dailyNotionalVolume: acc.dailyNotionalVolume + Number(market.volume),
dailyPremiumVolume: acc.dailyPremiumVolume + Number(market.premium),
dailyFees: acc.dailyFees + Number(market.premium),
Copy link
Contributor

Choose a reason for hiding this comment

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

for options we can't include premium on fees

Copy link
Author

@Aercwarden Aercwarden Mar 9, 2024

Choose a reason for hiding this comment

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

Oh okay! Can you suggest how can we show premiums as premiums and not as premium volume (which is only visible on a graph). premiums should be shown in the side bars as well along with fees, revenue etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

image you mean rev 24h, it is wrong file is should be 24h premiums data we will fix

Copy link
Author

Choose a reason for hiding this comment

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

Yes, 24h revenue should show as premiums 24h. anyways I've updated the code to show only revenue and not fees since they're the same data :)

Copy link
Author

Choose a reason for hiding this comment

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

image

premiums should show here on the left panel too

Copy link
Contributor

Choose a reason for hiding this comment

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

no fees is only add on fees when user buy option premium is not fees

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, 24h revenue should show as premiums 24h. anyways I've updated the code to show only revenue and not fees since they're the same data :)

if you need update fees/rev plz set at field dailyFees, dailyRevenue
now current adapter set fees = rev then show fees = rev premiums is show only options page

Copy link
Author

@Aercwarden Aercwarden Mar 11, 2024

Choose a reason for hiding this comment

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

If that's the case, no change has to be made and this PR can be closed. Our only concern is premiums not showing in main options page or anywhere except in just the bar graph as premium volume which as you mentioned will be fixed :)

Copy link
Contributor

Choose a reason for hiding this comment

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

yes will take look why option is show daily rev instead daily premium

Copy link
Author

Choose a reason for hiding this comment

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

Hey! updated the PR to just show more stats as per teams feedback :) please review

dailyRevenue: acc.dailyRevenue + Number(market.fees),
};
},
{
dailyNotionalVolume: 0,
dailyPremiumVolume: 0,
dailyFees: 0,
dailyRevenue: 0,
}
);

return {
timestamp,
totalPremiumVolume: cumulative.totalFees,
dailyPremiumVolume: daily.dailyFees,
...cumulative,
totalFees: cumulative.totalRevenue,
...daily,
Copy link
Contributor

Choose a reason for hiding this comment

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

fees is require dailyFees we can't list without dailyFees

Copy link
Author

@Aercwarden Aercwarden Jun 23, 2024

Choose a reason for hiding this comment

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

In our context, this will be protocol fees + premium?

dailyFees = daily protocol fees + daily premium?

when a user purchases options on stryke they pay premium + protocol fees

image

dailyFees: daily.dailyRevenue,
};
}

Expand Down
Loading