from typing import Literal
from pydantic import BaseModel, Field
from .constants import LINE_ITEM_NAMES_AND_ALIASES, BusinessRelationshipType
[docs]class GetCompanyIdFromIdentifier(BaseModel):
ticker_str: str = Field(description="The ticker")
[docs]class GetSecurityIdFromIdentifier(BaseModel):
identifier: str = Field(
description="The identifier, which can be a ticker symbol, ISIN, or CUSIP"
)
[docs]class GetTradingItemIdFromIdentifier(BaseModel):
identifier: str = Field(
description="The identifier, which can be a ticker symbol, ISIN, or CUSIP"
)
[docs]class GetIsinFromTicker(BaseModel):
ticker_str: str = Field(description="The ticker")
[docs]class GetCusipFromTicker(BaseModel):
ticker_str: str = Field(description="The ticker")
[docs]class GetInfoFromIdentifier(BaseModel):
identifier: str = Field(
description="The identifier, which can be a ticker symbol, ISIN, or CUSIP"
)
[docs]class GetEarningsCallDatetimesFromIdentifier(BaseModel):
identifier: str = Field(
description="The identifier, which can be a ticker symbol, ISIN, or CUSIP"
)
[docs]class GetHistoryMetadataFromIdentifier(BaseModel):
identifier: str = Field(
description="The identifier, which can be a ticker symbol, ISIN, or CUSIP"
)
[docs]class GetPricesFromIdentifier(BaseModel):
identifier: str = Field(
description="The identifier, which can be a ticker symbol, ISIN, or CUSIP"
)
periodicity: Literal["day", "week", "month", "year"] = Field(
default="day",
description="The frequency or interval at which the historical data points are sampled or aggregated. Periodicity is not the same as the date range. The date range specifies the time span over which the data is retrieved, while periodicity determines how the data within that date range is aggregated, valid inputs are ['day', 'week', 'month', 'year'].",
)
adjusted: bool = Field(
description="Whether to retrieve adjusted prices that account for corporate actions such as dividends and splits."
)
start_date: str | None = Field(
default=None,
description="The start date for historical price retrieval in format YYYY-MM-DD",
)
end_date: str | None = Field(
default=None, description="The end date for historical price retrieval in format YYYY-MM-DD"
)
[docs]class GetFinancialStatementFromIdentifier(BaseModel):
identifier: str = Field(
description="The identifier, which can be a ticker symbol, ISIN, or CUSIP"
)
statement: Literal["balance_sheet", "income_statement", "cashflow"] = Field(
description="The type of financial statement, valid inputs are ['balance_sheet', 'income_statement', 'cashflow']"
)
period_type: Literal["annual", "quarterly", "ltm", "ytd"] | None = Field(
default=None,
description="time period type, valid inputs are ['annual', 'quarterly', 'ltm', 'ytd'].",
)
start_year: int | None = Field(
default=None, description="The starting year for the data range."
)
end_year: int | None = Field(default=None, description="The ending year for the data range.")
start_quarter: Literal[1, 2, 3, 4] | None = Field(
default=None, description="starting quarter, valid inputs are [1, 2, 3, 4]"
)
end_quarter: Literal[1, 2, 3, 4] | None = Field(
default=None, description="ending quarter, valid inputs are [1, 2, 3, 4]"
)
[docs]class GetFinancialLineItemFromIdentifier(BaseModel):
identifier: str = Field(
description="The identifier, which can be a ticker symbol, ISIN, or CUSIP"
)
line_item: Literal[tuple(LINE_ITEM_NAMES_AND_ALIASES)] = Field( # type: ignore
description="The type of financial line_item requested"
)
period_type: Literal["annual", "quarterly", "ltm", "ytd"] | None = Field(
default=None,
description="time period type, valid inputs are ['annual', 'quarterly', 'ltm', 'ytd']",
)
start_year: int | None = Field(
default=None, description="The starting year for the data range."
)
end_year: int | None = Field(default=None, description="The ending year for the data range.")
start_quarter: Literal[1, 2, 3, 4] | None = Field(
default=None, description="starting quarter, valid inputs are [1, 2, 3, 4]"
)
end_quarter: Literal[1, 2, 3, 4] | None = Field(
default=None, description="ending quarter, valid inputs are [1, 2, 3, 4]"
)
[docs]class GetBusinessRelationshipFromIdentifier(BaseModel):
identifier: str = Field(
description="The identifier, which can be a ticker symbol, ISIN, or CUSIP"
)
business_relationship: BusinessRelationshipType = Field(
description="The type of business relationship requested"
)