Пример #1
0
 def historicalTicksLast(self, reqId, ticks, done):
     self._results[reqId] += [
         HistoricalTickLast(
             datetime.datetime.fromtimestamp(t.time, datetime.timezone.utc),
             TickAttribLast(**t.tickAttribLast.__dict__), t.price, t.size,
             t.exchange, t.specialConditions) for t in ticks if t.size
     ]
     if done:
         self._endReq(reqId)
Пример #2
0
 def tickByTickAllLast(self, reqId, tickType, time, price, size,
                       tickAttribLast, exchange, specialConditions):
     ticker = self.reqId2Ticker.get(reqId)
     if not ticker:
         self._logger.error(f'tickByTickAllLast: Unknown reqId: {reqId}')
         return
     attribs = TickAttribLast(**tickAttribLast.__dict__)
     tick = TickByTickAllLast(tickType, self.lastTime, price, size, attribs,
                              exchange, specialConditions)
     ticker.tickByTicks.append(tick)
     self.pendingTickers.add(ticker)