Beispiel #1
0
def market_cap(base: int, moat: int):
    ''' 估算总市值
        = 净资产 * (1+滚动roe) ^ (基本因子+护城河因子+成长因子)
    '''
    return expr.Multi(expr.Get('total_hldr_eqy_exc_min_int'),
                      expr.Power(expr.Sum(expr.Value(1),
                                          expr.Get('f_roe_ttm')),
                                 expr.Sum(base_factor(base),
                                          moat_factor(moat),
                                          growth_factor())))
Beispiel #2
0
def cashflow_free_pay_10_years_ratio():
    '''10年自由现金流/10年资本开支比'''
    return MetricsMeta(
        'f_cashflow_free_pay_10_y.r',
        expr.Div(
            expr.Sum(expr.Get('f_cashflow_free_y'), [
                expr.Before(expr.Get('f_cashflow_free_y'), past_year=n)
                for n in range(1, 10)
            ]),
            expr.Sum(expr.Get('c_pay_acq_const_fiolta', period='y'), [
                expr.Before(expr.Get('c_pay_acq_const_fiolta', period='y'),
                            past_year=n) for n in range(1, 10)
            ])),
        display='10年自由现金流与资本开支比')
Beispiel #3
0
def exp_3_ratio():
    '''三费占比'''
    return MetricsMeta('f_exp_3.r',
                       expr.Div(
                           expr.Sum(expr.Get('sell_exp'),
                                    expr.Get('admin_exp'),
                                    expr.Get('fin_exp')), expr.Get('revenue')),
                       display='三费占比')
Beispiel #4
0
def interest_bearing_liab():
    ''' 有息负债
        = 短期借款 + 1年内到期的长期负债 + 长期借款 + 应付债券 + 长期应付款
    '''
    return MetricsMeta(
        'f_interest_bearing_liab',
        expr.Sum(expr.Get('lt_borr'), expr.Get('st_borr'),
                 expr.Get('bond_payable'), expr.Get('lt_payable'),
                 expr.Get('non_cur_liab_due_1y')))
Beispiel #5
0
def prepayment_ave_y():
    '''平均预付账款'''
    return MetricsMeta(
        'f_prepayment_ave_y',
        expr.Div(
            expr.Sum(
                expr.Get('prepayment', period='y'),
                expr.Before(expr.Get('prepayment', period='y'), past_year=1)),
            expr.Value(2)))
Beispiel #6
0
def adv_receipts_ave_y():
    '''平均预收账款'''
    return MetricsMeta(
        'f_adv_receipts_ave_y',
        expr.Div(
            expr.Sum(
                expr.Get('adv_receipts', period='y'),
                expr.Before(expr.Get('adv_receipts', period='y'),
                            past_year=1)), expr.Value(2)))
Beispiel #7
0
def inventroy_ave_y():
    '''平均存货'''
    return MetricsMeta(
        'f_inventory_ave_y',
        expr.Div(
            expr.Sum(
                expr.Get('inventories', period='y'),
                expr.Before(expr.Get('inventories', period='y'), past_year=1)),
            expr.Value(2)))
Beispiel #8
0
def net_operating_cycle():
    '''营销:净营业周期'''
    return MetricsMeta('f_net_op_cycle_y',
                       expr.Sub(
                           expr.Sum(expr.Get('f_days_inventory_y'),
                                    expr.Get('f_days_accounts_receiv_y'),
                                    expr.Get('f_days_prepayment_y')),
                           expr.Get('f_days_acct_payable_y'),
                           expr.Get('f_days_adv_receipts_y')),
                       display='净营业周期')
Beispiel #9
0
def accounts_receiv_ave_y():
    '''平均应收账款'''
    return MetricsMeta(
        'f_accounts_receiv_ave_y',
        expr.Div(
            expr.Sum(
                expr.Get('accounts_receiv', period='y'),
                expr.Before(expr.Get('accounts_receiv', period='y'),
                            past_year=1), expr.Get('notes_receiv', period='y'),
                expr.Before(expr.Get('notes_receiv', period='y'),
                            past_year=1)), expr.Value(2)))
