Note deprecation of Coindesk Bitcoin Price Index source.

This commit is contained in:
Chris Berkhout 2022-11-24 15:29:39 +01:00
parent d6036c9d14
commit 3c290abb95

View file

@ -1,5 +1,6 @@
import dataclasses import dataclasses
import json import json
import logging
from decimal import Decimal from decimal import Decimal
import requests import requests
@ -19,6 +20,8 @@ class CoinDesk(BaseSource):
def description(self): def description(self):
return ( return (
"WARNING: This source is deprecated. Data stops at 2022-07-10.\n"
"The documentation URL now redirects to the main page.\n"
"An average of Bitcoin prices across leading global exchanges.\n" "An average of Bitcoin prices across leading global exchanges.\n"
"Powered by CoinDesk, https://www.coindesk.com/price/bitcoin" "Powered by CoinDesk, https://www.coindesk.com/price/bitcoin"
) )
@ -64,6 +67,8 @@ class CoinDesk(BaseSource):
return results return results
def fetch(self, series): def fetch(self, series):
logging.warning("This source is deprecated. Data stops at 2022-07-10.")
if series.base != "BTC" or series.quote in ["BTC", "XBT"]: if series.base != "BTC" or series.quote in ["BTC", "XBT"]:
# BTC is the only valid base. # BTC is the only valid base.
# BTC as the quote will return BTC/USD, which we don't want. # BTC as the quote will return BTC/USD, which we don't want.