Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_exchange_type(self):
assert ExchangeType
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
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