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

This commit is contained in:
tehcoderer
2023-08-09 11:41:44 -04:00
39 changed files with 1992 additions and 1137 deletions

View File

@@ -3,4 +3,4 @@ from openbb_charting.core.backend import (
create_backend,
get_backend,
)
from openbb_charting.core.to_plotly_json import to_plotly_json
from openbb_charting.core.to_chart import to_chart

View File

@@ -1,9 +1,12 @@
from inspect import getmembers, isfunction
from typing import List
from openbb_charting import charting_router
from openbb_core.app.router import RouterLoader
CHARTING_ROUTER = "./charting_router.py"
# refers to the root of the repo, not the root of the extension
# this script should be run from the root of the repo
CHARTING_ROUTER = "openbb_sdk/extensions/charting/openbb_charting/charting_router.py"
def get_routes() -> List[str]:
@@ -18,15 +21,13 @@ def create_charting_functions_w_routes(routes_to_add: List[str]):
f.write(
f"""
def {route}(**kwargs):
def {route}(**kwargs) -> Tuple[OpenBBFigure, Dict[str, Any]]:
raise NotImplementedError("Command `{original_route}` does not have a charting function")
"""
)
def get_charting_functions() -> List[str]:
from . import charting_router # pylint: disable=import-outside-toplevel
functions = getmembers(charting_router, isfunction)
if functions:
return [function[0] for function in functions]

View File

@@ -137,7 +137,7 @@ class ChartStyle:
for attr, ext in zip(
["plt_styles_available", "console_styles_available"],
[".pltstyle", ".richstyle.json"],
[".pltstyle.json", ".richstyle.json"],
):
for file in folder.rglob(f"*{ext}"):
getattr(self, attr)[file.name.replace(ext, "")] = file

View File

