From d22596842586a04667526b4310dbdc34f1e510e7 Mon Sep 17 00:00:00 2001 From: Zapata Date: Mon, 14 May 2018 17:09:57 +0200 Subject: [PATCH] Remove Yahoo Finance source as it has been shutdown. --- bitshares_pricefeed/sources/__init__.py | 1 - bitshares_pricefeed/sources/yahoo.py | 30 ------------------------- 2 files changed, 31 deletions(-) delete mode 100644 bitshares_pricefeed/sources/yahoo.py diff --git a/bitshares_pricefeed/sources/__init__.py b/bitshares_pricefeed/sources/__init__.py index 2d6b5be..b38500e 100644 --- a/bitshares_pricefeed/sources/__init__.py +++ b/bitshares_pricefeed/sources/__init__.py @@ -17,7 +17,6 @@ from .openexchangerate import OpenExchangeRates from .poloniex import Poloniex from .quandl import Quandl -from .yahoo import Yahoo from .yunbi import Yunbi from .bitstamp import Bitstamp from .aex import Aex diff --git a/bitshares_pricefeed/sources/yahoo.py b/bitshares_pricefeed/sources/yahoo.py deleted file mode 100644 index 9656b87..0000000 --- a/bitshares_pricefeed/sources/yahoo.py +++ /dev/null @@ -1,30 +0,0 @@ -import csv -import json -import requests -from . import FeedSource, _request_headers - - -class Yahoo(FeedSource): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - def _fetch(self): - feed = {} - try: - # Currencies and commodities - for base in self.bases: - feed[base] = {} - yahooAssets = ",".join([a + base + "=X" for a in self.quotes]) - url = "http://download.finance.yahoo.com/d/quotes.csv" - params = {'s': yahooAssets, 'f': 'l1', 'e': '.csv'} - response = requests.get(url=url, headers=_request_headers, timeout=self.timeout, params=params) - yahooprices = response.text.replace('\r', '').split('\n') - for i, quote in enumerate(self.quotes): - if float(yahooprices[i]) > 0: - if hasattr(self, "quoteNames") and quote in self.quoteNames: - quote = self.quoteNames[quote] - feed[base][quote] = {"price": (float(yahooprices[i])), - "volume": 1.0} - except Exception as e: - raise Exception("\nError fetching results from {1}! ({0})".format(str(e), type(self).__name__)) - return feed