def createDatabase(dbName, dbType): logging.info("Creating " + dbName + " equity data base") dbMgr = DBMgr.DBMgr() f_index = open(indexPath, "r") # TODO: trim extra spaces for company_name in f_index: parseAndCreateDB(dbMgr, dbName, dbType, company_name) logging.info("Successfully created " + dbName + " equity data base")
import DBMgr import argparse import datetime import calendar import csv db = DBMgr.DBMgr() csvFilePath = "exampleFootprints/footprint1.csv" def main(): args = parser.parse_args() days = args.days user = args.user if days > 0: print("Days: " + str(days)) days = 100 start = datetime.datetime.now() - datetime.timedelta(days=days) start = calendar.timegm(start.utctimetuple()) end = calendar.timegm(datetime.datetime.now().utctimetuple()) print("Querying database for footprint...") D = db.getFootprintData(user, start, end) print("Received footprint data") footprints = D["footprint"] timestamps = D["timestamp"] energies = D["energy"] with open(csvFilePath, mode='w') as csvFile: csvWriter = csv.writer(csvFile, delimiter=',')
def GET(self): return DBMgr.dump_recent_raw_submission()
def GET(self): return DBMgr.dump_debug_log()
def GET(self): return DBMgr.constructParameterValue()
# if sn=='1': # return yr + '-' + '01' # elif sn=='2': # return yr + '-' + '04' # elif sn=='3': # return yr + '-' + '07' # elif sn=='4': # return yr + '-' + '10' #for ifd in fdlist: # fddata = pd.read_pickle(ifd) # fddata.date = fddata.date.apply(toDate) # fddata.to_pickle(ifd) #%% factor selection: dataMgr = DBMgr() dataMgr.compSeasonRetLong(basic.code.values) with open('./dataMgr.pickle','wb') as f: pickle.dump(dataMgr,f) #%% ind_ret = dataMgr.seasonalRet.mean(axis=1) yrlist = [str(i) for i in range(2007,2018)] seasonlist = ['01','04','07','10'] mapSeason = {'01':'04','04':'07','07':'10','10':'01'} fdlist = glob.glob('./fundamental/*.pkl') res = defaultdict(list) wkDone = [] fdlist.remove('./fundamental/performance_all_quarter.pkl') for ifd in fdlist: