Example #1
0
  def __init__(self, id, name, type, mkt_open, mkt_close, symbols, book_freq='S', pipeline_delay = 40000,
               computation_delay = 1, stream_history = 0, log_orders = False, random_state = None):

    super().__init__(id, name, type, random_state)

    # Do not request repeated wakeup calls.
    self.reschedule = False

    # Store this exchange's open and close times.
    self.mkt_open = mkt_open
    self.mkt_close = mkt_close

    # Right now, only the exchange agent has a parallel processing pipeline delay.  This is an additional
    # delay added only to order activity (placing orders, etc) and not simple inquiries (market operating
    # hours, etc).
    self.pipeline_delay = pipeline_delay

    # Computation delay is applied on every wakeup call or message received.
    self.computation_delay = computation_delay

    # The exchange maintains an order stream of all orders leading to the last L trades
    # to support certain agents from the auction literature (GD, HBL, etc).
    self.stream_history = stream_history

    # Log all order activity?
    self.log_orders = log_orders

    # Create an order book for each symbol.
    self.order_books = {}

    for symbol in symbols:
      self.order_books[symbol] = OrderBook(self, symbol)
      
    # At what frequency will we archive the order books for visualization and analysis?
    self.book_freq = book_freq
Example #2
0
    def __init__(self,
                 id,
                 name,
                 type,
                 mkt_open,
                 mkt_close,
                 symbols,
                 book_freq='S',
                 wide_book=False,
                 pipeline_delay=40000,
                 computation_delay=1,
                 stream_history=0,
                 log_orders=False,
                 random_state=None):

        super().__init__(id, name, type, random_state)

        # dummy for printing purposes
        self.counter = 0

        # Do not request repeated wakeup calls.
        self.reschedule = False

        # Store this exchange's open and close times.
        self.mkt_open = mkt_open
        self.mkt_close = mkt_close

        # Right now, only the exchange agent has a parallel processing pipeline delay.  This is an additional
        # delay added only to order activity (placing orders, etc) and not simple inquiries (market operating
        # hours, etc).
        self.pipeline_delay = pipeline_delay

        # Computation delay is applied on every wakeup call or message received.
        self.computation_delay = computation_delay

        # The exchange maintains an order stream of all orders leading to the last L trades
        # to support certain agents from the auction literature (GD, HBL, etc).
        self.stream_history = stream_history

        # Log all order activity?
        self.log_orders = log_orders

        # Create an order book for each symbol.
        self.order_books = {}

        for symbol in symbols:
            self.order_books[symbol] = OrderBook(self, symbol)

        # At what frequency will we archive the order books for visualization and analysis?
        self.book_freq = book_freq

        # Store orderbook in wide format? ONLY WORKS with book_freq == 0
        self.wide_book = wide_book

        # The subscription dict is a dictionary with the key = agent ID,
        # value = dict (key = symbol, value = list [levels (no of levels to recieve updates for),
        # frequency (min number of ns between messages), last agent update timestamp]
        # e.g. {101 : {'AAPL' : [1, 10, pd.Timestamp(10:00:00)}}
        self.subscription_dict = {}
    def __init__(self,
                 id,
                 name,
                 mkt_open,
                 mkt_close,
                 symbols,
                 book_freq='S',
                 pipeline_delay=40000,
                 computation_delay=1,
                 stream_history=0):

        super().__init__(id, name)

        # Do not request repeated wakeup calls.
        self.reschedule = False

        # Store this exchange's open and close times.
        self.mkt_open = mkt_open
        self.mkt_close = mkt_close

        # Right now, only the exchange agent has a parallel processing pipeline delay.
        self.pipeline_delay = pipeline_delay
        self.computation_delay = computation_delay

        # The exchange maintains an order stream of all orders leading to the last L trades
        # to support certain agents from the auction literature (GD, HBL, etc).
        self.stream_history = stream_history

        # Create an order book for each symbol.
        self.order_books = {}

        for symbol in symbols:
            self.order_books[symbol] = OrderBook(self, symbol)

        # At what frequency will we archive the order books for visualization and analysis?
        self.book_freq = book_freq