Example #1
0
    def process_summary(self, summary: np.array):
        if self.mkt_snapshot_depth > 0:
            s = iqfeed_to_deque([summary], maxlen=self.mkt_snapshot_depth)

            # no need for deque for the symbol
            symbol = s['symbol'][0]
            s['symbol'] = symbol

            self.watched_symbols[symbol] = s

        self.listeners({'type': 'level_1_summary', 'data': iqfeed_to_dict(summary)})
Example #2
0
    def process_update(self, update: np.array):
        if self.mkt_snapshot_depth > 0:
            update = update[0] if len(update) == 1 else update
            symbol = update[0].decode("ascii")

            data = self.watched_symbols[symbol]

            for key, v in zip(data, update):  # skip symbol
                if key != 'symbol':
                    if isinstance(v, bytes):
                        v = v.decode('ascii')

                    data[key].append(v)
        else:
            data = iqfeed_to_dict(update)

        self.total_updates = (self.total_updates + 1) % 1000000007

        if self.total_updates % 1000 == 0:
            logging.getLogger(__name__).debug("%d total updates" % self.total_updates)

        self.listeners({'type': 'level_1_update', 'data': data})
Example #3
0
 def process_fundamentals(self, fund: np.array):
     fundamentals = iqfeed_to_dict(fund)
     s = fundamentals['symbol']
     result[s] = fundamentals
     if len(symbol - (result.keys() | invalid)) == 0:
         e.set()
Example #4
0
 def process_fundamentals(self, fund: np.array):
     f = iqfeed_to_dict(fund)
     self.listeners({'type': 'level_1_fundamentals', 'data': f})
Example #5
0
 def process_regional_quote(self, quote: np.array):
     self.listeners({'type': 'level_1_regional_quote', 'data': iqfeed_to_dict(quote)})