def get_target_product_data(excel_file_name='', strdate='', term='상환'): if excel_file_name == '': excel_file_name = u'OTC상환리스트.xlsx' df = read_otc_termination_file(excel_file_name, strdate[:4] + "." + strdate[4:6]) if not strdate in df.index: target_df = pd.DataFrame() # target_df = df.iloc[-2:].copy() return target_df df = df.loc[strdate] if len(df) == 0: return df elif isinstance(df, pd.Series): df_new = pd.DataFrame(df) df_new = df_new.transpose() df = df_new.copy() if term == '상환': target_df = df[(df[u'구분'] != 'ELT') & (df[u'구분'] != 'DLT')] target_df = target_df[(target_df[u'상환여부'] == u'만32805기상환') | (target_df[u'상환여부'] == u'조기상환')] return target_df elif term == '상환_ALL': target_df = df.copy() target_df = target_df[(target_df[u'상환여부'] == u'만기상환') | (target_df[u'상환여부'] == u'조기상환')] return target_df elif term == '미상환': target_df = df.copy() target_df = target_df[(target_df[u'상환여부'] == u'미상환')] return target_df else: df = pd.DataFrame() return df pass
def get_start_rownum(excel_file_name='', strdate=''): if excel_file_name == '': excel_file_name = u'OTC상환리스트.xlsx' df = read_otc_termination_file(excel_file_name, strdate[:4] + "." + strdate[4:6]) df = df.reset_index() rownum = len(df[df[u'가격결정일'] < strdate]) # strdate: 전영업일 return rownum pass
def get_prev_bzdate(excel_file_name='', strdate=''): if excel_file_name == '': excel_file_name == u'OTC상환리스트.xlsx' df = read_otc_termination_file(excel_file_name, strdate) df = df.reset_index() if strdate == '': now_dt = dt.datetime.now() strdate = now_dt.strftime("%Y%m%d") prev_bzdate = df[df[u'가격결정일'] < strdate].iloc[-1][u'가격결정일'] str_prev_bzdate = prev_bzdate.strftime("%Y%m%d") return str_prev_bzdate pass
def get_isin_code_lst(excel_file_name='', strdate=''): if excel_file_name == '': excel_file_name = u'OTC상환리스트.xlsx' df = read_otc_termination_file(excel_file_name, strdate[:4] + "." + strdate[4:6]) df = df.loc[strdate] if len(df) == 0: return [] elif isinstance(df, pd.Series): isin_code_lst = list() isin_code_lst.append(df[u'종목코드']) return isin_code_lst isin_code_lst = list(df[u'종목코드']) return isin_code_lst pass
def get_target_product_data(excel_file_name='', strdate=''): if excel_file_name == '': excel_file_name = u'OTC상환리스트.xlsx' df = read_otc_termination_file(excel_file_name, strdate[:4] + "." + strdate[4:6]) df = df.loc[strdate] if len(df) == 0: return [] elif isinstance(df, pd.Series): df_new = pd.DataFrame(df) df_new = df_new.transpose() df = df_new.copy() # target_df = df[(df[u'구분'] == 'ELS') | \ # (df[u'구분'] == 'ELB') | \ # (df[u'구분'] == 'DLS') |] target_df = df[(df[u'구분'] != 'ELT') & (df[u'구분'] != 'DLT')] # target_df = target_df[target_df[u'상환여부'] == u'미상환'] # target_df = target_df.sort(u'구분') return target_df pass
def get_target_product_data(excel_file_name='', strdate=''): if excel_file_name == '': excel_file_name = u'OTC상환리스트.xlsx' df = read_otc_termination_file(excel_file_name, strdate[:4] + "." + strdate[4:6]) df = df.loc[strdate] if len(df) == 0: return df elif isinstance(df, pd.Series): df_new = pd.DataFrame() df_new = df_new.transpose() df = df_new.copy() target_df = df[(df[u'구분'] == 'ELS') | (df[u'구분'] == 'ELB') | \ (df[u'구분'] == 'DLS') | (df[u'구분'] == 'DLB')] target_df = target_df[(target_df[u'상환여부'] == u'만기상환') | (target_df[u'상환여부'] == u'조기상환')] target_df = target_df[(target_df[u'공사모'] == u'공모') | (target_df[u'공사모'] == u'공사모')] return target_df pass