From 87246485d5206f0bf4cc6df9049b1bc07d7f68d1 Mon Sep 17 00:00:00 2001 From: Cameron Yick Date: Sun, 10 Sep 2017 22:27:51 -0400 Subject: [PATCH] Stub News Tickers Endpoint Implementation Remain commented out until we have time to provide mocked HTTP server response. --- tiingo/api.py | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/tiingo/api.py b/tiingo/api.py index 1385d84..4acd22f 100644 --- a/tiingo/api.py +++ b/tiingo/api.py @@ -92,9 +92,10 @@ class TiingoClient(RestClient): def get_news(self, tickers=[], tags=[], sources=[], startDate=None, endDate=None, limit=100, offset=0, sortBy="publishedDate"): """Return list of news articles matching given search terms - https://api.tiingo.com/docs/tiingo/news + # If no tickers provided, just searches general tickers + Args: tickers [string] : List of unique Stock Tickers to search tags [string] : List of topics tagged by Tiingo Algorithms @@ -104,9 +105,27 @@ class TiingoClient(RestClient): offset (int): Search results offset, used for paginating sortBy (string): "publishedDate" OR (#TODO: UPDATE THIS) """ - # params = {} + # url = "tiingo/news" + # params = { + # 'limit': limit, + # 'offset': offset, + # 'sortBy': sortBy + # } + # # TBD: whether these commas are necessary if just pass list instead # if tickers: - # tickers = ",".join(tickers) + # params['tickers'] = ",".join(tickers) + # if tags: + # params['tags'] = ",".join(tags) + # if sources: + # params['sources'] = ",".join(sources) + + # if startDate: + # params['startDate'] = startDate + # if endDate: + # params['endDate'] = endDate + + # response = self._request('GET', url, params=params) + # return response.json() raise NotImplementedError def get_bulk_news(self, file_id=None):