def ticker_update(self, data): price = float(data['price']) volume = int(float(data['volume'])*10**self.volume_precision) date = datetime.datetime.fromtimestamp(float(data['timestamp'])) print self.symbol, date, price, float(volume)/10**self.volume_precision # Datetime, Open, High, Low, Close, NumTrades, TotalVolume, BidVolume, AskVolume): try: rec = ScidRecord(date, price, price, price, price, 1, volume, 0, 0) self.scid.write(rec.to_struct()) self.scid.fp.flush() except Exception as e: print str(e)