Skip to content

Commit

Permalink
Expanding the fixedincome menu (#5655)
Browse files Browse the repository at this point in the history
* models and fetcher

* making the fetcher visible

* std model

* adding the command

* improvements to the models

* typo

* adding the command

* imrpovements to dwpcr

* standard model for ecb int rates

* adding the fetcher for fred

* standard model of ice bofa

* add ice_bofa command

* ruff

* ice bofa fetcher

* moody std model

* moody

* std model

* add cp command

* unused import

* cp

* spot

* ruff

* hqm

* tmc

* ffrmc

* tbffr

* ruff

* typing fixes

* buggy dates

* fred fetcher tests

* ruff

* adding ecb as a provider

* adding new provider related stuff

* adding the new command eu_ycvr

* models

* test for ecb fetcher

* Feature/v4 fixedincome int tests (#5661)

* integration tests

* happy ruff

* mini adjustment

* ruff

* typo

* verbose type

* fix tests

* docstrings everywhere and an happy pydocstyle

* fix tests
  • Loading branch information
hjoaquim authored Nov 6, 2023
1 parent d365d92 commit 537a6da
Show file tree
Hide file tree
Showing 68 changed files with 74,450 additions and 11 deletions.
1 change: 1 addition & 0 deletions openbb_platform/dev_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
openbb-quandl = { path = "./providers/quandl", optional = true, develop = true }
openbb-seeking-alpha = { path = "./providers/seeking_alpha", optional = true, develop = true }
openbb-yfinance = { path = "./providers/yfinance", optional = true, develop = true }
openbb-ecb = { path = "./providers/ecb", optional = true, develop = true }
openbb-charting = { path = "./extensions/charting", optional = true, develop = true }
openbb-futures = { path = "./extensions/futures", optional = true, develop = true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,229 @@ def test_fixedincome_iorb(params, headers):
result = requests.get(url, headers=headers, timeout=10)
assert isinstance(result, requests.Response)
assert result.status_code == 200


@pytest.mark.parametrize(
"params",
[
({"start_date": "2023-01-01", "end_date": "2023-06-06"}),
(
{
"parameter": "daily_excl_weekend",
"provider": "fred",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
}
),
],
)
@pytest.mark.integration
def test_fixedincome_dwpcr(params, headers):
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
url = f"http://0.0.0.0:8000/api/v1/fixedincome/dwpcr?{query_str}"
result = requests.get(url, headers=headers, timeout=10)
assert isinstance(result, requests.Response)
assert result.status_code == 200


@pytest.mark.parametrize(
"params",
[
(
{
"start_date": "2023-01-01",
"end_date": "2023-06-06",
"interest_rate_type": "lending",
}
)
],
)
@pytest.mark.integration
def test_fixedincome_ecb_interest_rates(params, headers):
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
url = f"http://0.0.0.0:8000/api/v1/fixedincome/ecb_interest_rates?{query_str}"
result = requests.get(url, headers=headers, timeout=10)
assert isinstance(result, requests.Response)
assert result.status_code == 200


@pytest.mark.parametrize(
"params",
[
({"start_date": "2023-01-01", "end_date": "2023-06-06", "index_type": "yield"}),
(
{
"category": "all",
"area": "us",
"grade": "non_sovereign",
"options": True,
"provider": "fred",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
"index_type": "yield",
}
),
],
)
@pytest.mark.integration
def test_fixedincome_ice_bofa(params, headers):
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
url = f"http://0.0.0.0:8000/api/v1/fixedincome/ice_bofa?{query_str}"
result = requests.get(url, headers=headers, timeout=10)
assert isinstance(result, requests.Response)
assert result.status_code == 200


@pytest.mark.parametrize(
"params",
[({"start_date": "2023-01-01", "end_date": "2023-06-06", "index_type": "aaa"})],
)
@pytest.mark.integration
def test_fixedincome_moody(params, headers):
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
url = f"http://0.0.0.0:8000/api/v1/fixedincome/moody?{query_str}"
result = requests.get(url, headers=headers, timeout=10)
assert isinstance(result, requests.Response)
assert result.status_code == 200


@pytest.mark.parametrize(
"params",
[
(
{
"start_date": "2023-01-01",
"end_date": "2023-06-06",
"maturity": "30d",
"category": "financial",
"grade": "aa",
}
)
],
)
@pytest.mark.integration
def test_fixedincome_cp(params, headers):
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
url = f"http://0.0.0.0:8000/api/v1/fixedincome/cp?{query_str}"
result = requests.get(url, headers=headers, timeout=10)
assert isinstance(result, requests.Response)
assert result.status_code == 200


@pytest.mark.parametrize(
"params",
[
(
{
"start_date": "2023-01-01",
"end_date": "2023-06-06",
"maturity": [10.0],
"category": ["spot_rate"],
}
)
],
)
@pytest.mark.integration
def test_fixedincome_spot(params, headers):
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
url = f"http://0.0.0.0:8000/api/v1/fixedincome/spot?{query_str}"
result = requests.get(url, headers=headers, timeout=10)
assert isinstance(result, requests.Response)
assert result.status_code == 200


@pytest.mark.parametrize(
"params",
[({"date": "2023-01-01", "yield_curve": ["spot"]})],
)
@pytest.mark.integration
def test_fixedincome_hqm(params, headers):
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
url = f"http://0.0.0.0:8000/api/v1/fixedincome/hqm?{query_str}"
result = requests.get(url, headers=headers, timeout=10)
assert isinstance(result, requests.Response)
assert result.status_code == 200


@pytest.mark.parametrize(
"params",
[({"start_date": "2023-01-01", "end_date": "2023-06-06", "maturity": "3m"})],
)
@pytest.mark.integration
def test_fixedincome_tmc(params, headers):
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
url = f"http://0.0.0.0:8000/api/v1/fixedincome/tmc?{query_str}"
result = requests.get(url, headers=headers, timeout=10)
assert isinstance(result, requests.Response)
assert result.status_code == 200


@pytest.mark.parametrize(
"params",
[({"start_date": "2023-01-01", "end_date": "2023-06-06", "maturity": "10y"})],
)
@pytest.mark.integration
def test_fixedincome_ffrmc(params, headers):
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
url = f"http://0.0.0.0:8000/api/v1/fixedincome/ffrmc?{query_str}"
result = requests.get(url, headers=headers, timeout=10)
assert isinstance(result, requests.Response)
assert result.status_code == 200


@pytest.mark.parametrize(
"params",
[({"start_date": "2023-01-01", "end_date": "2023-06-06", "maturity": "3m"})],
)
@pytest.mark.integration
def test_fixedincome_tbffr(params, headers):
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
url = f"http://0.0.0.0:8000/api/v1/fixedincome/tbffr?{query_str}"
result = requests.get(url, headers=headers, timeout=10)
assert isinstance(result, requests.Response)
assert result.status_code == 200


@pytest.mark.parametrize(
"params",
[
({"date": "2023-01-01", "yield_curve_type": "spot_rate"}),
(
{
"rating": "A",
"provider": "ecb",
"date": "2023-01-01",
"yield_curve_type": "spot_rate",
}
),
],
)
@pytest.mark.integration
def test_fixedincome_eu_ycrv(params, headers):
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
url = f"http://0.0.0.0:8000/api/v1/fixedincome/eu_ycrv?{query_str}"
result = requests.get(url, headers=headers, timeout=30)
assert isinstance(result, requests.Response)
assert result.status_code == 200
Loading

0 comments on commit 537a6da

Please sign in to comment.