summaryrefslogtreecommitdiff
path: root/trade_queue.py
diff options
context:
space:
mode:
Diffstat (limited to 'trade_queue.py')
-rw-r--r--trade_queue.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/trade_queue.py b/trade_queue.py
index c76017a..5e7fb41 100644
--- a/trade_queue.py
+++ b/trade_queue.py
@@ -4,6 +4,7 @@ from copy import deepcopy
from decimal import Decimal
from typing import Callable, Deque, List
+from exceptions import TradeNotFound
from trade import Trade
# Set up a dedicated logger for FIFOQueue
@@ -131,14 +132,15 @@ class FIFOQueue:
Trade: The removed trade.
Raises:
- ValueError: If no trade matches the predicate or multiple trades are found.
+ TradeNotFound: If no trade matches the predicate or multiple trades are found.
+ ValueError: If multiple trades match the predicate.
"""
# Use filter to find matching trades
matching_trades = list(filter(predicate, self.__queue))
if len(matching_trades) == 0:
logger.error("No matching trade found for removal.")
- raise ValueError("No trade matches the given predicate.")
+ raise TradeNotFound("No trade matches the given predicate.")
elif len(matching_trades) > 1:
logger.error("Multiple matching trades found for removal.")
raise ValueError(