How to use the flumine.clients.clients.ExchangeType 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_clients.py View on Github external
def test_exchange_type(self):
        assert ExchangeType
github liampauling / flumine / flumine / clients / baseclient.py View on Github external
def add_execution(self, flumine) -> None:
        if self.EXCHANGE == ExchangeType.SIMULATED or self.paper_trade:
            self.execution = flumine.simulated_execution
        elif self.EXCHANGE == ExchangeType.BETFAIR:
            self.execution = flumine.betfair_execution
github liampauling / flumine / flumine / execution / simulatedexecution.py View on Github external
import time
import requests
from typing import Optional

from .baseexecution import BaseExecution
from ..clients.clients import ExchangeType
from ..order.orderpackage import BaseOrderPackage, OrderPackageType


class SimulatedExecution(BaseExecution):

    EXCHANGE = ExchangeType.SIMULATED
    PLACE_LATENCY = 0.120
    CANCEL_LATENCY = 0.170
    UPDATE_LATENCY = 0.150  # todo confirm?
    REPLACE_LATENCY = 0.280

    def handler(self, order_package: BaseOrderPackage) -> None:
        """ Only uses _thread_pool if paper_trade
        """
        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