@@ -338,9 +338,7 @@ class OpenBBFigure(go.Figure):
for i, (x_i, name_i, color_i) in enumerate(zip(valid_x, name, colors)):
if not color_i:
color_i = ( # noqa: PLW2901
self._self._theme.up_color
if i % 2 == 0
else self._self._theme.down_color
self._theme.up_color if i % 2 == 0 else self._theme.down_color
)
res_mean, res_std = np.mean(x_i), np.std(x_i)
@@ -386,7 +384,7 @@ class OpenBBFigure(go.Figure):
name=name_i if len(name) < 2 else name[1],
mode="markers",
marker=dict(
color=self._self._theme.down_color,
color=self._theme.down_color,
symbol="line-ns-open",
size=8,
),
@@ -1381,7 +1379,7 @@ class OpenBBFigure(go.Figure):
height = kwargs.pop("height", len(data.index) * 28 + 25)
width = kwargs.pop("width", sum(columnwidth) * 8.7)
fig: OpenBBFigure = cls()
fig = OpenBBFigure(**kwargs)
fig.add_table(
header=dict(values=header_values),
cells=dict(

View File

@@ -0,0 +1,95 @@
from typing import List, Optional, Union
import pandas as pd
from openbb_sdk.extensions.charting.openbb_charting.core.openbb_figure import (
OpenBBFigure,
)
class OpenBBFigureTable(OpenBBFigure):
def __init__(
self,
tabular_data: pd.DataFrame,
columnwidth: Optional[List[Union[int, float]]] = None,
):
super().__init__()
self._tabular_data = tabular_data
self._columnwidth = columnwidth
def show(
self,
show_index: Optional[bool] = True,
index_name: Optional[str] = "",
headers: Optional[Union[List[str], pd.Index]] = None,
title: Optional[str] = "",
source: Optional[str] = "",
external: Optional[bool] = False,
) -> Optional["OpenBBFigureTable"]:
if external:
return self
if not self._backend.isatty:
tmp_fig = self.to_table()
tmp_fig.show()
else:
# Make a copy of the dataframe to avoid SettingWithCopyWarning
df = self._tabular_data.copy()
show_index = not isinstance(df.index, pd.RangeIndex) and show_index
# convert non-str that are not timestamp or int into str
# eg) praw.models.reddit.subreddit.Subreddit
for col in df.columns:
try:
if not any(
isinstance(df[col].iloc[x], pd.Timestamp)
for x in range(min(10, len(df)))
):
df[col] = pd.to_numeric(df[col], errors="ignore")
except (ValueError, TypeError):
df[col] = df[col].astype(str)
def _get_headers(_headers: Union[List[str], pd.Index]) -> List[str]:
"""Check if headers are valid and return them."""
output = _headers
if isinstance(_headers, pd.Index):
output = list(_headers)
if len(output) != len(df.columns):
raise (
ValueError(
"Length of headers does not match length of DataFrame"
)
)
return output
df_outgoing = df.copy()
# If headers are provided, use them
if headers is not None:
# We check if headers are valid
df_outgoing.columns = _get_headers(headers)
if show_index and index_name not in df_outgoing.columns:
# If index name is provided, we use it
df_outgoing.index.name = index_name or "Index"
df_outgoing = df_outgoing.reset_index()
for col in df_outgoing.columns:
if col == "":
df_outgoing = df_outgoing.rename(columns={col: " "})
self._backend.send_table(
df_table=df_outgoing,
title=title,
source=source, # type: ignore
theme=self._charting_settings.table_style,
)
def to_table(
self,
print_index: bool = True,
**kwargs,
) -> "OpenBBFigure":
data = self._tabular_data
columnwidth = self._columnwidth
return super().to_table(data, columnwidth, print_index, **kwargs)

View File

@@ -1,12 +1,13 @@
from typing import Any, Dict, Optional, Union
from typing import Any, Dict, Optional, Tuple, Union
import pandas as pd
from openbb_charting.core.openbb_figure import OpenBBFigure
from openbb_charting.core.plotly_ta.data_classes import ChartIndicators
from openbb_charting.core.plotly_ta.ta_class import PlotlyTA
from openbb_core.app.model.charts.charting_settings import ChartingSettings
def to_plotly_json(
def to_chart(
charting_settings: ChartingSettings,
data: Union[pd.DataFrame, pd.Series],
indicators: Optional[Union[ChartIndicators, Dict[str, Dict[str, Any]]]] = None,
@@ -15,7 +16,7 @@ def to_plotly_json(
volume: bool = True,
prepost: bool = False,
volume_ticks_x: int = 7,
) -> str:
) -> Tuple[OpenBBFigure, Dict[str, Any]]:
"""
Returns the plotly json representation of the chart.
This function is used so it can be called at the module level and used out of the box,
@@ -57,5 +58,6 @@ def to_plotly_json(
prepost=prepost,
volume_ticks_x=volume_ticks_x,
)
content = fig.show(external=True).to_plotly_json()
return fig.show(external=True).to_plotly_json()
return fig, content

View File

@@ -0,0 +1,102 @@
{
"data": {
"candlestick": [
{
"decreasing": {
"fillcolor": "#e4003a",
"line": {
"color": "#e4003a"
}
},
"increasing": {
"fillcolor": "#00ACFF",
"line": {
"color": "#00ACFF"
}
},
"type": "candlestick"
}
]
},
"layout": {
"annotationdefaults": {
"showarrow": false
},
"autotypenumbers": "strict",
"colorway": [
"#ffed00",
"#ef7d00",
"#e4003a",
"#c13246",
"#822661",
"#48277c",
"#005ca9",
"#00aaff",
"#9b30d9",
"#af005f",
"#5f00af",
"#af87ff"
],
"dragmode": "pan",
"font": {
"family": "Fira Code",
"size": 18
},
"hoverlabel": {
"align": "left"
},
"mapbox": {
"style": "light"
},
"hovermode": "x",
"legend": {
"bgcolor": "rgba(0, 0, 0, 0)",
"x": 0.01,
"xanchor": "left",
"y": 0.99,
"yanchor": "top",
"font": {
"size": 15
}
},
"paper_bgcolor": "white",
"plot_bgcolor": "white",
"xaxis": {
"automargin": true,
"autorange": true,
"rangeslider": {
"visible": false
},
"showgrid": true,
"showline": true,
"tickfont": {
"size": 14
},
"zeroline": false,
"tick0": 1,
"title": {
"standoff": 20
},
"linecolor": "#F5EFF3",
"mirror": true,
"ticks": "outside"
},
"yaxis": {
"anchor": "x",
"automargin": true,
"fixedrange": false,
"zeroline": false,
"showgrid": true,
"showline": true,
"side": "right",
"tick0": 0.5,
"title": {
"standoff": 20
},
"gridcolor": "#283442",
"linecolor": "#F5EFF3",
"mirror": true,
"ticks": "outside"
}
}
}

View File

@@ -20,7 +20,7 @@ class FMPCryptoEODQueryParams(CryptoEODQueryParams):
"""FMP Crypto end of day Query.
Source:
https://site.financialmodelingprep.com/developer/docs/cryptocurrency-historical-data-api/#Historical-Daily-Prices
https://site.financialmodelingprep.com/developer/docs/cryptocurrency-historical-data-api/#Historical-Daily-Prices
"""
timeseries: Optional[NonNegativeInt] = Field(

View File

@@ -1,3 +1,4 @@
import inspect
from functools import partial, wraps
from inspect import Parameter, Signature, signature
from typing import Any, Callable, Dict, Tuple, TypeVar
@@ -7,9 +8,11 @@ from fastapi.routing import APIRoute
from openbb_core.api.dependency.user import get_user
from openbb_core.app.command_runner import CommandRunner
from openbb_core.app.model.command_context import CommandContext
from openbb_core.app.model.command_output import CommandOutput
from openbb_core.app.model.user_settings import UserSettings
from openbb_core.app.router import RouterLoader
from openbb_core.app.service.system_service import SystemService
from pydantic import BaseModel
from typing_extensions import Annotated, ParamSpec
T = TypeVar("T")
@@ -73,6 +76,52 @@ def build_new_signature(func):
)
def validate_output(c_out: CommandOutput) -> CommandOutput:
"""
Validate CommandOutput object.
Checks against the CommandOutput schema and removes fields that contain the
`exclude_from_api` extra `pydantic.Field` kwarg.
Note that the modification to the `CommandOutput` object is done in-place.
Parameters
----------
c_out : CommandOutput
CommandOutput object to validate.
Returns
-------
CommandOutput
Validated CommandOutput object.
"""
def is_model(type_):
return inspect.isclass(type_) and issubclass(type_, BaseModel)
def exclude_fields_from_api(key: str, value: Any):
type_ = type(value)
# case where 1st layer field needs to be excluded
if key in c_out.__fields__ and c_out.__fields__[key].field_info.extra.get(
"exclude_from_api", None
):
delattr(c_out, key)
# if it's a model with nested fields
elif is_model(type_):
for field in type_.__fields__.values():
if field.field_info.extra.get("exclude_from_api", None):
delattr(value, field.name)
# if it's a yet a nested model we need to go deeper in the recursion
elif is_model(field.type_):
exclude_fields_from_api(field.name, getattr(value, field.name))
for k, v in c_out:
exclude_fields_from_api(k, v)
return c_out
def build_api_wrapper(
command_runner: CommandRunner,
route: APIRoute,
@@ -97,7 +146,7 @@ def build_api_wrapper(
execute = partial(command_runner.run_once, user_settings, path)
journal_entry = execute(*args, **kwargs)
return journal_entry.output
return validate_output(journal_entry.output)
return wrapper

View File

@@ -144,10 +144,28 @@ class ChartingManager(metaclass=SingletonMeta):
create_backend_func(charting_settings=charting_settings)
get_backend_func().start(debug=charting_settings.debug_mode)
def to_plotly_json(self, **kwargs) -> str:
def to_chart(self, **kwargs) -> Chart:
"""
Returns the plotly json representation of the chart.
Returns the chart object.
Parameters
----------
**kwargs
Keyword arguments to be passed to the charting extension.
Returns
-------
Chart
Chart object.
Raises
------
ChartingManagerError
If charting extension is not installed.
Exception
If the charting extension module does not contain the `to_chart` function.
"""
if not self._charting_extension_installed:
raise ChartingManagerError(
f"Charting extension `{self._charting_extension}` is not installed"
@@ -156,12 +174,19 @@ class ChartingManager(metaclass=SingletonMeta):
# Dynamically import the charting module
backend_module = import_module(self._charting_extension)
# Get the plotly json function from the charting module
to_plotly_json_func = getattr(backend_module, "to_plotly_json")
# Get the `to_chart` function from the charting module
to_chart_func = getattr(backend_module, "to_chart")
# Add the charting settings to the kwargs
kwargs["charting_settings"] = self._charting_settings
return to_plotly_json_func(**kwargs)
fig, content = to_chart_func(**kwargs)
return Chart(
content=content,
format=self.get_chart_format(self._charting_extension),
fig=fig,
)
def chart(
self,
@@ -211,7 +236,11 @@ class ChartingManager(metaclass=SingletonMeta):
kwargs["command_output_item"] = command_output_item
kwargs["charting_settings"] = self._charting_settings
charting_function = self.get_chart_function(self._charting_extension, route)
fig, content = charting_function(**kwargs)
return Chart(
content=self.get_chart_function(self._charting_extension, route)(**kwargs),
content=content,
format=self.get_chart_format(self._charting_extension),
fig=fig,
)

View File

@@ -2,7 +2,7 @@ from enum import Enum
from typing import Any, Dict, Optional
from openbb_core.app.model.abstract.error import Error
from pydantic import BaseModel
from pydantic import BaseModel, Field
class ChartFormat(str, Enum):
@@ -10,28 +10,30 @@ class ChartFormat(str, Enum):
class Chart(BaseModel):
content: Optional[Dict[str, Any]] = None
format: Optional[ChartFormat] = ChartFormat.plotly
error: Optional[Error] = None
content: Optional[Dict[str, Any]] = Field(
default=None,
description="Raw textual representation of the chart.",
)
format: Optional[ChartFormat] = Field(
default=ChartFormat.plotly,
description="Complementary attribute to the `content` attribute. It specifies the format of the chart.",
)
error: Optional[Error] = Field(
default=None,
description="Exception caught during the computation of the `Chart`.",
)
fig: Optional[Any] = Field(
default=None,
description="The figure object.",
exclude_from_api=True,
)
class Config:
validate_assignment = True
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
chart = OpenBBFigure()
chart.update(self.content)
chart.show()
else:
raise ValueError(f"Chart format {self.format} not supported.")
def __repr__(self) -> str:
return (
self.__class__.__name__
+ "\n\n"
+ "\n".join([f"{k}: {v}" for k, v in self.dict().items()])
)

View File

@@ -43,9 +43,8 @@ class ChartingSettings:
self.user_uuid: Optional[str] = (
user_settings.profile.hub_session.user_uuid if has_hub else None
)
self.user_exports_directory: str = user_settings.preferences.export_directory
self.user_styles_directory: str = (
user_settings.preferences.user_styles_directory
)
self.user_exports_directory = user_settings.preferences.export_directory
self.user_styles_directory = user_settings.preferences.user_styles_directory
# Theme
self.chart_style: str = user_settings.preferences.chart_style
self.table_style = user_settings.preferences.table_style

View File

@@ -1,4 +1,4 @@
from typing import Any, Dict, Generic, List, Optional, TypeVar, Union
from typing import Dict, Generic, List, Optional, TypeVar, Union
import pandas as pd
from pydantic import Field
@@ -8,7 +8,7 @@ from openbb_core.app.charting_manager import ChartingManager
from openbb_core.app.model.abstract.error import Error
from openbb_core.app.model.abstract.tagged import Tagged
from openbb_core.app.model.abstract.warning import Warning_
from openbb_core.app.model.charts.chart import Chart, ChartFormat
from openbb_core.app.model.charts.chart import Chart
from openbb_core.app.provider_interface import get_provider_interface
from openbb_core.app.utils import basemodel_to_df
@@ -109,41 +109,31 @@ class CommandOutput(GenericModel, Generic[T], Tagged):
return results
def to_plotly_json(
self, create_chart: bool = True, **kwargs
) -> Optional[Dict[str, Any]]:
def to_chart(self, **kwargs):
"""
Returns the plotly json representation of the chart.
If the chart was already computed it return the plotly json representation of the chart.
Otherwise it computes the chart based on the available data and provided kwargs.
Create or update the `Chart`.
Note that the `chart` attribute is composed by: `content`, `format` and `fig`.
Parameters
----------
create_chart : bool, optional
If True, it creates the chart object and populates the respective field on the object, by default True.
**kwargs
Keyword arguments to be passed to the charting extension.
This implies that the user has to know the charting extension API; this is the case
because the charting extension may vary on user settings.
This implies that the user has some knowledge on the charting extension API.
This is the case because the charting extension may vary on user preferences.
Returns
-------
chart.fig
The chart figure.
"""
cm = ChartingManager()
kwargs["data"] = self.to_dataframe()
if self.chart and not kwargs:
plotly_json = self.chart.content
else:
cm = ChartingManager()
kwargs["data"] = self.to_dataframe()
plotly_json = cm.to_plotly_json(**kwargs)
if create_chart:
try:
self.chart = Chart(content=plotly_json, format=ChartFormat.plotly)
except Exception as e:
self.chart = Chart(error=Error(message=str(e)))
return plotly_json
self.chart = cm.to_chart(**kwargs)
return self.chart.fig
def show(self):
"""Displays chart."""
if not self.chart:
if not self.chart and not self.chart.fig:
raise OpenBBError("Chart not found.")
self.chart.show()
self.chart.fig.show()

View File

@@ -0,0 +1,11 @@
from typing import Optional
from pydantic import BaseModel
class OpenBBCustomParameter(BaseModel):
"""Custom parameter for OpenBB."""
description: Optional[str] = None
class Config:
frozen = True

View File

@@ -16,6 +16,7 @@ class Preferences(BaseModel):
plot_open_export: bool = (
False # Whether to open plot image exports after they are created
)
table_style: Literal["dark", "light"] = "dark"
request_timeout: PositiveInt = 15
class Config:

View File

@@ -1,23 +1,16 @@
### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ###
from openbb_core.app.static.container import Container
class Extensions(Container):
@property
def crypto(self): # route = "/crypto"
from openbb_core.app.static.package import crypto
def news(self): # route = "/news"
from openbb_core.app.static.package import news
return crypto.CLASS_crypto(command_runner_session=self._command_runner_session)
@property
def economy(self): # route = "/economy"
from openbb_core.app.static.package import economy
return economy.CLASS_economy(
command_runner_session=self._command_runner_session
)
return news.CLASS_news(command_runner_session=self._command_runner_session)
@property
def fixedincome(self): # route = "/fixedincome"
@@ -34,16 +27,18 @@ class Extensions(Container):
return forex.CLASS_forex(command_runner_session=self._command_runner_session)
@property
def news(self): # route = "/news"
from openbb_core.app.static.package import news
def economy(self): # route = "/economy"
from openbb_core.app.static.package import economy
return news.CLASS_news(command_runner_session=self._command_runner_session)
return economy.CLASS_economy(
command_runner_session=self._command_runner_session
)
@property
def qa(self): # route = "/qa"
from openbb_core.app.static.package import qa
def crypto(self): # route = "/crypto"
from openbb_core.app.static.package import crypto
return qa.CLASS_qa(command_runner_session=self._command_runner_session)
return crypto.CLASS_crypto(command_runner_session=self._command_runner_session)
@property
def stocks(self): # route = "/stocks"
@@ -51,6 +46,12 @@ class Extensions(Container):
return stocks.CLASS_stocks(command_runner_session=self._command_runner_session)
@property
def qa(self): # route = "/qa"
from openbb_core.app.static.package import qa
return qa.CLASS_qa(command_runner_session=self._command_runner_session)
@property
def ta(self): # route = "/ta"
from openbb_core.app.static.package import ta

View File

@@ -2,11 +2,12 @@
import datetime
import typing
from typing import Literal, Optional, Union
from typing import Annotated, Literal, Optional, Union
from pydantic import validate_arguments
from openbb_core.app.model.command_output import CommandOutput
from openbb_core.app.model.custom_parameter import OpenBBCustomParameter
from openbb_core.app.static.container import Container
from openbb_core.app.static.filters import filter_call, filter_inputs, filter_output
@@ -16,11 +17,23 @@ class CLASS_crypto(Container):
@validate_arguments
def load(
self,
symbol: str,
start_date: Union[datetime.date, None, str] = None,
end_date: Union[datetime.date, None, str] = None,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
start_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="Start date of the data, in YYYY-MM-DD format."
),
] = None,
end_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="End date of the data, in YYYY-MM-DD format."
),
] = None,
chart: bool = False,
provider: Optional[Literal["fmp", "polygon"]] = None,
provider: Optional[Literal["polygon", "fmp"]] = None,
**kwargs,
) -> CommandOutput[typing.List]:
"""Crypto Intraday Price.
@@ -31,7 +44,7 @@ class CLASS_crypto(Container):
Parameters
----------
provider: Literal[fmp, polygon]
provider: Literal[polygon, fmp]
The provider to use for the query.
symbol : ConstrainedStrValue
Symbol to get data for.
@@ -72,6 +85,28 @@ class CLASS_crypto(Container):
vwap : PositiveFloat
Volume Weighted Average Price of the symbol.
polygon
=======
Parameters
----------
timespan : Literal['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year']
The timespan of the data.
sort : Literal['asc', 'desc']
Sort order of the data.
limit : PositiveInt
The number of data entries to return.
adjusted : bool
Whether the data is adjusted.
multiplier : PositiveInt
The multiplier of the timespan.
CryptoEOD
---------
n : PositiveInt
The number of transactions for the symbol in the time period.
fmp
===
@@ -94,29 +129,7 @@ class CLASS_crypto(Container):
label : str
Human readable format of the date.
changeOverTime : float
Change \\% in the price of the symbol over a period of time.
polygon
=======
Parameters
----------
timespan : Literal['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year']
The timespan of the data.
sort : Literal['asc', 'desc']
Sort order of the data.
limit : PositiveInt
The number of data entries to return.
adjusted : bool
Whether the data is adjusted.
multiplier : PositiveInt
The multiplier of the timespan.
CryptoEOD
---------
n : PositiveInt
The number of transactions for the symbol in the time period.""" # noqa: E501
Change \\% in the price of the symbol over a period of time."""
inputs = filter_inputs(
provider_choices={
"provider": provider,

View File

@@ -2,13 +2,14 @@
import datetime
import typing
from typing import List, Literal, Optional, Union
from typing import Annotated, List, Literal, Optional, Union
from pydantic import BaseModel, validate_arguments
import openbb_core.app.model.command_context
import openbb_core.app.model.results.empty
from openbb_core.app.model.command_output import CommandOutput
from openbb_core.app.model.custom_parameter import OpenBBCustomParameter
from openbb_core.app.static.container import Container
from openbb_core.app.static.filters import filter_call, filter_inputs, filter_output
@@ -40,7 +41,12 @@ class CLASS_economy(Container):
@validate_arguments
def const(
self,
index: Literal["nasdaq", "sp500", "dowjones"] = "dowjones",
index: Annotated[
Literal["nasdaq", "sp500", "dowjones"],
OpenBBCustomParameter(
description="The index for which we want to fetch the constituents."
),
] = "dowjones",
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,
@@ -125,64 +131,88 @@ class CLASS_economy(Container):
@validate_arguments
def cpi(
self,
countries: List[
Literal[
"australia",
"austria",
"belgium",
"brazil",
"bulgaria",
"canada",
"chile",
"china",
"croatia",
"cyprus",
"czech_republic",
"denmark",
"estonia",
"euro_area",
"finland",
"france",
"germany",
"greece",
"hungary",
"iceland",
"india",
"indonesia",
"ireland",
"israel",
"italy",
"japan",
"korea",
"latvia",
"lithuania",
"luxembourg",
"malta",
"mexico",
"netherlands",
"new_zealand",
"norway",
"poland",
"portugal",
"romania",
"russian_federation",
"slovak_republic",
"slovakia",
"slovenia",
"south_africa",
"spain",
"sweden",
"switzerland",
"turkey",
"united_kingdom",
"united_states",
]
countries: Annotated[
List[
Literal[
"australia",
"austria",
"belgium",
"brazil",
"bulgaria",
"canada",
"chile",
"china",
"croatia",
"cyprus",
"czech_republic",
"denmark",
"estonia",
"euro_area",
"finland",
"france",
"germany",
"greece",
"hungary",
"iceland",
"india",
"indonesia",
"ireland",
"israel",
"italy",
"japan",
"korea",
"latvia",
"lithuania",
"luxembourg",
"malta",
"mexico",
"netherlands",
"new_zealand",
"norway",
"poland",
"portugal",
"romania",
"russian_federation",
"slovak_republic",
"slovakia",
"slovenia",
"south_africa",
"spain",
"sweden",
"switzerland",
"turkey",
"united_kingdom",
"united_states",
]
],
OpenBBCustomParameter(description="The country or countries to get data."),
],
units: Literal["growth_previous", "growth_same", "index_2015"] = "growth_same",
frequency: Literal["monthly", "quarterly", "annual"] = "monthly",
harmonized: bool = False,
start_date: Union[datetime.date, None, str] = None,
end_date: Union[datetime.date, None, str] = None,
units: Annotated[
Literal["growth_previous", "growth_same", "index_2015"],
OpenBBCustomParameter(description="The data units."),
] = "growth_same",
frequency: Annotated[
Literal["monthly", "quarterly", "annual"],
OpenBBCustomParameter(description="The data time frequency."),
] = "monthly",
harmonized: typing.Annotated[
bool,
OpenBBCustomParameter(
description="Whether you wish to obtain harmonized data."
),
] = False,
start_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="Start date of the data, in YYYY-MM-DD format."
),
] = None,
end_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="End date of the data, in YYYY-MM-DD format."
),
] = None,
chart: bool = False,
provider: Optional[Literal["fred"]] = None,
**kwargs,
@@ -296,11 +326,23 @@ class CLASS_economy(Container):
@validate_arguments
def index(
self,
symbol: str,
start_date: Union[datetime.date, None, str] = None,
end_date: Union[datetime.date, None, str] = None,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
start_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="Start date of the data, in YYYY-MM-DD format."
),
] = None,
end_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="End date of the data, in YYYY-MM-DD format."
),
] = None,
chart: bool = False,
provider: Optional[Literal["fmp", "polygon"]] = None,
provider: Optional[Literal["polygon", "fmp"]] = None,
**kwargs,
) -> CommandOutput[typing.List]:
"""Get OHLCV data for an index.
@@ -311,7 +353,7 @@ class CLASS_economy(Container):
Parameters
----------
provider: Literal[fmp, polygon]
provider: Literal[polygon, fmp]
The provider to use for the query.
symbol : ConstrainedStrValue
Symbol to get data for.
@@ -352,6 +394,32 @@ class CLASS_economy(Container):
vwap : Optional[float]
Volume Weighted Average Price of the symbol.
polygon
=======
Parameters
----------
timespan : Literal['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year']
The timespan of the data.
sort : Literal['asc', 'desc']
Sort order of the data.
limit : PositiveInt
The number of data entries to return.
adjusted : bool
Whether the data is adjusted.
multiplier : PositiveInt
The multiplier of the timespan.
MajorIndicesEOD
---------------
t : datetime
The timestamp of the data.
n : PositiveInt
The number of transactions for the symbol in the time period.
vw : PositiveFloat
The volume weighted average price of the symbol.
fmp
===
@@ -375,30 +443,8 @@ class CLASS_economy(Container):
Change \\% in the price of the symbol.
label : Optional[str]
Human readable format of the date.
changeOverTime : Optional[float]
Change \\% in the price of the symbol over a period of time.
polygon
=======
Parameters
----------
timespan : Literal['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year']
The timespan of the data.
sort : Literal['asc', 'desc']
Sort order of the data.
limit : PositiveInt
The number of data entries to return.
adjusted : bool
Whether the data is adjusted.
multiplier : PositiveInt
The multiplier of the timespan.
MajorIndicesEOD
---------------
n : PositiveInt
The number of transactions for the symbol in the time period.""" # noqa: E501
changeOverTime : float
Change \\% in the price of the symbol over a period of time."""
inputs = filter_inputs(
provider_choices={
"provider": provider,

View File

@@ -2,13 +2,14 @@
import datetime
import typing
from typing import Literal, Optional, Union
from typing import Annotated, Literal, Optional, Union
from pydantic import validate_arguments
import openbb_core.app.model.command_context
import openbb_core.app.model.results.empty
from openbb_core.app.model.command_output import CommandOutput
from openbb_core.app.model.custom_parameter import OpenBBCustomParameter
from openbb_core.app.static.container import Container
from openbb_core.app.static.filters import filter_call, filter_inputs, filter_output
@@ -18,8 +19,18 @@ class CLASS_fixedincome(Container):
@validate_arguments
def treasury(
self,
start_date: Union[datetime.date, None, str] = None,
end_date: Union[datetime.date, None, str] = None,
start_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="Start date of the data, in YYYY-MM-DD format."
),
] = None,
end_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="End date of the data, in YYYY-MM-DD format."
),
] = None,
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,

View File

@@ -2,11 +2,12 @@
import datetime
import typing
from typing import Literal, Optional, Union
from typing import Annotated, Literal, Optional, Union
from pydantic import validate_arguments
from openbb_core.app.model.command_output import CommandOutput
from openbb_core.app.model.custom_parameter import OpenBBCustomParameter
from openbb_core.app.static.container import Container
from openbb_core.app.static.filters import filter_call, filter_inputs, filter_output
@@ -17,7 +18,7 @@ class CLASS_forex(Container):
def pairs(
self,
chart: bool = False,
provider: Optional[Literal["fmp", "polygon"]] = None,
provider: Optional[Literal["polygon", "fmp"]] = None,
**kwargs,
) -> CommandOutput[typing.List]:
"""Forex Available Pairs.
@@ -28,7 +29,7 @@ class CLASS_forex(Container):
Parameters
----------
provider: Literal[fmp, polygon]
provider: Literal[polygon, fmp]
The provider to use for the query.
All fields are standardized.
@@ -52,25 +53,6 @@ class CLASS_forex(Container):
name : str
The name of the currency pair.
fmp
===
Parameters
----------
All fields are standardized.
ForexPairs
----------
symbol : str
The symbol of the currency pair.
currency : str
The base currency of the currency pair.
stockExchange : Optional[str]
The stock exchange of the currency pair.
exchange_short_name : Optional[str]
The short name of the stock exchange of the currency pair.
polygon
=======
@@ -109,7 +91,26 @@ class CLASS_forex(Container):
last_updated_utc : datetime
The last updated timestamp in UTC.
delisted_utc : Optional[datetime]
The delisted timestamp in UTC.""" # noqa: E501
The delisted timestamp in UTC.
fmp
===
Parameters
----------
All fields are standardized.
ForexPairs
----------
symbol : str
The symbol of the currency pair.
currency : str
The base currency of the currency pair.
stockExchange : Optional[str]
The stock exchange of the currency pair.
exchange_short_name : Optional[str]
The short name of the stock exchange of the currency pair."""
inputs = filter_inputs(
provider_choices={
"provider": provider,
@@ -130,11 +131,23 @@ class CLASS_forex(Container):
@validate_arguments
def load(
self,
symbol: str,
start_date: Union[datetime.date, None, str] = None,
end_date: Union[datetime.date, None, str] = None,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
start_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="Start date of the data, in YYYY-MM-DD format."
),
] = None,
end_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="End date of the data, in YYYY-MM-DD format."
),
] = None,
chart: bool = False,
provider: Optional[Literal["fmp", "polygon"]] = None,
provider: Optional[Literal["polygon", "fmp"]] = None,
**kwargs,
) -> CommandOutput[typing.List]:
"""Forex Intraday Price.
@@ -145,7 +158,7 @@ class CLASS_forex(Container):
Parameters
----------
provider: Literal[fmp, polygon]
provider: Literal[polygon, fmp]
The provider to use for the query.
symbol : ConstrainedStrValue
Symbol to get data for.
@@ -186,6 +199,28 @@ class CLASS_forex(Container):
vwap : Optional[PositiveFloat]
Volume Weighted Average Price of the symbol.
polygon
=======
Parameters
----------
timespan : Literal['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year']
The timespan of the data.
sort : Literal['asc', 'desc']
Sort order of the data.
limit : PositiveInt
The number of data entries to return.
adjusted : bool
Whether the data is adjusted.
multiplier : PositiveInt
The multiplier of the timespan.
ForexEOD
--------
n : PositiveInt
The number of transactions for the symbol in the time period.
fmp
===
@@ -207,29 +242,7 @@ class CLASS_forex(Container):
label : str
Human readable format of the date.
changeOverTime : float
Change \\% in the price of the symbol over a period of time.
polygon
=======
Parameters
----------
timespan : Literal['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year']
The timespan of the data.
sort : Literal['asc', 'desc']
Sort order of the data.
limit : PositiveInt
The number of data entries to return.
adjusted : bool
Whether the data is adjusted.
multiplier : PositiveInt
The multiplier of the timespan.
ForexEOD
--------
n : PositiveInt
The number of transactions for the symbol in the time period.""" # noqa: E501
Change \\% in the price of the symbol over a period of time."""
inputs = filter_inputs(
provider_choices={
"provider": provider,

View File

@@ -1,7 +1,14 @@
{
"crypto_load": "/crypto/load",
"news_globalnews": "/news/globalnews",
"__extensions__": "",
"crypto": "/crypto",
"news": "/news",
"news_sectornews": "/news/sectornews",
"fixedincome_treasury": "/fixedincome/treasury",
"fixedincome": "/fixedincome",
"fixedincome_ycrv": "/fixedincome/ycrv",
"forex_pairs": "/forex/pairs",
"forex": "/forex",
"forex_load": "/forex/load",
"economy_corecpi": "/economy/corecpi",
"economy": "/economy",
"economy_const": "/economy/const",
@@ -37,41 +44,8 @@
"economy_trust": "/economy/trust",
"economy_usbonds": "/economy/usbonds",
"economy_valuation": "/economy/valuation",
"fixedincome_treasury": "/fixedincome/treasury",
"fixedincome": "/fixedincome",
"fixedincome_ycrv": "/fixedincome/ycrv",
"forex_pairs": "/forex/pairs",
"forex": "/forex",
"forex_load": "/forex/load",
"news_globalnews": "/news/globalnews",
"news": "/news",
"news_sectornews": "/news/sectornews",
"qa_normality": "/qa/normality",
"qa": "/qa",
"qa_capm": "/qa/capm",
"qa_qqplot": "/qa/qqplot",
"qa_om": "/qa/om",
"qa_kurtosis": "/qa/kurtosis",
"qa_pick": "/qa/pick",
"qa_spread": "/qa/spread",
"qa_rolling": "/qa/rolling",
"qa_var": "/qa/var",
"qa_line": "/qa/line",
"qa_hist": "/qa/hist",
"qa_unitroot": "/qa/unitroot",
"qa_beta": "/qa/beta",
"qa_sh": "/qa/sh",
"qa_so": "/qa/so",
"qa_cusum": "/qa/cusum",
"qa_raw": "/qa/raw",
"qa_cdf": "/qa/cdf",
"qa_decompose": "/qa/decompose",
"qa_skew": "/qa/skew",
"qa_quantile": "/qa/quantile",
"qa_bw": "/qa/bw",
"qa_es": "/qa/es",
"qa_acf": "/qa/acf",
"qa_summary": "/qa/summary",
"crypto_load": "/crypto/load",
"crypto": "/crypto",
"stocks_fa_analysis": "/stocks/fa/analysis",
"stocks": "/stocks",
"stocks_fa": "/stocks/fa",
@@ -219,6 +193,32 @@
"stocks_tob": "/stocks/tob",
"stocks_quote": "/stocks/quote",
"stocks_search": "/stocks/search",
"qa_normality": "/qa/normality",
"qa": "/qa",
"qa_capm": "/qa/capm",
"qa_qqplot": "/qa/qqplot",
"qa_om": "/qa/om",
"qa_kurtosis": "/qa/kurtosis",
"qa_pick": "/qa/pick",
"qa_spread": "/qa/spread",
"qa_rolling": "/qa/rolling",
"qa_var": "/qa/var",
"qa_line": "/qa/line",
"qa_hist": "/qa/hist",
"qa_unitroot": "/qa/unitroot",
"qa_beta": "/qa/beta",
"qa_sh": "/qa/sh",
"qa_so": "/qa/so",
"qa_cusum": "/qa/cusum",
"qa_raw": "/qa/raw",
"qa_cdf": "/qa/cdf",
"qa_decompose": "/qa/decompose",
"qa_skew": "/qa/skew",
"qa_quantile": "/qa/quantile",
"qa_bw": "/qa/bw",
"qa_es": "/qa/es",
"qa_acf": "/qa/acf",
"qa_summary": "/qa/summary",
"ta_atr": "/ta/atr",
"ta": "/ta",
"ta_fib": "/ta/fib",

View File

@@ -9,6 +9,7 @@ from pydantic import validate_arguments
import openbb_core.app.model.command_context
import openbb_core.app.model.results.empty
from openbb_core.app.model.command_output import CommandOutput
from openbb_core.app.model.custom_parameter import OpenBBCustomParameter
from openbb_core.app.static.container import Container
from openbb_core.app.static.filters import filter_call, filter_inputs, filter_output
@@ -18,7 +19,10 @@ class CLASS_news(Container):
@validate_arguments
def globalnews(
self,
page: pydantic.types.NonNegativeInt = 0,
page: typing.Annotated[
pydantic.types.NonNegativeInt,
OpenBBCustomParameter(description="The page of the global news."),
] = 0,
chart: bool = False,
provider: Optional[Literal["benzinga", "fmp"]] = None,
**kwargs,

View File

@@ -2,7 +2,7 @@
import datetime
import typing
from typing import Literal, Optional, Union
from typing import Annotated, Literal, Optional, Union
import pydantic
from pydantic import validate_arguments
@@ -10,6 +10,7 @@ from pydantic import validate_arguments
import openbb_core.app.model.command_context
import openbb_core.app.model.results.empty
from openbb_core.app.model.command_output import CommandOutput
from openbb_core.app.model.custom_parameter import OpenBBCustomParameter
from openbb_core.app.static.container import Container
from openbb_core.app.static.filters import filter_call, filter_inputs, filter_output
@@ -83,11 +84,23 @@ class CLASS_stocks(Container):
@validate_arguments
def load(
self,
symbol: str,
start_date: Union[datetime.date, None, str] = None,
end_date: Union[datetime.date, None, str] = None,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
start_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="Start date of the data, in YYYY-MM-DD format."
),
] = None,
end_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="End date of the data, in YYYY-MM-DD format."
),
] = None,
chart: bool = False,
provider: Optional[Literal["fmp", "polygon"]] = None,
provider: Optional[Literal["polygon", "fmp"]] = None,
**kwargs,
) -> CommandOutput[typing.List]:
"""Load stock data for a specific ticker.
@@ -98,7 +111,7 @@ class CLASS_stocks(Container):
Parameters
----------
provider: Literal[fmp, polygon]
provider: Literal[polygon, fmp]
The provider to use for the query.
symbol : ConstrainedStrValue
Symbol to get data for.
@@ -134,11 +147,33 @@ class CLASS_stocks(Container):
The low price of the symbol.
close : PositiveFloat
The close price of the symbol.
volume : float
volume : NonNegativeFloat
The volume of the symbol.
vwap : Optional[float]
vwap : Optional[PositiveFloat]
Volume Weighted Average Price of the symbol.
polygon
=======
Parameters
----------
timespan : Literal['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year']
The timespan of the data.
sort : Literal['asc', 'desc']
Sort order of the data.
limit : PositiveInt
The number of data entries to return.
adjusted : bool
Whether the data is adjusted.
multiplier : PositiveInt
The multiplier of the timespan.
StockEOD
--------
n : PositiveInt
The number of transactions for the symbol in the time period.
fmp
===
@@ -162,30 +197,8 @@ class CLASS_stocks(Container):
Change \\% in the price of the symbol.
label : Optional[str]
Human readable format of the date.
changeOverTime : Optional[float]
Change \\% in the price of the symbol over a period of time.
polygon
=======
Parameters
----------
timespan : Literal['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year']
The timespan of the data.
sort : Literal['asc', 'desc']
Sort order of the data.
limit : PositiveInt
The number of data entries to return.
adjusted : bool
Whether the data is adjusted.
multiplier : PositiveInt
The multiplier of the timespan.
StockEOD
--------
n : Optional[PositiveInt]
The number of transactions for the symbol in the time period.""" # noqa: E501
changeOverTime : float
Change \\% in the price of the symbol over a period of time."""
inputs = filter_inputs(
provider_choices={
"provider": provider,
@@ -210,11 +223,23 @@ class CLASS_stocks(Container):
@validate_arguments
def news(
self,
symbols: str,
page: int = 0,
limit: Optional[pydantic.types.NonNegativeInt] = 15,
symbols: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
page: typing.Annotated[
int,
OpenBBCustomParameter(
description="The page of the stock news to be retrieved."
),
] = 0,
limit: Annotated[
Optional[pydantic.types.NonNegativeInt],
OpenBBCustomParameter(
description="The number of results to return per page."
),
] = 15,
chart: bool = False,
provider: Optional[Literal["benzinga", "fmp", "polygon"]] = None,
provider: Optional[Literal["benzinga", "polygon", "fmp"]] = None,
**kwargs,
) -> CommandOutput[typing.List]:
"""Get news for one or more stock tickers.
@@ -225,7 +250,7 @@ class CLASS_stocks(Container):
Parameters
----------
provider: Literal[benzinga, fmp, polygon]
provider: Literal[benzinga, polygon, fmp]
The provider to use for the query.
symbols : ConstrainedStrValue
Symbol to get data for.
@@ -306,23 +331,6 @@ class CLASS_stocks(Container):
teaser : Optional[str]
The teaser of the news.
fmp
===
Parameters
----------
All fields are standardized.
StockNews
---------
symbol : str
Ticker of the fetched news.
image : Optional[str]
URL to the image of the news source.
site : str
Name of the news source.
polygon
=======
@@ -367,7 +375,24 @@ class CLASS_stocks(Container):
publisher : PolygonPublisher
Publisher of the article.
tickers : List[str]
Tickers covered in the article.""" # noqa: E501
Tickers covered in the article.
fmp
===
Parameters
----------
All fields are standardized.
StockNews
---------
symbol : str
Ticker of the fetched news.
image : Optional[str]
URL to the image of the news source.
site : str
Name of the news source."""
inputs = filter_inputs(
provider_choices={
"provider": provider,
@@ -392,8 +417,13 @@ class CLASS_stocks(Container):
@validate_arguments
def multiples(
self,
symbol: str,
limit: Optional[int] = 100,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
limit: Annotated[
Optional[int],
OpenBBCustomParameter(description="The number of data entries to return."),
] = 100,
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,

View File

@@ -7,6 +7,7 @@ from pydantic import BaseModel, validate_arguments
import openbb_core.app.model.command_context
import openbb_core.app.model.results.empty
from openbb_core.app.model.command_output import CommandOutput
from openbb_core.app.model.custom_parameter import OpenBBCustomParameter
from openbb_core.app.static.container import Container
from openbb_core.app.static.filters import filter_call, filter_inputs, filter_output
@@ -16,7 +17,9 @@ class CLASS_stocks_ca(Container):
@validate_arguments
def peers(
self,
symbol: str,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,

View File

@@ -1,11 +1,12 @@
### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ###
import typing
from typing import Literal, Optional
from typing import Annotated, Literal, Optional
from pydantic import validate_arguments
from openbb_core.app.model.command_output import CommandOutput
from openbb_core.app.model.custom_parameter import OpenBBCustomParameter
from openbb_core.app.static.container import Container
from openbb_core.app.static.filters import filter_call, filter_inputs, filter_output
@@ -15,111 +16,122 @@ class CLASS_stocks_dd(Container):
@validate_arguments
def sec(
self,
symbol: str,
type: Literal[
"1",
"1-A",
"1-E",
"1-K",
"1-N",
"1-SA",
"1-U",
"1-Z",
"10",
"10-D",
"10-K",
"10-M",
"10-Q",
"11-K",
"12b-25",
"13F",
"13H",
"144",
"15",
"15F",
"17-H",
"18",
"18-K",
"19b-4",
"19b-4(e)",
"19b-7",
"2-E",
"20-F",
"24F-2",
"25",
"3",
"4",
"40-F",
"5",
"6-K",
"7-M",
"8-A",
"8-K",
"8-M",
"9-M",
"ABS-15G",
"ABS-EE",
"ABS DD-15E",
"ADV",
"ADV-E",
"ADV-H",
"ADV-NR",
"ADV-W",
"ATS",
"ATS-N",
"ATS-R",
"BD",
"BD-N",
"BDW",
"C",
"CA-1",
"CB",
"CFPORTAL",
"CRS",
"CUSTODY",
"D",
"F-1",
"F-10",
"F-3",
"F-4",
"F-6",
"F-7",
"F-8",
"F-80",
"F-N",
"F-X",
"ID",
"MA",
"MA-I",
"MA-NR",
"MA-W",
"MSD",
"MSDW",
"N-14",
"N-17D-1",
"N-17f-1",
"N-17f-2",
"N-18f-1",
"N-1A",
"N-2",
"N-23c-3",
"N-27D-1",
"N-3",
"N-4",
"N-5",
"N-54A",
"N-54C",
"N-6",
"N-6EI-1",
"N-6F",
"N-8A",
"N-8B-2",
"N-8B-4",
"N-8F",
"N-CEN",
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
type: Annotated[
Literal[
"1",
"1-A",
"1-E",
"1-K",
"1-N",
"1-SA",
"1-U",
"1-Z",
"10",
"10-D",
"10-K",
"10-M",
"10-Q",
"11-K",
"12b-25",
"13F",
"13H",
"144",
"15",
"15F",
"17-H",
"18",
"18-K",
"19b-4",
"19b-4(e)",
"19b-7",
"2-E",
"20-F",
"24F-2",
"25",
"3",
"4",
"40-F",
"5",
"6-K",
"7-M",
"8-A",
"8-K",
"8-M",
"9-M",
"ABS-15G",
"ABS-EE",
"ABS DD-15E",
"ADV",
"ADV-E",
"ADV-H",
"ADV-NR",
"ADV-W",
"ATS",
"ATS-N",
"ATS-R",
"BD",
"BD-N",
"BDW",
"C",
"CA-1",
"CB",
"CFPORTAL",
"CRS",
"CUSTODY",
"D",
"F-1",
"F-10",
"F-3",
"F-4",
"F-6",
"F-7",
"F-8",
"F-80",
"F-N",
"F-X",
"ID",
"MA",
"MA-I",
"MA-NR",
"MA-W",
"MSD",
"MSDW",
"N-14",
"N-17D-1",
"N-17f-1",
"N-17f-2",
"N-18f-1",
"N-1A",
"N-2",
"N-23c-3",
"N-27D-1",
"N-3",
"N-4",
"N-5",
"N-54A",
"N-54C",
"N-6",
"N-6EI-1",
"N-6F",
"N-8A",
"N-8B-2",
"N-8B-4",
"N-8F",
"N-CEN",
],
OpenBBCustomParameter(description="The type of the SEC filing form."),
] = "10-K",
page: Optional[int] = 0,
limit: Optional[int] = 100,
page: Annotated[
Optional[int],
OpenBBCustomParameter(description="Page number of the results."),
] = 0,
limit: Annotated[
Optional[int],
OpenBBCustomParameter(description="The number of data entries to return."),
] = 100,
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,

View File

@@ -2,7 +2,7 @@
import datetime
import typing
from typing import List, Literal, Optional, Union
from typing import Annotated, List, Literal, Optional, Union
import pydantic
from pydantic import BaseModel, validate_arguments
@@ -10,6 +10,7 @@ from pydantic import BaseModel, validate_arguments
import openbb_core.app.model.command_context
import openbb_core.app.model.results.empty
from openbb_core.app.model.command_output import CommandOutput
from openbb_core.app.model.custom_parameter import OpenBBCustomParameter
from openbb_core.app.static.container import Container
from openbb_core.app.static.filters import filter_call, filter_inputs, filter_output
@@ -36,11 +37,21 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def balance(
self,
symbol: str,
period: Literal["annually", "quarterly"] = "annually",
limit: Optional[pydantic.types.NonNegativeInt] = 12,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
period: Annotated[
Literal["annually", "quarterly"],
OpenBBCustomParameter(
description="Period of the data to return (quarterly or annually)."
),
] = "annually",
limit: Annotated[
Optional[pydantic.types.NonNegativeInt],
OpenBBCustomParameter(description="The number of data entries to return."),
] = 12,
chart: bool = False,
provider: Optional[Literal["fmp", "polygon"]] = None,
provider: Optional[Literal["polygon", "fmp"]] = None,
**kwargs,
) -> CommandOutput[typing.List]:
"""Balance Sheet.
@@ -51,7 +62,7 @@ class CLASS_stocks_fa(Container):
Parameters
----------
provider: Literal[fmp, polygon]
provider: Literal[polygon, fmp]
The provider to use for the query.
symbol : ConstrainedStrValue
Symbol to get data for.
@@ -164,42 +175,6 @@ class CLASS_stocks_fa(Container):
total_liabilities_and_total_equity : Optional[int]
None
fmp
===
Parameters
----------
cik : Optional[str]
None
BalanceSheet
------------
calendarYear : Optional[int]
None
link : Optional[str]
None
finalLink : Optional[str]
None
cashAndShortTermInvestments : Optional[int]
None
goodwillAndIntangibleAssets : Optional[int]
None
deferredRevenueNonCurrent : Optional[int]
None
totalInvestments : Optional[int]
None
capitalLeaseObligations : Optional[int]
None
deferredTaxLiabilitiesNonCurrent : Optional[int]
None
totalNonCurrentLiabilities : Optional[int]
None
totalDebt : Optional[int]
None
netDebt : Optional[int]
None
polygon
=======
@@ -241,7 +216,43 @@ class CLASS_stocks_fa(Container):
BalanceSheet
------------
All fields are standardized.""" # noqa: E501
All fields are standardized.
fmp
===
Parameters
----------
cik : Optional[str]
None
BalanceSheet
------------
calendarYear : Optional[int]
None
link : Optional[str]
None
finalLink : Optional[str]
None
cashAndShortTermInvestments : Optional[int]
None
goodwillAndIntangibleAssets : Optional[int]
None
deferredRevenueNonCurrent : Optional[int]
None
totalInvestments : Optional[int]
None
capitalLeaseObligations : Optional[int]
None
deferredTaxLiabilitiesNonCurrent : Optional[int]
None
totalNonCurrentLiabilities : Optional[int]
None
totalDebt : Optional[int]
None
netDebt : Optional[int]
None"""
inputs = filter_inputs(
provider_choices={
"provider": provider,
@@ -266,8 +277,13 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def balance_growth(
self,
symbol: str,
limit: int = 10,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
limit: typing.Annotated[
int,
OpenBBCustomParameter(description="The number of data entries to return."),
] = 10,
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,
@@ -423,8 +439,18 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def cal(
self,
start_date: Union[datetime.date, None, str] = None,
end_date: Union[datetime.date, None, str] = None,
start_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="Start date of the data, in YYYY-MM-DD format."
),
] = None,
end_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="End date of the data, in YYYY-MM-DD format."
),
] = None,
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,
@@ -512,11 +538,21 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def cash(
self,
symbol: str,
period: Literal["annually", "quarterly"] = "annually",
limit: Optional[pydantic.types.NonNegativeInt] = 12,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
period: Annotated[
Literal["annually", "quarterly"],
OpenBBCustomParameter(
description="Period of the data to return (quarterly or annually)."
),
] = "annually",
limit: Annotated[
Optional[pydantic.types.NonNegativeInt],
OpenBBCustomParameter(description="The number of data entries to return."),
] = 12,
chart: bool = False,
provider: Optional[Literal["fmp", "polygon"]] = None,
provider: Optional[Literal["polygon", "fmp"]] = None,
**kwargs,
) -> CommandOutput[typing.List]:
"""Cash Flow Statement.
@@ -527,7 +563,7 @@ class CLASS_stocks_fa(Container):
Parameters
----------
provider: Literal[fmp, polygon]
provider: Literal[polygon, fmp]
The provider to use for the query.
symbol : ConstrainedStrValue
Symbol to get data for.
@@ -620,24 +656,6 @@ class CLASS_stocks_fa(Container):
cash_at_end_of_period : Optional[int]
None
fmp
===
Parameters
----------
cik : Optional[str]
Central Index Key (CIK) of the company.
CashFlowStatement
-----------------
calendarYear : Optional[int]
None
link : Optional[str]
None
finalLink : Optional[str]
None
polygon
=======
@@ -679,7 +697,25 @@ class CLASS_stocks_fa(Container):
CashFlowStatement
-----------------
All fields are standardized.""" # noqa: E501
All fields are standardized.
fmp
===
Parameters
----------
cik : Optional[str]
Central Index Key (CIK) of the company.
CashFlowStatement
-----------------
calendarYear : Optional[int]
None
link : Optional[str]
None
finalLink : Optional[str]
None"""
inputs = filter_inputs(
provider_choices={
"provider": provider,
@@ -704,8 +740,13 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def cash_growth(
self,
symbol: str,
limit: int = 10,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
limit: typing.Annotated[
int,
OpenBBCustomParameter(description="The number of data entries to return."),
] = 10,
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,
@@ -843,7 +884,9 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def comp(
self,
symbol: str,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,
@@ -938,8 +981,18 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def comsplit(
self,
start_date: Union[datetime.date, None, str] = None,
end_date: Union[datetime.date, None, str] = None,
start_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="Start date of the data, in YYYY-MM-DD format."
),
] = None,
end_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="End date of the data, in YYYY-MM-DD format."
),
] = None,
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,
@@ -1055,7 +1108,9 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def divs(
self,
symbol: str,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,
@@ -1155,8 +1210,13 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def earning(
self,
symbol: str,
limit: Optional[int] = 50,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
limit: Annotated[
Optional[int],
OpenBBCustomParameter(description="The number of data entries to return."),
] = 50,
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,
@@ -1246,7 +1306,9 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def emp(
self,
symbol: str,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,
@@ -1367,9 +1429,19 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def est(
self,
symbol: str,
period: Literal["quarterly", "annually"] = "annually",
limit: int = 30,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
period: Annotated[
Literal["quarterly", "annually"],
OpenBBCustomParameter(
description="Period of the data to return (quarterly or annually)."
),
] = "annually",
limit: typing.Annotated[
int,
OpenBBCustomParameter(description="The number of data entries to return."),
] = 30,
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,
@@ -1572,11 +1644,21 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def income(
self,
symbol: str,
period: Literal["annually", "quarterly"] = "annually",
limit: Optional[pydantic.types.NonNegativeInt] = 12,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
period: Annotated[
Literal["annually", "quarterly"],
OpenBBCustomParameter(
description="Period of the data to return (quarterly or annually)."
),
] = "annually",
limit: Annotated[
Optional[pydantic.types.NonNegativeInt],
OpenBBCustomParameter(description="The number of data entries to return."),
] = 12,
chart: bool = False,
provider: Optional[Literal["fmp", "polygon"]] = None,
provider: Optional[Literal["polygon", "fmp"]] = None,
**kwargs,
) -> CommandOutput[typing.List]:
"""Income Statement.
@@ -1587,7 +1669,7 @@ class CLASS_stocks_fa(Container):
Parameters
----------
provider: Literal[fmp, polygon]
provider: Literal[polygon, fmp]
The provider to use for the query.
symbol : ConstrainedStrValue
Symbol to get data for.
@@ -1690,19 +1772,6 @@ class CLASS_stocks_fa(Container):
final_link : Optional[str]
Final link to the income statement.
fmp
===
Parameters
----------
cik : Optional[str]
The CIK of the company if no symbol is provided.
IncomeStatement
---------------
All fields are standardized.
polygon
=======
@@ -1757,7 +1826,35 @@ class CLASS_stocks_fa(Container):
participating_securities_distributed_and_undistributed_earnings_loss_basic : Optional[float]
None
preferred_stock_dividends_and_other_adjustments : Optional[float]
None""" # noqa: E501
None
fmp
===
Parameters
----------
cik : Optional[str]
The CIK of the company if no symbol is provided.
IncomeStatement
---------------
calendarYear : Optional[int]
None
grossProfitRatio : Optional[float]
None
ebitdaratio : Optional[float]
None
operatingIncomeRatio : Optional[float]
None
incomeBeforeTaxRatio : Optional[float]
None
netIncomeRatio : Optional[float]
None
link : Optional[str]
None
finalLink : Optional[str]
None"""
inputs = filter_inputs(
provider_choices={
"provider": provider,
@@ -1782,9 +1879,19 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def income_growth(
self,
symbol: str,
limit: int = 10,
period: Literal["annually", "quarterly"] = "annually",
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
limit: typing.Annotated[
int,
OpenBBCustomParameter(description="The number of data entries to return."),
] = 10,
period: Annotated[
Literal["annually", "quarterly"],
OpenBBCustomParameter(
description="Period of the data to return (quarterly or annually)."
),
] = "annually",
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,
@@ -1917,34 +2024,48 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def ins(
self,
symbol: str,
transactionType: Optional[
List[
Literal[
"A-Award",
"C-Conversion",
"D-Return",
"E-ExpireShort",
"F-InKind",
"G-Gift",
"H-ExpireLong",
"I-Discretionary",
"J-Other",
"L-Small",
"M-Exempt",
"O-OutOfTheMoney",
"P-Purchase",
"S-Sale",
"U-Tender",
"W-Will",
"X-InTheMoney",
"Z-Trust",
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
transactionType: Annotated[
Optional[
List[
Literal[
"A-Award",
"C-Conversion",
"D-Return",
"E-ExpireShort",
"F-InKind",
"G-Gift",
"H-ExpireLong",
"I-Discretionary",
"J-Other",
"L-Small",
"M-Exempt",
"O-OutOfTheMoney",
"P-Purchase",
"S-Sale",
"U-Tender",
"W-Will",
"X-InTheMoney",
"Z-Trust",
]
]
]
],
OpenBBCustomParameter(description="The type of the transaction."),
] = ["P-Purchase"],
reportingCik: Optional[int] = None,
companyCik: Optional[int] = None,
page: Optional[int] = 0,
reportingCik: Annotated[
Optional[int],
OpenBBCustomParameter(description="The CIK of the reporting owner."),
] = None,
companyCik: Annotated[
Optional[int],
OpenBBCustomParameter(description="The CIK of the company owner."),
] = None,
page: Annotated[
Optional[int],
OpenBBCustomParameter(description="The page number of the data to fetch."),
] = 0,
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,
@@ -2055,9 +2176,16 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def ins_own(
self,
symbol: str,
include_current_quarter: bool = False,
date: Optional[datetime.date] = None,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
include_current_quarter: typing.Annotated[
bool, OpenBBCustomParameter(description="Include current quarter data.")
] = False,
date: Annotated[
Optional[datetime.date],
OpenBBCustomParameter(description="A specific date to get data for."),
] = None,
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,
@@ -2220,9 +2348,19 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def metrics(
self,
symbol: str,
period: Literal["annually", "quarterly"] = "annually",
limit: Optional[int] = 100,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
period: Annotated[
Literal["annually", "quarterly"],
OpenBBCustomParameter(
description="Period of the data to return (quarterly or annually)."
),
] = "annually",
limit: Annotated[
Optional[int],
OpenBBCustomParameter(description="The number of data entries to return."),
] = 100,
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,
@@ -2417,7 +2555,9 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def mgmt(
self,
symbol: str,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,
@@ -2533,7 +2673,9 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def overview(
self,
symbol: str,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,
@@ -2674,9 +2816,17 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def own(
self,
symbol: str,
date: datetime.date,
page: Optional[int] = 0,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
date: typing.Annotated[
datetime.date,
OpenBBCustomParameter(description="A specific date to get data for."),
],
page: Annotated[
Optional[int],
OpenBBCustomParameter(description="The page number of the data to fetch."),
] = 0,
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,
@@ -2829,7 +2979,9 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def pt(
self,
symbol: str,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,
@@ -2908,7 +3060,9 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def pta(
self,
symbol: str,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,
@@ -3051,9 +3205,19 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def revgeo(
self,
symbol: str,
period: Literal["quarterly", "annually"] = "annually",
structure: Literal["hierarchical", "flat"] = "flat",
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
period: Annotated[
Literal["quarterly", "annually"],
OpenBBCustomParameter(
description="Period of the data to return (quarterly or annually)."
),
] = "annually",
structure: Annotated[
Literal["hierarchical", "flat"],
OpenBBCustomParameter(description="The structure of the returned data."),
] = "flat",
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,
@@ -3142,9 +3306,19 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def revseg(
self,
symbol: str,
period: Literal["quarterly", "annually"] = "annually",
structure: Literal["hierarchical", "flat"] = "flat",
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
period: Annotated[
Literal["quarterly", "annually"],
OpenBBCustomParameter(
description="Period of the data to return (quarterly or annually)."
),
] = "annually",
structure: Annotated[
Literal["hierarchical", "flat"],
OpenBBCustomParameter(description="The structure of the returned data."),
] = "flat",
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,
@@ -3289,7 +3463,9 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def shrs(
self,
symbol: str,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,
@@ -3370,7 +3546,9 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def split(
self,
symbol: str,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,
@@ -3464,9 +3642,21 @@ class CLASS_stocks_fa(Container):
@validate_arguments
def transcript(
self,
symbol: str,
year: int,
quarter: Literal[1, 2, 3, 4] = 1,
symbol: typing.Annotated[
str, OpenBBCustomParameter(description="Symbol to get data for.")
],
year: typing.Annotated[
int,
OpenBBCustomParameter(
description="The year of the earnings call transcript."
),
],
quarter: Annotated[
Literal[1, 2, 3, 4],
OpenBBCustomParameter(
description="The quarter of the earnings call transcript."
),
] = 1,
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs,

View File

@@ -57,7 +57,7 @@ class CLASS_ta(Container):
>>> from openbb import obb
>>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp")
>>> atr_data = obb.ta.atr(data=stock_data.results)
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
index=index,
@@ -109,7 +109,7 @@ class CLASS_ta(Container):
>>> from openbb import obb
>>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp")
>>> fib_data = obb.ta.fib(data=stock_data.results, period=120)
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
index=index,
@@ -166,7 +166,7 @@ class CLASS_ta(Container):
>>> from openbb import obb
>>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp")
>>> obv_data = obb.ta.obv(data=stock_data.results, offset=0)
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
index=index,
@@ -219,7 +219,7 @@ class CLASS_ta(Container):
>>> from openbb import obb
>>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp")
>>> fisher_data = obb.ta.fisher(data=stock_data.results, length=14, signal=1)
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
index=index,
@@ -275,7 +275,7 @@ class CLASS_ta(Container):
>>> from openbb import obb
>>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp")
>>> adosc_data = obb.ta.adosc(data=stock_data.results, fast=3, slow=10, offset=0)
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
index=index,
@@ -297,7 +297,7 @@ class CLASS_ta(Container):
def tv(
self, chart: bool = False
) -> CommandOutput[openbb_core.app.model.results.empty.Empty]:
"""TradingView.""" # noqa: E501
"""TradingView."""
inputs = filter_inputs(
chart=chart,
)
@@ -365,7 +365,7 @@ class CLASS_ta(Container):
>>> bbands = obb.ta.bbands(
>>> data=stock_data.results, target="close", length=50, std=2, mamode="sma", offset=0
>>> )
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
target=target,
@@ -389,7 +389,7 @@ class CLASS_ta(Container):
def multi(
self, chart: bool = False
) -> CommandOutput[openbb_core.app.model.results.empty.Empty]:
"""Plot multiple indicators on the same chart.""" # noqa: E501
"""Plot multiple indicators on the same chart."""
inputs = filter_inputs(
chart=chart,
)
@@ -444,7 +444,7 @@ class CLASS_ta(Container):
>>> from openbb import obb
>>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp")
>>> zlma_data = obb.ta.zlma(data=stock_data.results, target="close", length=50, offset=0)
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
target=target,
@@ -506,7 +506,7 @@ class CLASS_ta(Container):
>>> from openbb import obb
>>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp")
>>> aroon_data = obb.ta.aroon(data=stock_data.results, length=25, scalar=100)
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
index=index,
@@ -565,7 +565,7 @@ class CLASS_ta(Container):
>>> from openbb import obb
>>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp")
>>> sma_data = obb.ta.sma(data=stock_data.results,target="close",length=50,offset=0)
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
target=target,
@@ -622,7 +622,7 @@ class CLASS_ta(Container):
>>> from openbb import obb
>>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp")
>>> demark_data = obb.ta.demark(data=stock_data.results,offset=0)
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
index=index,
@@ -677,7 +677,7 @@ class CLASS_ta(Container):
>>> from openbb import obb
>>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp")
>>> vwap_data = obb.ta.vwap(data=stock_data.results,anchor="D",offset=0)
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
index=index,
@@ -698,7 +698,7 @@ class CLASS_ta(Container):
def recom(
self, chart: bool = False
) -> CommandOutput[openbb_core.app.model.results.empty.Empty]:
"""Recommendation.""" # noqa: E501
"""Recommendation."""
inputs = filter_inputs(
chart=chart,
)
@@ -758,7 +758,7 @@ class CLASS_ta(Container):
>>> from openbb import obb
>>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp")
>>> macd_data = obb.ta.macd(data=stock_data.results,target="close",fast=12,slow=26,signal=9)
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
target=target,
@@ -816,7 +816,7 @@ class CLASS_ta(Container):
>>> from openbb import obb
>>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp")
>>> hma_data = obb.ta.hma(data=stock_data.results,target="close",length=50,offset=0)
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
target=target,
@@ -875,7 +875,7 @@ class CLASS_ta(Container):
>>> from openbb import obb
>>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp")
>>> donchian_data = obb.ta.donchian(data=stock_data.results,lower_length=20,upper_length=20,offset=0)
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
index=index,
@@ -927,7 +927,7 @@ class CLASS_ta(Container):
Number of periods for the offset, by default 26.
lookahead : bool, optional
drops the Chikou Span Column to prevent potential data leak
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
index=index,
@@ -980,7 +980,7 @@ class CLASS_ta(Container):
>>> from openbb import obb
>>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp")
>>> clenow_data = obb.ta.clenow(data=stock_data.results,period=90)
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
index=index,
@@ -1037,7 +1037,7 @@ class CLASS_ta(Container):
>>> from openbb import obb
>>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp")
>>> ad_data = obb.ta.ad(data=stock_data.results,offset=0)
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
index=index,
@@ -1091,7 +1091,7 @@ class CLASS_ta(Container):
>>> from openbb import obb
>>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp")
>>> adx_data = obb.ta.adx(data=stock_data.results,length=50,scalar=100.0,drift=1)
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
index=index,
@@ -1148,7 +1148,7 @@ class CLASS_ta(Container):
>>> from openbb import obb
>>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp")
>>> wma_data = obb.ta.wma(data=stock_data.results, target="close", length=50, offset=0)
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
target=target,
@@ -1197,7 +1197,7 @@ class CLASS_ta(Container):
-------
CommandOutput[List[Data]]
The CCI data.
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
index=index,
@@ -1257,7 +1257,7 @@ class CLASS_ta(Container):
>>> from openbb import obb
>>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp")
>>> rsi_data = obb.ta.rsi(data=stock_data.results, target="close", length=14, scalar=100.0, drift=1)
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
target=target,
@@ -1280,7 +1280,7 @@ class CLASS_ta(Container):
def summary(
self, chart: bool = False
) -> CommandOutput[openbb_core.app.model.results.empty.Empty]:
"""Summary.""" # noqa: E501
"""Summary."""
inputs = filter_inputs(
chart=chart,
)
@@ -1334,7 +1334,7 @@ class CLASS_ta(Container):
>>> from openbb import obb
>>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp")
>>> stoch_data = obb.ta.stoch(data=stock_data.results, fast_k_period=14, slow_d_period=3, slow_k_period=3)
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
index=index,
@@ -1356,7 +1356,7 @@ class CLASS_ta(Container):
def rsp(
self, chart: bool = False
) -> CommandOutput[openbb_core.app.model.results.empty.Empty]:
"""Relative Strength Performance.""" # noqa: E501
"""Relative Strength Performance."""
inputs = filter_inputs(
chart=chart,
)
@@ -1412,7 +1412,7 @@ class CLASS_ta(Container):
>>> from openbb import obb
>>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp")
>>> kc_data = obb.ta.kc(data=stock_data.results, length=20, scalar=20, ma_mode="ema", offset=0)
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
index=index,
@@ -1465,7 +1465,7 @@ class CLASS_ta(Container):
>>> from openbb import obb
>>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp")
>>> cg_data = obb.ta.cg(data=stock_data.results, length=14)
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
index=index,
@@ -1548,7 +1548,7 @@ class CLASS_ta(Container):
>>> from openbb import obb
>>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp")
>>> cones_data = obb.ta.cones(data=stock_data.results, lower_q=0.25, upper_q=0.75, model="STD")
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
index=index,
@@ -1611,7 +1611,7 @@ class CLASS_ta(Container):
>>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp")
>>> ema_data = obb.ta.ema(data=stock_data.results,target="close",length=50,offset=0)
""" # noqa: E501
"""
inputs = filter_inputs(
data=data,
target=target,

View File

@@ -21,8 +21,9 @@ from typing import (
import pandas as pd
from pydantic.fields import ModelField
from starlette.routing import BaseRoute
from typing_extensions import _AnnotatedAlias
from typing_extensions import Annotated, _AnnotatedAlias
from openbb_core.app.model.custom_parameter import OpenBBCustomParameter
from openbb_core.app.provider_interface import get_provider_interface
from openbb_core.app.router import RouterLoader
@@ -179,6 +180,9 @@ class ImportDefinition:
hint_type_list = cls.get_path_hint_type_list(path=path)
code = "\nfrom openbb_core.app.static.container import Container"
code += "\nfrom openbb_core.app.model.command_output import CommandOutput"
code += (
"\nfrom openbb_core.app.model.custom_parameter import OpenBBCustomParameter"
)
# These imports were not detected before build, so we add them manually and
# ruff --fix the resulting code to remove unused imports.
@@ -189,7 +193,7 @@ class ImportDefinition:
code += "\nimport pydantic"
code += "\nfrom pydantic import validate_arguments, BaseModel"
code += "\nfrom inspect import Parameter"
code += "\nfrom typing import List, Dict, Union, Optional, Literal"
code += "\nfrom typing import List, Dict, Union, Optional, Literal, Annotated"
code += "\nfrom openbb_core.app.utils import df_to_basemodel"
code += "\nfrom openbb_core.app.static.filters import filter_call, filter_inputs, filter_output\n"
@@ -347,6 +351,7 @@ class DocstringGenerator:
section_docstring += (
f"{cls.get_available_providers(query_mapping)}"
)
# TODO: How do we know if the model has a chart parameter?
elif section_name == "Data":
underline = "-" * len(model_name)
section_docstring += f"\n{model_name}\n{underline}\n"
@@ -366,23 +371,26 @@ class DocstringGenerator:
return docstring
@classmethod
def generate_command_docstring(cls, func: Callable, model_name: str) -> Callable:
def generate_command_docstring(
cls, func: Callable, model_name: Optional[str] = None
) -> Callable:
"""Generate the docstring for the command."""
provider_interface_mapping = get_provider_interface().map
query_mapping = provider_interface_mapping.get(model_name, None)
if query_mapping:
docstring = func.__doc__ or ""
docstring += "\n\n"
if model_name:
provider_interface_mapping = get_provider_interface().map
query_mapping = provider_interface_mapping.get(model_name, None)
if query_mapping:
docstring = func.__doc__ or ""
docstring += "\n\n"
query_mapping_ordered = cls.reorder_dictionary(query_mapping, "openbb")
docstring = cls.generate_provider_docstrings(
docstring=docstring,
query_mapping=query_mapping_ordered,
model_name=model_name,
provider_interface_mapping=provider_interface_mapping,
)
query_mapping_ordered = cls.reorder_dictionary(query_mapping, "openbb")
docstring = cls.generate_provider_docstrings(
docstring=docstring,
query_mapping=query_mapping_ordered,
model_name=model_name,
provider_interface_mapping=provider_interface_mapping,
)
func.__doc__ = docstring
func.__doc__ = docstring
return func
@@ -453,7 +461,7 @@ class MethodDefinition:
@staticmethod
def format_params(
parameter_map: Dict[str, Parameter]
) -> "OrderedDict[str, Parameter]":
) -> OrderedDict[str, Parameter]:
"""Format the params."""
# These are types we want to expand.
# For example, start_date is always a 'date', but we also accept 'str' as input.
@@ -517,9 +525,45 @@ class MethodDefinition:
return MethodDefinition.reorder_params(params=formatted)
@staticmethod
def build_func_params(parameter_map: Dict[str, Parameter]) -> str:
"""Build the function parameters."""
def add_field_descriptions(
od: OrderedDict[str, Parameter], model_name: Optional[str] = None
) -> OrderedDict[str, Parameter]:
"""Add the field description to the param signature."""
if model_name:
available_fields = (
get_provider_interface()
.map[model_name]["openbb"]["QueryParams"]["fields"]
.keys()
)
for param, value in od.items():
if param not in available_fields:
continue
description = (
get_provider_interface()
.map[model_name]["openbb"]["QueryParams"]["fields"][param]
.field_info.description
)
new_value = value.replace(
annotation=Annotated[
value.annotation, OpenBBCustomParameter(description=description)
]
)
od[param] = new_value
@staticmethod
def build_func_params(
parameter_map: Dict[str, Parameter], model_name: Optional[str] = None
) -> str:
od = MethodDefinition.format_params(parameter_map=parameter_map)
MethodDefinition.add_field_descriptions(
od=od, model_name=model_name
) # this modified `od` in place
func_params = ", ".join(str(param) for param in od.values())
func_params = func_params.replace("NoneType", "None")
func_params = func_params.replace(
@@ -560,10 +604,12 @@ class MethodDefinition:
@staticmethod
def build_command_method_signature(
func_name: str, parameter_map: Dict[str, Parameter], return_type: type
func_name: str,
parameter_map: Dict[str, Parameter],
return_type: type,
model_name: Optional[str] = None,
) -> str:
"""Build the command method signature."""
func_params = MethodDefinition.build_func_params(parameter_map)
func_params = MethodDefinition.build_func_params(parameter_map, model_name)
func_returns = MethodDefinition.build_func_returns(return_type)
code = "\n @filter_call"
@@ -622,7 +668,7 @@ class MethodDefinition:
@classmethod
def build_command_method(
cls, path: str, func: Callable, model_name: Optional[str]
cls, path: str, func: Callable, model_name: Optional[str] = None
) -> str:
"""Build the command method."""
func_name = func.__name__
@@ -630,15 +676,15 @@ class MethodDefinition:
sig = signature(func)
parameter_map = dict(sig.parameters)
if model_name:
func = DocstringGenerator.generate_command_docstring(
func=func, model_name=model_name
)
func = DocstringGenerator.generate_command_docstring(
func=func, model_name=model_name
)
code = cls.build_command_method_signature(
func_name=func_name,
parameter_map=parameter_map,
return_type=sig.return_annotation,
model_name=model_name,
)
code += cls.build_command_method_doc(func=func)
code += cls.build_command_method_implementation(path=path, func=func)

View File

@@ -60,8 +60,9 @@ class BalanceSheetData(Data):
description="Accrued income taxes, other deferred revenue"
)
short_term_debt: Optional[int] = Field(
description="Short-term borrowings, Long-term debt due within one year,"
" Operating lease obligations due within one year, Finance lease obligations due within one year"
description="Short-term borrowings, Long-term debt due within one year, "
"Operating lease obligations due within one year, "
"Finance lease obligations due within one year"
)
current_liabilities: Optional[int]

View File

@@ -91,8 +91,8 @@ class InstitutionalOwnershipData(Data, BaseSymbol):
description="Total number of call options contracts traded for Apple Inc. on the previous reporting date."
)
total_calls_change: int = Field(
description="Change in the total number of call options contracts "
"traded between the current and previous reporting dates."
description="Change in the total number of call options contracts traded between "
"the current and previous reporting dates."
)
total_puts: int = Field(
description="Total number of put options contracts traded for Apple Inc. on the specified date."
@@ -101,12 +101,12 @@ class InstitutionalOwnershipData(Data, BaseSymbol):
description="Total number of put options contracts traded for Apple Inc. on the previous reporting date."
)
total_puts_change: int = Field(
description="Change in the total number of put options contracts traded between the current and "
"previous reporting dates."
description="Change in the total number of put "
"options contracts traded between the current and previous reporting dates."
)
put_call_ratio: float = Field(
description="The put-call ratio, which is the ratio of the total number of put "
"options to call options traded on the specified date."
description="The put-call ratio, which is the ratio of the total number of "
"put options to call options traded on the specified date."
)
last_put_call_ratio: float = Field(
description="The put-call ratio on the previous reporting date."

View File

@@ -32,4 +32,4 @@ class StockEODData(Data):
low: PositiveFloat = Field(description=DATA_DESCRIPTIONS.get("low", ""))
close: PositiveFloat = Field(description=DATA_DESCRIPTIONS.get("close", ""))
volume: float = Field(description=DATA_DESCRIPTIONS.get("volume", ""))
vwap: Optional[float] = Field(description=DATA_DESCRIPTIONS.get("vwap", ""))
vwap: Optional[PositiveFloat] = Field(description=DATA_DESCRIPTIONS.get("vwap", ""))

View File

@@ -282,8 +282,8 @@ def display_redditsent(
Optionally specify the name of the sheet the data is exported to.
export: str
Format to export data
external_axes: Optional[List[plt.Axes]]
If supplied, expect 1 external axis
external_axes : bool, optional
Whether to return the figure object or not, by default False
"""
fig = OpenBBFigure()

View File

@@ -975,8 +975,8 @@ def display_yield_curve(
----------
date: str
Date to get curve for. If None, gets most recent date (format yyyy-mm-dd)
external_axes : Optional[List[plt.Axes]], optional
External axes (1 axis is expected in the list), by default None
external_axes : bool, optional
Whether to return the figure object or not, by default False
raw : bool
Output only raw data
export : str

View File

@@ -48,72 +48,67 @@ def display_brnn_forecast(
) -> Union[OpenBBFigure, None]:
"""Display BRNN forecast
Parameters
----------
data: Union[pd.Series, pd.DataFrame]
Input Data
target_column: str
Target column to forecast. Defaults to "close".
dataset_name: str
The name of the ticker to be predicted
n_predict: int
Days to predict. Defaults to 5.
train_split: float
Train/val split. Defaults to 0.85.
past_covariates: str
Multiple secondary columns to factor in when forecasting. Defaults to None.
forecast_horizon: int
Forecast horizon when performing historical forecasting. Defaults to 5.
input_chunk_length: int
Number of past time steps that are fed to the forecasting module at prediction time. Defaults to 14.
output_chunk_length: int
The length of the forecast of the model. Defaults to 5.
model_type: str
Either a string specifying the RNN module type ("RNN", "LSTM" or "GRU"). Defaults to "LSTM".
n_rnn_layers: int
Number of layers in the RNN module. Defaults to 1.
dropout: float
Fraction of neurons affected by Dropout. Defaults to 0.0.
batch_size: int
Number of time series (input and output sequences) used in each training pass. Defaults to 32.
n_epochs: int
Number of epochs over which to train the model. Defaults to 101.
learning_rate: float
Defaults to 1e-3.
model_save_name: str
Name for model. Defaults to "brnn_model".
force_reset: bool
If set to True, any previously-existing model with the same name will be reset
(all checkpoints will be discarded). Defaults to True.
save_checkpoints: bool
Whether or not to automatically save the untrained model and checkpoints from training.
Defaults to True.
sheet_name: str
Optionally specify the name of the sheet the data is exported to.
export: str
Format to export data
residuals: bool
Whether to show residuals for the model. Defaults to False.
forecast_only: bool
Whether to only show dates in the forecasting range. Defaults to False.
start_date: Optional[datetime]
The starting date to perform analysis, data before this is trimmed. Defaults to None.
end_date: Optional[datetime]
The ending date to perform analysis, data after this is trimmed. Defaults to None.
naive: bool
Whether to show the naive baseline. This just assumes the closing price will be the same
as the previous day's closing price. Defaults to False.
<<<<<<< HEAD
external_axes : bool, optional
Whether to return the figure object or not, by default False
=======
export_pred_raw: bool
Whether to export the raw predicted values. Defaults to False.
metric: str
The metric to use for the model. Defaults to "mape".
external_axes: Optional[List[plt.axes]]
External axes to plot on
>>>>>>> OpenBBTerminal-main
Parameters
----------
data: Union[pd.Series, pd.DataFrame]
Input Data
target_column: str
Target column to forecast. Defaults to "close".
dataset_name: str
The name of the ticker to be predicted
n_predict: int
Days to predict. Defaults to 5.
train_split: float
Train/val split. Defaults to 0.85.
past_covariates: str
Multiple secondary columns to factor in when forecasting. Defaults to None.
forecast_horizon: int
Forecast horizon when performing historical forecasting. Defaults to 5.
input_chunk_length: int
Number of past time steps that are fed to the forecasting module at prediction time. Defaults to 14.
output_chunk_length: int
The length of the forecast of the model. Defaults to 5.
model_type: str
Either a string specifying the RNN module type ("RNN", "LSTM" or "GRU"). Defaults to "LSTM".
n_rnn_layers: int
Number of layers in the RNN module. Defaults to 1.
dropout: float
Fraction of neurons affected by Dropout. Defaults to 0.0.
batch_size: int
Number of time series (input and output sequences) used in each training pass. Defaults to 32.
n_epochs: int
Number of epochs over which to train the model. Defaults to 101.
learning_rate: float
Defaults to 1e-3.
model_save_name: str
Name for model. Defaults to "brnn_model".
force_reset: bool
If set to True, any previously-existing model with the same name will be reset
(all checkpoints will be discarded). Defaults to True.
save_checkpoints: bool
Whether or not to automatically save the untrained model and checkpoints from training.
Defaults to True.
sheet_name: str
Optionally specify the name of the sheet the data is exported to.
export: str
Format to export data
residuals: bool
Whether to show residuals for the model. Defaults to False.
forecast_only: bool
Whether to only show dates in the forecasting range. Defaults to False.
start_date: Optional[datetime]
The starting date to perform analysis, data before this is trimmed. Defaults to None.
end_date: Optional[datetime]
The ending date to perform analysis, data after this is trimmed. Defaults to None.
naive: bool
Whether to show the naive baseline. This just assumes the closing price will be the same
as the previous day's closing price. Defaults to False.
export_pred_raw: bool
Whether to export the raw predicted values. Defaults to False.
metric: str
The metric to use for the model. Defaults to "mape".
external_axes : bool, optional
Whether to return the figure object or not, by default False
"""
data = helpers.clean_data(
data, start_date, end_date, target_column, past_covariates

View File

@@ -41,57 +41,52 @@ def display_expo_forecast(
) -> Union[OpenBBFigure, None]:
"""Display Probabilistic Exponential Smoothing forecast
Parameters
----------
data : Union[pd.Series, np.array]
Data to forecast
dataset_name: str
The name of the ticker to be predicted
target_column: Optional[str]:
Target column to forecast. Defaults to "close".
trend: str
Trend component. One of [N, A, M]
Defaults to ADDITIVE.
seasonal: str
Seasonal component. One of [N, A, M]
Defaults to ADDITIVE.
seasonal_periods: int
Number of seasonal periods in a year
If not set, inferred from frequency of the series.
dampen: str
Dampen the function
n_predict: int
Number of days to forecast
start_window: float
Size of sliding window from start of timeseries and onwards
forecast_horizon: int
Number of days to forecast when backtesting and retraining historical
sheet_name: str
Optionally specify the name of the sheet the data is exported to.
export: str
Format to export data
residuals: bool
Whether to show residuals for the model. Defaults to False.
forecast_only: bool
Whether to only show dates in the forecasting range. Defaults to False.
start_date: Optional[datetime]
The starting date to perform analysis, data before this is trimmed. Defaults to None.
end_date: Optional[datetime]
The ending date to perform analysis, data after this is trimmed. Defaults to None.
naive: bool
Whether to show the naive baseline. This just assumes the closing price will be the same
as the previous day's closing price. Defaults to False.
<<<<<<< HEAD
external_axes : bool, optional
Whether to return the figure object or not, by default False
=======
export_pred_raw: bool
Whether to export the raw predicted values. Defaults to False.
metric: str
The metric to use when backtesting. Defaults to "mape".
external_axes: Optional[List[plt.axes]]
External axes to plot on
>>>>>>> OpenBBTerminal-main
Parameters
----------
data : Union[pd.Series, np.array]
Data to forecast
dataset_name: str
The name of the ticker to be predicted
target_column: Optional[str]:
Target column to forecast. Defaults to "close".
trend: str
Trend component. One of [N, A, M]
Defaults to ADDITIVE.
seasonal: str
Seasonal component. One of [N, A, M]
Defaults to ADDITIVE.
seasonal_periods: int
Number of seasonal periods in a year
If not set, inferred from frequency of the series.
dampen: str
Dampen the function
n_predict: int
Number of days to forecast
start_window: float
Size of sliding window from start of timeseries and onwards
forecast_horizon: int
Number of days to forecast when backtesting and retraining historical
sheet_name: str
Optionally specify the name of the sheet the data is exported to.
export: str
Format to export data
residuals: bool
Whether to show residuals for the model. Defaults to False.
forecast_only: bool
Whether to only show dates in the forecasting range. Defaults to False.
start_date: Optional[datetime]
The starting date to perform analysis, data before this is trimmed. Defaults to None.
end_date: Optional[datetime]
The ending date to perform analysis, data after this is trimmed. Defaults to None.
naive: bool
Whether to show the naive baseline. This just assumes the closing price will be the same
as the previous day's closing price. Defaults to False.
export_pred_raw: bool
Whether to export the raw predicted values. Defaults to False.
metric: str
The metric to use when backtesting. Defaults to "mape".
external_axes : bool, optional
Whether to return the figure object or not, by default False
"""
data = helpers.clean_data(data, start_date, end_date, target_column, None)
if not helpers.check_data(data, target_column, None):

View File

@@ -40,7 +40,7 @@ def get_data(
query_params = {
"all_feilds": "False",
"ordering": "-published_on,-share_of_article,-pagerank",
"ordering": "-published_on,-entity_score,-share_of_article,-pagerank",
}
if ticker:
query_params["ticker"] = ticker
@@ -70,7 +70,7 @@ def get_data(
query_params["offset"] = offset # type:ignore
response = requests.get(
"https://althub-backend.invisagealpha.com/api/OnclusiveSentiment/",
"https://data-access.althub.com/api/OnclusiveSentiment/",
headers=headers,
params=query_params,
timeout=5,