nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: liampauling/flumine
Pull request #447 (2021-06-03 10:19:53)

Sets order to be executable after violating on market status


Patch:
diff --git a/flumine/controls/tradingcontrols.py b/flumine/controls/tradingcontrols.py
index 95ec094..270e178 100644
--- a/flumine/controls/tradingcontrols.py
+++ b/flumine/controls/tradingcontrols.py
@@ -113,6 +113,7 @@ class MarketValidation(BaseControl):
         market = self.flumine.markets.markets.get(order.market_id)
         if market and market.market_book.status != "OPEN":
             self._on_error(order, "Market is not open")
+            order.executable()
 
 
 class StrategyExposure(BaseControl):


Test patch:
diff --git a/tests/test_tradingcontrols.py b/tests/test_tradingcontrols.py
index 55efd74..ada0c0c 100644
--- a/tests/test_tradingcontrols.py
+++ b/tests/test_tradingcontrols.py
@@ -288,24 +288,28 @@ class TestMarketValidation(unittest.TestCase):
     def test__validate_betfair_market_status(self, mock_on_error):
         self.trading_control._validate_betfair_market_status(self.mock_order)
         mock_on_error.assert_not_called()
+        self.mock_order.executable.assert_not_called()
 
     @mock.patch("flumine.controls.tradingcontrols.MarketValidation._on_error")
     def test__validate_betfair_market_status_closed(self, mock_on_error):
         self.mock_market.market_book.status = "CLOSED"
         self.trading_control._validate_betfair_market_status(self.mock_order)
         mock_on_error.assert_called()
+        self.mock_order.executable.assert_called()
 
     @mock.patch("flumine.controls.tradingcontrols.MarketValidation._on_error")
     def test__validate_betfair_market_status_suspended(self, mock_on_error):
         self.mock_market.market_book.status = "SUSPENDED"
         self.trading_control._validate_betfair_market_status(self.mock_order)
         mock_on_error.assert_called()
+        self.mock_order.executable.assert_called()
 
     @mock.patch("flumine.controls.tradingcontrols.MarketValidation._on_error")
     def test__validate_betfair_market_not_found(self, mock_on_error):
         self.mock_flumine.markets.markets = {}
         self.trading_control._validate_betfair_market_status(self.mock_order)
         mock_on_error.assert_not_called()
+        self.mock_order.executable.assert_not_called()
 
 
 class TestStrategyExposure(unittest.TestCase):
Repository: liampauling/flumine
Pull request #448 (2021-06-03 10:23:38)

Lunswor market validation order to still be executable


Patch:
diff --git a/HISTORY.rst b/HISTORY.rst
index 1b717a7..b3676c8 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -3,6 +3,13 @@
 Release History
 ---------------
 
+1.19.3 (2021-06-03)
++++++++++++++++++++
+
+**Bug Fixes**
+
+- Set order to be executable after violating on market status  (@lunswor)
+
 1.19.2 (2021-06-03)
 +++++++++++++++++++
 
diff --git a/flumine/__version__.py b/flumine/__version__.py
index 0e433c6..24d6e86 100644
--- a/flumine/__version__.py
+++ b/flumine/__version__.py
@@ -1,6 +1,6 @@
 __title__ = "flumine"
 __description__ = "Betfair trading framework"
 __url__ = "https://github.com/liampauling/flumine"
-__version__ = "1.19.2"
+__version__ = "1.19.3"
 __author__ = "Liam Pauling"
 __license__ = "MIT"
diff --git a/flumine/controls/tradingcontrols.py b/flumine/controls/tradingcontrols.py
index 95ec094..270e178 100644
--- a/flumine/controls/tradingcontrols.py
+++ b/flumine/controls/tradingcontrols.py
@@ -113,6 +113,7 @@ class MarketValidation(BaseControl):
         market = self.flumine.markets.markets.get(order.market_id)
         if market and market.market_book.status != "OPEN":
             self._on_error(order, "Market is not open")
+            order.executable()
 
 
 class StrategyExposure(BaseControl):


Test patch:
diff --git a/tests/test_tradingcontrols.py b/tests/test_tradingcontrols.py
index 55efd74..ada0c0c 100644
--- a/tests/test_tradingcontrols.py
+++ b/tests/test_tradingcontrols.py
@@ -288,24 +288,28 @@ class TestMarketValidation(unittest.TestCase):
     def test__validate_betfair_market_status(self, mock_on_error):
         self.trading_control._validate_betfair_market_status(self.mock_order)
         mock_on_error.assert_not_called()
+        self.mock_order.executable.assert_not_called()
 
     @mock.patch("flumine.controls.tradingcontrols.MarketValidation._on_error")
     def test__validate_betfair_market_status_closed(self, mock_on_error):
         self.mock_market.market_book.status = "CLOSED"
         self.trading_control._validate_betfair_market_status(self.mock_order)
         mock_on_error.assert_called()
+        self.mock_order.executable.assert_called()
 
     @mock.patch("flumine.controls.tradingcontrols.MarketValidation._on_error")
     def test__validate_betfair_market_status_suspended(self, mock_on_error):
         self.mock_market.market_book.status = "SUSPENDED"
         self.trading_control._validate_betfair_market_status(self.mock_order)
         mock_on_error.assert_called()
+        self.mock_order.executable.assert_called()
 
     @mock.patch("flumine.controls.tradingcontrols.MarketValidation._on_error")
     def test__validate_betfair_market_not_found(self, mock_on_error):
         self.mock_flumine.markets.markets = {}
         self.trading_control._validate_betfair_market_status(self.mock_order)
         mock_on_error.assert_not_called()
+        self.mock_order.executable.assert_not_called()
 
 
 class TestStrategyExposure(unittest.TestCase):