def add_nbbo(self, feeds: List[Feed], symbols: List[str], callback): """ feeds: list of feed classes list of feeds (exchanges) that comprises the NBBO symbols: list str the trading symbols callback: function pointer the callback to be invoked when a new tick is calculated for the NBBO """ cb = NBBO(callback, symbols) for feed in feeds: self.add_feed(feed(channels=[L2_BOOK], symbols=symbols, callbacks={L2_BOOK: cb}))
def add_nbbo(self, feeds: List[Feed], symbols: List[str], callback, config=None): """ feeds: list of feed classes list of feeds (exchanges) that comprises the NBBO symbols: list str the trading symbols callback: function pointer the callback to be invoked when a new tick is calculated for the NBBO config: dict, str, or None optional information to pass to each exchange that is part of the NBBO feed """ cb = NBBO(callback, symbols) for feed in feeds: self.add_feed(feed(channels=[L2_BOOK], symbols=symbols, callbacks={L2_BOOK: cb}, config=config))
def add_nbbo(self, feeds, pairs, callback, timeout=120): """ feeds: list of feed classes list of feeds (exchanges) that comprises the NBBO pairs: list str the trading pairs callback: function pointer the callback to be invoked when a new tick is calculated for the NBBO timeout: int seconds without a message before a connection will be considered dead and reestablished. See `add_feed` """ cb = NBBO(callback, pairs) for feed in feeds: self.add_feed(feed(channels=[L2_BOOK], pairs=pairs, callbacks={L2_BOOK: cb}), timeout=timeout)