mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 20:42:26 +00:00
Fixes integrated tests for alt and economy (#2655)
* Fixes integrated tests for alt and economy * Added fixes * Added fixes
This commit is contained in:
@@ -111,7 +111,8 @@ def get_startups() -> pd.DataFrame:
|
||||
pandas.DataFrame:
|
||||
list of startups
|
||||
"""
|
||||
soup = _make_request("https://runacap.com/ross-index/")
|
||||
response = requests.get("https://runacap.com/ross-index/", timeout=10)
|
||||
soup = BeautifulSoup(response.content, "html.parser")
|
||||
startups = []
|
||||
if soup:
|
||||
table = soup.find("table", {"id": "table_1"})
|
||||
|
||||
@@ -561,7 +561,11 @@ def get_macro_data(
|
||||
return pd.Series(dtype=float), ""
|
||||
|
||||
if start_date or end_date:
|
||||
df = df.loc[start_date:end_date]
|
||||
try:
|
||||
df = df.loc[start_date:end_date]
|
||||
except TypeError:
|
||||
console.print("[red]Invalid date sent. Format as YYYY-MM-DD[/red]\n")
|
||||
return pd.DataFrame(), "NA/NA"
|
||||
|
||||
if (
|
||||
symbol
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
__docformat__ = "numpy"
|
||||
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
import pandas as pd
|
||||
import yfinance as yf
|
||||
@@ -590,8 +592,8 @@ INDICES = {
|
||||
def get_index(
|
||||
index: str,
|
||||
interval: str = "1d",
|
||||
start_date: int = None,
|
||||
end_date: int = None,
|
||||
start_date: Optional[str] = None,
|
||||
end_date: Optional[str] = None,
|
||||
column: str = "Adj Close",
|
||||
) -> pd.Series:
|
||||
"""Obtain data on any index [Source: Yahoo Finance]
|
||||
@@ -600,9 +602,9 @@ def get_index(
|
||||
----------
|
||||
index: str
|
||||
The index you wish to collect data for.
|
||||
start_date : str
|
||||
start_date : Optional[str]
|
||||
the selected country
|
||||
end_date : bool
|
||||
end_date : Optional[str]
|
||||
The currency you wish to convert the data to.
|
||||
interval : str
|
||||
Valid intervals: 1m, 2m, 5m, 15m, 30m, 60m, 90m, 1h, 1d, 5d, 1wk, 1mo or 3mo
|
||||
@@ -620,6 +622,15 @@ def get_index(
|
||||
else:
|
||||
ticker = index
|
||||
|
||||
try:
|
||||
if start_date:
|
||||
datetime.strptime(str(start_date), "%Y-%m-%d")
|
||||
if end_date:
|
||||
datetime.strptime(str(end_date), "%Y-%m-%d")
|
||||
except ValueError:
|
||||
console.print("[red]Please format date as YYYY-MM-DD[/red]\n")
|
||||
return pd.Series(dtype="object")
|
||||
|
||||
index_data = yf.download(
|
||||
ticker,
|
||||
start=start_date,
|
||||
|
||||
Reference in New Issue
Block a user