From 6506b4f238c27325e767b6975a5c002fa513c2fd Mon Sep 17 00:00:00 2001 From: Cameron Yick Date: Fri, 1 Sep 2017 09:42:30 -0400 Subject: [PATCH] Deprecate documentation + tests + code for mutual funds metrics --- README.rst | 9 +-------- docs/index.rst | 1 - docs/usage.rst | 7 ------- tests/test_tiingo.py | 43 ------------------------------------------- tiingo/api.py | 32 -------------------------------- 5 files changed, 1 insertion(+), 91 deletions(-) diff --git a/README.rst b/README.rst index 9084735..f4f7eb3 100644 --- a/README.rst +++ b/README.rst @@ -26,7 +26,6 @@ Tiingo Python Tiingo is a financial data platform that makes high quality financial tools available to all. They have a RESTful and Real-Time Data API. Presently, the API includes support for the following endpoints: * Stock Market Ticker Closing Prices + Metadata. Data includes full distribution details and is validated using a proprietary EOD Price Engine. -* Mutual Funds Metadata + Metrics updated daily. Supports over 26,500 Mutual Funds and ETFs. * (Coming Soon): Curated news from top financial news sources + curated blogs. Stories are tagged by Tiingo's algorithms. @@ -77,13 +76,6 @@ Now you can use ``TiingoClient`` to make your API calls. (Other parameters are a # Get latest prices, based on 3+ sources, as CSV or JSON, sampled weekly ticker_price = client.get_ticker_price("GOOGL", frequency="weekly") - # WARNING: These will only work if your account has access to the - # Mutual Funds portion of the API. - # Get mutual fund metadata - fund_metadata = client.get_fund_metadata("VFINX") - # Get mutual fund Expenses and Shareholder Fee Data for June 2017 - fund_metrics = client.get_fund_metrics("VFINX", "2017-06-01", "2017-06-30") - # Get news articles about given tickers or search terms from given domains # Coming soon! @@ -98,6 +90,7 @@ Features -------- * Easy programmatic access to Tiingo API +# Ability to reuse session across API calls for better performance * Coming soon: * Client-side validation of tickers, to save your API calls! * Data validation of returned responses diff --git a/docs/index.rst b/docs/index.rst index f063429..2992630 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -37,7 +37,6 @@ Contents: Tiingo is a financial data platform that makes high quality financial tools available to all. They have a RESTful and Real-Time Data API. Presently, the API includes support for the following endpoints: * Stock Market Ticker Closing Prices + Metadata. Data includes full distribution details and is validated using a proprietary EOD Price Engine. -* Mutual Funds Metadata + Metrics updated daily. Supports over 26,500 Mutual Funds and ETFs. * (Coming Soon): Curated news from top financial news sources + curated blogs. Stories are tagged by Tiingo's algorithms. diff --git a/docs/usage.rst b/docs/usage.rst index 515ea8e..e7ff075 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -43,13 +43,6 @@ Now you can use ``TiingoClient`` to make your API calls. (Other parameters are a # Get latest prices, based on 3+ sources, as CSV or JSON, sampled weekly ticker_price = client.get_ticker_price("GOOGL", frequency="weekly") - # WARNING: These will only work if your account has access to the - # Mutual Funds portion of the API. - # Get mutual fund metadata - fund_metadata = client.get_fund_metadata("VFINX") - # Get mutual fund Expenses and Shareholder Fee Data for June 2017 - fund_metrics = client.get_fund_metrics("VFINX", "2017-06-01", "2017-06-30") - # Get news articles about given tickers or search terms from given domains # Coming soon! diff --git a/tests/test_tiingo.py b/tests/test_tiingo.py index 4181f5c..dc83494 100644 --- a/tests/test_tiingo.py +++ b/tests/test_tiingo.py @@ -20,20 +20,6 @@ from tiingo.restclient import RestClientError # Expand test coverage -@pytest.fixture -def fund_metadata_response(): - """Test /tiingo/ endpoint""" - t = TiingoClient() - return t.get_fund_metadata("vfinx") - - -@pytest.fixture -def fund_metrics_response(): - """Test /tiingo/ endpoint""" - t = TiingoClient() - return t.get_fund_metrics("VFINX") - - def test_client_repr(): """Test representation of client when logged to console""" client = TiingoClient() @@ -84,35 +70,6 @@ class TestTickerPrices(TestCase): response = self._client.list_tickers() assert not response - -# FUND ENDPOINTS -# tiingo/funds -# Try to get a working API key from Tiingo development for testing purposes - -class TestMutualFunds(TestCase): - - def setUp(self): - self._client = TiingoClient() - self._metadata_response = self._client.get_fund_metrics('VFINX') - self._metrics_response = \ - self._client.get_fund_metrics('VFINX', - startDate="2012-1-1", - endDate="2016-1-1") - - @pytest.mark.skip(reason="My API key doesn't have access to mutual funds API") - def test_fund_metadata(self, fund_metadata_response): - """Refactor this with python data schemavalidation""" - assert fund_metadata_response.get('ticker') == "vfinx" - assert fund_metadata_response.get("shareClass", startDate="2012-1-1", - endDate="2016-1-1") - - @pytest.mark.skip(reason="My API key doesn't have access to mutual funds API") - def test_fund_metrics(self, fund_metrics_response): - """Test Fund Level Metrics""" - assert len(fund_metrics_response) > 0 - assert fund_metrics_response[0].get('managementFee') - - # News Feed # tiingo/news class TestNews(TestCase): diff --git a/tiingo/api.py b/tiingo/api.py index 5b4c000..1385d84 100644 --- a/tiingo/api.py +++ b/tiingo/api.py @@ -87,38 +87,6 @@ class TiingoClient(RestClient): else: return response.content.decode("utf-8") - # FUND DATA (From over 26,000 mutual funds) - # https://api.tiingo.com/docs/tiingo/funds - # TODO: Validate the models returned by the fund - def get_fund_metadata(self, fund): - """Return metadata for 1 mutual fund / ETF - - Args: - fund (string): Unique identifier for fund/ETF - """ - url = "tiingo/funds/{}".format(fund) - response = self._request('GET', url) - return response.json() - - def get_fund_metrics(self, fund, startDate=None, endDate=None): - """Return metrics about a fund. If no date provided, - return latest metrics. - Args: - fund (string): Unique identifier for fund/ETF - startDate (string): Start of fund range in YYYY-MM-DD format - endDate (string): End of fund range in YYYY-MM-DD format - """ - url = "tiingo/funds/{}/metrics".format(fund) - params = {} - - if startDate: - params['startDate'] = startDate - if endDate: - params['endDate'] = endDate - - response = self._request('GET', url, params=params) - return response.json() - # NEWS FEEDS # tiingo/news def get_news(self, tickers=[], tags=[], sources=[], startDate=None,