コード例 #1
0
ファイル: loadDatabase.py プロジェクト: SanchaySaria/projects
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")
コード例 #2
0
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=',')
コード例 #3
0
 def GET(self):
     return DBMgr.dump_recent_raw_submission()
コード例 #4
0
 def GET(self):
     return DBMgr.dump_debug_log()
コード例 #5
0
ファイル: server.py プロジェクト: Columbia-ICSL/RecEnergy
 def GET(self):
     return DBMgr.constructParameterValue()
コード例 #6
0
ファイル: SCRIPT.py プロジェクト: wqmike123/millionaire
#    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: