mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 13:01:38 +00:00
* LLM mode * Docstring truncation * Preferences * Output type * use settings instead? (#6314) * Refactor with @montezdesousa * fix test * fix: max length type * field descriptions * try with FieldInfo * ugly... * partial * override FieldInfo __repr__ * typing * separate model_config * rename OpenBBCustomParameter to OpenBBField * lint * pydocstyle * don't include choices if no choices --------- Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Henrique Joaquim <henriquecjoaquim@gmail.com> Co-authored-by: Diogo Sousa <montezdesousa@gmail.com>
90 lines
2.7 KiB
Python
90 lines
2.7 KiB
Python
### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ###
|
|
|
|
from typing import Literal, Optional
|
|
|
|
from openbb_core.app.model.field import OpenBBField
|
|
from openbb_core.app.model.obbject import OBBject
|
|
from openbb_core.app.static.container import Container
|
|
from openbb_core.app.static.utils.decorators import exception_handler, validate
|
|
from openbb_core.app.static.utils.filters import filter_inputs
|
|
from typing_extensions import Annotated
|
|
|
|
|
|
class ROUTER_equity_compare(Container):
|
|
"""/equity/compare
|
|
peers
|
|
"""
|
|
|
|
def __repr__(self) -> str:
|
|
return self.__doc__ or ""
|
|
|
|
@exception_handler
|
|
@validate
|
|
def peers(
|
|
self,
|
|
symbol: Annotated[str, OpenBBField(description="Symbol to get data for.")],
|
|
provider: Annotated[
|
|
Optional[Literal["fmp"]],
|
|
OpenBBField(
|
|
description="The provider to use for the query, by default None.\n If None, the provider specified in defaults is selected or 'fmp' if there is\n no default."
|
|
),
|
|
] = None,
|
|
**kwargs
|
|
) -> OBBject:
|
|
"""Get the closest peers for a given company.
|
|
|
|
Peers consist of companies trading on the same exchange, operating within the same sector
|
|
and with comparable market capitalizations.
|
|
|
|
|
|
Parameters
|
|
----------
|
|
symbol : str
|
|
Symbol to get data for.
|
|
provider : Optional[Literal['fmp']]
|
|
The provider to use for the query, by default None.
|
|
If None, the provider specified in defaults is selected or 'fmp' if there is
|
|
no default.
|
|
|
|
Returns
|
|
-------
|
|
OBBject
|
|
results : EquityPeers
|
|
Serializable results.
|
|
provider : Optional[Literal['fmp']]
|
|
Provider name.
|
|
warnings : Optional[List[Warning_]]
|
|
List of warnings.
|
|
chart : Optional[Chart]
|
|
Chart object.
|
|
extra : Dict[str, Any]
|
|
Extra info.
|
|
|
|
EquityPeers
|
|
-----------
|
|
peers_list : List[str]
|
|
A list of equity peers based on sector, exchange and market cap.
|
|
|
|
Examples
|
|
--------
|
|
>>> from openbb import obb
|
|
>>> obb.equity.compare.peers(symbol='AAPL', provider='fmp')
|
|
""" # noqa: E501
|
|
|
|
return self._run(
|
|
"/equity/compare/peers",
|
|
**filter_inputs(
|
|
provider_choices={
|
|
"provider": self._get_provider(
|
|
provider,
|
|
"/equity/compare/peers",
|
|
("fmp",),
|
|
)
|
|
},
|
|
standard_params={
|
|
"symbol": symbol,
|
|
},
|
|
extra_params=kwargs,
|
|
)
|
|
)
|