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 synthetics API routes #5

Open
wants to merge 21 commits into
base: add-synthetics
Choose a base branch
from

Conversation

K-Lascar
Copy link
Collaborator

@K-Lascar K-Lascar commented Oct 18, 2024

Made several changes in accordance to the standards laid out in Coingecko: https://docs.google.com/document/d/1v27QFoQq1SKT3Priq3aqPgB70Xd_PnDzbOCiuoCyixw/edit?tab=t.0#heading=h.pama79xv4dlm

  • Added liquidity for all markets in USD.
  • Added all new synthetic tokens.
    -> This approach is currently static, any suggestions on improving this integration using the tokens API.
  • Filter daily volume in the subgraph endpoint.

Copy link

vercel bot commented Oct 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gmx-integration-api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 28, 2024 0:09am

// open: 1,
// close: 1,
// }
// }
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this change expected? if this function is no longer need maybe better to delete it?

// high: 1,
// low: 1,
// }
// }
Copy link
Collaborator

Choose a reason for hiding this comment

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

if this logic is not needed, let's remove this code


const callsByMarket = markets.reduce<Record<string, any>>((acc, market) => {
const longTokenPrice = prices[market.longToken];
const indexTokenPrice = market.indexToken === "0x0000000000000000000000000000000000000000" ? longTokenPrice : prices[market.indexToken];
Copy link
Collaborator

Choose a reason for hiding this comment

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

you can use AddressZero from constants.ts instead of "0x0000000000000000000000000000000000000000"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Understood, completed it now

indexTokenPrice,
longTokenPrice,
shortTokenPrice,
'0xab15365d3aa743e766355e2557c230d8f943e195dc84d9b2b05928a07b635ee1',
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's create a variable for this value to improve readability?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the suggestion added it into the configs

const result = results[index];
if (result && result.result) {
const gmPrice = (result.result[0] * BigInt(1000) / USD_DIVISOR);
const tokenPrice = Number(Number(gmPrice) / 1000);
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think just Number(gmPrice) / 1000 should work, no need to wrap in Number one more time

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hi @gdev8317, I receive an error if I do not double wrap Number(gmPrice), will keep this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants