Merge pull request #327 from hydrosquall/feature/add-news-parameter

[feature] Add news onlyWithTickers parameter
This commit is contained in:
Cameron Yick
2019-09-01 21:24:09 -04:00
committed by GitHub
3 changed files with 12 additions and 4 deletions

View File

@@ -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)
--------------------

View File

@@ -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",

View File

@@ -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()