diff --git a/google_stocks/__init__.py b/google_stocks/__init__.py index 57a3122..31b4cba 100644 --- a/google_stocks/__init__.py +++ b/google_stocks/__init__.py @@ -49,6 +49,8 @@ class Index: price: decimal.Decimal subtitle: str title: str + state: str + timestamp: str def __init__(self, name: str): """Init.""" @@ -104,6 +106,11 @@ class Index: percent_change_str = tag[1][0].text_content().strip() percent_change_str = percent_change_str.replace("\N{MINUS SIGN}", "-") + assert tag[2][0][0].text and tag[2][0][1].text + + self.state = tag[2][0][0].text.rstrip(": ").lower() + self.timestamp = tag[2][0][1].text + self.day_change = decimal.Decimal(percent_change_str) m = re_percent_change.match(tag[1][1].text_content()) assert m @@ -115,4 +122,7 @@ class Index: @property def one_line(self) -> str: """Index name, price and price change.""" - return f"{self.title}: {self.price} ({self.percent_change}%)" + return ( + f"{self.title}: {self.price} ({self.percent_change}%) " + + f"{self.state} {self.timestamp}" + )