I have a code that fetch usd prices of some currencies contract writted in file using…
- User
I have a code that fetch usd prices of some currencies contract writted in file using geckoterminal api, geckoterminal allow 30 addresses in one api call, but i found that geckotetminal dont confirm liquidity when giving prices, i want yo use defillama free coins prices api because defillama promise they check for true price and if they cant they will add new a 'confidence' value for how much they confirm the price... Defillama api related doc: GET /prices/current/{coins} Get current prices of tokens by contract address The goal of this API is to price as many tokens as possible, including exotic ones that never get traded, which makes them impossible to price by looking at markets.
The base of our data are prices pulled from coingecko, which is then extended through multiple means:
We price all bridged tokens by using the price of the token in it's original chain, so we fetch all bridged versions of USDC on arbitrum, fantom, avax... and price all them using the price for the token on Ethereum, which we know. Right now we support 10 different bridging protocols.
We have multiple adapters to price specialized sets of tokens by running custom code:
We price yearn's yToken LPs by checking how much underlying token can be withdrawn for each LP
Aave, compound and euler LP tokens are also priced based on their relationship against underlying tokens
Uniswap, curve, balancer and stargate LPs are priced using the underlying tokens in each pair
GMX's GLP token is priced based on the value of tokens given on withdrawal (which includes calculations based on trader's PnL)
Synthetix tokens are priced using forex prices of the coin they are pegged to
For tokens that we haven't been able to price in any other way, we find the pool with most liquidity for each on uniswap, curve and serum and then use the prices provided on those exchanges.
Unlike all the other tokens, we can't confirm that these prices are correct, so we only ingest the ones that have sufficient liquidity and, even in that case, we attach a confidence value to them that is related to the depth of liquidity and which represents our confidence in the quality of each price. API consumers can choose to filter out prices with low confidence values.
Our API server is fully open source and we are constantly adding more pricing adapters, extending the amount of tokens we support.
Tokens are queried using {chain}:{address}, where chain is an identifier such as ethereum, bsc, polygon, avax... You can also get tokens by coingecko id by setting coingecko as the chain, eg: coingecko:ethereum, coingecko:bitcoin. Examples:
ethereum:0xdF574c24545E5FfEcb9a659c229253D4111d87e1 bsc:0x762539b45a1dcce3d36d080f74d1aed37844b878 coingecko:ethereum arbitrum:0x4277f8f2c384827b5273592ff7cebd9f2c1ac258 Parameters Name Description coins * string (path) set of comma-separated tokens defined as {chain}:{address}
- Assistant