from typing import Union
from dateutil import parser
from ...models import BaseSubAccountDetails
[docs]
class SymitarSubAccountDetails(BaseSubAccountDetails):
def __init__(
self,
share_id: str,
share_desc: str,
apy: str,
maturity_date: Union[str, None],
div_rate: str,
opening_amount: str,
):
super().__init__(share_id, share_desc)
self.account_id = share_id
self.account_desc = share_desc
self.apy = "{0:.3f}%".format(float(apy)) if apy else apy
self.maturity_date = None
if maturity_date and maturity_date != "--/--/----":
self.maturity_date = parser.parse(maturity_date).date().strftime("%m/%d/%Y")
self.div_rate = "{0:.3f}%".format(float(div_rate)) if div_rate else div_rate
self.funding_amount = None
if opening_amount:
self.funding_amount = "${:,.2f}".format(
float(opening_amount.replace("$", "").replace(",", ""))
)