-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Expand file tree
/
Copy pathdiscovery_router.py
More file actions
67 lines (58 loc) · 1.73 KB
/
Copy pathdiscovery_router.py
File metadata and controls
67 lines (58 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
"""Disc router for ETFs."""
from openbb_core.app.model.command_context import CommandContext
from openbb_core.app.model.example import APIEx
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
router = Router(prefix="/discovery")
# pylint: disable=unused-argument
@router.command(
model="ETFGainers",
operation_id="etf_gainers",
examples=[
APIEx(description="Get the top ETF gainers.", parameters={"provider": "wsj"}),
],
)
async def gainers(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject:
"""Get the top ETF gainers."""
return await OBBject.from_query(Query(**locals()))
@router.command(
model="ETFLosers",
operation_id="etf_losers",
examples=[
APIEx(description="Get the top ETF losers.", parameters={"provider": "wsj"}),
],
)
async def losers(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject:
"""Get the top ETF losers."""
return await OBBject.from_query(Query(**locals()))
@router.command(
model="ETFActive",
operation_id="etf_active",
examples=[
APIEx(description="Get the most active ETFs.", parameters={"provider": "wsj"}),
],
)
async def active(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject:
"""Get the most active ETFs."""
return await OBBject.from_query(Query(**locals()))