How to use the flumine.order.orderpackage.OrderPackageType 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_orderpackage.py View on Github external
def test_order_limit(self):
        self.assertEqual(self.order_package.order_limit(OrderPackageType.PLACE), 200)
        self.assertEqual(self.order_package.order_limit(OrderPackageType.CANCEL), 60)
        self.assertEqual(self.order_package.order_limit(OrderPackageType.UPDATE), 60)
        self.assertEqual(self.order_package.order_limit(OrderPackageType.REPLACE), 60)
github liampauling / flumine / tests / test_orderpackage.py View on Github external
def test_order_limit(self):
        self.assertEqual(self.order_package.order_limit(OrderPackageType.PLACE), 200)
        self.assertEqual(self.order_package.order_limit(OrderPackageType.CANCEL), 60)
        self.assertEqual(self.order_package.order_limit(OrderPackageType.UPDATE), 60)
        self.assertEqual(self.order_package.order_limit(OrderPackageType.REPLACE), 60)
github liampauling / flumine / flumine / execution / baseexecution.py View on Github external
def handler(self, order_package: BaseOrderPackage):
        """ Handles order_package, capable of place, cancel,
        replace and update.
        """
        http_session = self._get_http_session()
        if order_package.package_type == OrderPackageType.PLACE:
            func = self.execute_place
        elif order_package.package_type == OrderPackageType.CANCEL:
            func = self.execute_cancel
        elif order_package.package_type == OrderPackageType.UPDATE:
            func = self.execute_update
        elif order_package.package_type == OrderPackageType.REPLACE:
            func = self.execute_replace
        else:
            raise NotImplementedError()

        self._thread_pool.submit(func, order_package, http_session)
github liampauling / flumine / flumine / order / orderpackage.py View on Github external
def order_limit(cls, package_type: OrderPackageType) -> int:
        if package_type == OrderPackageType.PLACE:
            return order_limits["placeOrders"]
        elif package_type == OrderPackageType.CANCEL:
            return order_limits["cancelOrders"]
        elif package_type == OrderPackageType.UPDATE:
            return order_limits["updateOrders"]
        elif package_type == OrderPackageType.REPLACE:
            return order_limits["replaceOrders"]
github liampauling / flumine / flumine / controls / clientcontrols.py View on Github external
def _validate(self, order_package) -> None:
        self._check_hour()
        self.total += 1
        if order_package.package_type == OrderPackageType.PLACE:
            self._check_transaction_count(len(order_package))
            self.place_requests += len(order_package)
            if not self.safe:  # and order.flumine_order_type == "initial"
                for order in order_package:
                    self._on_error(
                        order,
                        "Max Order Count has been reached ({0}) for current hour".format(
                            self.transaction_count
                        ),
                    )
        elif order_package.package_type == OrderPackageType.CANCEL:
            self.cancel_requests += len(order_package)
        elif order_package.package_type == OrderPackageType.UPDATE:
            self.update_requests += len(order_package)
        elif order_package.package_type == OrderPackageType.REPLACE:
            self.replace_requests += len(order_package)