summaryrefslogtreecommitdiff
path: root/trade.py
diff options
context:
space:
mode:
authoruvok2025-04-14 20:36:12 +0200
committeruvok2025-04-14 20:36:12 +0200
commit14b737dc629950a4d9fe30c841c8697c958feff0 (patch)
tree1a0d6c374272498d74607c50757ee7a015ea58ca /trade.py
parent71f5ca16725d5e75edae7b1db876b5ec277fd797 (diff)
Check initializer
Diffstat (limited to 'trade.py')
-rw-r--r--trade.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/trade.py b/trade.py
index 3ceaeb6..d031622 100644
--- a/trade.py
+++ b/trade.py
@@ -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