diff options
author | uvok | 2025-04-17 17:48:50 +0200 |
---|---|---|
committer | uvok | 2025-04-17 17:48:50 +0200 |
commit | 9627c4426614d5ad9d57f56e93ba5c53e10ed387 (patch) | |
tree | d0fbc6dd094865b59ed9cd6840100f3b690532c3 /trade.py | |
parent | 0825795ae09b1c85a6c1d7f6289c09f936cef74c (diff) |
Add refid to tax
Diffstat (limited to 'trade.py')
-rw-r--r-- | trade.py | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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})" |