Repository: liampauling/flumine
Pull request #459 (2021-07-05 08:56:18)

guess whos back
bflw upgrade
black upgrade


Patch:
diff --git a/HISTORY.rst b/HISTORY.rst
index 6774912..d868ca5 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -3,6 +3,19 @@
 Release History
 ---------------
 
+1.19.5 (2021-07-05)
++++++++++++++++++++
+
+**Bug Fixes**
+
+- #453 Replace Orders drop custom separator from order_id field
+- Docs typo (@petercoles)
+
+**Libraries**
+
+- betfairlightweight upgraded to 2.12.2
+- black upgraded to black==21.6b0
+
 1.19.4 (2021-06-03)
 +++++++++++++++++++
 
diff --git a/docs/advanced.md b/docs/advanced.md
index 00ce562..e6d98eb 100644
--- a/docs/advanced.md
+++ b/docs/advanced.md
@@ -111,3 +111,23 @@ Max number of workers in execution thread pool
 ### async_place_orders
 
 Place orders sent with place orders flag, prevents waiting for bet delay
+
+### place_latency
+
+Place latency used for backtesting / simulation execution
+
+### cancel_latency
+
+Cancel latency used for backtesting / simulation execution
+
+### update_latency
+
+Update latency used for backtesting / simulation execution
+
+### replace_latency
+
+Replace latency used for backtesting / simulation execution
+
+### order_sep 
+
+customer_order_ref separator
diff --git a/flumine/__version__.py b/flumine/__version__.py
index 2afa9a2..76c3946 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.4"
+__version__ = "1.19.5"
 __author__ = "Liam Pauling"
 __license__ = "MIT"
diff --git a/flumine/config.py b/flumine/config.py
index db6faaf..013f0de 100644
--- a/flumine/config.py
+++ b/flumine/config.py
@@ -24,3 +24,5 @@ place_latency = 0.120
 cancel_latency = 0.170
 update_latency = 0.150
 replace_latency = 0.280
+
+order_sep = "-"  # customer_order_ref separator
diff --git a/flumine/order/order.py b/flumine/order/order.py
index aeb4622..6f6b24d 100644
--- a/flumine/order/order.py
+++ b/flumine/order/order.py
@@ -14,6 +14,7 @@ from .ordertype import LimitOrder, LimitOnCloseOrder, MarketOnCloseOrder, OrderT
 from .responses import Responses
 from ..exceptions import OrderUpdateError
 from ..backtest.simulated import Simulated
+from .. import config
 
 logger = logging.getLogger(__name__)
 
@@ -48,7 +49,7 @@ class BaseOrder:
         side: str,
         order_type: Union[LimitOrder, LimitOnCloseOrder, MarketOnCloseOrder],
         handicap: float = 0,
-        sep: str = "-",
+        sep: str = config.order_sep,
         context: dict = None,
         notes: collections.OrderedDict = None,  # order notes (e.g. triggers/market state)
     ):
@@ -80,7 +81,7 @@ class BaseOrder:
 
         self.cleared_order = None
 
-        self._sep = "-"  # DEFAULT VALUE
+        self._sep = config.order_sep
         self.sep = sep
 
     # status
diff --git a/flumine/order/trade.py b/flumine/order/trade.py
index 452ad22..30cda01 100644
--- a/flumine/order/trade.py
+++ b/flumine/order/trade.py
@@ -10,6 +10,7 @@ from ..strategy.strategy import BaseStrategy
 from .order import BetfairOrder
 from .ordertype import LimitOrder, LimitOnCloseOrder, MarketOnCloseOrder
 from ..exceptions import OrderError
+from .. import config
 
 logger = logging.getLogger(__name__)
 
@@ -81,7 +82,9 @@ class Trade:
         side: str,
         order_type: Union[LimitOrder, LimitOnCloseOrder, MarketOnCloseOrder],
         order: Type[BetfairOrder] = BetfairOrder,
