Skip to content

Commit

Permalink
open draft
Browse files Browse the repository at this point in the history
  • Loading branch information
deeleeramone committed Jan 19, 2025
1 parent 58b252c commit b161e50
Show file tree
Hide file tree
Showing 6 changed files with 1,315 additions and 479 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
"""Management Discussion & Analysis Standard Model."""

from datetime import date as dateType
from typing import Optional

from openbb_core.provider.abstract.data import Data
from openbb_core.provider.abstract.query_params import QueryParams
from openbb_core.provider.utils.descriptions import QUERY_DESCRIPTIONS
from pydantic import Field, field_validator


class ManagementDiscussionAnalysisQueryParams(QueryParams):
symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", ""))
calendar_year: Optional[int] = Field(
default=None,
description="Calendar year of the report. By default, is the current year."
+ " If the calendar period is not provided, but the calendar year is, it will return the annual report.",
)
calendar_period: Optional[int] = Field(
gt=0,
le=4,
default=None,
description="Calendar period of the report. By default, is the most recent report available for the symbol."
+ " If no calendar year and no calendar period are provided, it will return the most recent report.",
)

@field_validator("symbol", mode="before", check_fields=False)
@classmethod
def to_upper(cls, v: str):
"""Convert field to uppercase."""
return v.upper()


class ManagementDiscussionAnalysisData(Data):
"""Management Discussion & Analysis Data."""

symbol: str = Field(description="The symbol of the company.")
calendar_year: int = Field(description="The calendar year of the report.")
calendar_period: int = Field(description="The calendar period of the report.")
period_ending: Optional[dateType] = Field(
description="The end date of the reporting period.", default=None
)
content: str = Field(
description="The content of the management discussion and analysis."
)
Original file line number Diff line number Diff line change
Expand Up @@ -477,3 +477,17 @@ async def trailing_dividend_yield(
) -> OBBject:
"""Get the 1 year trailing dividend yield for a given company over time."""
return await OBBject.from_query(Query(**locals()))


@router.command(
model="ManagementDiscussionAnalysis",
examples=[APIEx(parameters={"symbol": "AAPL", "provider": "sec"})],
)
async def management_discussion_analysis(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject:
"""Get the Management Discussion & Analysis section from the financial statements for a given company."""
return await OBBject.from_query(Query(**locals()))
4 changes: 4 additions & 0 deletions openbb_platform/providers/sec/openbb_sec/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
from openbb_sec.models.insider_trading import SecInsiderTradingFetcher
from openbb_sec.models.institutions_search import SecInstitutionsSearchFetcher
from openbb_sec.models.latest_financial_reports import SecLatestFinancialReportsFetcher
from openbb_sec.models.management_discussion_analysis import (
SecManagementDiscussionAnalysisFetcher,
)
from openbb_sec.models.rss_litigation import SecRssLitigationFetcher
from openbb_sec.models.schema_files import SecSchemaFilesFetcher
from openbb_sec.models.sic_search import SecSicSearchFetcher
Expand All @@ -33,6 +36,7 @@
"InsiderTrading": SecInsiderTradingFetcher,
"InstitutionsSearch": SecInstitutionsSearchFetcher,
"LatestFinancialReports": SecLatestFinancialReportsFetcher,
"ManagementDiscussionAnalysis": SecManagementDiscussionAnalysisFetcher,
"RssLitigation": SecRssLitigationFetcher,
"SchemaFiles": SecSchemaFilesFetcher,
"SicSearch": SecSicSearchFetcher,
Expand Down
Loading

0 comments on commit b161e50

Please sign in to comment.