mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-26 11:12:50 +00:00
* crypto search add validation for '-'-separated pairs * set default query value to None * improve /crypto description with custom examples * improve /crypto/price/historical description with custom examples * updated static for crypto menu * ignore line too long * linting --------- Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
32 lines
905 B
Python
32 lines
905 B
Python
"""Crypto Router."""
|
|
|
|
from openbb_core.app.model.command_context import CommandContext
|
|
from openbb_core.app.model.obbject import OBBject
|
|
from openbb_core.app.provider_interface import (
|
|
ExtraParams,
|
|
ProviderChoices,
|
|
StandardParams,
|
|
)
|
|
from openbb_core.app.query import Query
|
|
from openbb_core.app.router import Router
|
|
|
|
from openbb_crypto.price.price_router import router as price_router
|
|
|
|
router = Router(prefix="")
|
|
router.include_router(price_router)
|
|
|
|
|
|
# pylint: disable=unused-argument
|
|
@router.command(
|
|
model="CryptoSearch",
|
|
examples=['obb.crypto.search("BTCUSD")', 'obb.crypto.search("ETH-USD")'],
|
|
)
|
|
async def search(
|
|
cc: CommandContext,
|
|
provider_choices: ProviderChoices,
|
|
standard_params: StandardParams,
|
|
extra_params: ExtraParams,
|
|
) -> OBBject:
|
|
"""Search available cryptocurrency pairs within a provider."""
|
|
return await OBBject.from_query(Query(**locals()))
|