Files
OpenBB/openbb_platform/extensions/equity/openbb_equity/equity_router.py
teh_coderer bc2fa9b3e1 Feature/platform async (#5763)
* 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>
2023-11-23 13:01:56 +00:00

80 lines
2.8 KiB
Python

"""Equity 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_equity.calendar.calendar_router import router as calendar_router
from openbb_equity.compare.compare_router import router as compare_router
from openbb_equity.darkpool.darkpool_router import router as darkpool_router
from openbb_equity.discovery.discovery_router import router as discovery_router
from openbb_equity.estimates.estimates_router import router as estimates_router
from openbb_equity.fundamental.fundamental_router import router as fundamental_router
from openbb_equity.ownership.ownership_router import router as ownership_router
from openbb_equity.price.price_router import router as price_router
from openbb_equity.shorts.shorts_router import router as shorts_router
router = Router(prefix="")
router.include_router(calendar_router)
router.include_router(compare_router)
router.include_router(estimates_router)
router.include_router(darkpool_router)
router.include_router(discovery_router)
router.include_router(fundamental_router)
router.include_router(ownership_router)
router.include_router(price_router)
router.include_router(shorts_router)
# pylint: disable=import-outside-toplevel, W0613:unused-argument
@router.command(model="EquitySearch")
async def search(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject[BaseModel]:
"""Equity Search. Search for a company or stock ticker."""
return await OBBject.from_query(Query(**locals()))
@router.command(model="EquityScreener")
async def screener(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject[BaseModel]:
"""Equity Screen. Screen for companies meeting various criteria."""
return await OBBject.from_query(Query(**locals()))
@router.command(model="EquityInfo")
async def profile(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject[BaseModel]:
"""Equity Info. Get general price and performance metrics of a stock."""
return await OBBject.from_query(Query(**locals()))
@router.command(model="MarketSnapshots")
async def market_snapshots(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject[BaseModel]:
"""Get a current, complete, market snapshot."""
return await OBBject.from_query(Query(**locals()))