Ejemplo n.º 1
0
                                         Code_lst, 'sum', bkfil,
                                         **add_lback_kwarg)
    # Total Asset
    aa_yr, aa_qtr = WS_retrieve_custom(aa_item['Item'], aa_item['Table'],
                                       Code_lst, 'avg', bkfil,
                                       **add_lback_kwarg)

    # Year
    fill_cols = ['FiscalPrd', 'CalPrdEndDate', 'Value_', 'FILLyr']
    cf_yr_samp = WS_resample(seq_DT, cf_yr, fill_cols=fill_cols)
    ni_yr_samp = WS_resample(seq_DT, ni_yr, fill_cols=fill_cols)
    rev_yr_samp = WS_resample(seq_DT, rev_yr, fill_cols=fill_cols)
    aa_yr_samp = WS_resample(seq_DT, aa_yr, fill_cols=fill_cols)

    cols = ['BASE_DT', 'Code', 'FiscalPrd', 'Value_']
    _acc_yr_samp = align_subtract(cf_yr_samp, ni_yr_samp)
    accruals_yr_samp = align_div(_acc_yr_samp[cols], aa_yr_samp)
    accrualsS_yr_samp = align_div(_acc_yr_samp[cols], rev_yr_samp)

    DF_accruals_yr = DF_accruals_yr.append(accruals_yr_samp, sort=False)
    DF_accrualsS_yr = DF_accrualsS_yr.append(accrualsS_yr_samp, sort=False)

    # Quarter
    fill_cols = [
        'FiscalPrd', 'FiscalPrd2', 'CalPrdEndDate', 'Value_', 'FILLyr'
    ]
    cf_qtr_samp = WS_resample(seq_DT, cf_qtr, fill_cols=fill_cols)
    ni_qtr_samp = WS_resample(seq_DT, ni_qtr, fill_cols=fill_cols)
    rev_qtr_samp = WS_resample(seq_DT, rev_qtr, fill_cols=fill_cols)
    aa_qtr_samp = WS_resample(seq_DT, aa_qtr, fill_cols=fill_cols)
Ejemplo n.º 2
0
                                       **add_lback_kwarg)
    # Capex
    cx_yr, cx_qtr = WS_retrieve_custom(cx_item['Item'], cx_item['Table'],
                                       Code_lst, 'sum', bkfil,
                                       **add_lback_kwarg)

    # Year
    fill_cols = ['FiscalPrd', 'CalPrdEndDate', 'Value_', 'FILLyr']
    cf_yr_samp = WS_resample(seq_DT, cf_yr, fill_cols=fill_cols)
    ev_yr_samp = WS_resample(seq_DT, ev_yr, fill_cols=fill_cols)
    eb_yr_samp = WS_resample(seq_DT, eb_yr, fill_cols=fill_cols)
    da_yr_samp = WS_resample(seq_DT, da_yr, fill_cols=fill_cols)
    cx_yr_samp = WS_resample(seq_DT, cx_yr, fill_cols=fill_cols)

    eba_yr_samp = align_add(eb_yr_samp, da_yr_samp)
    fcf_yr_samp = align_subtract(cf_yr_samp, cx_yr_samp)

    evebitda_yr_samp = align_div(ev_yr_samp, eba_yr_samp)
    cfoev_yr_samp = align_div(cf_yr_samp, ev_yr_samp)
    fcfev_yr_samp = align_div(fcf_yr_samp, ev_yr_samp)

    DF_evebitda_yr = DF_evebitda_yr.append(evebitda_yr_samp, sort=False)
    DF_cfoev_yr = DF_cfoev_yr.append(cfoev_yr_samp, sort=False)
    DF_fcfev_yr = DF_fcfev_yr.append(fcfev_yr_samp, sort=False)

    # Quarter
    fill_cols = [
        'FiscalPrd', 'FiscalPrd2', 'CalPrdEndDate', 'Value_', 'FILLyr'
    ]
    cf_qtr_samp = WS_resample(seq_DT, cf_qtr, fill_cols=fill_cols)
    ev_qtr_samp = WS_resample(seq_DT, ev_qtr, fill_cols=fill_cols)
Ejemplo n.º 3
0
    # COGS
    co_yr, co_qtr = WS_retrieve_custom(co_item['Item'], co_item['Table'],
                                       Code_lst, 'sum', bkfil,
                                       **add_lback_kwarg)
    # Operating Income
    oi_yr, oi_qtr = WS_retrieve_custom(oi_item['Item'], oi_item['Table'],
                                       Code_lst, 'sum', bkfil,
                                       **add_lback_kwarg)

    # Year
    fill_cols = ['FiscalPrd', 'CalPrdEndDate', 'Value_', 'FILLyr']
    re_yr_samp = WS_resample(seq_DT, re_yr, fill_cols=fill_cols)
    co_yr_samp = WS_resample(seq_DT, co_yr, fill_cols=fill_cols)
    oi_yr_samp = WS_resample(seq_DT, oi_yr, fill_cols=fill_cols)

    cm_yr_samp = align_subtract(re_yr_samp, co_yr_samp)

    ol_yr_samp = align_div(cm_yr_samp, oi_yr_samp)

    DF_ol_yr = DF_ol_yr.append(ol_yr_samp, sort=False)

    # Quarter
    fill_cols = [
        'FiscalPrd', 'FiscalPrd2', 'CalPrdEndDate', 'Value_', 'FILLyr'
    ]
    re_qtr_samp = WS_resample(seq_DT, re_qtr, fill_cols=fill_cols)
    co_qtr_samp = WS_resample(seq_DT, co_qtr, fill_cols=fill_cols)
    oi_qtr_samp = WS_resample(seq_DT, oi_qtr, fill_cols=fill_cols)

    cm_qtr_samp = align_subtract(re_qtr_samp, co_qtr_samp)
Ejemplo n.º 4
0
    fill_cols = ['FiscalPrd', 'CalPrdEndDate', 'Value_', 'FILLyr']
    hist_yr_samp = WS_resample(seq_DT, hist_DF_yr, fill_cols=fill_cols)
    # Yr-P2Sales
    ps_DF_yr = pd.merge(
        mktcap_DF.rename(columns={'Value_': 'mktcap'})[[
            'BASE_DT', 'Code', 'mktcap'
        ]],
        hist_yr_samp[hist_yr_samp['Item'] == '1001'].rename(
            columns={'Value_': 'sales'})[['BASE_DT', 'Code', 'sales']],
        on=['BASE_DT', 'Code'])
    ps_DF_yr['Value_'], ps_DF_yr[
        'freq'] = ps_DF_yr['mktcap'] / ps_DF_yr['sales'], 'Y'
    # Yr-P2FCF
    pfcf_DF_yr = align_subtract(
        hist_yr_samp[hist_yr_samp['Item'] == '4860'][[
            'BASE_DT', 'Code', 'FiscalPrd', 'Value_'
        ]], hist_yr_samp[hist_yr_samp['Item'] == '4601'][[
            'BASE_DT', 'Code', 'FiscalPrd', 'Value_'
        ]])
    pfcf_DF_yr = pd.merge(
        mktcap_DF.rename(columns={'Value_': 'mktcap'})[[
            'BASE_DT', 'Code', 'mktcap'
        ]],
        pfcf_DF_yr.rename(columns={
            'Value_0': 'CFO',
            'Value_1': 'Capex',
            'Value_': 'FCF'
        }),
        on=['BASE_DT', 'Code'])
    pfcf_DF_yr['Value_'], pfcf_DF_yr[
        'freq'] = pfcf_DF_yr['mktcap'] / pfcf_DF_yr['FCF'], 'Y'