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

Inconsistent token price from CryptoCompare API #5055

Open
nicky-ru opened this issue Dec 11, 2024 · 0 comments
Open

Inconsistent token price from CryptoCompare API #5055

nicky-ru opened this issue Dec 11, 2024 · 0 comments

Comments

@nicky-ru
Copy link

Issue

We noticed inconsistent token price for IOTX (and possibly for other tokens) when using the CryptoCompare API. The returned price via the direct IOTX/USD trading pair is outdated, resulting in incorrect token price information being displayed in MetaMask. The current API at the time of opening the issue returns a price of $0.056, whereas the accurate price should be $0.045.

Cause

The issue arises because the CryptoCompare API's direct IOTX/USD trading pair is not up-to-date. The returned price is sourced from a limited set of markets that no longer reflect current market data. This leads to discrepancies in the displayed price.

Proposed Solutions

  1. Use the CADLI Index: (recommended by CCData team after reaching out to their support team)
    To resolve the outdated price issue, we can switch to CryptoCompare's new CADLI index. CADLI consolidates all available markets for a given cryptocurrency and returns a 24-hour volume-weighted average USD price.

  2. Update the API Call:
    Instead of querying the direct pairs, use the following API endpoint to get the updated token price:

    https://data-api.cryptocompare.com/index/cc/v1/latest/tick?market=cadli&instruments=ETH-USD&apply_mapping=true&groups=VALUE
    

    which also supports fetching prices directly for multiple tokens:

    https://data-api.cryptocompare.com/index/cc/v1/latest/tick?market=cadli&instruments=ETH-USD,IOTX-USD&apply_mapping=true&groups=VALUE
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants