diff --git a/tests/test_tiingo.py b/tests/test_tiingo.py index e238052..ed1cf8d 100644 --- a/tests/test_tiingo.py +++ b/tests/test_tiingo.py @@ -90,16 +90,19 @@ class TestNews(TestCase): def test_get_news_articles(self): """Confirm that news article work""" + NUM_ARTICLES = 10 + search_params = { "tickers": ["aapl", "googl"], "tags": ["Technology", "Bitcoin"], "startDate": "2016-01-01", "endDate": "2017-08-31", "sources": ['washingtonpost.com', 'altcointoday.com'], - "limit": 10 + "limit": NUM_ARTICLES } articles = self._client.get_news(**search_params) + assert len(articles) == NUM_ARTICLES for article in articles: assert all(key in article for key in self.article_keys) diff --git a/tiingo/api.py b/tiingo/api.py index 0019980..a41e5a9 100644 --- a/tiingo/api.py +++ b/tiingo/api.py @@ -109,22 +109,13 @@ class TiingoClient(RestClient): params = { 'limit': limit, 'offset': offset, - 'sortBy': sortBy + 'sortBy': sortBy, + 'tickers': tickers, + 'sources': sources, + 'tags': tags, + 'startDate': startDate, + 'endDate': endDate } - - # TBD: whether these commas are necessary if just pass list instead - if 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()