diff options
Diffstat (limited to 'trade.py')
-rw-r--r-- | trade.py | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -25,8 +25,12 @@ class Trade: date (str): The date of the trade, formatted as a string. """ - if amount <= 0 or total_cost <= 0: - raise ValueError("Amount and total cost must be > 0") + if amount < 0 and total_cost < 0: + pass + elif amount > 0 and total_cost > 0: + pass + else: + raise ValueError("Amount and tota> cost must be same sign") self.__amount: Decimal = Decimal(amount) self.__total_cost: Decimal = Decimal(total_cost) |