mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-01 23:12:21 +00:00
* init * updates * Update helpers.py * tests * Update helpers.py * Update command_runner.py * Update helpers.py * deps * Update helpers.py * only check `async` if model is specified, revert `qa`, `ta`, and `econometrics` * merge issues * Update command_runner.py * remove typing and type: ignore * fix helpers typing * add aiohttp to core deps, remove from charting * remove @overload * ruff * import helper from source * helpers typing+pylint * black --------- Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> Co-authored-by: Pratyush Shukla <ps4534@nyu.edu> Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt> Co-authored-by: Diogo Sousa <montezdesousa@gmail.com>
40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
"""The Currency 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 pydantic import BaseModel
|
|
|
|
from openbb_currency.price.price_router import router as price_router
|
|
|
|
router = Router(prefix="")
|
|
router.include_router(price_router)
|
|
|
|
|
|
# pylint: disable=unused-argument
|
|
@router.command(model="CurrencyPairs")
|
|
async def search(
|
|
cc: CommandContext,
|
|
provider_choices: ProviderChoices,
|
|
standard_params: StandardParams,
|
|
extra_params: ExtraParams,
|
|
) -> OBBject[BaseModel]:
|
|
"""Currency Search. Search available currency pairs."""
|
|
return await OBBject.from_query(Query(**locals()))
|
|
|
|
|
|
@router.command(model="CurrencyReferenceRates")
|
|
async def reference_rates(
|
|
cc: CommandContext,
|
|
provider_choices: ProviderChoices,
|
|
standard_params: StandardParams,
|
|
extra_params: ExtraParams,
|
|
) -> OBBject[BaseModel]:
|
|
"""Current, official, currency reference rates."""
|
|
return await OBBject.from_query(Query(**locals()))
|