From 9fee65ab68951c77c7f694ebabce6f4fa9181f9b Mon Sep 17 00:00:00 2001 From: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> Date: Tue, 20 Feb 2024 14:35:30 +0100 Subject: [PATCH] Add ETF examples (#6102) Co-authored-by: Pratyush Shukla --- .../openbb_etf/discovery/discovery_router.py | 27 ++++++++++++++++--- .../extensions/etf/openbb_etf/etf_router.py | 10 ++++++- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/openbb_platform/extensions/etf/openbb_etf/discovery/discovery_router.py b/openbb_platform/extensions/etf/openbb_etf/discovery/discovery_router.py index 3f6c10f9b2f..21e60286f49 100644 --- a/openbb_platform/extensions/etf/openbb_etf/discovery/discovery_router.py +++ b/openbb_platform/extensions/etf/openbb_etf/discovery/discovery_router.py @@ -15,7 +15,14 @@ router = Router(prefix="/discovery") # pylint: disable=unused-argument -@router.command(model="ETFGainers", operation_id="etf_gainers") +@router.command( + model="ETFGainers", + operation_id="etf_gainers", + examples=[ + "### Get the top ETF gainers. ###", + 'obb.etf.discovery.gainers(provider="wsj")', + ], +) async def gainers( cc: CommandContext, provider_choices: ProviderChoices, @@ -26,7 +33,14 @@ async def gainers( return await OBBject.from_query(Query(**locals())) -@router.command(model="ETFLosers", operation_id="etf_losers") +@router.command( + model="ETFLosers", + operation_id="etf_losers", + examples=[ + "### Get the top ETF losers. ###", + 'obb.etf.discovery.losers(provider="wsj")', + ], +) async def losers( cc: CommandContext, provider_choices: ProviderChoices, @@ -37,7 +51,14 @@ async def losers( return await OBBject.from_query(Query(**locals())) -@router.command(model="ETFActive", operation_id="etf_active") +@router.command( + model="ETFActive", + operation_id="etf_active", + examples=[ + "### Get the most active ETFs. ###", + 'obb.etf.discovery.active(provider="wsj")', + ], +) async def active( cc: CommandContext, provider_choices: ProviderChoices, diff --git a/openbb_platform/extensions/etf/openbb_etf/etf_router.py b/openbb_platform/extensions/etf/openbb_etf/etf_router.py index c2906727d7a..8a528a885cf 100644 --- a/openbb_platform/extensions/etf/openbb_etf/etf_router.py +++ b/openbb_platform/extensions/etf/openbb_etf/etf_router.py @@ -41,7 +41,15 @@ async def search( return await OBBject.from_query(Query(**locals())) -@router.command(model="EtfHistorical", operation_id="etf_historical") +@router.command( + model="EtfHistorical", + operation_id="etf_historical", + examples=[ + 'obb.etf.historical("SPY", provider="yfinance")', + "#### This function accepts multiple tickers. ####", + 'obb.etf.historical("SPY,IWM,QQQ,DJIA", provider="yfinance")', + ], +) async def historical( cc: CommandContext, provider_choices: ProviderChoices,