-
Notifications
You must be signed in to change notification settings - Fork 6
/
ratio_module.py
54 lines (45 loc) · 1.69 KB
/
ratio_module.py
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 try_module import trying as trying
class Ratio:
def __init__(self, tree):
self.tree = tree
def get_present_year_dividend_present_year_dividend_per_share(self, tree):
p1 = trying(
tree, '//*[@id="leftcontainer"]/table/tbody/tr[6]/td[2]'
)
return p1
def get_present_year_dividend_present_year_dividend_per_share_minus1(
self, tree
):
p2 = trying(
tree, '//*[@id="leftcontainer"]/table/tbody/tr[6]/td[3]'
)
return p2
def get_present_year_dividend_present_year_dividend_per_share_minus2(
self, tree
):
p3 = trying(
tree, '//*[@id="leftcontainer"]/table/tbody/tr[6]/td[4]'
)
return p3
def get_present_year_dividend_present_year_dividend_per_share_minus3(
self, tree
):
return trying(
tree, '//*[@id="leftcontainer"]/table/tbody/tr[6]/td[5]'
)
def get_present_year_dividend_present_year_dividend_per_share_minus4(
self, tree
):
return trying(
tree, '//*[@id="leftcontainer"]/table/tbody/tr[6]/td[6]'
)
def consistent_dividend_payout(self, tree):
all_dividends = list(map(
lambda f: f(tree) > 0,
[self.get_present_year_dividend_present_year_dividend_per_share,
self.get_present_year_dividend_present_year_dividend_per_share_minus1,
self.get_present_year_dividend_present_year_dividend_per_share_minus2,
self.get_present_year_dividend_present_year_dividend_per_share_minus3,
self.get_present_year_dividend_present_year_dividend_per_share_minus4]
))
return all(all_dividends)