Files
OpenBB/openbb_platform/extensions/index/openbb_index/index_router.py
Henrique Joaquim 6e3038b9e7 Fix tests (#5819)
* fix equity tests - python

* remove test for intrinio

* remove index.fred and fix tests w/@hjoaquim,@IgorWounds

* fix ultima company news model w/@hjoaquim,@IgorWounds

* re-record intrinio insider trading w/@hjoaquim,@IgorWounds

* adjust endpoint

* adjust endpoint

* adjust params

* fix equity test w/@IgorWounds

* re-record

* remove ultima test

* adding keys to the workflow

* typo

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>
2023-11-29 18:35:45 +00:00

104 lines
3.0 KiB
Python

"""Index 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
router = Router(prefix="")
# pylint: disable=unused-argument
@router.command(model="MarketIndices")
async def market(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject[BaseModel]:
"""Historical Market Indices."""
return await OBBject.from_query(Query(**locals()))
@router.command(model="EuropeanIndices")
async def european(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject[BaseModel]:
"""Historical European Indices."""
return await OBBject.from_query(Query(**locals()))
@router.command(model="IndexConstituents")
async def constituents(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject[BaseModel]:
"""Index Constituents. Constituents of an index."""
return await OBBject.from_query(Query(**locals()))
@router.command(model="EuropeanIndexConstituents")
async def european_constituents(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject[BaseModel]:
"""European Index Constituents. Constituents of select european indices."""
return await OBBject.from_query(Query(**locals()))
@router.command(model="IndexSnapshots")
async def snapshots(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject[BaseModel]:
"""Index Snapshots. Current levels for all indices from a provider."""
return await OBBject.from_query(Query(**locals()))
@router.command(model="AvailableIndices")
async def available(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject[BaseModel]:
"""Available Indices. Available indices for a given provider."""
return await OBBject.from_query(Query(**locals()))
@router.command(model="IndexSearch")
async def search(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject[BaseModel]:
"""Index Search. Search for indices."""
return await OBBject.from_query(Query(**locals()))
@router.command(model="SP500Multiples")
async def sp500_multiples(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject[BaseModel]:
"""S&P 500 Multiples. Historical S&P 500 multiples and Shiller PE ratios."""
return await OBBject.from_query(Query(**locals()))