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

This commit is contained in:
hjoaquim
2023-08-09 12:19:03 +01:00
17 changed files with 1924 additions and 1339 deletions

View File

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

View File

@@ -0,0 +1,7 @@
from pydantic import BaseModel
class OpenBBCustomParameter(BaseModel):
"""Custom parameter for OpenBB."""
description: str

View File

@@ -6,18 +6,10 @@ 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 +26,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 +45,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."""
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 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.
@@ -348,6 +390,32 @@ class CLASS_economy(Container):
volume : PositiveFloat
The volume 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
===
@@ -374,33 +442,7 @@ class CLASS_economy(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.
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."""
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."""
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."""
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.
@@ -139,6 +152,28 @@ class CLASS_stocks(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.
StockEOD
--------
n : PositiveInt
The number of transactions for the symbol in the time period.
fmp
===
@@ -161,29 +196,7 @@ class CLASS_stocks(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.
StockEOD
--------
n : PositiveInt
The number of transactions for the symbol in the time period."""
Change \\% in the price of the symbol over a period of time."""
inputs = filter_inputs(
provider_choices={
"provider": provider,
@@ -208,11 +221,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.
@@ -223,7 +248,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.
@@ -296,23 +321,6 @@ class CLASS_stocks(Container):
image : List[BenzingaImage]
The images associated with 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
=======
@@ -357,7 +365,24 @@ class CLASS_stocks(Container):
publisher : PolygonPublisher
Publisher of the article.
tickers : List[str]
Tickers covered in the article."""
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,
@@ -382,8 +407,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

@@ -8,6 +8,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
@@ -17,7 +18,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 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
@@ -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."""
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."""
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.
@@ -1672,34 +1754,6 @@ class CLASS_stocks_fa(Container):
weighted_average_shares_outstanding_dil : Optional[int]
Weighted average shares outstanding diluted.
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
polygon
=======
@@ -1754,6 +1808,34 @@ 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
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={
@@ -1779,9 +1861,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
@@ -1914,34 +2006,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
@@ -2052,9 +2158,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
@@ -2217,9 +2330,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
@@ -2414,7 +2537,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
@@ -2530,7 +2655,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
@@ -2671,9 +2798,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
@@ -2826,7 +2961,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
@@ -2905,7 +3042,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
@@ -3047,9 +3186,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
@@ -3136,9 +3285,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
@@ -3283,7 +3442,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
@@ -3364,7 +3525,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
@@ -3458,9 +3621,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

File diff suppressed because it is too large Load Diff

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"
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(
@@ -557,10 +601,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"
@@ -619,7 +665,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__
@@ -627,15 +673,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,7 +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,7 +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."
@@ -100,10 +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."