mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-29 12:43:48 +00:00
[HotFix] Index Router Docstrings & sp500_multiples() Cleanup (#6063)
* sp500 multiples cleanup * remove dict from standard model * static pacakge * pylint
This commit is contained in:
@@ -334,7 +334,7 @@ def test_index_snapshots(params, headers):
|
||||
[
|
||||
(
|
||||
{
|
||||
"series_name": "PE Ratio by Month",
|
||||
"series_name": "pe_month",
|
||||
"start_date": "2023-01-01",
|
||||
"end_date": "2023-06-06",
|
||||
"collapse": "monthly",
|
||||
|
||||
@@ -318,7 +318,7 @@ def test_index_snapshots(params, obb):
|
||||
[
|
||||
(
|
||||
{
|
||||
"series_name": "PE Ratio by Month",
|
||||
"series_name": "pe_month",
|
||||
"start_date": "2023-01-01",
|
||||
"end_date": "2023-06-06",
|
||||
"collapse": "monthly",
|
||||
|
||||
@@ -38,56 +38,88 @@ async def market(
|
||||
return await OBBject.from_query(Query(**locals()))
|
||||
|
||||
|
||||
@router.command(model="IndexConstituents")
|
||||
@router.command(
|
||||
model="IndexConstituents",
|
||||
exclude_auto_examples=True,
|
||||
examples=[
|
||||
'obb.index.constituents("dowjones", provider="fmp").to_df()',
|
||||
"#### Providers other than FMP will use the ticker symbol. ####",
|
||||
'obb.index.constituents("BEP50P", provider="cboe").to_df()',
|
||||
],
|
||||
)
|
||||
async def constituents(
|
||||
cc: CommandContext,
|
||||
provider_choices: ProviderChoices,
|
||||
standard_params: StandardParams,
|
||||
extra_params: ExtraParams,
|
||||
) -> OBBject:
|
||||
"""Index Constituents. Constituents of an index."""
|
||||
"""Index Constituents."""
|
||||
return await OBBject.from_query(Query(**locals()))
|
||||
|
||||
|
||||
@router.command(model="IndexSnapshots")
|
||||
@router.command(
|
||||
model="IndexSnapshots",
|
||||
exclude_auto_examples=True,
|
||||
examples=[
|
||||
'obb.index.snapshots(region="us",provider="cboe").to_df()',
|
||||
],
|
||||
)
|
||||
async def snapshots(
|
||||
cc: CommandContext,
|
||||
provider_choices: ProviderChoices,
|
||||
standard_params: StandardParams,
|
||||
extra_params: ExtraParams,
|
||||
) -> OBBject:
|
||||
"""Index Snapshots. Current levels for all indices from a provider."""
|
||||
"""Index Snapshots. Current levels for all indices from a provider, grouped by `region`."""
|
||||
return await OBBject.from_query(Query(**locals()))
|
||||
|
||||
|
||||
@router.command(model="AvailableIndices")
|
||||
@router.command(
|
||||
model="AvailableIndices",
|
||||
exclude_auto_examples=True,
|
||||
examples=[
|
||||
'obb.index.available(provider="yfinance").to_df()',
|
||||
],
|
||||
)
|
||||
async def available(
|
||||
cc: CommandContext,
|
||||
provider_choices: ProviderChoices,
|
||||
standard_params: StandardParams,
|
||||
extra_params: ExtraParams,
|
||||
) -> OBBject:
|
||||
"""Available Indices. Available indices for a given provider."""
|
||||
"""All indices available from a given provider."""
|
||||
return await OBBject.from_query(Query(**locals()))
|
||||
|
||||
|
||||
@router.command(model="IndexSearch")
|
||||
@router.command(
|
||||
model="IndexSearch",
|
||||
exclude_auto_examples=True,
|
||||
examples=[
|
||||
"obb.index.search(query='SPX', provider='cboe').to_df()",
|
||||
],
|
||||
)
|
||||
async def search(
|
||||
cc: CommandContext,
|
||||
provider_choices: ProviderChoices,
|
||||
standard_params: StandardParams,
|
||||
extra_params: ExtraParams,
|
||||
) -> OBBject:
|
||||
"""Index Search. Search for indices."""
|
||||
"""Filters indices for rows containing the query."""
|
||||
return await OBBject.from_query(Query(**locals()))
|
||||
|
||||
|
||||
@router.command(model="SP500Multiples")
|
||||
@router.command(
|
||||
model="SP500Multiples",
|
||||
exclude_auto_examples=True,
|
||||
examples=[
|
||||
'obb.index.sp500_multiples(series_name="shiller_pe_year", provider="nasdaq").to_df()',
|
||||
],
|
||||
)
|
||||
async def sp500_multiples(
|
||||
cc: CommandContext,
|
||||
provider_choices: ProviderChoices,
|
||||
standard_params: StandardParams,
|
||||
extra_params: ExtraParams,
|
||||
) -> OBBject:
|
||||
"""S&P 500 Multiples. Historical S&P 500 multiples and Shiller PE ratios."""
|
||||
"""Historical S&P 500 multiples and Shiller PE ratios."""
|
||||
return await OBBject.from_query(Query(**locals()))
|
||||
|
||||
@@ -15,12 +15,20 @@ router = Router(prefix="/price")
|
||||
# pylint: disable=unused-argument
|
||||
|
||||
|
||||
@router.command(model="IndexHistorical")
|
||||
@router.command(
|
||||
model="IndexHistorical",
|
||||
exclude_auto_examples=True,
|
||||
examples=[
|
||||
'obb.index.price.historical("^GSPC", provider="fmp").to_df()',
|
||||
"#### Not all providers have the same symbols. ####",
|
||||
'obb.index.price.historical("SPX", provider="intrinio").to_df()',
|
||||
],
|
||||
)
|
||||
async def historical(
|
||||
cc: CommandContext,
|
||||
provider_choices: ProviderChoices,
|
||||
standard_params: StandardParams,
|
||||
extra_params: ExtraParams,
|
||||
) -> OBBject:
|
||||
"""Index Historical Price. Load stock data for a specific index."""
|
||||
"""Historical Index Levels."""
|
||||
return await OBBject.from_query(Query(**locals()))
|
||||
|
||||
Reference in New Issue
Block a user