Skip to content

Commit

Permalink
Merge pull request #10 from OpenBB-finance/feature/openbb-sdk-v4
Browse files Browse the repository at this point in the history
Feature/openbb sdk v4
  • Loading branch information
AdiSai authored Oct 31, 2023
2 parents 99adb07 + 4b4cd9a commit 4564b52
Show file tree
Hide file tree
Showing 69 changed files with 64,216 additions and 4,353 deletions.
1 change: 1 addition & 0 deletions openbb_platform/dev_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
openbb-fred = { path = "./providers/fred", develop = true }
openbb-intrinio = { path = "./providers/intrinio", develop = true }
openbb-polygon = { path = "./providers/polygon", develop = true }
openbb-wsj = { path = "./providers/wsj", develop = true }
openbb-tradingeconomics = { path = "./providers/tradingeconomics", develop = true }
openbb-oecd = { path = "./providers/oecd", develop = true }
openbb-sec = { path = "./providers/sec", develop = true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,15 +499,18 @@ def test_economy_gdpforecast(params, headers):
"provider": "tradingeconomics",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
"country": "portugal",
"group": "gdp",
"importance": "Low",
"country": "mexico,sweden",
}
)
),
(
{
"provider": "fmp",
}
),
],
)
@pytest.mark.integration
def test_economy_econcal(params, headers):
def test_economy_calendar(params, headers):
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,15 +437,19 @@ def test_economy_gdpforecast(params, obb):
{
"start_date": "2023-01-01",
"end_date": "2023-06-06",
"country": "portugal",
"importance": "Low",
"group": "gdp",
"country": "mexico,sweden",
"provider": "tradingeconomics",
}
),
(
{
"provider": "fmp",
}
),
],
)
@pytest.mark.integration
def test_economy_econcal(params, obb):
def test_economy_calendar(params, obb):
params = {p: v for p, v in params.items() if v}

