Files
OpenBB/openbb_platform/openbb/package/crypto.py
Igor Radovanovic 04d3af5c50 [Feature] - LLM mode (#6308)
* 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>
2024-04-19 15:49:53 +00:00

105 lines
3.2 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_crypto(Container):
"""/crypto
/price
search
"""
def __repr__(self) -> str:
return self.__doc__ or ""
@property
def price(self):
# pylint: disable=import-outside-toplevel
from . import crypto_price
return crypto_price.ROUTER_crypto_price(command_runner=self._command_runner)
@exception_handler
@validate
def search(
self,
query: Annotated[
Optional[str], OpenBBField(description="Search query.")
] = None,
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:
"""Search available cryptocurrency pairs within a provider.
Parameters
----------
query : Optional[str]
Search query.
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 : List[CryptoSearch]
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.
CryptoSearch
------------
symbol : str
Symbol representing the entity requested in the data. (Crypto)
name : Optional[str]
Name of the crypto.
currency : Optional[str]
The currency the crypto trades for. (provider: fmp)
exchange : Optional[str]
The exchange code the crypto trades on. (provider: fmp)
exchange_name : Optional[str]
The short name of the exchange the crypto trades on. (provider: fmp)
Examples
--------
>>> from openbb import obb
>>> obb.crypto.search(provider='fmp')
>>> obb.crypto.search(query='BTCUSD', provider='fmp')
""" # noqa: E501
return self._run(
"/crypto/search",
**filter_inputs(
provider_choices={
"provider": self._get_provider(
provider,
"/crypto/search",
("fmp",),
)
},
standard_params={
"query": query,
},
extra_params=kwargs,
)
)