diff options
-rw-r--r-- | trade.py | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -1,5 +1,10 @@ +from decimal import Decimal + class Trade: def __init__(self, amount: float, total_cost: float, date: str) -> None: + if amount <= 0 or total_cost <= 0: + raise ValueError("Amount and total cost must be > 0") + self.__amount: float = amount self.__total_cost: float = total_cost self.__date: str = date |