Beispiel #10
0
def acct_payable_ave_y():
    '''平均应付账款'''
    return MetricsMeta(
        'f_acct_payable_ave_y',
        expr.Div(
            expr.Sum(
                expr.Get('acct_payable', period='y'),
                expr.Get('notes_payable', period='y'),
                expr.Before(expr.Get('acct_payable', period='y'), past_year=1),
                expr.Before(expr.Get('notes_payable', period='y'),
                            past_year=1)), expr.Value(2)))
Beispiel #11
0
def income_attr_p_ttm():
    # 滚动净利润:最近连续4个季度
    ttm_q3 = [expr.Before(expr.Get('n_income_attr_p',
                                   increment=True,
                                   var_type='f'),
                          past_quarter=i)
              for i in range(1, 4)]
    return MetricsMeta('f_income_attr_p_ttm',
                       expr.Sum(expr.Get('n_income_attr_p',
                                         increment=True,
                                         var_type='f'),
                                ttm_q3))
Beispiel #12
0
def net_profit_growth_pay_10_years_ratio():
    '''10年净利润增长/10年资本开支比'''
    return MetricsMeta(
        'f_n_income_attr_p_pay_10_y.r',
        expr.Div(
            expr.Sub(
                expr.Get('n_income_attr_p', period='y'),
                expr.Before(expr.Get('n_income_attr_p', period='y'),
                            past_year=9)),
            expr.Sum(expr.Get('c_pay_acq_const_fiolta', period='y'), [
                expr.Before(expr.Get('c_pay_acq_const_fiolta', period='y'),
                            past_year=n) for n in range(1, 10)
            ])),
        display='10年净利润增长与资本开支比')
Beispiel #13
0
def roe():
    ''' 年度ROE(平均)
        =净利润/净资产
        =归母净利润/(期初+期末归母净资产)/2
        =每股净利润/每股净资产
        =销售净利率*总资产周转率*杠杆系数
    '''
    return MetricsMeta(
        'f_roe',
        expr.Div(
            expr.Get('n_income_attr_p'),
            expr.Div(
                expr.Sum(
                    expr.Get('total_hldr_eqy_exc_min_int'),
                    expr.Get('total_hldr_eqy_exc_min_int', period_begin=True)),
                expr.Value(2))))
Beispiel #14
0
def roe_ttm():
    ''' 年度ROE(加权平均)
        根据中国证监会发布的《公开发行证券公司信息披露编报规则》第9号的通知的规定:加权平均净资产收益率(ROE)的计算公式如下:ROE= P/(E0 + NP÷2 + Ei×Mi÷M0 - Ej×Mj÷M0)
        其中:
        P为报告期利润;
        NP为报告期净利润;
        E0为期初净资产;
        Ei为报告期发行新股或债转股等新增净资产;
        Ej为报告期回购或现金分红等减少净资产;
        M0为报告期月份数;
        Mi为新增净资产下一月份起至报告期期末的月份数;
        Mj为减少净资产下一月份起至报告期期末的月份数。
    '''
    return MetricsMeta('f_roe_ttm',
                       expr.Div(
                           expr.Get('f_income_attr_p_ttm'),
                           expr.Div(
                               expr.Sum(
                                   expr.Get('total_hldr_eqy_exc_min_int'),
                                   expr.Before(
                                       expr.Get('total_hldr_eqy_exc_min_int'),
                                       past_quarter=4)), expr.Value(2))),
                       display='ROE(滚动)')
Beispiel #15
0
def receivables():
    '''营销:应收款项 = 应收票据 + 应收账款'''
    return MetricsMeta(
        'f_receivables',
        expr.Sum(expr.Get('notes_receiv'), expr.Get('accounts_receiv')))
Beispiel #16
0
def total_assets_y():
    '''总资产 = 流动资产合计 + 非流动资产合计'''
    return MetricsMeta('f_total_assets_y',
                       expr.Sum(expr.Get('total_nca', period='y'),
                                expr.Get('total_cur_assets', period='y')),
                       display='总资产')