Merge branch 'feature/openbb-sdk-v4' into feature/argparse_translator

This commit is contained in:
hjoaquim
2023-07-28 10:00:54 +01:00
2 changed files with 7 additions and 2 deletions

View File

@@ -20,6 +20,9 @@ class Chart(BaseModel):
def show(self):
"""Shows the chart in PyWry, browser or notebook."""
# TODO : this method should be handled by the ChartingManager so that
# this model class doesn't have specific knowledge on the charting extension
# pylint: disable=import-outside-toplevel
if self.format == ChartFormat.plotly:
from openbb_charting.core.openbb_figure import OpenBBFigure

View File

@@ -46,6 +46,7 @@ def get_sources() -> pd.DataFrame:
# If data request failed
console.print("[red]Status code not 200. Unable to retrieve data\n[/red]")
df = pd.DataFrame()
return df
df = df.sort_values(by=["title"], ascending=True)
df = df[["id", "title", "web"]]
@@ -125,7 +126,7 @@ def get_news(
"X-RapidAPI-Key": get_current_user().credentials.API_BIZTOC_TOKEN,
"X-RapidAPI-Host": "biztoc.p.rapidapi.com",
}
df = pd.DataFrame()
while not have_data:
if term:
req = request(
@@ -158,7 +159,8 @@ def get_news(
break
df = pd.DataFrame(req.json(), columns=["title", "body", "url", "created"])
if df.empty:
return df
df["created"] = pd.to_datetime(df["created"])
df = df.sort_values(by=[sort], ascending=False)