# Date Sequence to be made by this batch bkfil, rtvStart, seq_DT = batch_sequence(option, freq) # Getting the Universe in TMSRS_CD ~ Code Map allSec = getUnique_TMSRS_CD() codeMap = get_Mapping_orig(mapping) trim_codeMap = codeMap[codeMap['TMSRS_CD'].isin(allSec)].copy() trim_codeMap_uniq = trim_codeMap['Code'].unique() print(trim_codeMap.iloc[:2]) print('\n>>> Total Mapping Securities #: {}'.format(trim_codeMap.shape[0])) print('>>> Total Performing Securities #: {}'.format( trim_codeMap_uniq.shape[0])) # Checking Level of Duplicates in codeMap chk_codeMap = check_mapping_df(trim_codeMap) DF_accruals_yr, DF_accruals_qtr = pd.DataFrame(), pd.DataFrame() DF_accrualsS_yr, DF_accrualsS_qtr = pd.DataFrame(), pd.DataFrame() # Transform Security List into Batch Chunks tot_n = chunker_count(trim_codeMap_uniq, 50) Code_lst_tot = chunker(trim_codeMap_uniq.tolist(), 50) # Bring needed items cf_item = Item_lst.loc['NetCF_Operating'] ni_item = Item_lst.loc['NetIncome_bExIt'] rev_item = Item_lst.loc['NetSales_Revenue'] aa_item = Item_lst.loc['TotAsset_st'] st_time = time.time()
'endDT']] = DEBUG_.groupby('TMSRS_CD')['startDT', 'endDT'].apply(my_func) trim_codeMap = DEBUG_.append(GOOD_, sort=True) trim_codeMap.sort_index(inplace=True) #*------------ Debug Map trim_codeMap_uniq = trim_codeMap['TMSRS_CD'].unique() print(trim_codeMap.iloc[:2]) print('\n>>> Total Mapping Securities #: {}'.format(trim_codeMap.shape[0])) print('>>> Total Performing Securities #: {}'.format( trim_codeMap_uniq.shape[0])) # Checking Level of Duplicates in codeMap chk_codeMap = check_mapping_df(trim_codeMap, mapCode_nm='Sedol') DF_Momentum = pd.DataFrame() tot_n = seq_DT.shape[0] st_time = time.time() for i, dt_ in enumerate(seq_DT): handle_ax = AxiomaModel(modelDate=dt_, offline=True, check_existing_csv=True) handle_ax.get_RM() DF = handle_ax.factor_exp[['ShortTermMomentum', 'MediumTermMomentum']].copy() DF.reset_index(drop=False, inplace=True)