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

Update price API #8

Open
HDauven opened this issue Jan 2, 2022 · 0 comments
Open

Update price API #8

HDauven opened this issue Jan 2, 2022 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@HDauven
Copy link
Member

HDauven commented Jan 2, 2022

The current price API used is the Uniswap V2 subgraph. The NII price is calculated based off of the Uniswap V2 Ethereum price in USDT and the NII/ETH pair ratio. Implementation details can be found here.

The code base could be simplified significantly by using the CoinGecko price API directly by retrieving the NII price in USDT.

CoinGecko API documentation can be found here.

A potential approach could be to call the following endpoint:
https://api.coingecko.com/api/v3/coins/nahmii?localization=%22EN%22&tickers=true&market_data=true&community_data=false&developer_data=false&sparkline=false

The resulting structure has the following data that might be relevant:

{
  ...
  "market_data": {
    "current_price": {
      ...
      "usd": 0.00692759,
      ...
    },
}

This USD value can be used to replace most of the code that currently lives in the thegraph-calls.js file.

@HDauven HDauven added enhancement New feature or request good first issue Good for newcomers labels Jan 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant