From 9627c4426614d5ad9d57f56e93ba5c53e10ed387 Mon Sep 17 00:00:00 2001 From: uvok Date: Thu, 17 Apr 2025 17:48:50 +0200 Subject: Add refid to tax --- trade.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'trade.py') diff --git a/trade.py b/trade.py index a07efe7..796f824 100644 --- a/trade.py +++ b/trade.py @@ -13,7 +13,9 @@ class Trade: Provides methods to modify the trade and access various attributes. """ - def __init__(self, amount: Decimal, total_cost: Decimal, date: str) -> None: + def __init__( + self, amount: Decimal, total_cost: Decimal, date: str, refid: str | None = None + ) -> None: """ Initialize a new Trade instance. @@ -29,6 +31,7 @@ class Trade: self.__amount: Decimal = Decimal(amount) self.__total_cost: Decimal = Decimal(total_cost) self.__date: str = date + self.__refid: str | None = refid def remove_coins( self, @@ -114,4 +117,5 @@ class Trade: Returns: str: A formatted string displaying the trade details. """ - return f"Trade(amount={self.amount:.2f}, price_per_coin={self.price_per_coin:.2f}, total_cost={self.total_cost:.2f}, date={self.date})" + rid = self.__refid or "" + return f"Trade(amount={self.amount:.2f}, price_per_coin={self.price_per_coin:.2f}, total_cost={self.total_cost:.2f}, date={self.date}, refid={rid})" -- cgit v1.2.3