Skip to content

Commit

Permalink
Prevent signals opening pairs that are already active
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Wu Fei authored and Carlos Wu Fei committed Jan 3, 2024
1 parent 1b464f1 commit ba3b784
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions api/deals/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,15 @@ def open_deal(self):
- If base order deal is not executed, bot is not activated
"""
# Check if bot with same pair is already active
active_bot = self.db_collection.find_one(
{"pair": self.active_bot.pair, "status": Status.active}
)
if active_bot:
raise CreateDealControllerError(
f"Bot with pair {self.active_bot.pair} is already active"
)

# If there is already a base order do not execute
base_order_deal = next(
(
Expand Down

0 comments on commit ba3b784

Please sign in to comment.