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
|
"""Estimates Router."""
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="/estimates")
# pylint: disable=unused-argument
@router.command(
model="PriceTarget",
examples=[
APIEx(parameters={"provider": "benzinga"}),
APIEx(
description="Get price targets for Microsoft using 'benzinga' as provider.",
parameters={
"start_date": "2020-01-01",
"end_date": "2024-02-16",
"limit": 10,
"symbol": "msft",
"provider": "benzinga",
"action": "downgrades",
},
),
],
)
async def price_target(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject:
"""Get analyst price targets by company."""
return await OBBject.from_query(Query(**locals()))
@router.command(
model="AnalystEstimates",
examples=[
APIEx(parameters={"symbol": "AAPL", "provider": "fmp"}),
],
)
async def historical(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject:
"""Get historical analyst estimates for earnings and revenue."""
return await OBBject.from_query(Query(**locals()))
@router.command(
model="PriceTargetConsensus",
examples=[
APIEx(parameters={"symbol": "AAPL", "provider": "fmp"}),
APIEx(parameters={"symbol": "AAPL,MSFT", "provider": "yfinance"}),
],
)
async def consensus(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject:
"""Get consensus price target and recommendation."""
return await OBBject.from_query(Query(**locals()))
@router.command(
model="AnalystSearch",
examples=[
APIEx(parameters={"provider": "benzinga"}),
APIEx(parameters={"firm_name": "Wedbush", "provider": "benzinga"}),
],
)
async def analyst_search(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject:
"""Search for specific analysts and get their forecast track record."""
return await OBBject.from_query(Query(**locals()))
@router.command(
model="SalesEstimates",
examples=[],
)
async def sales_estimates(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject:
"""Get sales estimates."""
return await OBBject.from_query(Query(**locals()))
|