class QuotePublisher(object): """ Qoute publisher class """ def __init__(self, *args, **kwargs): self.socket = ZmqSocket(settings.QUOTES_BIND_ADDRESS, 'XPUB') super(QuotePublisher, self).__init__(*args, **kwargs) def send(self, quote): json = simplejson.dumps(quote) self.socket.send(json)
class BandAnalyzer(object): def __init__(self, *args, **kwargs): self.socket = ZmqSocket(settings.QUOTES_BIND_ADDRESS, 'XSUB') super(BandAnalyzer, self).__init__(*args, **kwargs) def process_quotes(self): data = self.socket.receive() if data: print data
def __init__(self, *args, **kwargs): self.socket = ZmqSocket(settings.QUOTES_BIND_ADDRESS, 'XPUB') super(QuotePublisher, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): self.socket = ZmqSocket(settings.QUOTES_BIND_ADDRESS, 'XSUB') super(BandAnalyzer, self).__init__(*args, **kwargs)