How to use the flumine.order.order.OrderStatus function in flumine

To help you get started, we’ve selected a few flumine examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github liampauling / flumine / tests / test_order.py View on Github external
def test__update_status(self, mock_info):
        self.order._update_status(OrderStatus.EXECUTION_COMPLETE)
        self.assertEqual(self.order.status_log, [OrderStatus.EXECUTION_COMPLETE])
        self.assertEqual(self.order.status, OrderStatus.EXECUTION_COMPLETE)
github liampauling / flumine / tests / test_order.py View on Github external
def test_replace(self, mock_replacing):
        self.order.status = OrderStatus.EXECUTABLE
        with self.assertRaises(OrderUpdateError):
            self.order.replace(1.01)

        self.mock_order_type.ORDER_TYPE = OrderTypes.LIMIT
        self.mock_order_type.price = 2.02
        self.order.replace(1.01)
        self.assertEqual(self.order.update_data, {"new_price": 1.01})
        mock_replacing.assert_called_with()

        with self.assertRaises(OrderUpdateError):
            self.order.replace(2.02)
github liampauling / flumine / tests / test_order.py View on Github external
def test_info(self):
        self.order.status_log = [OrderStatus.PENDING, OrderStatus.EXECUTION_COMPLETE]
        self.assertEqual(
            self.order.info,
            {
                "bet_id": None,
                "handicap": self.order.handicap,
                "id": self.order.id,
                "market_id": self.mock_trade.market_id,
                "selection_id": self.mock_trade.selection_id,
                "status": None,
                "status_log": "Pending, Execution complete",
                "trade": self.mock_trade.info,
                "order_type": self.mock_order_type.info,
                "info": {
                    "side": self.order.side,
                    "size_matched": self.order.size_matched,
                    "size_remaining": self.order.size_remaining,
github liampauling / flumine / tests / test_order.py View on Github external
def test_replace_error(self):
        self.mock_order_type.ORDER_TYPE = OrderTypes.LIMIT
        self.order.status = OrderStatus.PENDING
        with self.assertRaises(OrderUpdateError):
            self.order.replace(1.52)
github liampauling / flumine / flumine / order / orderpackage.py View on Github external
def orders(self) -> list:
        return [o for o in self._orders if o.status != OrderStatus.VIOLATION]
github liampauling / flumine / flumine / order / order.py View on Github external
def violation(self) -> None:
        self._update_status(OrderStatus.VIOLATION)
        self.update_data.clear()
github liampauling / flumine / flumine / order / order.py View on Github external
def replacing(self) -> None:
        self._update_status(OrderStatus.REPLACING)