-        **kwargs,
+        sep: str = config.order_sep,
+        context: dict = None,
+        notes: collections.OrderedDict = None,
     ) -> BetfairOrder:
         if order_type.EXCHANGE != order.EXCHANGE:
             raise OrderError(
@@ -92,7 +95,9 @@ class Trade:
             side=side,
             order_type=order_type,
             handicap=self.handicap,
-            **kwargs,
+            sep=sep,
+            context=context,
+            notes=notes,
         )
         self.orders.append(order)
         return order
@@ -108,7 +113,13 @@ class Trade:
             persistence_type=order.order_type.persistence_type,
         )
         order = BetfairOrder(
-            trade=self, side=order.side, order_type=order_type, handicap=order.handicap
+            trade=self,
+            side=order.side,
+            order_type=order_type,
+            handicap=order.handicap,
+            sep=order.sep,
+            context=order.context,
+            notes=order.notes,
         )
         self.orders.append(order)
         return order
diff --git a/mkdocs.yml b/mkdocs.yml
index efa9444..452b7dd 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -22,7 +22,7 @@ nav:
       - QuickStart: 'quickstart.md'
       - Help: 'help.md'
     - Advanced:
-      - Stategies: 'strategies.md'
+      - Strategies: 'strategies.md'
       - Trades / Orders: 'trades.md'
       - Markets: 'markets.md'
       - Controls: 'controls.md'
diff --git a/requirements.txt b/requirements.txt
index aee936f..9bd3138 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,4 @@
-betfairlightweight==2.12.1
+betfairlightweight==2.12.2
 tenacity==5.0.3
 python-json-logger==2.0.1
 requests


Test patch:
diff --git a/requirements-test.txt b/requirements-test.txt
index e2dff21..1ea795a 100644
--- a/requirements-test.txt
+++ b/requirements-test.txt
@@ -1,5 +1,5 @@
 # Tests & Linting
-black==21.5b2
+black==21.6b0
 coverage
 
 # Documentation
diff --git a/tests/test_config.py b/tests/test_config.py
index 2069d73..1c3b494 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -16,3 +16,4 @@ class ConfigTest(unittest.TestCase):
         self.assertEqual(config.cancel_latency, 0.170)
         self.assertEqual(config.update_latency, 0.150)
         self.assertEqual(config.replace_latency, 0.280)
+        self.assertEqual(config.order_sep, "-")
diff --git a/tests/test_trade.py b/tests/test_trade.py
index e3f1cf8..454f39b 100644
--- a/tests/test_trade.py
+++ b/tests/test_trade.py
@@ -79,19 +79,19 @@ class TradeTest(unittest.TestCase):
         self.assertFalse(self.trade.complete)
 
     def test_create_order(self):
-        mock_order_type = mock.Mock()
-        mock_order_type.EXCHANGE = "SYM"
-        mock_order = mock.Mock()
-        mock_order.EXCHANGE = "SYM"
+        mock_order_type = mock.Mock(EXCHANGE="SYM")
+        mock_order = mock.Mock(EXCHANGE="SYM")
         self.trade.create_order(
-            "BACK", mock_order_type, order=mock_order, context={1: 2}
+            "BACK", mock_order_type, order=mock_order, sep="-", context={1: 2}
         )
         mock_order.assert_called_with(
             trade=self.trade,
             side="BACK",
             order_type=mock_order_type,
             handicap=self.trade.handicap,
+            sep="-",
             context={1: 2},
+            notes=None,
         )
         self.assertEqual(self.trade.orders, [mock_order()])
 
@@ -101,12 +101,10 @@ class TradeTest(unittest.TestCase):
         mock_order = mock.Mock()
         mock_order.EXCHANGE = "MYS"
         with self.assertRaises(OrderError):
-            self.trade.create_order(
-                "BACK", mock_order_type, handicap=1, order=mock_order
-            )
+            self.trade.create_order("BACK", mock_order_type, order=mock_order)
 
     def test_create_order_replacement(self):
-        mock_order = mock.Mock()
+        mock_order = mock.Mock(sep="-")
         replacement_order = self.trade.create_order_replacement(mock_order, 12, 2.00)
         self.assertEqual(self.trade.orders, [replacement_order])