You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.5 KiB
Python

"""
Activist ownership schemas — SC 13D / 13G
"""
from datetime import date
from typing import Any, Dict, List, Optional
from pydantic import BaseModel, ConfigDict, Field
class ActivistEventEntry(BaseModel):
model_config = ConfigDict(from_attributes=True)
symbol: str
filing_date: date
filer_name: str
filer_cik: str
form_type: str
ownership_pct: Optional[float] = None
shares_owned: Optional[float] = None
is_amendment: bool = False
change_pct: Optional[float] = None
accession_number: str
parse_status: str
@classmethod
def from_orm_obj(cls, obj) -> "ActivistEventEntry":
return cls(
symbol=obj.symbol,
filing_date=obj.filing_date.date() if hasattr(obj.filing_date, "date") else obj.filing_date,
filer_name=obj.filer_name,
filer_cik=obj.filer_cik,
form_type=obj.form_type,
ownership_pct=obj.ownership_pct,
shares_owned=obj.shares_owned,
is_amendment=obj.is_amendment or False,
change_pct=obj.change_pct,
accession_number=obj.accession_number,
parse_status=obj.parse_status,
)
class ActivistEventsResponse(BaseModel):
symbol: str
as_of: date
window: Dict[str, Any] = Field(default_factory=dict)
events: List[ActivistEventEntry]
total_count: int
class ActivistActiveResponse(BaseModel):
as_of: date
min_ownership_pct: float
positions: List[ActivistEventEntry]
total_count: int