Docstring generation

This commit is contained in:
Igor Radovanovic
2023-08-01 14:06:16 +02:00
parent e77b51711d
commit cebe8fcfcf
12 changed files with 3913 additions and 124 deletions

View File

@@ -1,6 +1,7 @@
### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ###
from openbb_core.app.static.container import Container

View File

@@ -23,7 +23,104 @@ class CLASS_crypto(Container):
provider: Optional[Literal["fmp", "polygon"]] = None,
**kwargs
) -> CommandOutput[typing.List]:
"""Crypto Intraday Price."""
"""Crypto Intraday Price.
openbb
======
Parameters
----------
provider: Literal[fmp, polygon]
The provider to use for the query.
symbol : ConstrainedStrValue
Symbol to get data for.
start_date : Optional[date]
Start date of the data, in YYYY-MM-DD format.
end_date : Optional[date]
End date of the data, in YYYY-MM-DD format.
Returns
-------
CommandOutput
results: List[Data]
Serializable results.
provider: Optional[PROVIDERS]
Provider name.
warnings: Optional[List[Warning_]]
List of warnings.
error: Optional[Error]
Caught exceptions.
chart: Optional[Chart]
Chart object.
CryptoEOD
---------
open : PositiveFloat
The open price of the symbol.
high : PositiveFloat
The high price of the symbol.
low : PositiveFloat
The low price of the symbol.
close : PositiveFloat
The close price of the symbol.
volume : PositiveFloat
The volume of the symbol.
fmp
===
Parameters
----------
timeseries : Optional[NonNegativeInt]
Number of days to look back.
CryptoEOD
---------
date : datetime
The date of the data.
adjClose : float
Adjusted Close Price of the symbol.
unadjustedVolume : float
Unadjusted volume of the symbol.
change : float
Change in the price of the symbol from the previous day.
changePercent : float
Change \\% in the price of the symbol.
vwap : float
Volume Weighted Average Price of the symbol.
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
---------
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."""
inputs = filter_inputs(
provider_choices={
"provider": provider,

View File

@@ -45,7 +45,62 @@ class CLASS_economy(Container):
provider: Optional[Literal["fmp"]] = None,
**kwargs
) -> CommandOutput[typing.List]:
"""Get the constituents of an index."""
"""Get the constituents of an index.
openbb
======
Parameters
----------
provider: Literal[fmp]
The provider to use for the query.
index : Literal['nasdaq', 'sp500', 'dowjones']
Returns
-------
CommandOutput
results: List[Data]
Serializable results.
provider: Optional[PROVIDERS]
Provider name.
warnings: Optional[List[Warning_]]
List of warnings.
error: Optional[Error]
Caught exceptions.
chart: Optional[Chart]
Chart object.
MajorIndicesConstituents
------------------------
name : str
None
sector : str
None
subSector : Optional[str]
None
headQuarter : Optional[str]
None
dateFirstAdded : Union[date, str, NoneType]
None
cik : int
None
founded : Union[date, str]
None
fmp
===
Parameters
----------
All fields are standardized.
MajorIndicesConstituents
------------------------
All fields are standardized."""
inputs = filter_inputs(
provider_choices={
"provider": provider,
@@ -130,7 +185,66 @@ class CLASS_economy(Container):
provider: Optional[Literal["fred"]] = None,
**kwargs
) -> CommandOutput[typing.List]:
"""CPI."""
"""CPI.
openbb
======
Parameters
----------
provider: Literal[fred]
The provider to use for the query.
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']]
The country or countries to get data.
units : Literal['growth_previous', 'growth_same', 'index_2015']
The data units.
frequency : Literal['monthly', 'quarterly', 'annual']
The data time frequency.
harmonized : bool
Whether you wish to obtain harmonized data.
start_date : Optional[date]
Start date of the data, in YYYY-MM-DD format.
end_date : Optional[date]
End date of the data, in YYYY-MM-DD format.
Returns
-------
CommandOutput
results: List[Data]
Serializable results.
provider: Optional[PROVIDERS]
Provider name.
warnings: Optional[List[Warning_]]
List of warnings.
error: Optional[Error]
Caught exceptions.
chart: Optional[Chart]
Chart object.
CPI
---
date : date
The date of the data.
realtime_start : date
The date the data was updated.
realtime_end : date
The date the data was updated.
value : float
The value of the data.
fred
====
Parameters
----------
All fields are standardized.
CPI
---
All fields are standardized."""
inputs = filter_inputs(
provider_choices={
"provider": provider,
@@ -187,7 +301,104 @@ class CLASS_economy(Container):
provider: Optional[Literal["fmp", "polygon"]] = None,
**kwargs
) -> CommandOutput[typing.List]:
"""Get OHLCV data for an index."""
"""Get OHLCV data for an index.
openbb
======
Parameters
----------
provider: Literal[fmp, polygon]
The provider to use for the query.
symbol : ConstrainedStrValue
Symbol to get data for.
start_date : Optional[date]
Start date of the data, in YYYY-MM-DD format.
end_date : Optional[date]
End date of the data, in YYYY-MM-DD format.
Returns
-------
CommandOutput
results: List[Data]
Serializable results.
provider: Optional[PROVIDERS]
Provider name.
warnings: Optional[List[Warning_]]
List of warnings.
error: Optional[Error]
Caught exceptions.
chart: Optional[Chart]
Chart object.
MajorIndicesEOD
---------------
open : PositiveFloat
The open price of the symbol.
high : PositiveFloat
The high price of the symbol.
low : PositiveFloat
The low price of the symbol.
close : PositiveFloat
The close price of the symbol.
volume : PositiveFloat
The volume of the symbol.
fmp
===
Parameters
----------
timeseries : Optional[NonNegativeInt]
Number of days to look back.
MajorIndicesEOD
---------------
date : datetime
The date of the data.
adjClose : float
Adjusted Close Price of the symbol.
unadjustedVolume : float
Unadjusted volume of the symbol.
change : float
Change in the price of the symbol from the previous day.
changePercent : float
Change \\% in the price of the symbol.
vwap : float
Volume Weighted Average Price of the symbol.
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."""
inputs = filter_inputs(
provider_choices={
"provider": provider,
@@ -213,7 +424,57 @@ class CLASS_economy(Container):
def available_indices(
self, chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs
) -> CommandOutput[typing.List]:
"""AVAILABLE_INDICES."""
"""AVAILABLE_INDICES.
openbb
======
Parameters
----------
provider: Literal[fmp]
The provider to use for the query.
All fields are standardized.
Returns
-------
CommandOutput
results: List[Data]
Serializable results.
provider: Optional[PROVIDERS]
Provider name.
warnings: Optional[List[Warning_]]
List of warnings.
error: Optional[Error]
Caught exceptions.
chart: Optional[Chart]
Chart object.
AvailableIndices
----------------
symbol : ConstrainedStrValue
Symbol to get data for.
name : Optional[str]
The name of the index.
currency : Optional[str]
The currency the index is traded in.
stock_exchange : str
The stock exchange where the index is listed.
exchange_short_name : str
The short name of the stock exchange where the index is listed.
fmp
===
Parameters
----------
All fields are standardized.
AvailableIndices
----------------
All fields are standardized."""
inputs = filter_inputs(
provider_choices={
"provider": provider,
@@ -235,7 +496,55 @@ class CLASS_economy(Container):
def risk(
self, chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs
) -> CommandOutput[typing.List]:
"""Market Risk Premium."""
"""Market Risk Premium.
openbb
======
Parameters
----------
provider: Literal[fmp]
The provider to use for the query.
All fields are standardized.
Returns
-------
CommandOutput
results: List[Data]
Serializable results.
provider: Optional[PROVIDERS]
Provider name.
warnings: Optional[List[Warning_]]
List of warnings.
error: Optional[Error]
Caught exceptions.
chart: Optional[Chart]
Chart object.
RiskPremium
-----------
country : str
None
continent : Optional[str]
None
totalEquityRiskPremium : PositiveFloat
None
countryRiskPremium : NonNegativeFloat
None
fmp
===
Parameters
----------
All fields are standardized.
RiskPremium
-----------
All fields are standardized."""
inputs = filter_inputs(
provider_choices={
"provider": provider,

View File

@@ -18,12 +18,80 @@ class CLASS_fixedincome(Container):
def treasury(
self,
start_date: Optional[str] = None,
end_date: Optional[str] = "2023-07-31",
end_date: Optional[str] = "2023-08-01",
chart: bool = False,
provider: Optional[Literal["fmp"]] = None,
**kwargs
) -> CommandOutput[typing.List]:
"""Get treasury rates."""
"""Get treasury rates.
openbb
======
Parameters
----------
provider: Literal[fmp]
The provider to use for the query.
start_date : Optional[str]
Start date of the data, in YYYY-MM-DD format.
end_date : Optional[str]
End date of the data, in YYYY-MM-DD format.
Returns
-------
CommandOutput
results: List[Data]
Serializable results.
provider: Optional[PROVIDERS]
Provider name.
warnings: Optional[List[Warning_]]
List of warnings.
error: Optional[Error]
Caught exceptions.
chart: Optional[Chart]
Chart object.
TreasuryRates
-------------
date : date
None
fmp
===
Parameters
----------
All fields are standardized.
TreasuryRates
-------------
month1 : float
None
month2 : float
None
month3 : float
None
month6 : float
None
year1 : float
None
year2 : float
None
year3 : float
None
year5 : float
None
year7 : float
None
year10 : float
None
year20 : float
None
year30 : float
None"""
inputs = filter_inputs(
provider_choices={
"provider": provider,

View File

@@ -20,7 +20,96 @@ class CLASS_forex(Container):
provider: Optional[Literal["fmp", "polygon"]] = None,
**kwargs
) -> CommandOutput[typing.List]:
"""Forex Available Pairs."""
"""Forex Available Pairs.
openbb
======
Parameters
----------
provider: Literal[fmp, polygon]
The provider to use for the query.
All fields are standardized.
Returns
-------
CommandOutput
results: List[Data]
Serializable results.
provider: Optional[PROVIDERS]
Provider name.
warnings: Optional[List[Warning_]]
List of warnings.
error: Optional[Error]
Caught exceptions.
chart: Optional[Chart]
Chart object.
ForexPairs
----------
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
=======
Parameters
----------
symbol : Optional[str]
Symbol of the pair to search.
date : Optional[date]
A specific date to get data for.
search : Optional[str]
Search for terms within the ticker and/or company name.
active : Optional[Literal[True, False]]
Specify if the tickers returned should be actively traded on the queried date.
order : Optional[Literal['asc', 'desc']]
Order data by ascending or descending.
sort : Optional[Literal['ticker', 'name', 'market', 'locale', 'currency_symbol', 'currency_name', 'base_currency_symbol', 'base_currency_name', 'last_updated_utc', 'delisted_utc']]
Sort field used for ordering.
limit : Optional[PositiveInt]
The number of data entries to return.
ForexPairs
----------
market : str
The name of the trading market. Always 'fx'.
locale : str
The locale of the currency pair.
currency_symbol : str
The symbol of the quote currency.
currency_name : str
The name of the quote currency.
base_currency_symbol : str
The symbol of the base currency.
base_currency_name : str
The name of the base currency.
last_updated_utc : datetime
The last updated timestamp in UTC.
delisted_utc : Optional[datetime]
The delisted timestamp in UTC."""
inputs = filter_inputs(
provider_choices={
"provider": provider,
@@ -48,7 +137,103 @@ class CLASS_forex(Container):
provider: Optional[Literal["fmp", "polygon"]] = None,
**kwargs
) -> CommandOutput[typing.List]:
"""Forex Intraday Price."""
"""Forex Intraday Price.
openbb
======
Parameters
----------
provider: Literal[fmp, polygon]
The provider to use for the query.
symbol : ConstrainedStrValue
Symbol to get data for.
start_date : Optional[date]
Start date of the data, in YYYY-MM-DD format.
end_date : Optional[date]
End date of the data, in YYYY-MM-DD format.
Returns
-------
CommandOutput
results: List[Data]
Serializable results.
provider: Optional[PROVIDERS]
Provider name.
warnings: Optional[List[Warning_]]
List of warnings.
error: Optional[Error]
Caught exceptions.
chart: Optional[Chart]
Chart object.
ForexEOD
--------
open : PositiveFloat
The open price of the symbol.
high : PositiveFloat
The high price of the symbol.
low : PositiveFloat
The low price of the symbol.
close : PositiveFloat
The close price of the symbol.
volume : NonNegativeFloat
The volume of the symbol.
fmp
===
Parameters
----------
All fields are standardized.
ForexEOD
--------
date : datetime
The date of the data.
adjClose : float
Adjusted Close Price of the symbol.
unadjustedVolume : float
Unadjusted volume of the symbol.
change : float
Change in the price of the symbol from the previous day.
changePercent : float
Change \\% in the price of the symbol.
vwap : Optional[float]
Volume Weighted Average Price of the symbol.
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
--------
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."""
inputs = filter_inputs(
provider_choices={
"provider": provider,

View File

@@ -76,8 +76,10 @@
"stocks": "/stocks",
"stocks_fa": "/stocks/fa",
"stocks_fa_balance": "/stocks/fa/balance",
"stocks_fa_balance_growth": "/stocks/fa/balance_growth",
"stocks_fa_cal": "/stocks/fa/cal",
"stocks_fa_cash": "/stocks/fa/cash",
"stocks_fa_cash_growth": "/stocks/fa/cash_growth",
"stocks_fa_comp": "/stocks/fa/comp",
"stocks_fa_comsplit": "/stocks/fa/comsplit",
"stocks_fa_customer": "/stocks/fa/customer",
@@ -95,6 +97,7 @@
"stocks_fa_growth": "/stocks/fa/growth",
"stocks_fa_historical_5": "/stocks/fa/historical_5",
"stocks_fa_income": "/stocks/fa/income",
"stocks_fa_income_growth": "/stocks/fa/income_growth",
"stocks_fa_ins": "/stocks/fa/ins",
"stocks_fa_key": "/stocks/fa/key",
"stocks_fa_metrics": "/stocks/fa/metrics",

View File

@@ -23,7 +23,100 @@ class CLASS_news(Container):
provider: Optional[Literal["benzinga", "fmp"]] = None,
**kwargs
) -> CommandOutput[typing.List]:
"""Global News."""
"""Global News.
openbb
======
Parameters
----------
provider: Literal[benzinga, fmp]
The provider to use for the query.
page : NonNegativeInt
The page of the global news.
Returns
-------
CommandOutput
results: List[Data]
Serializable results.
provider: Optional[PROVIDERS]
Provider name.
warnings: Optional[List[Warning_]]
List of warnings.
error: Optional[Error]
Caught exceptions.
chart: Optional[Chart]
Chart object.
GlobalNews
----------
date : date
The published date of the news.
title : str
The title of the news.
text : Optional[str]
The text/body of the news.
url : str
The URL of the news.
image : List[BenzingaImage]
The images associated with the news.
benzinga
========
Parameters
----------
pageSize : int
The number of results to return per page.
displayOutput : Literal['headline', 'summary', 'full', 'all']
The type of data to return.
date : Optional[datetime]
The date of the news to retrieve.
dateFrom : Optional[datetime]
The start date of the news to retrieve.
dateTo : Optional[datetime]
The end date of the news to retrieve.
updatedSince : Optional[int]
The number of seconds since the news was updated.
publishedSince : Optional[int]
The number of seconds since the news was published.
sort : Optional[Literal['published_at', 'updated_at', 'title', 'author', 'channel', 'ticker', 'topic', 'content_type']]
The order in which to sort the news. Options are: published_at, updated_at, title, author, channel, ticker, topic, content_type.
isin : Optional[str]
The ISIN of the news to retrieve.
cusip : Optional[str]
The CUSIP of the news to retrieve.
tickers : Optional[str]
The tickers of the news to retrieve.
channels : Optional[str]
The channels of the news to retrieve.
topics : Optional[str]
The topics of the news to retrieve.
authors : Optional[str]
The authors of the news to retrieve.
content_types : Optional[str]
The content types of the news to retrieve.
GlobalNews
----------
All fields are standardized.
fmp
===
Parameters
----------
All fields are standardized.
GlobalNews
----------
site : str
The site of the news."""
inputs = filter_inputs(
provider_choices={
"provider": provider,

View File

@@ -90,7 +90,104 @@ class CLASS_stocks(Container):
provider: Optional[Literal["fmp", "polygon"]] = None,
**kwargs
) -> CommandOutput[typing.List]:
"""Load stock data for a specific ticker."""
"""Load stock data for a specific ticker.
openbb
======
Parameters
----------
provider: Literal[fmp, polygon]
The provider to use for the query.
symbol : ConstrainedStrValue
Symbol to get data for.
start_date : Optional[date]
Start date of the data, in YYYY-MM-DD format.
end_date : Optional[date]
End date of the data, in YYYY-MM-DD format.
Returns
-------
CommandOutput
results: List[Data]
Serializable results.
provider: Optional[PROVIDERS]
Provider name.
warnings: Optional[List[Warning_]]
List of warnings.
error: Optional[Error]
Caught exceptions.
chart: Optional[Chart]
Chart object.
StockEOD
--------
open : PositiveFloat
The open price of the symbol.
high : PositiveFloat
The high price of the symbol.
low : PositiveFloat
The low price of the symbol.
close : PositiveFloat
The close price of the symbol.
volume : PositiveFloat
The volume of the symbol.
fmp
===
Parameters
----------
timeseries : Optional[NonNegativeInt]
Number of days to look back.
StockEOD
--------
date : datetime
The date of the data.
adjClose : float
Adjusted Close Price of the symbol.
unadjustedVolume : float
Unadjusted volume of the symbol.
change : float
Change in the price of the symbol from the previous day.
changePercent : float
Change \\% in the price of the symbol.
vwap : float
Volume Weighted Average Price of the symbol.
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
--------
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."""
inputs = filter_inputs(
provider_choices={
"provider": provider,
@@ -122,7 +219,157 @@ class CLASS_stocks(Container):
provider: Optional[Literal["benzinga", "fmp", "polygon"]] = None,
**kwargs
) -> CommandOutput[typing.List]:
"""Get news for one or more stock tickers."""
"""Get news for one or more stock tickers.
openbb
======
Parameters
----------
provider: Literal[benzinga, fmp, polygon]
The provider to use for the query.
symbols : ConstrainedStrValue
page : int
The page of the stock news to be retrieved.
limit : Optional[NonNegativeInt]
The number of results to return per page.
Returns
-------
CommandOutput
results: List[Data]
Serializable results.
provider: Optional[PROVIDERS]
Provider name.
warnings: Optional[List[Warning_]]
List of warnings.
error: Optional[Error]
Caught exceptions.
chart: Optional[Chart]
Chart object.
StockNews
---------
date : date
The published date of the news.
title : str
The title of the news.
text : Optional[str]
The text/body of the news.
url : str
The URL of the news.
benzinga
========
Parameters
----------
displayOutput : Literal['headline', 'summary', 'full', 'all']
The type of data to return.
date : Optional[datetime]
The date of the news to retrieve.
dateFrom : Optional[datetime]
The start date of the news to retrieve.
dateTo : Optional[datetime]
The end date of the news to retrieve.
updatedSince : Optional[int]
The number of seconds since the news was updated.
publishedSince : Optional[int]
The number of seconds since the news was published.
sort : Optional[Literal['published_at', 'updated_at', 'title', 'author', 'channel', 'ticker', 'topic', 'content_type']]
The order in which to sort the news. Options are: published_at, updated_at, title, author, channel, ticker, topic, content_type.
isin : Optional[str]
The ISIN of the news to retrieve.
cusip : Optional[str]
The CUSIP of the news to retrieve.
channels : Optional[str]
The channels of the news to retrieve.
topics : Optional[str]
The topics of the news to retrieve.
authors : Optional[str]
The authors of the news to retrieve.
content_types : Optional[str]
The content types of the news to retrieve.
StockNews
---------
image : List[BenzingaImage]
The images associated with the news.
fmp
===
Parameters
----------
All fields are standardized.
StockNews
---------
symbol : str
None
publishedDate : datetime
None
image : Optional[str]
None
site : str
None
polygon
=======
Parameters
----------
ticker_lt : Optional[str]
None
ticker_lte : Optional[str]
None
ticker_gt : Optional[str]
None
ticker_gte : Optional[str]
None
published_utc : Optional[str]
None
published_utc_lt : Optional[str]
None
published_utc_lte : Optional[str]
None
published_utc_gt : Optional[str]
None
published_utc_gte : Optional[str]
None
order : Optional[Literal['asc', 'desc']]
None
sort : Optional[str]
None
StockNews
---------
amp_url : Optional[str]
None
article_url : str
None
author : Optional[str]
None
description : Optional[str]
None
id : str
None
image_url : Optional[str]
None
keywords : Optional[List[str]]
None
published_utc : datetime
None
publisher : PolygonPublisher
None
tickers : List[str]
None"""
inputs = filter_inputs(
provider_choices={
"provider": provider,
@@ -153,7 +400,277 @@ class CLASS_stocks(Container):
provider: Optional[Literal["fmp"]] = None,
**kwargs
) -> CommandOutput[typing.List]:
"""Get valuation multiples for a stock ticker."""
"""Get valuation multiples for a stock ticker.
openbb
======
Parameters
----------
provider: Literal[fmp]
The provider to use for the query.
symbol : ConstrainedStrValue
Symbol to get data for.
limit : Optional[int]
None
Returns
-------
CommandOutput
results: List[Data]
Serializable results.
provider: Optional[PROVIDERS]
Provider name.
warnings: Optional[List[Warning_]]
List of warnings.
error: Optional[Error]
Caught exceptions.
chart: Optional[Chart]
Chart object.
StockMultiples
--------------
revenue_per_share_ttm : Optional[float]
None
net_income_per_share_ttm : Optional[float]
None
operating_cash_flow_per_share_ttm : Optional[float]
None
free_cash_flow_per_share_ttm : Optional[float]
None
cash_per_share_ttm : Optional[float]
None
book_value_per_share_ttm : Optional[float]
None
tangible_book_value_per_share_ttm : Optional[float]
None
shareholders_equity_per_share_ttm : Optional[float]
None
interest_debt_per_share_ttm : Optional[float]
None
market_cap_ttm : Optional[float]
None
enterprise_value_ttm : Optional[float]
None
pe_ratio_ttm : Optional[float]
None
price_to_sales_ratio_ttm : Optional[float]
None
pocf_ratio_ttm : Optional[float]
None
pfcf_ratio_ttm : Optional[float]
None
pb_ratio_ttm : Optional[float]
None
ptb_ratio_ttm : Optional[float]
None
ev_to_sales_ttm : Optional[float]
None
enterprise_value_over_ebitda_ttm : Optional[float]
None
ev_to_operating_cash_flow_ttm : Optional[float]
None
ev_to_free_cash_flow_ttm : Optional[float]
None
earnings_yield_ttm : Optional[float]
None
free_cash_flow_yield_ttm : Optional[float]
None
debt_to_equity_ttm : Optional[float]
None
debt_to_assets_ttm : Optional[float]
None
net_debt_to_ebitda_ttm : Optional[float]
None
current_ratio_ttm : Optional[float]
None
interest_coverage_ttm : Optional[float]
None
income_quality_ttm : Optional[float]
None
dividend_yield_ttm : Optional[float]
None
payout_ratio_ttm : Optional[float]
None
sales_general_and_administrative_to_revenue_ttm : Optional[float]
None
research_and_development_to_revenue_ttm : Optional[float]
None
intangibles_to_total_assets_ttm : Optional[float]
None
capex_to_operating_cash_flow_ttm : Optional[float]
None
capex_to_revenue_ttm : Optional[float]
None
capex_to_depreciation_ttm : Optional[float]
None
stock_based_compensation_to_revenue_ttm : Optional[float]
None
graham_number_ttm : Optional[float]
None
roic_ttm : Optional[float]
None
return_on_tangible_assets_ttm : Optional[float]
None
graham_net_net_ttm : Optional[float]
None
working_capital_ttm : Optional[float]
None
tangible_asset_value_ttm : Optional[float]
None
net_current_asset_value_ttm : Optional[float]
None
invested_capital_ttm : Optional[float]
None
average_receivables_ttm : Optional[float]
None
average_payables_ttm : Optional[float]
None
average_inventory_ttm : Optional[float]
None
days_sales_outstanding_ttm : Optional[float]
None
days_payables_outstanding_ttm : Optional[float]
None
days_of_inventory_on_hand_ttm : Optional[float]
None
receivables_turnover_ttm : Optional[float]
None
payables_turnover_ttm : Optional[float]
None
inventory_turnover_ttm : Optional[float]
None
roe_ttm : Optional[float]
None
capex_per_share_ttm : Optional[float]
None
fmp
===
Parameters
----------
All fields are standardized.
StockMultiples
--------------
revenuePerShareTTM : Optional[float]
None
netIncomePerShareTTM : Optional[float]
None
operatingCashFlowPerShareTTM : Optional[float]
None
freeCashFlowPerShareTTM : Optional[float]
None
cashPerShareTTM : Optional[float]
None
bookValuePerShareTTM : Optional[float]
None
tangibleBookValuePerShareTTM : Optional[float]
None
shareholdersEquityPerShareTTM : Optional[float]
None
interestDebtPerShareTTM : Optional[float]
None
marketCapTTM : Optional[float]
None
enterpriseValueTTM : Optional[float]
None
peRatioTTM : Optional[float]
None
priceToSalesRatioTTM : Optional[float]
None
pocfratioTTM : Optional[float]
None
pfcfRatioTTM : Optional[float]
None
pbRatioTTM : Optional[float]
None
ptbRatioTTM : Optional[float]
None
evToSalesTTM : Optional[float]
None
enterpriseValueOverEBITDATTM : Optional[float]
None
evToOperatingCashFlowTTM : Optional[float]
None
evToFreeCashFlowTTM : Optional[float]
None
earningsYieldTTM : Optional[float]
None
freeCashFlowYieldTTM : Optional[float]
None
debtToEquityTTM : Optional[float]
None
debtToAssetsTTM : Optional[float]
None
netDebtToEBITDATTM : Optional[float]
None
currentRatioTTM : Optional[float]
None
interestCoverageTTM : Optional[float]
None
incomeQualityTTM : Optional[float]
None
dividendYieldTTM : Optional[float]
None
payoutRatioTTM : Optional[float]
None
salesGeneralAndAdministrativeToRevenueTTM : Optional[float]
None
researchAndDevelopementToRevenueTTM : Optional[float]
None
intangiblesToTotalAssetsTTM : Optional[float]
None
capexToOperatingCashFlowTTM : Optional[float]
None
capexToRevenueTTM : Optional[float]
None
capexToDepreciationTTM : Optional[float]
None
stockBasedCompensationToRevenueTTM : Optional[float]
None
grahamNumberTTM : Optional[float]
None
roicTTM : Optional[float]
None
returnOnTangibleAssetsTTM : Optional[float]
None
grahamNetNetTTM : Optional[float]
None
workingCapitalTTM : Optional[float]
None
tangibleAssetValueTTM : Optional[float]
None
netCurrentAssetValueTTM : Optional[float]
None
investedCapitalTTM : Optional[float]
None
averageReceivablesTTM : Optional[float]
None
averagePayablesTTM : Optional[float]
None
averageInventoryTTM : Optional[float]
None
daysSalesOutstandingTTM : Optional[float]
None
daysPayablesOutstandingTTM : Optional[float]
None
daysOfInventoryOnHandTTM : Optional[float]
None
receivablesTurnoverTTM : Optional[float]
None
payablesTurnoverTTM : Optional[float]
None
inventoryTurnoverTTM : Optional[float]
None
roeTTM : Optional[float]
None
capexPerShareTTM : Optional[float]
None"""
inputs = filter_inputs(
provider_choices={
"provider": provider,

View File

@@ -22,7 +22,52 @@ class CLASS_stocks_ca(Container):
provider: Optional[Literal["fmp"]] = None,
**kwargs
) -> CommandOutput[typing.List]:
"""Company peers."""
"""Company peers.
openbb
======
Parameters
----------
provider: Literal[fmp]
The provider to use for the query.
symbol : ConstrainedStrValue
Symbol to get data for.
Returns
-------
CommandOutput
results: List[Data]
Serializable results.
provider: Optional[PROVIDERS]
Provider name.
warnings: Optional[List[Warning_]]
List of warnings.
error: Optional[Error]
Caught exceptions.
chart: Optional[Chart]
Chart object.
StockPeers
----------
symbol : str
None
peers_list : Optional[List[str]]
None
fmp
===
Parameters
----------
All fields are standardized.
StockPeers
----------
All fields are standardized."""
inputs = filter_inputs(
provider_choices={
"provider": provider,

View File

@@ -23,7 +23,67 @@ class CLASS_stocks_dd(Container):
provider: Optional[Literal["fmp"]] = None,
**kwargs
) -> CommandOutput[typing.List]:
"""SEC Filings."""
"""SEC Filings.
openbb
======
Parameters
----------
provider: Literal[fmp]
The provider to use for the query.
symbol : str
None
type : Optional[str]
None
page : Optional[int]
None
limit : Optional[int]
None
Returns
-------
CommandOutput
results: List[Data]
Serializable results.
provider: Optional[PROVIDERS]
Provider name.
warnings: Optional[List[Warning_]]
List of warnings.
error: Optional[Error]
Caught exceptions.
chart: Optional[Chart]
Chart object.
SECFilings
----------
symbol : str
None
cik : str
None
type : str
None
link : str
None
fmp
===
Parameters
----------
All fields are standardized.
SECFilings
----------
fillingDate : date
None
acceptedDate : date
None
finalLink : str
None"""
inputs = filter_inputs(
provider_choices={
"provider": provider,

File diff suppressed because it is too large Load Diff

View File

@@ -22,10 +22,9 @@ from typing import (
)
import pandas as pd
from starlette.routing import BaseRoute
from openbb_core.app.provider_interface import get_provider_interface
from openbb_core.app.router import RouterLoader
from starlette.routing import BaseRoute
class PackageBuilder:
@@ -222,92 +221,131 @@ class ClassDefinition:
class DocstringGenerator:
"""Generate docstrings for the commands dynamically."""
"""Dynamically generate docstrings for the commands."""
@staticmethod
def get_docstrings(query_mapping: dict) -> dict:
"""Get docstrings from the query mapping."""
mapping = query_mapping.copy()
for _, model_mapping in mapping.items():
for _, query_params_mapping in model_mapping.items():
query_params_mapping.pop("fields", None)
return mapping
def get_command_output_description() -> str:
"""Get the command output description."""
command_output_description = (
"\nReturns\n"
"-------\n"
"CommandOutput\n"
" results: List[Data]\n"
" Serializable results.\n"
" provider: Optional[PROVIDERS]\n"
" Provider name.\n"
" warnings: Optional[List[Warning_]]\n"
" List of warnings.\n"
" error: Optional[Error]\n"
" Caught exceptions.\n"
" chart: Optional[Chart]\n"
" Chart object.\n"
)
return command_output_description
@staticmethod
def clean_provider_docstring(
section_name: Literal["QueryParams", "Data"], docstring: str, model_name: str
) -> str:
"""Clean the provider docstring from standard fields."""
provider_interface = get_provider_interface()
if section_name == "QueryParams":
standard_fields = provider_interface.params[model_name][
"standard"
].__dataclass_fields__.keys()
elif section_name == "Data":
standard_fields = provider_interface.data[model_name][
"standard"
].__dataclass_fields__.keys()
def get_available_providers(query_mapping: dict) -> str:
"""Return a string of available providers."""
available_providers = ", ".join(query_mapping.keys())
available_providers = available_providers.replace("openbb, ", "")
available_providers = available_providers.replace("openbb", "")
provider_string = f"provider: Literal[{available_providers}]\n"
provider_string += " The provider to use for the query.\n"
return provider_string
@staticmethod
def reorder_dictionary(dictionary: dict, key_to_move_first: str) -> dict:
"""Reorder a dictionary so that a given key is first."""
if key_to_move_first in dictionary:
ordered_dict = OrderedDict(
[(key_to_move_first, dictionary[key_to_move_first])]
)
for key, value in dictionary.items():
if key != key_to_move_first:
ordered_dict[key] = value
return ordered_dict
else:
return docstring
return dictionary
doc_lines = docstring.split("\n")
cleaned_lines = []
skip_lines = False
@classmethod
def extract_field_details(
cls,
model_name: str,
provider: str,
section_name: str,
section_docstring: str,
mapping: dict,
) -> str:
"""Extract the field details from the map and add them to the docstring."""
if section_docstring == "":
return section_docstring
for line in doc_lines:
stripped_line = line.strip()
parameter_word = stripped_line.split(" : ")[0]
padding = " "
if parameter_word in standard_fields:
skip_lines = True
elif ":" in stripped_line and parameter_word not in standard_fields:
skip_lines = False
field_mapping = mapping[model_name][provider.lower()][section_name]["fields"]
fields = field_mapping.keys()
if not skip_lines:
cleaned_lines.append(line)
if len(fields) == 0:
section_docstring += "All fields are standardized.\n"
else:
for field in fields:
# We need to get the string representation of the field type
# because Pydantic uses a custom repr.
try:
field_type = field_mapping[field].__repr_args__()[1][1]
except AttributeError:
# Fallback to the annotation if the repr fails
field_type = field_mapping[field].annotation
for i, line in enumerate(cleaned_lines):
try:
if line == "---------" and cleaned_lines[i + 1] == " ":
cleaned_lines[i] = "---------"
cleaned_lines[i + 1] = "All fields are standardized.\n"
break
except IndexError:
cleaned_lines.append("All fields are standardized.\n")
field_description = field_mapping[field].field_info.description
return "\n".join(cleaned_lines)
section_docstring += f"{field} : {field_type}\n"
section_docstring += f"{padding}{field_description}\n"
if provider == "openbb" and section_name == "QueryParams":
section_docstring += cls.get_command_output_description()
return section_docstring
@classmethod
def generate_provider_docstrings(
cls, docstring: str, docstring_mapping: dict, model_name: str
cls,
docstring: str,
query_mapping: dict,
model_name: str,
provider_interface_mapping: dict,
) -> str:
"""Generate the docstring for the provider."""
for provider, model_mapping in docstring_mapping.items():
for provider, model_mapping in query_mapping.items():
docstring += f"\n{provider}"
docstring += f"\n{'=' * len(provider)}"
for section_name, section_docstring in model_mapping.items():
missing_doc = "\nReturns\n-------\nDocumentation not available.\n\n"
section_docstring = (
section_docstring["docstring"]
if section_docstring["docstring"]
else missing_doc
)
# clean the docstring from its original indentation
if missing_doc != section_docstring:
section_docstring = "\n".join(
line[4:] for line in section_docstring.split("\n")[1:]
)
section_docstring = "\n".join(
f"{line}" for line in section_docstring.split("\n")
)
if provider != "Standard":
section_docstring = cls.clean_provider_docstring(
section_name,
docstring=section_docstring,
model_name=model_name,
for section_name in model_mapping:
section_docstring = ""
if section_name == "QueryParams":
section_docstring += "\nParameters\n----------\n"
if provider == "openbb":
section_docstring += (
f"{cls.get_available_providers(query_mapping)}"
)
elif section_name == "Data":
underline = "-" * len(model_name)
section_docstring += f"\n{model_name}\n{underline}\n"
else:
continue
section_docstring = cls.extract_field_details(
model_name=model_name,
provider=provider,
section_name=section_name,
section_docstring=section_docstring,
mapping=provider_interface_mapping,
)
docstring += f"\n{section_docstring}"
@@ -319,23 +357,15 @@ class DocstringGenerator:
provider_interface_mapping = get_provider_interface().map
query_mapping = provider_interface_mapping.get(model_name, None)
if query_mapping:
docstring_mapping = cls.get_docstrings(query_mapping)
docstring = func.__doc__ or ""
docstring += "\n\n"
available_providers = ", ".join(docstring_mapping.keys())
available_providers = available_providers.replace("openbb, ", "")
available_providers = available_providers.replace("openbb", "")
docstring += f"\n\nAvailable providers: {available_providers}\n"
docstring_mapping_ordered = {
"Standard": docstring_mapping.pop("openbb", None), # type: ignore
**docstring_mapping,
}
query_mapping_ordered = cls.reorder_dictionary(query_mapping, "openbb")
docstring = cls.generate_provider_docstrings(
docstring, docstring_mapping_ordered, model_name
docstring=docstring,
query_mapping=query_mapping_ordered,
model_name=model_name,
provider_interface_mapping=provider_interface_mapping,
)
func.__doc__ = docstring
@@ -565,10 +595,10 @@ class MethodDefinition:
sig = signature(func)
parameter_map = dict(sig.parameters)
# if model_name:
# func = DocstringGenerator.generate_command_docstring(
# func=func, model_name=model_name
# )
if model_name:
func = DocstringGenerator.generate_command_docstring(
func=func, model_name=model_name
)
code = cls.build_command_method_signature(
func_name=func_name,