From f27592b8862846296b465a1b4e3f9f2b00cf24cf Mon Sep 17 00:00:00 2001 From: D1ther Date: Tue, 21 Apr 2026 18:26:48 +0300 Subject: [PATCH 1/2] fix(models): resolve 'deal_expire_at' error by adding 30s dead time protection Fixes an issue where turbo options trades were systematically rejected by the server if placed within the last 30 seconds of the current candle duration. Problem: The 'to_payload' method in 'TradeOrder' was calculating 'expire_at' by simply shifting the time to the nearest next candle boundary. However, the Binomo platform enforces a 30-second 'dead time' (a freeze period) before expiration. If the trade request was sent when (expire_at - now) < 30, the WebSocket server would return a 'deal_expire_at' validation error and reject the trade. Solution: Added a dead time protection check. If the calculated 'expire_at' is less than 30 seconds away from the current time, we add another full 'duration_seconds' period to safely shift the expiration to the end of the subsequent candle boundary. This ensures compliance with the broker's minimum expiration limits constraint. --- BinomoAPI/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/BinomoAPI/models.py b/BinomoAPI/models.py index ec5509e..92220b6 100644 --- a/BinomoAPI/models.py +++ b/BinomoAPI/models.py @@ -73,6 +73,9 @@ def to_payload(self, ref: int, created_at: Optional[int] = None, join_ref: Optio # expire_at must be aligned to the next candle boundary (in seconds) now_seconds = int(now) expire_at = now_seconds - (now_seconds % self.duration_seconds) + self.duration_seconds + + if (expire_at - now_seconds) < 30: + expire_at += self.duration_seconds return { "topic": "bo", From 3a9fca5800b91e80dcfd14bf1a9656f79b453ce8 Mon Sep 17 00:00:00 2001 From: D1ther Date: Tue, 21 Apr 2026 18:41:34 +0300 Subject: [PATCH 2/2] fix(models) increased accuracy when checking the time to open a deal Fix: changed validation to ensure deal time is calculated accurately to avoid issues Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- BinomoAPI/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BinomoAPI/models.py b/BinomoAPI/models.py index 92220b6..14d33f9 100644 --- a/BinomoAPI/models.py +++ b/BinomoAPI/models.py @@ -74,7 +74,7 @@ def to_payload(self, ref: int, created_at: Optional[int] = None, join_ref: Optio now_seconds = int(now) expire_at = now_seconds - (now_seconds % self.duration_seconds) + self.duration_seconds - if (expire_at - now_seconds) < 30: + while (expire_at - now) < 30: expire_at += self.duration_seconds return {