From 020f6fa87bbced1283393ef83296a1804e6cd44c Mon Sep 17 00:00:00 2001 From: zansibal Date: Fri, 2 May 2025 09:56:13 +0200 Subject: [PATCH 1/4] added feature to request repeat dealing window for traded epics --- trading_ig/rest.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/trading_ig/rest.py b/trading_ig/rest.py index 74b0c8b..fb52a15 100644 --- a/trading_ig/rest.py +++ b/trading_ig/rest.py @@ -1387,6 +1387,33 @@ def update_working_order( return self.fetch_deal_by_deal_reference(deal_reference) else: raise IGException(response.text) + + def fetch_repeat_dealing_window(self, epic=None, session=None): + """ + Returns repeat dealing window status for account + :param epic: filter epic, optional + :type epic: str + :param session: session object, otional + :type session: Session + :return: repeat dealing windows for recently traded epics + :rtype: dict + """ + self.non_trading_rate_limit_pause_or_pass() + version = "1" + params = {} + if epic is not None: + params["epic"] = epic + endpoint = "/repeat-dealing-window" + action = "read" + for i in range(5): + response = self._req(action, endpoint, params, session, version) + if not response.status_code == 200: + logger.info("Error fetching repeat dealing window, retrying.") + time.sleep(1) + else: + break + data = self.parse_response(response.text) + return data # -------- END -------- # From 14df69948f6de3b72f89a29a83420249e3b2b603 Mon Sep 17 00:00:00 2001 From: zansibal Date: Fri, 2 May 2025 10:14:17 +0200 Subject: [PATCH 2/4] spelling error --- trading_ig/rest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trading_ig/rest.py b/trading_ig/rest.py index fb52a15..513603e 100644 --- a/trading_ig/rest.py +++ b/trading_ig/rest.py @@ -1393,7 +1393,7 @@ def fetch_repeat_dealing_window(self, epic=None, session=None): Returns repeat dealing window status for account :param epic: filter epic, optional :type epic: str - :param session: session object, otional + :param session: session object, optional :type session: Session :return: repeat dealing windows for recently traded epics :rtype: dict From ac2c89046a4eb00fa7da45d1e6560d09c5ab92c5 Mon Sep 17 00:00:00 2001 From: zansibal Date: Fri, 2 May 2025 11:11:25 +0200 Subject: [PATCH 3/4] black compliant --- trading_ig/rest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trading_ig/rest.py b/trading_ig/rest.py index 513603e..b951b0b 100644 --- a/trading_ig/rest.py +++ b/trading_ig/rest.py @@ -1402,7 +1402,7 @@ def fetch_repeat_dealing_window(self, epic=None, session=None): version = "1" params = {} if epic is not None: - params["epic"] = epic + params["epic"] = epic endpoint = "/repeat-dealing-window" action = "read" for i in range(5): From 024dfb29a22a860234a636b7fde428121a117164 Mon Sep 17 00:00:00 2001 From: zansibal Date: Fri, 2 May 2025 11:13:16 +0200 Subject: [PATCH 4/4] black compliant again --- trading_ig/rest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trading_ig/rest.py b/trading_ig/rest.py index b951b0b..4e3c620 100644 --- a/trading_ig/rest.py +++ b/trading_ig/rest.py @@ -1387,7 +1387,7 @@ def update_working_order( return self.fetch_deal_by_deal_reference(deal_reference) else: raise IGException(response.text) - + def fetch_repeat_dealing_window(self, epic=None, session=None): """ Returns repeat dealing window status for account