Package QSTK :: Package qstkutil :: Module dateutil
[hide private]
[frames] | no frames]

Module dateutil

source code

Created on March 22, 2011


Author: Drew Bratcher & Tucker Balch

Contact: tucker@cc.gatech.edu

utilities for date and time manipulation

Version: $Revision: 295 $

Functions [hide private]
 
getMonthNames() source code
 
getYears(funds) source code
 
getMonths(funds, year) source code
 
getDays(funds, year, month) source code
 
getDaysBetween(ts_start, ts_end) source code
 
getFirstDay(funds, year, month) source code
 
getNYSEdays(startday=datetime.datetime(1964, 7, 5, 0, 0), endday=datetime.datetime(2020, 12, 31, 0, 0), timeofday=datetime.timedelta(0))
Create a list of timestamps between startday and endday (inclusive) that correspond to the days there was trading at the NYSE. This function depends on a separately created a file that lists all days since July 4, 1962 that the NYSE has been open, going forward to 2020 (based on the holidays that NYSE recognizes).
source code
 
getNextNNYSEdays(startday, days, timeofday)
Create a list of timestamps from startday that is days days long that correspond to the days there was trading at NYSE. This function depends on the file used in getNYSEdays and assumes the dates within are in order.
source code
 
getPrevNNYSEday(startday, timeofday)
This function returns the last valid trading day before the start day, or returns the start day if it is a valid trading day. This function depends on the file used in getNYSEdays and assumes the dates within are in order.
source code
 
ymd2epoch(year, month, day)
Convert YMD info into a unix epoch value.
source code
 
epoch2date(ts)
@summary Convert seconds since epoch into date
source code
Variables [hide private]
  __package__ = 'QSTK.qstkutil'
Function Details [hide private]

getNYSEdays(startday=datetime.datetime(1964, 7, 5, 0, 0), endday=datetime.datetime(2020, 12, 31, 0, 0), timeofday=datetime.timedelta(0))

source code 
Parameters:
  • startday - First timestamp to consider (inclusive)
  • endday - Last day to consider (inclusive)

getNextNNYSEdays(startday, days, timeofday)

source code 
Parameters:
  • startday - First timestamp to consider (inclusive)
  • days - Number of timestamps to return

getPrevNNYSEday(startday, timeofday)

source code 
Parameters:
  • startday - First timestamp to consider (inclusive)
  • days - Number of timestamps to return

ymd2epoch(year, month, day)

source code 
Parameters:
  • year - The year
  • month - The month
  • day - The day

epoch2date(ts)

source code 

@summary Convert seconds since epoch into date

Parameters:
  • ts - Seconds since epoch