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
|
"""Executive Compensation Standard Model."""
from datetime import (
date as dateType,
datetime,
)
from typing import List, Optional, Set, Union
from pydantic import Field, NonNegativeFloat, field_validator
from openbb_core.provider.abstract.data import Data
from openbb_core.provider.abstract.query_params import QueryParams
from openbb_core.provider.utils.descriptions import (
DATA_DESCRIPTIONS,
QUERY_DESCRIPTIONS,
)
class ExecutiveCompensationQueryParams(QueryParams):
"""Executive Compensation Query."""
symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", ""))
start_date: Optional[dateType] = Field(
default=None,
description=QUERY_DESCRIPTIONS.get("start_date", ""),
)
end_date: Optional[dateType] = Field(
default=None,
description=QUERY_DESCRIPTIONS.get("end_date", ""),
)
@field_validator("symbol", mode="before", check_fields=False)
@classmethod
def to_upper(cls, v: str) -> str:
"""Convert field to uppercase."""
return v.upper()
class ExecutiveCompensationData(Data):
"""Executive Compensation Data."""
symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", ""))
cik: Optional[str] = Field(
default=None,
description=DATA_DESCRIPTIONS.get("cik", ""),
)
filing_date: dateType = Field(description="Date of the filing.")
accepted_date: datetime = Field(description="Date the filing was accepted.")
name_and_position: str = Field(description="Name and position of the executive.")
year: int = Field(description="Year of the compensation.")
salary: NonNegativeFloat = Field(description="Salary of the executive.")
bonus: NonNegativeFloat = Field(description="Bonus of the executive.")
stock_award: NonNegativeFloat = Field(description="Stock award of the executive.")
incentive_plan_compensation: NonNegativeFloat = Field(
description="Incentive plan compensation of the executive."
)
all_other_compensation: NonNegativeFloat = Field(
description="All other compensation of the executive."
)
total: NonNegativeFloat = Field(description="Total compensation of the executive.")
url: str = Field(description="URL of the filing data.")
@field_validator("symbol", mode="before", check_fields=False)
@classmethod
def to_upper(cls, v: Union[str, List[str], Set[str]]):
"""Convert field to uppercase."""
if isinstance(v, str):
return v.upper()
return ",".join([symbol.upper() for symbol in list(v)])
|