granularity_to_time

oandapyV20.contrib.generic.granularity_to_time(s)

convert a named granularity into seconds.

get value in seconds for named granularities: M1, M5 … H1 etc.

>>> print(granularity_to_time("M5"))
300
oandapyV20.contrib.generic.secs2time(e)

secs2time - convert epoch to datetime.

>>> d = secs2time(1497499200)
>>> d
datetime.datetime(2017, 6, 15, 4, 0)
>>> d.strftime("%Y%m%d-%H:%M:%S")
'20170615-04:00:00'