Files
OpenBB/tests/openbb_terminal/stocks/test_databento_model.py
James Maslek eea170bdda Adding databento as a source (#4293)
* First commit

* Baby steps

* Keys and sdk

* Fix import for api key

* Add SDK endpoints

* Test + api checks

* tests

* roque print of api key

* Changes

* minor

* custom timeout

* improve timeouts

---------

Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>
2023-02-24 10:33:45 -05:00

36 lines
901 B
Python

import pytest
from openbb_terminal.stocks import databento_model
@pytest.fixture(scope="module")
def vcr_config():
return {
"filter_headers": [
("User-Agent", None),
("Authorization", "MOCK_AUTHORIZATION"),
],
}
def test_databento_model():
"""Tests the DataBento model."""
model = databento_model.DataBento(
symbol="AAPL", start="2021-08-10", end="2021-08-11"
)
assert model.symbol == "AAPL"
assert model.exchange == "XNAS.ITCH"
assert model.stype == "native"
assert model.start == "2021-08-10"
assert model.end == "2021-08-11"
@pytest.mark.vcr
def test_stock_load(recorder):
"""Tests the stock load function."""
result = databento_model.get_historical_stock(
symbol="AAPL", start_date="2022-08-01", end_date="2022-12-01"
)
assert result.empty is False
recorder.capture(result)