yahoo: add back null handling, improve timestamp handling.
Thanks @arkn98!
This commit is contained in:
parent
b6f4c17530
commit
ee8ca0573d
2 changed files with 25 additions and 4 deletions
|
@ -54,6 +54,13 @@ def long_ok(requests_mock):
|
|||
yield requests_mock
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def with_null_ok(requests_mock):
|
||||
json = (Path(os.path.splitext(__file__)[0]) / "inrx-with-null.json").read_text()
|
||||
requests_mock.add(responses.GET, url("INR=X"), body=json, status=200)
|
||||
yield requests_mock
|
||||
|
||||
|
||||
def test_normalizesymbol(src):
|
||||
assert src.normalizesymbol("tsla") == "TSLA"
|
||||
|
||||
|
@ -157,6 +164,13 @@ def test_fetch_from_before_start(src, type, long_ok):
|
|||
assert len(series.prices) > 9
|
||||
|
||||
|
||||
def test_fetch_skips_dates_with_nulls(src, type, with_null_ok):
|
||||
series = src.fetch(Series("INR=X", "", type, "2017-07-10", "2017-07-12"))
|
||||
assert series.prices[0] == Price("2017-07-10", Decimal("64.61170196533203125"))
|
||||
assert series.prices[1] == Price("2017-07-12", Decimal("64.52559661865234375"))
|
||||
assert len(series.prices) == 2
|
||||
|
||||
|
||||
def test_fetch_to_future(src, type, recent_ok):
|
||||
series = src.fetch(Series("TSLA", "", type, "2021-01-04", "2100-01-08"))
|
||||
assert len(series.prices) > 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue