mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-16 06:11:57 +00:00
Merge branch 'feature/openbb-sdk-v4' into feature/argparse_translator
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user