summaryrefslogtreecommitdiff
path: root/trade_queue.py
diff options
context:
space:
mode:
Diffstat (limited to 'trade_queue.py')
-rw-r--r--trade_queue.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/trade_queue.py b/trade_queue.py
index 73640bf..ae21f95 100644
--- a/trade_queue.py
+++ b/trade_queue.py
@@ -41,6 +41,14 @@ class FIFOQueue:
self._cache_valid = False
logger.info(f"Added trade: {trade}.")
+ def add_trade(self, trade: Trade) -> None:
+ """
+ Add a trade to the queue.
+ """
+ self.__queue.append(trade)
+ self._cache_valid = False
+ logger.info(f"Added trade: {trade}.")
+
def remove_coins(self, amount: float | Decimal) -> List[Trade]:
"""
Remove a specified amount of coins from the queue, returning the
@@ -121,7 +129,9 @@ class FIFOQueue:
raise ValueError("No trade matches the given predicate.")
elif len(matching_trades) > 1:
logger.error("Multiple matching trades found for removal.")
- raise ValueError("Multiple trades match the given predicate. Please refine your criteria.")
+ raise ValueError(
+ "Multiple trades match the given predicate. Please refine your criteria."
+ )
# Locate the exact match in the original queue
trade_to_remove = matching_trades[0]