mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-09 10:51:57 +00:00
Merge branch 'develop' into feature/more-async
This commit is contained in:
@@ -73,7 +73,9 @@ jobs:
|
||||
"intrinio_api_key": "${{ secrets.INTRINIO_API_KEY }}",
|
||||
"tradingeconomics_api_key": "${{ secrets.TRADINGECONOMICS_API_KEY }}",
|
||||
"quandl_api_key": "${{ secrets.QUANDL_API_KEY }}",
|
||||
"biztoc_api_key": "${{ secrets.BIZTOC_API_KEY }}"
|
||||
"biztoc_api_key": "${{ secrets.BIZTOC_API_KEY }}",
|
||||
"nasdaq_api_key": "${{ secrets.NASDAQ_API_KEY }}",
|
||||
"tiingo_token": "${{ secrets.TIINGO_TOKEN }}"
|
||||
}
|
||||
}' > ~/.openbb_platform/user_settings.json
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ def test_equity_calendar_splits(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/equity/calendar/split?{query_str}"
|
||||
url = f"http://0.0.0.0:8000/api/v1/equity/calendar/splits?{query_str}"
|
||||
result = requests.get(url, headers=headers, timeout=10)
|
||||
assert isinstance(result, requests.Response)
|
||||
assert result.status_code == 200
|
||||
@@ -445,7 +445,7 @@ def test_equity_ownership_institutional(params, headers):
|
||||
|
||||
query_str = get_querystring(params, [])
|
||||
url = f"http://0.0.0.0:8000/api/v1/equity/ownership/institutional?{query_str}"
|
||||
result = requests.get(url, headers=headers, timeout=10)
|
||||
result = requests.get(url, headers=headers, timeout=20)
|
||||
assert isinstance(result, requests.Response)
|
||||
assert result.status_code == 200
|
||||
|
||||
@@ -1273,17 +1273,6 @@ def test_equity_discovery_upcoming_release_days(params, headers):
|
||||
"provider": "fmp",
|
||||
}
|
||||
),
|
||||
(
|
||||
{
|
||||
"provider": "intrinio",
|
||||
"symbol": "AAPL",
|
||||
"thea_enabled": None,
|
||||
"start_date": "2023-11-06",
|
||||
"end_date": "2023-11-07",
|
||||
"limit": 50,
|
||||
"form_type": "10-Q",
|
||||
}
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
@@ -1310,7 +1299,7 @@ def test_equity_shorts_fails_to_deliver(params, headers):
|
||||
|
||||
query_str = get_querystring(params, [])
|
||||
url = f"http://0.0.0.0:8000/api/v1/equity/shorts/fails_to_deliver?{query_str}"
|
||||
result = requests.get(url, headers=headers, timeout=10)
|
||||
result = requests.get(url, headers=headers, timeout=20)
|
||||
assert isinstance(result, requests.Response)
|
||||
assert result.status_code == 200
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ def test_equity_calendar_dividend(params, obb):
|
||||
)
|
||||
@pytest.mark.integration
|
||||
def test_equity_calendar_splits(params, obb):
|
||||
result = obb.equity.calendar.split(**params)
|
||||
result = obb.equity.calendar.splits(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
@@ -477,7 +477,10 @@ def test_equity_fundamental_metrics(params, obb):
|
||||
result = obb.equity.fundamental.metrics(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
if isinstance(result.results, list):
|
||||
assert len(result.results) > 0
|
||||
else:
|
||||
assert result.results is not None
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@@ -505,6 +508,7 @@ def test_equity_fundamental_overview(params, obb):
|
||||
result = obb.equity.fundamental.overview(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert result.results is not None
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@@ -532,6 +536,7 @@ def test_equity_estimates_price_target(params, obb):
|
||||
result = obb.equity.estimates.price_target(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert result.results is not None
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@@ -543,6 +548,7 @@ def test_equity_estimates_consensus(params, obb):
|
||||
result = obb.equity.estimates.consensus(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert result.results is not None
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@@ -673,6 +679,7 @@ def test_equity_compare_peers(params, obb):
|
||||
result = obb.equity.compare.peers(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert result.results is not None
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@@ -941,7 +948,10 @@ def test_equity_fundamental_latest_attributes(params, obb):
|
||||
result = obb.equity.fundamental.latest_attributes(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
if isinstance(result.results, list):
|
||||
assert len(result.results) > 0
|
||||
else:
|
||||
assert result.results is not None
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@@ -1007,6 +1017,7 @@ def test_equity_price_quote(params, obb):
|
||||
result = obb.equity.price.quote(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert result.results is not None
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@@ -1021,7 +1032,10 @@ def test_equity_profile(params, obb):
|
||||
result = obb.equity.profile(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
if isinstance(result.results, list):
|
||||
assert len(result.results) > 0
|
||||
else:
|
||||
assert result.results is not None
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@@ -1187,17 +1201,6 @@ def test_equity_discovery_upcoming_release_days(params, obb):
|
||||
"provider": "fmp",
|
||||
}
|
||||
),
|
||||
(
|
||||
{
|
||||
"provider": "intrinio",
|
||||
"symbol": "AAPL",
|
||||
"thea_enabled": None,
|
||||
"start_date": "2023-11-06",
|
||||
"end_date": "2023-11-07",
|
||||
"limit": 50,
|
||||
"form_type": "10-Q",
|
||||
}
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
@@ -1207,7 +1210,10 @@ def test_equity_discovery_filings(params, obb):
|
||||
result = obb.equity.discovery.filings(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
if isinstance(result.results, list):
|
||||
assert len(result.results) > 0
|
||||
else:
|
||||
assert result.results is not None
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
||||
@@ -351,7 +351,7 @@ def test_fixedincome_corporate_spot_rates(params, headers):
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"params",
|
||||
[({"date": "2023-01-01", "yield_curve": ["spot"]})],
|
||||
[({"date": "2023-01-01", "yield_curve": "spot"})],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
def test_fixedincome_corporate_hqm(params, headers):
|
||||
|
||||
@@ -320,7 +320,7 @@ def test_fixedincome_corporate_spot_rates(params, obb):
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"params",
|
||||
[({"date": "2023-01-01", "yield_curve": ["spot"]})],
|
||||
[({"date": "2023-01-01", "yield_curve": "spot"})],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
def test_fixedincome_corporate_hqm(params, obb):
|
||||
|
||||
@@ -278,28 +278,3 @@ def test_index_sp500_multiples(params, headers):
|
||||
result = requests.get(url, headers=headers, timeout=20)
|
||||
assert isinstance(result, requests.Response)
|
||||
assert result.status_code == 200
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"params",
|
||||
[
|
||||
(
|
||||
{
|
||||
"symbol": "$GDP",
|
||||
"start_date": "2023-01-01",
|
||||
"end_date": "2023-06-06",
|
||||
"limit": 100,
|
||||
"provider": "nasdaq",
|
||||
}
|
||||
)
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
def test_index_fred(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/index/fred?{query_str}"
|
||||
result = requests.get(url, headers=headers, timeout=10)
|
||||
assert isinstance(result, requests.Response)
|
||||
assert result.status_code == 200
|
||||
|
||||
@@ -258,25 +258,3 @@ def test_index_sp500_multiples(params, obb):
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
assert len(result.results) > 0
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"params",
|
||||
[
|
||||
(
|
||||
{
|
||||
"symbol": "$GDP",
|
||||
"start_date": "2023-01-01",
|
||||
"end_date": "2023-06-06",
|
||||
"limit": 100,
|
||||
}
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
def test_index_fred(params, obb):
|
||||
result = obb.index.fred(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
|
||||
@@ -37,17 +37,6 @@ async def european(
|
||||
return await OBBject.from_query(Query(**locals()))
|
||||
|
||||
|
||||
@router.command(model="FredIndices")
|
||||
async def fred(
|
||||
cc: CommandContext,
|
||||
provider_choices: ProviderChoices,
|
||||
standard_params: StandardParams,
|
||||
extra_params: ExtraParams,
|
||||
) -> OBBject[BaseModel]:
|
||||
"""Historical Fred Indices. Close values for selected Fred indices."""
|
||||
return await OBBject.from_query(Query(**locals()))
|
||||
|
||||
|
||||
@router.command(model="IndexConstituents")
|
||||
async def constituents(
|
||||
cc: CommandContext,
|
||||
|
||||
@@ -139,13 +139,6 @@ def test_news_world(params, headers):
|
||||
"source": "bloomberg.com",
|
||||
}
|
||||
),
|
||||
(
|
||||
{
|
||||
"provider": "ultima",
|
||||
"symbols": "AAPL,MSFT",
|
||||
"limit": 20,
|
||||
}
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
|
||||
@@ -140,13 +140,6 @@ def test_news_world(params, obb):
|
||||
"source": "bloomberg.com",
|
||||
}
|
||||
),
|
||||
(
|
||||
{
|
||||
"provider": "ultima",
|
||||
"symbols": "AAPL,MSFT",
|
||||
"limit": 20,
|
||||
}
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
|
||||
@@ -5,7 +5,7 @@ interactions:
|
||||
Accept:
|
||||
- '*/*'
|
||||
Accept-Encoding:
|
||||
- gzip, deflate, br
|
||||
- gzip, deflate
|
||||
Connection:
|
||||
- keep-alive
|
||||
method: GET
|
||||
@@ -13,7 +13,7 @@ interactions:
|
||||
response:
|
||||
body:
|
||||
string: !!binary |
|
||||
H4sIALKaZmUAA+xd21fayh7+V7J4OS+Kc7/wFhWtrYILtLt777UXKxtizSoCJwlWT1f/9zPhVhSS
|
||||
H4sIAGlVZ2UAA+xd21fayh7+V7J4OS+Kc7/wFhWtrYILtLt777UXKxtizSoCJwlWT1f/9zPhVhSS
|
||||
apxJEOalRXKZMPm+b363mflRiUNvEHndOBgOOjdBPxh8jSq1v39Upp87PS/2K7UKAgjvA7oPxRUU
|
||||
NYxqCFYBAH9V9uYnjsO+Ou82jkdR7eDg+/fv1cjvVr8O7w/csHsb3PvRgd/76oUH6o7eAUYASnyg
|
||||
bgGmHxFOPnNw8BD1TzChXwA5+H6zfzMM70gHMkEIkRARSCFm1Ye7vmo4iKKxH3bioPvND1Xbrnt5
|
||||
@@ -74,7 +74,7 @@ interactions:
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Wed, 29 Nov 2023 01:58:10 GMT
|
||||
- Wed, 29 Nov 2023 15:14:49 GMT
|
||||
Transfer-Encoding:
|
||||
- chunked
|
||||
Vary:
|
||||
|
||||
@@ -27,11 +27,15 @@ class UltimaCompanyNewsQueryParams(CompanyNewsQueryParams):
|
||||
class UltimaCompanyNewsData(CompanyNewsData):
|
||||
"""Ultima Company News Data."""
|
||||
|
||||
__alias_dict__ = {"date": "publishedDate", "text": "summary", "title": "headline"}
|
||||
__alias_dict__ = {
|
||||
"symbols": "ticker",
|
||||
"date": "publishedDate",
|
||||
"text": "summary",
|
||||
"title": "headline",
|
||||
}
|
||||
|
||||
publisher: str = Field(description="Publisher of the news.")
|
||||
ticker: str = Field(description="Ticker associated with the news.")
|
||||
riskCategory: str = Field(description="Risk category of the news.")
|
||||
risk_category: str = Field(description="Risk category of the news.")
|
||||
|
||||
|
||||
class UltimaCompanyNewsFetcher(
|
||||
@@ -80,12 +84,13 @@ class UltimaCompanyNewsFetcher(
|
||||
for key in ["8k_filings", "articles", "industry_summary"]:
|
||||
for item in ele[key]:
|
||||
# manual assignment required for Pydantic to work
|
||||
item["ticker"] = ele["ticker"]
|
||||
item["symbols"] = ele["ticker"]
|
||||
item["date"] = datetime.strptime(
|
||||
item["publishedDate"], "%Y-%m-%d %H:%M:%S"
|
||||
)
|
||||
item["title"] = item["headline"]
|
||||
item["url"] = item["url"]
|
||||
item["publisher"] = item["publisher"]
|
||||
item["risk_category"] = item["riskCategory"]
|
||||
results.append(UltimaCompanyNewsData.model_validate(item))
|
||||
return results
|
||||
|
||||
Reference in New Issue
Block a user