def quote_factory(_, row): """Converts row to quote""" symbol, expiration, date, time, close = row expiration = database.decode_date(expiration) date = database.decode_date(date) time = database.decode_time(time) return FutureQuote(symbol, expiration, date, time, close)
def quote_factory(_, row): """Converts row to quote""" symbol, type_, expiration, strike, date, time, \ bid, ask, stock, iv_bid, iv_ask = row expiration = database.decode_date(expiration) date = database.decode_date(date) time = database.decode_time(time) return OptionQuote(symbol, type_, expiration, strike, date, time, bid, ask, stock, iv_bid, iv_ask)
def test_time_none(self): self.assertIsNone(database.encode_time(None)) self.assertIsNone(database.decode_time(None))
def test_time(self): time = datetime.time(18, 55) self.assertEqual(database.decode_time(database.encode_time(time)), time)