Add columns param to get_ticker_price, including tests

This commit is contained in:
Koen werklaptop
2024-10-23 21:27:02 +02:00
parent 80b40c5be5
commit 6b53725dca
5 changed files with 109 additions and 4 deletions

View File

@@ -114,6 +114,24 @@ class TestTiingoWithPython(TestCase):
frequency="30Min")
self.assertGreater(len(prices), 1)
@vcr.use_cassette('tests/fixtures/ticker_price_with_volume_column.yaml')
def test_get_dataframe_with_volume_column(self):
"""Confirm that CSV endpoint works"""
prices = self._client.get_dataframe("GOOGL",
columns="volume",
fmt='json')
assert len(prices) == 1
assert len(prices.columns) == 2
@vcr.use_cassette('tests/fixtures/ticker_price_with_multiple_columns.yaml')
def test_get_dataframe_with_multiple_columns(self):
"""Confirm that CSV endpoint works"""
prices = self._client.get_dataframe("GOOGL",
columns="open,high,low,close,volume",
fmt='json')
assert len(prices) == 1
assert len(prices.columns) == 6
def test_metric_name_column_error(self):
with self.assertRaises(APIColumnNameError):
self._client.get_dataframe(['GOOGL', 'AAPL'], startDate='2018-01-05',