April 2019
Intermediate to advanced
426 pages
11h 13m
English
Whether we are fetching prices, sending orders, or tracking positions, an event-driven system design will trigger key parts of our system in a multi-threaded fashion without blocking the main thread.
Let's begin writing our Broker class in Python, as follows:
from abc import abstractmethod
class Broker(object):
def __init__(self, host, port): self.host = host
self.port = port
self.__price_event_handler = None
self.__order_event_handler = None
self.__position_event_handler = None
In the constructor, we can provide the host and port public connection configurations of our broker for the inheriting child classes. Three variables are declared for storing the event handlers of prices, orders, and position updates, ...
Read now
Unlock full access