result = obb.economy.econcal(**params)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@ def gdpforecast(


@router.command(model="EconomicCalendar")
def econcal(
def calendar(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject[BaseModel]:
"""GDP Data."""
"""Economic Calendar."""
return OBBject(results=Query(**locals()).execute())
143 changes: 142 additions & 1 deletion openbb_platform/extensions/etf/integration/test_etf_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ def headers():

@pytest.mark.parametrize(
"params",
[({"query": None, "provider": "fmp"})],
[
({"query": "", "provider": "fmp"}),
],
)
@pytest.mark.integration
def test_etf_search(params, headers):
Expand Down Expand Up @@ -65,6 +67,100 @@ def test_etf_historical(params, headers):
assert result.status_code == 200


@pytest.mark.parametrize(
"params",
[
({"symbol": "IOO", "provider": "fmp"}),
({"symbol": "MISL", "provider": "fmp"}),
],
)
@pytest.mark.integration
def test_etf_info(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/etf/info?{query_str}"
result = requests.get(url, headers=headers, timeout=10)
assert isinstance(result, requests.Response)
assert result.status_code == 200


@pytest.mark.parametrize(
"params",
[
({"symbol": "IOO", "provider": "fmp"}),
({"symbol": "MISL", "provider": "fmp"}),
],
)
@pytest.mark.integration
def test_etf_sectors(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/etf/sectors?{query_str}"
result = requests.get(url, headers=headers, timeout=10)
assert isinstance(result, requests.Response)
assert result.status_code == 200


@pytest.mark.parametrize(
"params",
[
(
{
"symbol": "IOO",
"date": "2023-01-01",
"cik": None,
"provider": "fmp",
}
),
(
{
"symbol": "SPY",
"date": "2023-04-20",
"cik": None,
"provider": "fmp",
}
),
(
{
"symbol": "MISL",
"date": "2023-04-20",
"cik": "0001329377",
"provider": "fmp",
}
),
],
)
@pytest.mark.integration
def test_etf_holdings(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/etf/holdings?{query_str}"
result = requests.get(url, headers=headers, timeout=10)
assert isinstance(result, requests.Response)
assert result.status_code == 200


@pytest.mark.parametrize(
"params",
[
({"symbol": "IOO"}),
({"symbol": "MISL", "cik": None, "provider": "fmp"}),
],
)
@pytest.mark.integration
def test_etf_holdings_date(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/etf/holdings_date?{query_str}"
result = requests.get(url, headers=headers, timeout=10)
assert isinstance(result, requests.Response)
assert result.status_code == 200


@pytest.mark.parametrize(
"params",
[({"symbol": "SPY,VOO,QQQ,IWM,IWN,GOVT,JNK", "provider": "fmp"})],
Expand All @@ -78,3 +174,48 @@ def test_etf_price_performance(params, headers):
result = requests.get(url, headers=headers, timeout=10)
assert isinstance(result, requests.Response)
assert result.status_code == 200


@pytest.mark.parametrize(
"params",
[({"sort": "desc", "limit": 10, "provider": "wsj"})],
)
@pytest.mark.integration
def test_etf_disc_gainers(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/stocks/disc/gainers?{query_str}"
result = requests.get(url, headers=headers, timeout=10)
assert isinstance(result, requests.Response)
assert result.status_code == 200


@pytest.mark.parametrize(
"params",
[({"sort": "desc", "limit": 10, "provider": "wsj"})],
)
@pytest.mark.integration
def test_etf_disc_losers(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/stocks/disc/losers?{query_str}"
result = requests.get(url, headers=headers, timeout=10)
assert isinstance(result, requests.Response)
assert result.status_code == 200


@pytest.mark.parametrize(
"params",
[({"sort": "desc", "limit": 10, "provider": "wsj"})],
)
@pytest.mark.integration
def test_etf_disc_active(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/stocks/disc/active?{query_str}"
result = requests.get(url, headers=headers, timeout=10)
assert isinstance(result, requests.Response)
assert result.status_code == 200
132 changes: 132 additions & 0 deletions openbb_platform/extensions/etf/integration/test_etf_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,96 @@ def test_etf_historical(params, obb):
assert len(result.results) > 0


@pytest.mark.parametrize(
"params",
[
({"symbol": "IOO", "provider": "fmp"}),
({"symbol": "MISL", "provider": "fmp"}),
],
)
@pytest.mark.integration
def test_etf_info(params, obb):
params = {p: v for p, v in params.items() if v}

result = obb.etf.info(**params)
assert result
assert isinstance(result, OBBject)
assert len(result.results) > 0


@pytest.mark.parametrize(
"params",
[
({"symbol": "IOO", "provider": "fmp"}),
({"symbol": "MISL", "provider": "fmp"}),
],
)
@pytest.mark.integration
def test_etf_sectors(params, obb):
params = {p: v for p, v in params.items() if v}

result = obb.etf.sectors(**params)
assert result
assert isinstance(result, OBBject)
assert len(result.results) > 0


@pytest.mark.parametrize(
"params",
[
(
{
"symbol": "IOO",
"date": "2023-01-01",
"cik": None,
"provider": "fmp",
}
),
(
{
"symbol": "SPY",
"date": "2023-04-20",
"cik": None,
"provider": "fmp",
}
),
(
{
"symbol": "MISL",
"date": "2023-04-20",
"cik": "0001329377",
"provider": "fmp",
}
),
],
)
@pytest.mark.integration
def test_etf_holdings(params, obb):
params = {p: v for p, v in params.items() if v}

result = obb.etf.holdings(**params)
assert result
assert isinstance(result, OBBject)
assert len(result.results) > 0


@pytest.mark.parametrize(
"params",
[
({"symbol": "IOO"}),
({"symbol": "MISL", "cik": None, "provider": "fmp"}),
],
)
@pytest.mark.integration
def test_etf_holdings_date(params, obb):
params = {p: v for p, v in params.items() if v}

result = obb.etf.holdings_date(**params)
assert result
assert isinstance(result, OBBject)
assert len(result.results) > 0


@pytest.mark.parametrize(
"params",
[({"symbol": "SPY,VOO,QQQ,IWM,IWN,GOVT,JNK", "provider": "fmp"})],
Expand All @@ -75,3 +165,45 @@ def test_etf_price_performance(params, obb):
assert result
assert isinstance(result, OBBject)
assert len(result.results) > 0


@pytest.mark.parametrize(
"params",
[({"sort": "desc", "limit": 10})],
)
@pytest.mark.integration
def test_etf_disc_gainers(params, obb):
params = {p: v for p, v in params.items() if v}

result = obb.stocks.disc.gainers(**params)
assert result
assert isinstance(result, OBBject)
assert len(result.results) > 0


@pytest.mark.parametrize(
"params",
[({"sort": "desc", "limit": 10})],
)
@pytest.mark.integration
def test_etf_disc_losers(params, obb):
params = {p: v for p, v in params.items() if v}

result = obb.stocks.disc.losers(**params)
assert result
assert isinstance(result, OBBject)
assert len(result.results) > 0


@pytest.mark.parametrize(
"params",
[({"sort": "desc", "limit": 10})],
)
@pytest.mark.integration
def test_etf_disc_active(params, obb):
params = {p: v for p, v in params.items() if v}

result = obb.stocks.disc.active(**params)
assert result
assert isinstance(result, OBBject)
assert len(result.results) > 0
Empty file.
Loading

0 comments on commit 4564b52

Please sign in to comment.