-
Notifications
You must be signed in to change notification settings - Fork 350
Expand file tree
/
Copy pathdividends.py
More file actions
54 lines (48 loc) · 1.87 KB
/
dividends.py
File metadata and controls
54 lines (48 loc) · 1.87 KB
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
from typing import Optional
from ...modelclass import modelclass
@modelclass
class Dividend:
"Dividend contains data for a historical cash dividend, including the ticker symbol, declaration date, ex-dividend date, record date, pay date, frequency, and amount."
id: Optional[int] = None
cash_amount: Optional[float] = None
currency: Optional[str] = None
declaration_date: Optional[str] = None
dividend_type: Optional[str] = None
ex_dividend_date: Optional[str] = None
frequency: Optional[int] = None
pay_date: Optional[str] = None
record_date: Optional[str] = None
ticker: Optional[str] = None
@staticmethod
def from_dict(d):
return Dividend(**d)
@modelclass
class StockDividend:
cash_amount: Optional[float] = None
currency: Optional[str] = None
declaration_date: Optional[str] = None
distribution_type: Optional[str] = None
ex_dividend_date: Optional[str] = None
frequency: Optional[int] = None
historical_adjustment_factor: Optional[float] = None
id: Optional[str] = None
pay_date: Optional[str] = None
record_date: Optional[str] = None
split_adjusted_cash_amount: Optional[float] = None
ticker: Optional[str] = None
@staticmethod
def from_dict(d):
return StockDividend(
cash_amount=d.get("cash_amount"),
currency=d.get("currency"),
declaration_date=d.get("declaration_date"),
distribution_type=d.get("distribution_type"),
ex_dividend_date=d.get("ex_dividend_date"),
frequency=d.get("frequency"),
historical_adjustment_factor=d.get("historical_adjustment_factor"),
id=d.get("id"),
pay_date=d.get("pay_date"),
record_date=d.get("record_date"),
split_adjusted_cash_amount=d.get("split_adjusted_cash_amount"),
ticker=d.get("ticker"),
)