示例#1
0
 def __init__(self, dbLoc = dbLoc, saveLoc = saveLoc, shortProduct = '코스피 200'):
 
     self.trdDate = dh.getTradingDate()
     short = dh.getBenchmark(dbLoc)
     short.getBmTs(self.trdDate[0], self.trdDate[len(self.trdDate)-1], [shortProduct])
     shortBp = short.pivoted().copy()
     self.shortProductRet = shortBp.pct_change()
     self.eom_trdDate = utils.getEomTrdDate(self.trdDate)
     
     k2db = df.dbLite(dbLoc,'k200')
     self.info_k2 = k2db.getBulk('k200').copy()
     self.eom_info_k2 = list(sorted(set(self.info_k2.date)))
     
     del k2db
     del short
示例#2
0
#%%
'''
neutral stock Number
picked stock Number
portfolio making
eom = 13

'''

if __name__ == '__main__' :
    
    baseDbs = dh.getAlldatabase(dbLoc)
    descDb = dh.getAlldatabase(saveLoc)
    trdDate = dh.getTradingDate()
    eom = utils.getEomTrdDate(trdDate)
    # simulation base information setting
    base = longShortSimSetting()
    
    i = 72
    for i in range(72, len(eom)-1):
        result = pd.DataFrame()
        # base.eom_trdDate[i]
        base.k2Setting(base.eom_trdDate[i])
        neut = base.info_k2_refDate
        desc = filteringDesc(base.eom_trdDate[i])
        desc.setDesc()
        descList = list(desc.stocks_filtered.keys())
        
        baseDate = base.shortProductRet[(base.shortProductRet.index > eom[i]) & 
                                        (base.shortProductRet.index <= eom[i+1])]