summaryrefslogtreecommitdiffstats
path: root/openbb_platform/extensions/equity/openbb_equity/discovery/discovery_router.py
blob: b8fbbc1a7be7291948ec8dcde37dcdb96d440f29 (plain)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
"""Disc router for Equities."""

# pylint: disable=unused-argument
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")


@router.command(
    model="EquityGainers",
    examples=[
        APIEx(parameters={"provider": "yfinance"}),
        APIEx(parameters={"sort": "desc", "provider": "yfinance"}),
    ],
)
async def gainers(
    cc: CommandContext,
    provider_choices: ProviderChoices,
    standard_params: StandardParams,
    extra_params: ExtraParams,
) -> OBBject:
    """Get the top price gainers in the stock market."""
    return await OBBject.from_query(Query(**locals()))


@router.command(
    model="EquityLosers",
    examples=[
        APIEx(parameters={"provider": "yfinance"}),
        APIEx(parameters={"sort": "desc", "provider": "yfinance"}),
    ],
)
async def losers(
    cc: CommandContext,
    provider_choices: ProviderChoices,
    standard_params: StandardParams,
    extra_params: ExtraParams,
) -> OBBject:
    """Get the top price losers in the stock market."""
    return await OBBject.from_query(Query(**locals()))


@router.command(
    model="EquityActive",
    examples=[
        APIEx(parameters={"provider": "yfinance"}),
        APIEx(parameters={"sort": "desc", "provider": "yfinance"}),
    ],
)
async def active(
    cc: CommandContext,
    provider_choices: ProviderChoices,
    standard_params: StandardParams,
    extra_params: ExtraParams,
) -> OBBject:
    """Get the most actively traded stocks based on volume."""
    return await OBBject.from_query(Query(**locals()))


@router.command(
    model="EquityUndervaluedLargeCaps",
    examples=[
        APIEx(parameters={"provider": "yfinance"}),
        APIEx(parameters={"sort": "desc", "provider": "yfinance"}),
    ],
)
async def undervalued_large_caps(
    cc: CommandContext,
    provider_choices: ProviderChoices,
    standard_params: StandardParams,
    extra_params: ExtraParams,
) -> OBBject:
    """Get potentially undervalued large cap stocks."""
    return await OBBject.from_query(Query(**locals()))


@router.command(
    model="EquityUndervaluedGrowth",
    examples=[
        APIEx(parameters={"provider": "yfinance"}),
        APIEx(parameters={"sort": "desc", "provider": "yfinance"}),
    ],
)
async def undervalued_growth(
    cc: CommandContext,
    provider_choices: ProviderChoices,
    standard_params: StandardParams,
    extra_params: ExtraParams,
) -> OBBject:
    """Get potentially undervalued growth stocks."""
    return await OBBject.from_query(Query(**locals()))


@router.command(
    model="EquityAggressiveSmallCaps",
    examples=[
        APIEx(parameters={"provider": "yfinance"}),
        APIEx(parameters={"sort": "desc", "provider": "yfinance"}),
    ],
)
async def aggressive_small_caps(
    cc: CommandContext,
    provider_choices: ProviderChoices,
    standard_params: StandardParams,
    extra_params: ExtraParams,
) -> OBBject:
    """Get top small cap stocks based on earnings growth."""
    return await OBBject.from_query(Query(**locals()))


@router.command(
    model="GrowthTechEquities",
    examples=[
        APIEx(parameters={"provider": "yfinance"}),
        APIEx(parameters={"sort": "desc", "provider": "yfinance"}),
    ],
)
async def growth_tech(
    cc: CommandContext,
    provider_choices: ProviderChoices,
    standard_params: StandardParams,
    extra_params: ExtraParams,
) -> OBBject:
    """Get top tech stocks based on revenue and earnings growth."""
    return await OBBject.from_query(Query(**locals()))


@router.command(
    model="TopRetail",
    examples=[APIEx(parameters={"provider": "nasdaq"})],
)
async def top_retail(
    cc: CommandContext,
    provider_choices: ProviderChoices,
    standard_params: StandardParams,
    extra_params: ExtraParams,
) -> OBBject:
    """Track over $30B USD/day of individual investors trades.

    It gives a daily view into retail activity and sentiment for over 9,500 US traded stocks,
    ADRs, and ETPs.
    """
    return await OBBject.from_query(Query(**locals()))


@router.command(
    model="UpcomingReleaseDays",
    examples=[APIEx(parameters={"provider": "seeking_alpha"})],
)
async def upcoming_release_days(
    cc: CommandContext,
    provider_choices: ProviderChoices,
    standard_params: StandardParams,
    extra_params: ExtraParams,
) -> OBBject:
    """Get upcoming earnings release dates."""
    return await OBBject.from_query(Query(**locals()))


@router.command(
    model="DiscoveryFilings",
    examples=[
        APIEx(parameters={"provider": "fmp"}),
        APIEx(
            description="Get filings for the year 2023, limited to 100 results",
            parameters={
                "start_date": "2023-01-01",
                "end_date": "2023-12-31",
                "limit": 100,
                "provider": "fmp",
            },
        ),
    ],
)
async def filings(
    cc: CommandContext,
    provider_choices: ProviderChoices,
    standard_params: StandardParams,
    extra_params: ExtraParams,
) -> OBBject:
    """Get the URLs to SEC filings reported to EDGAR database, such as 10-K, 10-Q, 8-K, and more.

    SEC filings include Form 10-K, Form 10-Q, Form 8-K, the proxy statement, Forms 3, 4, and 5, Schedule 13, Form 114,
    Foreign Investment Disclosures and others. The annual 10-K report is required to be
    filed annually and includes the company's financial statements, management discussion and analysis,
    and audited financial statements.
    """
    return await OBBject.from_query(Query(**locals()))