Ejemplo n.º 1
0
def main():
   #logging.basicConfig(filename='time2tid_test.log', level=logging.DEBUG)

   my_dt = datetime(2014, 10, 31, 15, 30)

   my_dt = my_dt - timedelta(hours=8) 

   timeformat = "%Y/%b/%d %I:%M:%S %p"

   print
   print "Target time:", utc2local(my_dt).strftime(timeformat)

   #logging.info('Entering time2tid')
   lst_trades = time2tid( datetime2unixtime(my_dt) )
   #logging.info('Done time2tid')

   print "Closing prices:"

   for trade in lst_trades:
      print unixtime2localtime(trade['date']).strftime(timeformat), trade['type'], float(trade['price'])

   print

   print "Raw data:" 
   print lst_trades
Ejemplo n.º 2
0
import datetime
from okcoin import utiltime

dt = datetime.datetime(2014,2,19,6,0,0)

ut = utiltime.datetime2unixtime(dt)

dt_local = utiltime.utc2local(dt)

utl = utiltime.datetime2unixtime(dt_local)

print "The reference time in UTC is:"
print dt

print "Its unix timestamp is (utc):"
print ut

print "The reference local time is:"
print dt_local

print "Its unix timestamp is (local timezone):"
print ut