From d7c7f15c195ef35792f5e342137f04b37b9f045b Mon Sep 17 00:00:00 2001
From: uvok
Date: Mon, 14 Apr 2025 20:15:57 +0200
Subject: Add method to remove coins

---
 trade.py | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'trade.py')

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
-- 
cgit v1.2.3