summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--trade.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/trade.py b/trade.py
index 4eddb7f..3ceaeb6 100644
--- a/trade.py
+++ b/trade.py
@@ -4,6 +4,13 @@ class Trade:
self.__total_cost: float = total_cost
self.__date: str = date
+ def remove_coins(self, amount: float) -> None:
+ if amount > self.__amount:
+ raise ValueError(f"Can't remove more than {self.__amount}")
+
+ self.__total_cost -= amount * self.price_per_coin
+ self.__amount -= amount
+
@property
def amount(self) -> float:
return self.__amount