Files
OpenBB/openbb_platform/openbb/package/crypto.py
montezdesousa f328a45b95 [Feature] - refactor examples (#6154)
* remove auto examples and split python from api

* add missing exampels

* rebuild

* query params focstring

* black

* add scoped examples

* group model imports in the router

* unblock api

* fix

* classify examples

* fix package identation

* black sig

* fix indentation without linter

* fix python examples

* remove doc

* pylint

* again

* add model validators

* commodity, crypto, currency

* filter examples

* fix python examples

* fix filter and build

* undo toml change

* add comment

* oop

* comment

* typing

* lint

* Update router.py

* Update econometrics_router.py

* fix to_python

* to_python

* to_python

* black

* fix multiple line field descriptions

* remove circular import

* add missing import

* pass indent as object attr

* doc

* doc

* this looks better

* forgot this

* fix: new examples adapted

* fix prev commit

* avoid future problems

* Update ownership_router.py

* rebuild + remove todo

* make description mandatory for python examples

* simple indent

* append_examples func works for both website and docstring

* Add example unit tests

* Edit example unit tests

* fix validator

* this works

* fix to_python

* fix mandatory docstrings

* typing

* shorter error msgs

* economy router

* fix more examples

* more examples

* more examples

* more examples

* field desc

* minor fix

* fix etf examples

* handling types better

* lint

* rename method

* rename var

* docstring + move method

* typing

* prompt

* rebuild

* prompt fix in PythonEx

* fix examples without model

* example mock data

* add get_field_type func to get field data type

* panel data

* mock data

* fix

* fix

* docstring

* ohlcv

* pylint

* quantitaive router

* simplify mock data

* fix remaining quantitative routers

* a bit more flexibility for examples

* lint

* mock dat from sample

* docstring

* assertion

* bugfix

* minor fix

* technical

* fix integration tests

* fix docstring

* econometrics examples

* econometrics examples

* remove warning

* add technical examples

* fix bad examples

* fix more examples

* update test rules

* remoce old pydantic referenc

* fix bug in treasury prices

* fix quantitative examples

* discovery router

* equity shorts

* equity shorts

* fix currency pairs

* fix sec_router example

* fix panel data to support all funcs

* black

* more examples fixes

* simplify test

* rebuild

* test doc

* add provider to some ex

* ^

* last

* add provider

* rebuild

* working examples

* noqa

* pylint

* pylint

* clean

* minor fix

* fix test

* lint

* ruff

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>
Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
2024-03-09 23:22:40 +00:00

105 lines
3.3 KiB
Python

### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ###
from typing import Literal, Optional
from openbb_core.app.model.custom_parameter import OpenBBCustomParameter
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], OpenBBCustomParameter(description="Search query.")
] = None,
provider: Annotated[
Optional[Literal["fmp"]],
OpenBBCustomParameter(
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,
)
)