diff --git a/HISTORY.rst b/HISTORY.rst index 68291c2..d4078df 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -2,9 +2,14 @@ History ======= +0.12.x (2019-09-XX) +-------------------- +* Update me with new features! + 0.11.x (2019-09-XX) -------------------- -* [/news] Internally rename sources parameter to "source", ensure lists are passed as comma separated values +* [/news] Internally rename sources parameter to "source", ensure lists are passed as comma separated values #325. Non-breaking external change. +* [/news] Add new URL parameter for "onlyWithTickers" #327 0.10.x (2019-05-11) -------------------- diff --git a/tests/fixtures/news.yaml b/tests/fixtures/news.yaml index 6181501..f691ec5 100644 --- a/tests/fixtures/news.yaml +++ b/tests/fixtures/news.yaml @@ -9,7 +9,7 @@ interactions: Content-Type: [application/json] User-Agent: [tiingo-python-client 0.11.0] method: GET - uri: https://api.tiingo.com/tiingo/news?limit=1&offset=0&sortBy=publishedDate&tickers=aapl&tickers=googl&source=cnbc.com,altcointoday.com&tags=Technology&tags=Bitcoin&startDate=2016-01-01&endDate=2017-08-31 + uri: https://api.tiingo.com/tiingo/news?limit=1&offset=0&sortBy=publishedDate&tickers=aapl&tickers=googl&source=cnbc.com,altcointoday.com&tags=Technology&tags=Bitcoin&startDate=2016-01-01&endDate=2017-08-31&onlyWithTickers=False response: body: {string: '[{ "publishedDate": "2016-01-11T23:13:00Z", diff --git a/tiingo/api.py b/tiingo/api.py index 0cf9fbb..f02023a 100644 --- a/tiingo/api.py +++ b/tiingo/api.py @@ -278,6 +278,7 @@ class TiingoClient(RestClient): # tiingo/news def get_news(self, tickers=[], tags=[], sources=[], startDate=None, endDate=None, limit=100, offset=0, sortBy="publishedDate", + onlyWithTickers=False, fmt='json'): """Return list of news articles matching given search terms https://api.tiingo.com/docs/tiingo/news @@ -291,7 +292,8 @@ class TiingoClient(RestClient): startDate, endDate [date]: Boundaries of news search window limit (int): Max results returned. Default 100, max 1000 offset (int): Search results offset, used for paginating - sortBy (string): "publishedDate" OR (#TODO: UPDATE THIS) + sortBy (string): "publishedDate" OR "crawlDate", descending + onlyWithTickers (bool): If true, only links with tagged tickers will return. """ url = "tiingo/news" params = { @@ -302,7 +304,8 @@ class TiingoClient(RestClient): 'source': (",").join(sources), 'tags': tags, 'startDate': startDate, - 'endDate': endDate + 'endDate': endDate, + 'onlyWithTickers': onlyWithTickers } response = self._request('GET', url, params=params) data = response.json()