Fix BtcConverter by migrating from decommissioned CoinDesk API to Coinbase#161
Open
LIGHTUNCHARGED wants to merge 1 commit into
Open
Fix BtcConverter by migrating from decommissioned CoinDesk API to Coinbase#161LIGHTUNCHARGED wants to merge 1 commit into
LIGHTUNCHARGED wants to merge 1 commit into
Conversation
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.
The CoinDesk Bitcoin Price Index (BPI) API domain (api.coindesk.com) has been completely decommissioned. As a result, every method inside the BtcConverter class currently fails, throwing urllib3.exceptions.NameResolutionError / DNS resolution failures.
This PR restores full functionality to BtcConverter by replacing the dead CoinDesk endpoints in forex_python/bitcoin.py with Coinbase's stable, public, and keyless API endpoints:
Real-time spot price endpoint: /v2/prices/BTC-{currency}/spot
Historical price endpoint (by date): /v2/prices/BTC-{currency}/spot?date={YYYY-MM-DD}
All internal class methods, historical queries, and conversions (supporting both float and Decimal response formats) have been thoroughly updated and are now fully functional.
Changes Checklist
[x] Swapped dead api.coindesk.com URLs with active api.coinbase.com endpoints.
[x] Parsed the updated JSON response schema structure from the Coinbase API.
[x] Verified compatibility with both standard float and exact Decimal data returns.
[x] Tested all historical date parsing methods locally.
You can verify the fix by running the following end-to-end test script against the modified branch. It exercises every core method available in the BtcConverter class: