Repository: liampauling/flumine
Pull request #524 (2021-11-11 16:10:27)

Missing clk handling in order and race stream


Patch:
diff --git a/HISTORY.rst b/HISTORY.rst
index 31f709c..2dfe407 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -3,6 +3,13 @@
 Release History
 ---------------
 
+1.20.10 (2021-11-11)
++++++++++++++++++++
+
+**Bug Fixes**
+
+- Missing clk handling in order and race stream
+
 1.20.9 (2021-11-11)
 +++++++++++++++++++
 
diff --git a/flumine/__version__.py b/flumine/__version__.py
index cb87f3b..6d3b395 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.20.9"
+__version__ = "1.20.10"
 __author__ = "Liam Pauling"
 __license__ = "MIT"
diff --git a/flumine/streams/datastream.py b/flumine/streams/datastream.py
index 9fbf60f..6199a32 100644
--- a/flumine/streams/datastream.py
+++ b/flumine/streams/datastream.py
@@ -86,7 +86,7 @@ class FlumineOrderStream(FlumineStream):
                 )
             self._updates_processed += 1
 
-        self.on_process([self.unique_id, publish_time, data])
+        self.on_process([self.unique_id, self._clk, publish_time, data])
         return False
 
 
@@ -106,7 +106,7 @@ class FlumineRaceStream(FlumineStream):
                 )
             self._updates_processed += 1
 
-        self.on_process([self.unique_id, publish_time, data])
+        self.on_process([self.unique_id, self._clk, publish_time, data])
         return False
 
 


Test patch:
diff --git a/tests/test_streams.py b/tests/test_streams.py
index 3f8d249..b1196b0 100644
--- a/tests/test_streams.py
+++ b/tests/test_streams.py
@@ -567,6 +567,7 @@ class TestDataStream(unittest.TestCase):
     def test_flumine_order_stream(self, mock_on_process):
         mock_listener = mock.Mock(stream_unique_id=0)
         stream = datastream.FlumineOrderStream(mock_listener, 0)
+        stream._clk = "AAA"
         order_updates = [{"id": "1.123"}, {"id": "1.456"}, {"id": "1.123"}]
         stream._process(order_updates, 123)
 
@@ -574,13 +575,14 @@ class TestDataStream(unittest.TestCase):
         self.assertEqual(len(stream._caches), 2)
         self.assertEqual(stream._updates_processed, 3)
         mock_on_process.assert_called_with(
-            [mock_listener.stream_unique_id, 123, order_updates]
+            [mock_listener.stream_unique_id, "AAA", 123, order_updates]
         )
 
     @mock.patch("flumine.streams.datastream.FlumineRaceStream.on_process")
     def test_flumine_race_stream(self, mock_on_process):
         mock_listener = mock.Mock(stream_unique_id=0)
         stream = datastream.FlumineRaceStream(mock_listener, 0)
+        stream._clk = "AAA"
         race_updates = [{"mid": "1.123"}, {"mid": "1.456"}, {"mid": "1.123"}]
         stream._process(race_updates, 123)
 
@@ -588,7 +590,7 @@ class TestDataStream(unittest.TestCase):
         self.assertEqual(len(stream._caches), 2)
         self.assertEqual(stream._updates_processed, 3)
         mock_on_process.assert_called_with(
-            [mock_listener.stream_unique_id, 123, race_updates]
+            [mock_listener.stream_unique_id, "AAA", 123, race_updates]
         )