Repository navigation
Fall back to Chainlink feeds for BTC/ETH when CoinGecko refuses - #112
Merged
Merged
Conversation
CoinGecko's keyless /api/v3/simple/price now answers every caller with a CloudFront 403 HTML page (/ping still answers 200), which took down the crypto_price tool, BTC/ETH price alerts and ether's USD value in wallet and portfolio answers. Read the Chainlink BTC/USD (0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c) and ETH/USD (0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419) mainnet feeds through the existing Infura node: one constant Multicall3 eth_call of decimals() and latestRoundData() for both feeds. Quote time is updatedAt; a reading past the one-hour heartbeat plus five minutes is marked stale, and price alerts treat it as no reading. CoinGecko is asked first only when the new optional COINGECKO_API_KEY is set (Demo plan, x-cg-demo-api-key header, redacted from logs); otherwise, and on any CoinGecko failure, Chainlink answers. Without an Infura key CoinGecko is asked as before. The price tool, price alerts and wallet/ portfolio ether pricing share the order, the clock and the edges' transport. When every source fails nothing is substituted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Outage
Since 2026-09-29 CoinGecko's keyless
https://api.coingecko.com/api/v3/simple/priceanswers HTTP 403 with a CloudFront HTML page ("The request could not be satisfied … Request blocked") to every caller: the production server, a dev laptop and GitHub runners./api/v3/pingstill answers 200. CoinGecko was the only BTC/ETH source, somarket_crypto:crypto_price, BTC/ETH price alerts, and ether's USD value in wallet answers (and in portfolios when the Aave oracle does not answer) were all down.Fix
0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88cand ETH/USD0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419on Ethereum mainnet, verified on chain (description()= "BTC / USD" / "ETH / USD",decimals()= 8). Read through the existing Infura node as one constant Multicall3eth_call(decimals()+latestRoundData()for both feeds). Quote time =updatedAt; older than the 1 h heartbeat + 5 min is marked stale in the time line, and a stale reading is no reading for an alert. Source label "Chainlink"; figures rounded to the cent.COINGECKO_API_KEY(SecretStr, Demo plan, sent asx-cg-demo-api-key, redacted from logs); otherwise, or on any CoinGecko failure (HTTP error, 403/429, non-JSON, missing price), Chainlink. WithoutINFURA_KEYCoinGecko is asked as before.Edges. If every source fails, the existing "no current figure" behaviour holds.Edges.http_transport; the feed read is constant and reaches onlymainnet.infura.io, which the crypto server's declared target now lists. Closed vocabulary unchanged.COINGECKO_API_KEYdeclared forbotindocker-compose.yml; README,docs/deploy-coolify.md,docs/operations.mdupdated. OpenSpec: newfix-crypto-price-fallbackchange;add-alert-kindsscenario adjusted.Tests
tests/unit/test_crypto_price_fallback.py): CloudFront 403 regression, fallback on 429/500/HTML/missing price/timeout, keyless skips CoinGecko, key header only when set and never in the URL, neither key logged, both sources down, constant feed request, decimals scaling, round validation, stale boundary and wording, alerts (Chainlink source, stale → failed read), wallet pricing, declared hosts.tests/integration/test_chainlink_live.py, skips withoutINFURA_KEY): feed description/decimals, fresh BTC/ETH readings, price tool answering from Chainlink.