diff options
Diffstat (limited to 'trade.py')
-rw-r--r-- | trade.py | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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 |